--- a/mobile/android/base/ActionModeCompat.java
+++ b/mobile/android/base/ActionModeCompat.java
@@ -13,19 +13,19 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
class ActionModeCompat implements GeckoPopupMenu.OnMenuItemClickListener,
GeckoPopupMenu.OnMenuItemLongClickListener,
View.OnClickListener {
private final String LOGTAG = "GeckoActionModeCompat";
- private Callback mCallback;
- private ActionModeCompatView mView;
- private Presenter mPresenter;
+ private final Callback mCallback;
+ private final ActionModeCompatView mView;
+ private final Presenter mPresenter;
/* A set of callbacks to be called during this ActionMode's lifecycle. These will control the
* creation, interaction with, and destruction of menuitems for the view */
public static interface Callback {
/* Called when action mode is first created. Implementors should use this to inflate menu resources. */
public boolean onCreateActionMode(ActionModeCompat mode, Menu menu);
/* Called to refresh an action mode's action menu. Called whenever the mode is invalidated. Implementors
--- a/mobile/android/base/AlertNotification.java
+++ b/mobile/android/base/AlertNotification.java
@@ -28,17 +28,17 @@ public class AlertNotification
private final String mText;
private final NotificationManager mNotificationManager;
private boolean mProgressStyle;
private double mPrevPercent = -1;
private String mPrevAlertText = "";
private static final double UPDATE_THRESHOLD = .01;
- private Context mContext;
+ private final Context mContext;
public AlertNotification(Context aContext, int aNotificationId, int aIcon,
String aTitle, String aText, long aWhen, Uri aIconUri) {
super(aIcon, (aText.length() > 0) ? aText : aTitle, aWhen);
mIcon = aIcon;
mTitle = aTitle;
mText = aText;
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -235,17 +235,17 @@ public class BrowserApp extends GeckoApp
private Integer mTargetTabForEditingMode;
// The animator used to toggle HomePager visibility has a race where if the HomePager is shown
// (starting the animation), the HomePager is hidden, and the HomePager animation completes,
// both the web content and the HomePager will be hidden. This flag is used to prevent the
// race by determining if the web content should be hidden at the animation's end.
private boolean mHideWebContentOnAnimationEnd;
- private DynamicToolbar mDynamicToolbar = new DynamicToolbar();
+ private final DynamicToolbar mDynamicToolbar = new DynamicToolbar();
@Override
public View onCreateView(final String name, final Context context, final AttributeSet attrs) {
final View view;
if (BrowserToolbar.class.getName().equals(name)) {
view = BrowserToolbar.create(context, attrs);
} else if (TabsPanel.TabsLayout.class.getName().equals(name)) {
view = TabsPanel.createTabsLayout(context, attrs);
--- a/mobile/android/base/BrowserLocaleManager.java
+++ b/mobile/android/base/BrowserLocaleManager.java
@@ -50,21 +50,21 @@ public class BrowserLocaleManager implem
private static final String FALLBACK_LOCALE_TAG = "en-US";
// These are volatile because we don't impose restrictions
// over which thread calls our methods.
private volatile Locale currentLocale;
private volatile Locale systemLocale = Locale.getDefault();
- private AtomicBoolean inited = new AtomicBoolean(false);
+ private final AtomicBoolean inited = new AtomicBoolean(false);
private boolean systemLocaleDidChange;
private BroadcastReceiver receiver;
- private static AtomicReference<LocaleManager> instance = new AtomicReference<LocaleManager>();
+ private static final AtomicReference<LocaleManager> instance = new AtomicReference<LocaleManager>();
public static LocaleManager getInstance() {
LocaleManager localeManager = instance.get();
if (localeManager != null) {
return localeManager;
}
localeManager = new BrowserLocaleManager();
--- a/mobile/android/base/ChromeCast.java
+++ b/mobile/android/base/ChromeCast.java
@@ -38,17 +38,17 @@ class ChromeCast implements GeckoMediaPl
private static final boolean SHOW_DEBUG = false;
static final String MIRROR_RECIEVER_APP_ID = "5F72F863";
private final Context context;
private final RouteInfo route;
private GoogleApiClient apiClient;
private RemoteMediaPlayer remoteMediaPlayer;
- private boolean canMirror;
+ private final boolean canMirror;
private String mSessionId;
private MirrorChannel mMirrorChannel;
private boolean mApplicationStarted = false;
// Callback to start playback of a url on a remote device
private class VideoPlayCallback implements ResultCallback<ApplicationConnectionResult>,
RemoteMediaPlayer.OnStatusUpdatedListener,
RemoteMediaPlayer.OnMetadataUpdatedListener {
--- a/mobile/android/base/ContactService.java
+++ b/mobile/android/base/ContactService.java
@@ -85,18 +85,18 @@ public class ContactService implements G
private HashMap<String, String> mColumnNameConstantsMap;
private HashMap<String, String> mMimeTypeConstantsMap;
private HashMap<String, Integer> mAddressTypesMap;
private HashMap<String, Integer> mPhoneTypesMap;
private HashMap<String, Integer> mEmailTypesMap;
private HashMap<String, Integer> mWebsiteTypesMap;
private HashMap<String, Integer> mImTypesMap;
- private ContentResolver mContentResolver;
- private GeckoApp mActivity;
+ private final ContentResolver mContentResolver;
+ private final GeckoApp mActivity;
ContactService(EventDispatcher eventDispatcher, GeckoApp activity) {
mEventDispatcher = eventDispatcher;
mActivity = activity;
mContentResolver = mActivity.getContentResolver();
EventDispatcher.getInstance().registerGeckoThreadListener(this,
"Android:Contacts:Clear",
--- a/mobile/android/base/DoorHangerPopup.java
+++ b/mobile/android/base/DoorHangerPopup.java
@@ -26,17 +26,17 @@ import android.widget.CheckBox;
public class DoorHangerPopup extends ArrowPopup
implements GeckoEventListener,
Tabs.OnTabsChangedListener,
DoorHanger.OnButtonClickListener {
private static final String LOGTAG = "GeckoDoorHangerPopup";
// Stores a set of all active DoorHanger notifications. A DoorHanger is
// uniquely identified by its tabId and value.
- private HashSet<DoorHanger> mDoorHangers;
+ private final HashSet<DoorHanger> mDoorHangers;
// Whether or not the doorhanger popup is disabled.
private boolean mDisabled;
public DoorHangerPopup(Context context) {
super(context);
mDoorHangers = new HashSet<DoorHanger>();
--- a/mobile/android/base/FormAssistPopup.java
+++ b/mobile/android/base/FormAssistPopup.java
@@ -396,18 +396,18 @@ public class FormAssistPopup extends Rel
});
}
private static void broadcastGeckoEvent(String eventName, String eventData) {
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent(eventName, eventData));
}
private class AutoCompleteListAdapter extends ArrayAdapter<Pair<String, String>> {
- private LayoutInflater mInflater;
- private int mTextViewResourceId;
+ private final LayoutInflater mInflater;
+ private final int mTextViewResourceId;
public AutoCompleteListAdapter(Context context, int textViewResourceId) {
super(context, textViewResourceId);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mTextViewResourceId = textViewResourceId;
}
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -178,17 +178,17 @@ public abstract class GeckoApp
protected ButtonToast mToast;
protected LayerView mLayerView;
private AbsoluteLayout mPluginContainer;
private FullScreenHolder mFullScreenPluginContainer;
private View mFullScreenPluginView;
- private HashMap<String, PowerManager.WakeLock> mWakeLocks = new HashMap<String, PowerManager.WakeLock>();
+ private final HashMap<String, PowerManager.WakeLock> mWakeLocks = new HashMap<String, PowerManager.WakeLock>();
protected boolean mShouldRestore;
protected boolean mInitialized;
private Telemetry.Timer mJavaUiStartupTimer;
private Telemetry.Timer mGeckoReadyStartupTimer;
private String mPrivateBrowsingSession;
--- a/mobile/android/base/GeckoBatteryManager.java
+++ b/mobile/android/base/GeckoBatteryManager.java
@@ -25,17 +25,17 @@ public class GeckoBatteryManager extends
private final static double kUnknownRemainingTime = -1.0;
private static long sLastLevelChange;
private static boolean sNotificationsEnabled;
private static double sLevel = kDefaultLevel;
private static boolean sCharging = kDefaultCharging;
private static double sRemainingTime = kDefaultRemainingTime;
- private static GeckoBatteryManager sInstance = new GeckoBatteryManager();
+ private static final GeckoBatteryManager sInstance = new GeckoBatteryManager();
private final IntentFilter mFilter;
private Context mApplicationContext;
private boolean mIsEnabled;
public static GeckoBatteryManager getInstance() {
return sInstance;
}
--- a/mobile/android/base/GeckoConnectivityReceiver.java
+++ b/mobile/android/base/GeckoConnectivityReceiver.java
@@ -20,17 +20,17 @@ public class GeckoConnectivityReceiver e
*/
private static final String LINK_DATA_UP = "up";
private static final String LINK_DATA_DOWN = "down";
private static final String LINK_DATA_CHANGED = "changed";
private static final String LINK_DATA_UNKNOWN = "unknown";
private static final String LOGTAG = "GeckoConnectivityReceiver";
- private static GeckoConnectivityReceiver sInstance = new GeckoConnectivityReceiver();
+ private static final GeckoConnectivityReceiver sInstance = new GeckoConnectivityReceiver();
private final IntentFilter mFilter;
private Context mApplicationContext;
private boolean mIsEnabled;
public static GeckoConnectivityReceiver getInstance() {
return sInstance;
}
--- a/mobile/android/base/GeckoEvent.java
+++ b/mobile/android/base/GeckoEvent.java
@@ -38,17 +38,17 @@ import org.mozilla.gecko.mozglue.Robocop
*/
@JNITarget
public class GeckoEvent {
private static final String LOGTAG = "GeckoEvent";
private static final int EVENT_FACTORY_SIZE = 5;
// Maybe we're probably better to just make mType non final, and just store GeckoEvents in here...
- private static SparseArray<ArrayBlockingQueue<GeckoEvent>> mEvents = new SparseArray<ArrayBlockingQueue<GeckoEvent>>();
+ private static final SparseArray<ArrayBlockingQueue<GeckoEvent>> mEvents = new SparseArray<ArrayBlockingQueue<GeckoEvent>>();
public static GeckoEvent get(NativeGeckoEvent type) {
synchronized (mEvents) {
ArrayBlockingQueue<GeckoEvent> events = mEvents.get(type.value);
if (events != null && events.size() > 0) {
return events.poll();
}
}
--- a/mobile/android/base/GeckoInputConnection.java
+++ b/mobile/android/base/GeckoInputConnection.java
@@ -992,17 +992,17 @@ class GeckoInputConnection
}
}
final class DebugGeckoInputConnection
extends GeckoInputConnection
implements InvocationHandler {
private InputConnection mProxy;
- private StringBuilder mCallLevel;
+ private final StringBuilder mCallLevel;
private DebugGeckoInputConnection(View targetView,
GeckoEditableClient editable) {
super(targetView, editable);
mCallLevel = new StringBuilder();
}
public static GeckoEditableListener create(View targetView,
--- a/mobile/android/base/GeckoJavaSampler.java
+++ b/mobile/android/base/GeckoJavaSampler.java
@@ -57,17 +57,17 @@ public class GeckoJavaSampler {
private static class SamplingThread implements Runnable {
private final int mInterval;
private final int mSampleCount;
private boolean mPauseSampler;
private boolean mStopSampler;
- private SparseArray<Sample[]> mSamples = new SparseArray<Sample[]>();
+ private final SparseArray<Sample[]> mSamples = new SparseArray<Sample[]>();
private int mSamplePos;
public SamplingThread(final int aInterval, final int aSampleCount) {
// If we sample faster then 10ms we get to many missed samples
mInterval = Math.max(10, aInterval);
mSampleCount = aSampleCount;
}
--- a/mobile/android/base/GeckoProfile.java
+++ b/mobile/android/base/GeckoProfile.java
@@ -35,17 +35,17 @@ import android.util.Log;
public final class GeckoProfile {
private static final String LOGTAG = "GeckoProfile";
// Used to "lock" the guest profile, so that we'll always restart in it
private static final String LOCK_FILE_NAME = ".active_lock";
public static final String DEFAULT_PROFILE = "default";
public static final String GUEST_PROFILE = "guest";
- private static HashMap<String, GeckoProfile> sProfileCache = new HashMap<String, GeckoProfile>();
+ private static final HashMap<String, GeckoProfile> sProfileCache = new HashMap<String, GeckoProfile>();
private static String sDefaultProfileName;
// Caches the guest profile dir.
private static File sGuestDir;
private static GeckoProfile sGuestProfile;
public static boolean sIsUsingCustomProfile;
--- a/mobile/android/base/GeckoProfileDirectories.java
+++ b/mobile/android/base/GeckoProfileDirectories.java
@@ -53,27 +53,27 @@ public class GeckoProfileDirectories {
public boolean matches(INISection section);
}
private static final String MOZILLA_DIR_NAME = "mozilla";
/**
* Returns true if the supplied profile entry represents the default profile.
*/
- private static INISectionPredicate sectionIsDefault = new INISectionPredicate() {
+ private static final INISectionPredicate sectionIsDefault = new INISectionPredicate() {
@Override
public boolean matches(INISection section) {
return section.getIntProperty("Default") == 1;
}
};
/**
* Returns true if the supplied profile entry has a 'Name' field.
*/
- private static INISectionPredicate sectionHasName = new INISectionPredicate() {
+ private static final INISectionPredicate sectionHasName = new INISectionPredicate() {
@Override
public boolean matches(INISection section) {
final String name = section.getStringProperty("Name");
return name != null;
}
};
@RobocopTarget
--- a/mobile/android/base/GeckoThread.java
+++ b/mobile/android/base/GeckoThread.java
@@ -32,17 +32,17 @@ public class GeckoThread extends Thread
Launching,
WaitForDebugger,
Launched,
GeckoRunning,
GeckoExiting,
GeckoExited
}
- private static AtomicReference<LaunchState> sLaunchState =
+ private static final AtomicReference<LaunchState> sLaunchState =
new AtomicReference<LaunchState>(LaunchState.Launching);
private static GeckoThread sGeckoThread;
private final String mArgs;
private final String mAction;
private final String mUri;
--- a/mobile/android/base/IntentHelper.java
+++ b/mobile/android/base/IntentHelper.java
@@ -26,17 +26,17 @@ public final class IntentHelper implemen
private static final String[] EVENTS = {
"Intent:GetHandlers",
"Intent:Open",
"Intent:OpenForResult",
"WebActivity:Open"
};
private static IntentHelper instance;
- private Activity activity;
+ private final Activity activity;
private IntentHelper(Activity activity) {
this.activity = activity;
EventDispatcher.getInstance().registerGeckoThreadListener(this, EVENTS);
}
public static IntentHelper init(Activity activity) {
if (instance == null) {
--- a/mobile/android/base/LightweightThemeDrawable.java
+++ b/mobile/android/base/LightweightThemeDrawable.java
@@ -21,21 +21,21 @@ import android.graphics.Shader;
import android.graphics.drawable.Drawable;
/**
* A special drawable used with lightweight themes. This draws a color
* (with an optional color-filter) and a bitmap (with a linear gradient
* to specify the alpha) in order.
*/
public class LightweightThemeDrawable extends Drawable {
- private Paint mPaint;
+ private final Paint mPaint;
private Paint mColorPaint;
- private Bitmap mBitmap;
- private Resources mResources;
+ private final Bitmap mBitmap;
+ private final Resources mResources;
private int mStartColor;
private int mEndColor;
public LightweightThemeDrawable(Resources resources, Bitmap bitmap) {
mBitmap = bitmap;
mResources = resources;
--- a/mobile/android/base/MemoryMonitor.java
+++ b/mobile/android/base/MemoryMonitor.java
@@ -42,17 +42,17 @@ class MemoryMonitor extends BroadcastRec
// Memory pressure levels. Keep these in sync with those in AndroidJavaWrappers.h
private static final int MEMORY_PRESSURE_NONE = 0;
private static final int MEMORY_PRESSURE_CLEANUP = 1;
private static final int MEMORY_PRESSURE_LOW = 2;
private static final int MEMORY_PRESSURE_MEDIUM = 3;
private static final int MEMORY_PRESSURE_HIGH = 4;
- private static MemoryMonitor sInstance = new MemoryMonitor();
+ private static final MemoryMonitor sInstance = new MemoryMonitor();
static MemoryMonitor getInstance() {
return sInstance;
}
private final PressureDecrementer mPressureDecrementer;
private int mMemoryPressure; // Synchronized access only.
private volatile boolean mStoragePressure; // Accessed via UI thread intent, background runnables.
--- a/mobile/android/base/NotificationHelper.java
+++ b/mobile/android/base/NotificationHelper.java
@@ -59,17 +59,17 @@ public final class NotificationHelper im
private static final String NOTIFICATION_SCHEME = "moz-notification";
private static final String BUTTON_EVENT = "notification-button-clicked";
private static final String CLICK_EVENT = "notification-clicked";
private static final String CLEARED_EVENT = "notification-cleared";
private static final String CLOSED_EVENT = "notification-closed";
- private Context mContext;
+ private final Context mContext;
// Holds a list of notifications that should be cleared if the Fennec Activity is shut down.
// Will not include ongoing or persistent notifications that are tied to Gecko's lifecycle.
private HashMap<String, String> mClearableNotifications;
private boolean mInitialized;
private static NotificationHelper sInstance;
--- a/mobile/android/base/ScrollAnimator.java
+++ b/mobile/android/base/ScrollAnimator.java
@@ -21,17 +21,17 @@ public class ScrollAnimator implements V
// Assuming 60fps, this will make the view scroll once per frame
static final long MS_PER_FRAME = 1000 / 60;
// Maximum number of pixels that can be scrolled per frame
static final float MAX_SCROLL = 0.075f * GeckoAppShell.getDpi();
private class ScrollRunnable extends TimerTask {
- private View mView;
+ private final View mView;
public ScrollRunnable(View view) {
mView = view;
}
@Override
public final void run() {
mView.scrollBy(mX, mY);
--- a/mobile/android/base/SuggestClient.java
+++ b/mobile/android/base/SuggestClient.java
@@ -41,17 +41,17 @@ public class SuggestClient {
// should contain the string "__searchTerms__", which is replaced with the query
private final String mSuggestTemplate;
// the maximum number of suggestions to return
private final int mMaxResults;
// used by robocop for testing
- private boolean mCheckNetwork;
+ private final boolean mCheckNetwork;
// used to make suggestions appear instantly after opt-in
private String mPrevQuery;
private ArrayList<String> mPrevResults;
public SuggestClient(Context context, String suggestTemplate, int timeout, int maxResults) {
mContext = context;
mMaxResults = maxResults;
--- a/mobile/android/base/Tab.java
+++ b/mobile/android/base/Tab.java
@@ -40,37 +40,37 @@ public class Tab {
private String mBaseDomain;
private String mUserRequested; // The original url requested. May be typed by the user or sent by an extneral app for example.
private String mTitle;
private Bitmap mFavicon;
private String mFaviconUrl;
private int mFaviconSize;
private boolean mHasFeeds;
private boolean mHasOpenSearch;
- private SiteIdentity mSiteIdentity;
+ private final SiteIdentity mSiteIdentity;
private boolean mReaderEnabled;
private BitmapDrawable mThumbnail;
private int mHistoryIndex;
private int mHistorySize;
- private int mParentId;
- private boolean mExternal;
+ private final int mParentId;
+ private final boolean mExternal;
private boolean mBookmark;
private int mFaviconLoadId;
private String mContentType;
private boolean mHasTouchListeners;
private ZoomConstraints mZoomConstraints;
private boolean mIsRTL;
- private ArrayList<View> mPluginViews;
- private HashMap<Object, Layer> mPluginLayers;
+ private final ArrayList<View> mPluginViews;
+ private final HashMap<Object, Layer> mPluginLayers;
private int mBackgroundColor;
private int mState;
private Bitmap mThumbnailBitmap;
private boolean mDesktopMode;
private boolean mEnteringReaderMode;
- private Context mAppContext;
+ private final Context mAppContext;
private ErrorType mErrorType = ErrorType.NONE;
private static final int MAX_HISTORY_LIST_SIZE = 50;
private volatile int mLoadProgress;
private volatile int mRecordingCount;
private String mMostRecentHomePanel;
public static final int STATE_DELAYED = 0;
public static final int STATE_LOADING = 1;
--- a/mobile/android/base/Tabs.java
+++ b/mobile/android/base/Tabs.java
@@ -60,17 +60,17 @@ public class Tabs implements GeckoEventL
public static final int LOADURL_DESKTOP = 1 << 5;
public static final int LOADURL_BACKGROUND = 1 << 6;
public static final int LOADURL_EXTERNAL = 1 << 7;
private static final long PERSIST_TABS_AFTER_MILLISECONDS = 1000 * 5;
public static final int INVALID_TAB_ID = -1;
- private static AtomicInteger sTabId = new AtomicInteger(0);
+ private static final AtomicInteger sTabId = new AtomicInteger(0);
private volatile boolean mInitialTabsAdded;
private Context mAppContext;
private ContentObserver mContentObserver;
private final Runnable mPersistTabsRunnable = new Runnable() {
@Override
public void run() {
--- a/mobile/android/base/TextSelection.java
+++ b/mobile/android/base/TextSelection.java
@@ -49,17 +49,17 @@ class TextSelection extends Layer implem
private float mViewZoom;
private String mCurrentItems;
private TextSelectionActionModeCallback mCallback;
// These timers are used to avoid flicker caused by selection handles showing/hiding quickly. For isntance
// when moving between single handle caret mode and two handle selection mode.
- private Timer mActionModeTimer = new Timer("actionMode");
+ private final Timer mActionModeTimer = new Timer("actionMode");
private class ActionModeTimerTask extends TimerTask {
@Override
public void run() {
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
endActionMode();
}
--- a/mobile/android/base/animation/AnimatorProxy.java
+++ b/mobile/android/base/animation/AnimatorProxy.java
@@ -30,17 +30,17 @@ class AnimatorProxy {
public void setTranslationX(float translationX);
public float getTranslationY();
public void setTranslationY(float translationY);
public View getView();
}
- private AnimatorProxyImpl mImpl;
+ private final AnimatorProxyImpl mImpl;
private AnimatorProxy(AnimatorProxyImpl impl) {
mImpl = impl;
}
public static AnimatorProxy create(View view) {
AnimatorProxy proxy = PROXIES.get(view);
final boolean needsAnimationProxy = Versions.preHC;
@@ -141,17 +141,17 @@ class AnimatorProxy {
/*
* AnimatorProxyPreHC uses the technique used by the NineOldAndroids described here:
* http://jakewharton.com/advanced-pre-honeycomb-animation/
*
* Some of this code is based on Jake Wharton's AnimatorProxy released as part of
* the NineOldAndroids library under the Apache License 2.0.
*/
private static class AnimatorProxyPreHC extends Animation implements AnimatorProxyImpl {
- private WeakReference<View> mViewRef;
+ private final WeakReference<View> mViewRef;
private final RectF mBefore;
private final RectF mAfter;
private final Matrix mTempMatrix;
private float mAlpha;
private float mTranslationX;
private float mTranslationY;
@@ -286,17 +286,17 @@ class AnimatorProxy {
if (view != null) {
t.setAlpha(mAlpha);
transformMatrix(t.getMatrix(), view);
}
}
}
private static class AnimatorProxyPostHC implements AnimatorProxyImpl {
- private WeakReference<View> mViewRef;
+ private final WeakReference<View> mViewRef;
public AnimatorProxyPostHC(View view) {
mViewRef = new WeakReference<View>(view);
}
@Override
public float getAlpha() {
View view = mViewRef.get();
--- a/mobile/android/base/animation/BounceAnimator.java
+++ b/mobile/android/base/animation/BounceAnimator.java
@@ -27,17 +27,17 @@ public class BounceAnimator extends Valu
public Attributes(float value, int duration) {
this.value = value;
this.durationMs = duration;
}
}
private final View mView;
private final String mPropertyName;
- private List<Animator> animatorChain = new LinkedList<Animator>();
+ private final List<Animator> animatorChain = new LinkedList<Animator>();
public BounceAnimator(View view, String property) {
mView = view;
mPropertyName = property;
}
public void queue(Attributes attrs) {
final ValueAnimator animator = ObjectAnimator.ofFloat(mView, mPropertyName, attrs.value);
--- a/mobile/android/base/animation/PropertyAnimator.java
+++ b/mobile/android/base/animation/PropertyAnimator.java
@@ -41,21 +41,21 @@ public class PropertyAnimator implements
float to;
}
public static interface PropertyAnimationListener {
public void onPropertyAnimationStart();
public void onPropertyAnimationEnd();
}
- private Interpolator mInterpolator;
+ private final Interpolator mInterpolator;
private long mStartTime;
- private long mDuration;
- private float mDurationReciprocal;
- private List<ElementHolder> mElementsList;
+ private final long mDuration;
+ private final float mDurationReciprocal;
+ private final List<ElementHolder> mElementsList;
private List<PropertyAnimationListener> mListeners;
FramePoster mFramePoster;
private boolean mUseHardwareLayer;
public PropertyAnimator(long duration) {
this(duration, new DecelerateInterpolator());
}
--- a/mobile/android/base/background/datareporting/TelemetryRecorder.java
+++ b/mobile/android/base/background/datareporting/TelemetryRecorder.java
@@ -45,17 +45,17 @@ import android.util.Base64;
public class TelemetryRecorder {
private final String LOG_TAG = "TelemetryRecorder";
private final File parentDir;
private final String filename;
private File tmpFile;
private File destFile;
- private File cacheDir;
+ private final File cacheDir;
private OutputStream outputStream;
private MessageDigest checksum;
private String base64Checksum;
/**
* Charset to use for writing pings; default is us-ascii.
*
--- a/mobile/android/base/background/healthreport/HealthReportDatabaseStorage.java
+++ b/mobile/android/base/background/healthreport/HealthReportDatabaseStorage.java
@@ -904,17 +904,17 @@ public class HealthReportDatabaseStorage
c.close();
}
}
/**
* Cache the lookup from measurement and field specifier to field instance.
* This allows us to memoize the field ID lookup, too.
*/
- private HashMap<String, Field> fields = new HashMap<String, Field>();
+ private final HashMap<String, Field> fields = new HashMap<String, Field>();
private boolean fieldsCacheUpdated = false;
private void invalidateFieldsCache() {
synchronized (this.fields) {
fieldsCacheUpdated = false;
}
}
--- a/mobile/android/base/background/healthreport/HealthReportDatabases.java
+++ b/mobile/android/base/background/healthreport/HealthReportDatabases.java
@@ -12,17 +12,17 @@ import org.mozilla.gecko.background.comm
import android.content.Context;
/**
* Manages a set of per-profile Health Report storage helpers.
*/
public class HealthReportDatabases {
private static final String LOG_TAG = "HealthReportDatabases";
- private Context context;
+ private final Context context;
private final HashMap<File, HealthReportDatabaseStorage> storages = new HashMap<File, HealthReportDatabaseStorage>();
public HealthReportDatabases(final Context context) {
this.context = context;
}
public synchronized HealthReportDatabaseStorage getDatabaseHelperForProfile(final File profileDir) {
--- a/mobile/android/base/background/preferences/PreferenceFragment.java
+++ b/mobile/android/base/background/preferences/PreferenceFragment.java
@@ -48,17 +48,17 @@ public abstract class PreferenceFragment
private static final int FIRST_REQUEST_CODE = 100;
private static final int MSG_BIND_PREFERENCES = 1;
// This triggers "This Handler class should be static or leaks might occur".
// The issue is that the Handler references the Fragment; messages targeting
// the Handler reference it; and if such messages are long lived, the Fragment
// cannot be GCed. This is not an issue for us; our messages are short-lived.
- private Handler mHandler = new Handler() {
+ private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_BIND_PREFERENCES:
bindPreferences();
break;
}
@@ -294,17 +294,17 @@ public abstract class PreferenceFragment
throw new RuntimeException(
"Your content must have a ListView whose id attribute is " +
"'android.R.id.list'");
}
mList.setOnKeyListener(mListOnKeyListener);
mHandler.post(mRequestFocus);
}
- private OnKeyListener mListOnKeyListener = new OnKeyListener() {
+ private final OnKeyListener mListOnKeyListener = new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
Object selectedItem = mList.getSelectedItem();
if (selectedItem instanceof Preference) {
@SuppressWarnings("unused")
View selectedView = mList.getSelectedView();
//return ((Preference)selectedItem).onKey(
--- a/mobile/android/base/db/AbstractTransactionalProvider.java
+++ b/mobile/android/base/db/AbstractTransactionalProvider.java
@@ -45,18 +45,18 @@ import android.util.Log;
* single ContentProvider to access each per-profile database.
* * {@link SharedBrowserDatabaseProvider} is an example of a per-profile provider
* that allows for multiple providers to safely work with the same databases.
*/
@SuppressWarnings("javadoc")
public abstract class AbstractTransactionalProvider extends ContentProvider {
private static final String LOGTAG = "GeckoTransProvider";
- private static boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
- private static boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
+ private static final boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
+ private static final boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
protected abstract SQLiteDatabase getReadableDatabase(Uri uri);
protected abstract SQLiteDatabase getWritableDatabase(Uri uri);
public abstract SQLiteDatabase getWritableDatabaseForTesting(Uri uri);
protected abstract Uri insertInTransaction(Uri uri, ContentValues values);
protected abstract int deleteInTransaction(Uri uri, String selection, String[] selectionArgs);
--- a/mobile/android/base/db/BrowserDatabaseHelper.java
+++ b/mobile/android/base/db/BrowserDatabaseHelper.java
@@ -1560,18 +1560,18 @@ final class BrowserDatabaseHelper extend
}
private static final String qualifyColumn(String table, String column) {
return DBUtils.qualifyColumn(table, column);
}
// Calculate these once, at initialization. isLoggable is too expensive to
// have in-line in each log call.
- private static boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
- private static boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
+ private static final boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
+ private static final boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
protected static void trace(String message) {
if (logVerbose) {
Log.v(LOGTAG, message);
}
}
protected static void debug(String message) {
if (logDebug) {
--- a/mobile/android/base/db/BrowserProvider.java
+++ b/mobile/android/base/db/BrowserProvider.java
@@ -242,18 +242,18 @@ public class BrowserProvider extends Sha
return true;
}
return false;
}
// Calculate these once, at initialization. isLoggable is too expensive to
// have in-line in each log call.
- private static boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
- private static boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
+ private static final boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
+ private static final boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
protected static void trace(String message) {
if (logVerbose) {
Log.v(LOGTAG, message);
}
}
protected static void debug(String message) {
if (logDebug) {
--- a/mobile/android/base/db/FormHistoryProvider.java
+++ b/mobile/android/base/db/FormHistoryProvider.java
@@ -27,18 +27,18 @@ public class FormHistoryProvider extends
private static final int FORM_HISTORY = 100;
private static final int DELETED_FORM_HISTORY = 101;
private static final UriMatcher URI_MATCHER;
// This should be kept in sync with the db version in toolkit/components/satchel/nsFormHistory.js
- private static int DB_VERSION = 4;
- private static String DB_FILENAME = "formhistory.sqlite";
+ private static final int DB_VERSION = 4;
+ private static final String DB_FILENAME = "formhistory.sqlite";
private static final String TELEMETRY_TAG = "SQLITEBRIDGE_PROVIDER_FORMS";
private static final String WHERE_GUID_IS_NULL = BrowserContract.DeletedFormHistory.GUID + " IS NULL";
private static final String WHERE_GUID_IS_VALUE = BrowserContract.DeletedFormHistory.GUID + " = ?";
private static final String LOG_TAG = "FormHistoryProvider";
static {
--- a/mobile/android/base/db/HomeProvider.java
+++ b/mobile/android/base/db/HomeProvider.java
@@ -22,18 +22,18 @@ import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.util.Log;
public class HomeProvider extends SQLiteBridgeContentProvider {
private static final String LOGTAG = "GeckoHomeProvider";
// This should be kept in sync with the db version in mobile/android/modules/HomeProvider.jsm
- private static int DB_VERSION = 2;
- private static String DB_FILENAME = "home.sqlite";
+ private static final int DB_VERSION = 2;
+ private static final String DB_FILENAME = "home.sqlite";
private static final String TELEMETRY_TAG = "SQLITEBRIDGE_PROVIDER_HOME";
private static final String TABLE_ITEMS = "items";
// Endpoint to return static fake data.
static final int ITEMS_FAKE = 100;
static final int ITEMS = 101;
static final int ITEMS_ID = 102;
--- a/mobile/android/base/db/PasswordsProvider.java
+++ b/mobile/android/base/db/PasswordsProvider.java
@@ -34,18 +34,18 @@ public class PasswordsProvider extends S
private static final int PASSWORDS = 100;
private static final int DELETED_PASSWORDS = 101;
static final String DEFAULT_PASSWORDS_SORT_ORDER = Passwords.HOSTNAME + " ASC";
static final String DEFAULT_DELETED_PASSWORDS_SORT_ORDER = DeletedPasswords.TIME_DELETED + " ASC";
private static final UriMatcher URI_MATCHER;
- private static HashMap<String, String> PASSWORDS_PROJECTION_MAP;
- private static HashMap<String, String> DELETED_PASSWORDS_PROJECTION_MAP;
+ private static final HashMap<String, String> PASSWORDS_PROJECTION_MAP;
+ private static final HashMap<String, String> DELETED_PASSWORDS_PROJECTION_MAP;
// this should be kept in sync with the version in toolkit/components/passwordmgr/storage-mozStorage.js
private static final int DB_VERSION = 5;
private static final String DB_FILENAME = "signons.sqlite";
private static final String WHERE_GUID_IS_NULL = BrowserContract.DeletedPasswords.GUID + " IS NULL";
private static final String WHERE_GUID_IS_VALUE = BrowserContract.DeletedPasswords.GUID + " = ?";
private static final String LOG_TAG = "GeckPasswordsProvider";
--- a/mobile/android/base/fxa/activities/FxAccountAbstractSetupActivity.java
+++ b/mobile/android/base/fxa/activities/FxAccountAbstractSetupActivity.java
@@ -69,17 +69,17 @@ abstract public class FxAccountAbstractS
protected FxAccountAbstractSetupActivity(int resume) {
super(resume);
}
private static final String LOG_TAG = FxAccountAbstractSetupActivity.class.getSimpleName();
// By default, any custom server configuration is only shown when the account
// is configured to use a custom server.
- private static boolean ALWAYS_SHOW_CUSTOM_SERVER_LAYOUT = false;
+ private static final boolean ALWAYS_SHOW_CUSTOM_SERVER_LAYOUT = false;
protected int minimumPasswordLength = 8;
protected AutoCompleteTextView emailEdit;
protected EditText passwordEdit;
protected Button showPasswordButton;
protected TextView remoteErrorTextView;
protected Button button;
--- a/mobile/android/base/gfx/Axis.java
+++ b/mobile/android/base/gfx/Axis.java
@@ -125,17 +125,17 @@ abstract class Axis {
private final SubdocumentScrollHelper mSubscroller;
private int mOverscrollMode; /* Default to only overscrolling if we're allowed to scroll in a direction */
private float mFirstTouchPos; /* Position of the first touch event on the current drag. */
private float mTouchPos; /* Position of the most recent touch event on the current drag. */
private float mLastTouchPos; /* Position of the touch event before touchPos. */
private float mVelocity; /* Velocity in this direction; pixels per animation frame. */
- private float[] mRecentVelocities; /* Circular buffer of recent velocities since last touch start. */
+ private final float[] mRecentVelocities;/* Circular buffer of recent velocities since last touch start. */
private int mRecentVelocityCount; /* Number of values put into mRecentVelocities (unbounded). */
private boolean mScrollingDisabled; /* Whether movement on this axis is locked. */
private boolean mDisableSnap; /* Whether overscroll snapping is disabled. */
private float mDisplacement;
private FlingStates mFlingState = FlingStates.STOPPED; /* The fling state we're in on this axis. */
protected abstract float getOrigin();
--- a/mobile/android/base/gfx/BufferedCairoImage.java
+++ b/mobile/android/base/gfx/BufferedCairoImage.java
@@ -13,17 +13,17 @@ import android.util.Log;
import java.nio.ByteBuffer;
/** A Cairo image that simply saves a buffer of pixel data. */
public class BufferedCairoImage extends CairoImage {
private ByteBuffer mBuffer;
private IntSize mSize;
private int mFormat;
- private static String LOGTAG = "GeckoBufferedCairoImage";
+ private static final String LOGTAG = "GeckoBufferedCairoImage";
/** Creates a buffered Cairo image from a byte buffer. */
public BufferedCairoImage(ByteBuffer inBuffer, int inWidth, int inHeight, int inFormat) {
setBuffer(inBuffer, inWidth, inHeight, inFormat);
}
/** Creates a buffered Cairo image from an Android bitmap. */
public BufferedCairoImage(Bitmap bitmap) {
--- a/mobile/android/base/gfx/DisplayPortCalculator.java
+++ b/mobile/android/base/gfx/DisplayPortCalculator.java
@@ -70,17 +70,17 @@ final class DisplayPortCalculator {
PREF_DISPLAYPORT_VB_REVERSE_BUFFER,
PREF_DISPLAYPORT_VB_DANGER_X_BASE,
PREF_DISPLAYPORT_VB_DANGER_Y_BASE,
PREF_DISPLAYPORT_VB_DANGER_X_INCR,
PREF_DISPLAYPORT_VB_DANGER_Y_INCR,
PREF_DISPLAYPORT_PB_VELOCITY_THRESHOLD };
PrefsHelper.getPrefs(prefs, new PrefsHelper.PrefHandlerBase() {
- private Map<String, Integer> mValues = new HashMap<String, Integer>();
+ private final Map<String, Integer> mValues = new HashMap<String, Integer>();
@Override public void prefValue(String pref, int value) {
mValues.put(pref, value);
}
@Override public void finish() {
setStrategy(mValues);
}
--- a/mobile/android/base/gfx/GLController.java
+++ b/mobile/android/base/gfx/GLController.java
@@ -83,17 +83,17 @@ public class GLController {
/* This is written by the compositor thread (while the UI thread
* is blocked on it) and read by the UI thread. */
private volatile boolean mCompositorCreated;
private EGL10 mEGL;
private EGLDisplay mEGLDisplay;
private EGLConfig mEGLConfig;
- private EGLPreloadingThread mEGLPreloadingThread;
+ private final EGLPreloadingThread mEGLPreloadingThread;
private EGLSurface mEGLSurfaceForCompositor;
private static final int LOCAL_EGL_OPENGL_ES2_BIT = 4;
private static final int[] CONFIG_SPEC_16BPP = {
EGL10.EGL_RED_SIZE, 5,
EGL10.EGL_GREEN_SIZE, 6,
EGL10.EGL_BLUE_SIZE, 5,
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -28,17 +28,17 @@ import java.util.List;
class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
{
private static final String LOGTAG = "GeckoLayerClient";
private LayerRenderer mLayerRenderer;
private boolean mLayerRendererInitialized;
- private Context mContext;
+ private final Context mContext;
private IntSize mScreenSize;
private IntSize mWindowSize;
private DisplayPortMetrics mDisplayPort;
private boolean mRecordDrawTimes;
private final DrawTimingQueue mDrawTimingQueue;
private VirtualLayer mRootLayer;
@@ -54,17 +54,17 @@ class GeckoLayerClient implements LayerV
private ImmutableViewportMetrics mGeckoViewport;
/*
* The viewport metrics being used to draw the current frame. This is only
* accessed by the compositor thread, and so needs no synchronisation.
*/
private ImmutableViewportMetrics mFrameMetrics;
- private List<DrawListener> mDrawListeners;
+ private final List<DrawListener> mDrawListeners;
/* Used as temporaries by syncViewportInfo */
private final ViewTransform mCurrentViewTransform;
private final RectF mCurrentViewTransformMargins;
/* Used as the return value of progressiveUpdateCallback */
private final ProgressiveUpdateData mProgressiveUpdateData;
private DisplayPortMetrics mProgressiveUpdateDisplayPort;
@@ -89,17 +89,17 @@ class GeckoLayerClient implements LayerV
private LayerView.OnMetricsChangedListener mViewportChangeListener;
private ZoomConstraints mZoomConstraints;
private boolean mGeckoIsReady;
private final PanZoomController mPanZoomController;
private final LayerMarginsAnimator mMarginsAnimator;
- private LayerView mView;
+ private final LayerView mView;
/* This flag is true from the time that browser.js detects a first-paint is about to start,
* to the time that we receive the first-paint composite notification from the compositor.
* Note that there is a small race condition with this; if there are two paints that both
* have the first-paint flag set, and the second paint happens concurrently with the
* composite for the first paint, then this flag may be set to true prematurely. Fixing this
* is possible but risky; see https://bugzilla.mozilla.org/show_bug.cgi?id=797615#c751
*/
--- a/mobile/android/base/gfx/JavaPanZoomController.java
+++ b/mobile/android/base/gfx/JavaPanZoomController.java
@@ -36,19 +36,19 @@ import android.view.View;
* https://github.com/joehewitt/scrollability/
*/
class JavaPanZoomController
extends GestureDetector.SimpleOnGestureListener
implements PanZoomController, SimpleScaleGestureDetector.SimpleScaleGestureListener, GeckoEventListener
{
private static final String LOGTAG = "GeckoPanZoomController";
- private static String MESSAGE_ZOOM_RECT = "Browser:ZoomToRect";
- private static String MESSAGE_ZOOM_PAGE = "Browser:ZoomToPageWidth";
- private static String MESSAGE_TOUCH_LISTENER = "Tab:HasTouchListener";
+ private static final String MESSAGE_ZOOM_RECT = "Browser:ZoomToRect";
+ private static final String MESSAGE_ZOOM_PAGE = "Browser:ZoomToPageWidth";
+ private static final String MESSAGE_TOUCH_LISTENER = "Tab:HasTouchListener";
// Animation stops if the velocity is below this value when overscrolled or panning.
private static final float STOPPED_THRESHOLD = 4.0f;
// Animation stops is the velocity is below this threshold when flinging.
private static final float FLING_STOPPED_THRESHOLD = 0.1f;
// The distance the user has to pan before we recognize it as such (e.g. to avoid 1-pixel pans
@@ -897,18 +897,18 @@ class JavaPanZoomController
/* The task that performs the bounce animation. */
private class BounceRenderTask extends PanZoomRenderTask {
/*
* The viewport metrics that represent the start and end of the bounce-back animation,
* respectively.
*/
- private ImmutableViewportMetrics mBounceStartMetrics;
- private ImmutableViewportMetrics mBounceEndMetrics;
+ private final ImmutableViewportMetrics mBounceStartMetrics;
+ private final ImmutableViewportMetrics mBounceEndMetrics;
// How long ago this bounce was started in ns.
private long mBounceDuration;
BounceRenderTask(ImmutableViewportMetrics startMetrics, ImmutableViewportMetrics endMetrics) {
super();
mBounceStartMetrics = startMetrics;
mBounceEndMetrics = endMetrics;
}
--- a/mobile/android/base/gfx/LayerMarginsAnimator.java
+++ b/mobile/android/base/gfx/LayerMarginsAnimator.java
@@ -248,18 +248,18 @@ public class LayerMarginsAnimator {
if (action == MotionEvent.ACTION_DOWN && event.getPointerCount() == 1) {
mTouchTravelDistance.set(0.0f, 0.0f);
}
return false;
}
class LayerMarginsAnimationTask extends RenderTask {
- private float mStartLeft, mStartTop, mStartRight, mStartBottom;
- private float mTop, mBottom, mLeft, mRight;
+ private final float mStartLeft, mStartTop, mStartRight, mStartBottom;
+ private final float mTop, mBottom, mLeft, mRight;
private boolean mContinueAnimation;
public LayerMarginsAnimationTask(boolean runAfter, ImmutableViewportMetrics metrics,
float left, float top, float right, float bottom) {
super(runAfter);
mContinueAnimation = true;
this.mStartLeft = metrics.marginLeft;
this.mStartTop = metrics.marginTop;
--- a/mobile/android/base/gfx/LayerRenderer.java
+++ b/mobile/android/base/gfx/LayerRenderer.java
@@ -64,20 +64,20 @@ public class LayerRenderer implements Ta
private RenderContext mLastPageContext;
private int mMaxTextureSize;
private int mBackgroundColor;
private int mOverscrollColor;
private long mLastFrameTime;
private final CopyOnWriteArrayList<RenderTask> mTasks;
- private CopyOnWriteArrayList<Layer> mExtraLayers = new CopyOnWriteArrayList<Layer>();
+ private final CopyOnWriteArrayList<Layer> mExtraLayers = new CopyOnWriteArrayList<Layer>();
// Dropped frames display
- private int[] mFrameTimings;
+ private final int[] mFrameTimings;
private int mCurrentFrame, mFrameTimingsSum, mDroppedFrames;
// Render profiling output
private int mFramesRendered;
private float mCompleteFramesRendered;
private boolean mProfileRender;
private long mProfileOutputTime;
@@ -412,19 +412,19 @@ public class LayerRenderer implements Ta
}
}
}
public class Frame {
// The timestamp recording the start of this frame.
private long mFrameStartTime;
// A fixed snapshot of the viewport metrics that this frame is using to render content.
- private ImmutableViewportMetrics mFrameMetrics;
+ private final ImmutableViewportMetrics mFrameMetrics;
// A rendering context for page-positioned layers, and one for screen-positioned layers.
- private RenderContext mPageContext, mScreenContext;
+ private final RenderContext mPageContext, mScreenContext;
// Whether a layer was updated.
private boolean mUpdated;
private final Rect mPageRect;
private final Rect mAbsolutePageRect;
private final PointF mRenderOffset;
public Frame(ImmutableViewportMetrics metrics) {
mFrameMetrics = metrics;
--- a/mobile/android/base/gfx/LayerView.java
+++ b/mobile/android/base/gfx/LayerView.java
@@ -45,22 +45,22 @@ import android.view.inputmethod.InputCon
import android.widget.FrameLayout;
/**
* A view rendered by the layer compositor.
*
* Note that LayerView is accessed by Robocop via reflection.
*/
public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener {
- private static String LOGTAG = "GeckoLayerView";
+ private static final String LOGTAG = "GeckoLayerView";
private GeckoLayerClient mLayerClient;
private PanZoomController mPanZoomController;
private LayerMarginsAnimator mMarginsAnimator;
- private GLController mGLController;
+ private final GLController mGLController;
private InputConnectionHandler mInputConnectionHandler;
private LayerRenderer mRenderer;
/* Must be a PAINT_xxx constant */
private int mPaintState;
private int mBackgroundColor;
private FullScreenState mFullScreenState;
private SurfaceView mSurfaceView;
--- a/mobile/android/base/gfx/PluginLayer.java
+++ b/mobile/android/base/gfx/PluginLayer.java
@@ -13,20 +13,20 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.view.SurfaceView;
import android.view.View;
import android.widget.AbsoluteLayout;
public class PluginLayer extends TileLayer {
private static final String LOGTAG = "PluginLayer";
- private View mView;
+ private final View mView;
private SurfaceView mSurfaceView;
- private PluginLayoutParams mLayoutParams;
- private AbsoluteLayout mContainer;
+ private final PluginLayoutParams mLayoutParams;
+ private final AbsoluteLayout mContainer;
private boolean mDestroyed;
private boolean mViewVisible;
private RectF mLastViewport;
private float mLastZoomFactor;
private static final float TEXTURE_MAP[] = {
@@ -118,17 +118,17 @@ public class PluginLayer extends TileLay
public void draw(RenderContext context) {
}
class PluginLayoutParams extends AbsoluteLayout.LayoutParams
{
private static final String LOGTAG = "GeckoApp.PluginLayoutParams";
private RectF mRect;
- private int mMaxDimension;
+ private final int mMaxDimension;
private float mLastResolution;
public PluginLayoutParams(RectF rect, int maxDimension) {
super(0, 0, 0, 0);
mMaxDimension = maxDimension;
reset(rect);
}
--- a/mobile/android/base/gfx/ScrollbarLayer.java
+++ b/mobile/android/base/gfx/ScrollbarLayer.java
@@ -23,17 +23,17 @@ public class ScrollbarLayer extends Tile
// To avoid excessive GC, declare some objects here that would otherwise
// be created and destroyed frequently during draw().
private final RectF mBarRectF;
private final Rect mBarRect;
private final float[] mCoords;
private final RectF mCapRectF;
- private LayerRenderer mRenderer;
+ private final LayerRenderer mRenderer;
private int mProgram;
private int mPositionHandle;
private int mTextureHandle;
private int mSampleHandle;
private int mTMatrixHandle;
private int mOpacityHandle;
// Fragment shader used to draw the scroll-bar with opacity
--- a/mobile/android/base/gfx/SimpleScaleGestureDetector.java
+++ b/mobile/android/base/gfx/SimpleScaleGestureDetector.java
@@ -31,22 +31,22 @@ import java.util.Stack;
* - Starting with three or more fingers down, releasing fingers so that only two are down, and
* then performing a scale gesture is handled correctly.
*
* - It doesn't take pressure into account, which results in smoother scaling.
*/
class SimpleScaleGestureDetector {
private static final String LOGTAG = "GeckoSimpleScaleGestureDetector";
- private SimpleScaleGestureListener mListener;
+ private final SimpleScaleGestureListener mListener;
private long mLastEventTime;
private boolean mScaleResult;
/* Information about all pointers that are down. */
- private LinkedList<PointerInfo> mPointerInfo;
+ private final LinkedList<PointerInfo> mPointerInfo;
/** Creates a new gesture detector with the given listener. */
SimpleScaleGestureDetector(SimpleScaleGestureListener listener) {
mListener = listener;
mPointerInfo = new LinkedList<PointerInfo>();
}
/** Forward touch events to this function. */
--- a/mobile/android/base/gfx/SubdocumentScrollHelper.java
+++ b/mobile/android/base/gfx/SubdocumentScrollHelper.java
@@ -15,20 +15,20 @@ import org.json.JSONObject;
import android.graphics.PointF;
import android.os.Handler;
import android.util.Log;
class SubdocumentScrollHelper implements GeckoEventListener {
private static final String LOGTAG = "GeckoSubdocScroll";
- private static String MESSAGE_PANNING_OVERRIDE = "Panning:Override";
- private static String MESSAGE_CANCEL_OVERRIDE = "Panning:CancelOverride";
- private static String MESSAGE_SCROLL = "Gesture:Scroll";
- private static String MESSAGE_SCROLL_ACK = "Gesture:ScrollAck";
+ private static final String MESSAGE_PANNING_OVERRIDE = "Panning:Override";
+ private static final String MESSAGE_CANCEL_OVERRIDE = "Panning:CancelOverride";
+ private static final String MESSAGE_SCROLL = "Gesture:Scroll";
+ private static final String MESSAGE_SCROLL_ACK = "Gesture:ScrollAck";
private final Handler mUiHandler;
private final EventDispatcher mEventDispatcher;
/* This is the amount of displacement we have accepted but not yet sent to JS; this is
* only valid when mOverrideScrollPending is true. */
private final PointF mPendingDisplacement;
--- a/mobile/android/base/gfx/TextureGenerator.java
+++ b/mobile/android/base/gfx/TextureGenerator.java
@@ -14,17 +14,17 @@ import javax.microedition.khronos.egl.EG
import javax.microedition.khronos.egl.EGLContext;
public class TextureGenerator {
private static final String LOGTAG = "TextureGenerator";
private static final int POOL_SIZE = 5;
private static TextureGenerator sSharedInstance;
- private ArrayBlockingQueue<Integer> mTextureIds;
+ private final ArrayBlockingQueue<Integer> mTextureIds;
private EGLContext mContext;
private TextureGenerator() { mTextureIds = new ArrayBlockingQueue<Integer>(POOL_SIZE); }
public static TextureGenerator get() {
if (sSharedInstance == null)
sSharedInstance = new TextureGenerator();
return sSharedInstance;
--- a/mobile/android/base/gfx/TextureReaper.java
+++ b/mobile/android/base/gfx/TextureReaper.java
@@ -7,17 +7,17 @@ package org.mozilla.gecko.gfx;
import android.opengl.GLES20;
import java.util.ArrayList;
/** Manages a list of dead tiles, so we don't leak resources. */
public class TextureReaper {
private static TextureReaper sSharedInstance;
- private ArrayList<Integer> mDeadTextureIDs;
+ private final ArrayList<Integer> mDeadTextureIDs;
private TextureReaper() { mDeadTextureIDs = new ArrayList<Integer>(); }
public static TextureReaper get() {
if (sSharedInstance == null)
sSharedInstance = new TextureReaper();
return sSharedInstance;
}
--- a/mobile/android/base/health/BrowserHealthRecorder.java
+++ b/mobile/android/base/health/BrowserHealthRecorder.java
@@ -910,17 +910,17 @@ public class BrowserHealthRecorder imple
throw new IllegalArgumentException("Unknown search location: " + location);
}
this.location = location;
this.engineID = engineID;
}
}
- private static ConcurrentLinkedQueue<Search> delayedSearches = new ConcurrentLinkedQueue<>();
+ private static final ConcurrentLinkedQueue<Search> delayedSearches = new ConcurrentLinkedQueue<>();
public static void recordSearchDelayed(String location, String engineID) {
final Search search = new Search(location, engineID);
delayedSearches.add(search);
}
@Override
public void processDelayed() {
--- a/mobile/android/base/home/BookmarksListAdapter.java
+++ b/mobile/android/base/home/BookmarksListAdapter.java
@@ -99,17 +99,17 @@ class BookmarksListAdapter extends Multi
// This is usually implemented by the enclosing fragment/activity.
public static interface OnRefreshFolderListener {
// The folder id to refresh the list with.
public void onRefreshFolder(FolderInfo folderInfo, RefreshType refreshType);
}
// mParentStack holds folder info instances (id + title) that allow
// us to navigate back up the folder hierarchy.
- private LinkedList<FolderInfo> mParentStack;
+ private final LinkedList<FolderInfo> mParentStack;
// Refresh folder listener.
private OnRefreshFolderListener mListener;
public BookmarksListAdapter(Context context, Cursor cursor, List<FolderInfo> parentStack) {
// Initializing with a null cursor.
super(context, cursor, VIEW_TYPES, LAYOUT_TYPES);
--- a/mobile/android/base/home/HomeListView.java
+++ b/mobile/android/base/home/HomeListView.java
@@ -28,17 +28,17 @@ public class HomeListView extends ListVi
// ContextMenuInfo associated with the currently long pressed list item.
private HomeContextMenuInfo mContextMenuInfo;
// On URL open listener
protected OnUrlOpenListener mUrlOpenListener;
// Top divider
- private boolean mShowTopDivider;
+ private final boolean mShowTopDivider;
// ContextMenuInfo maker
private HomeContextMenuInfo.Factory mContextMenuInfoFactory;
public HomeListView(Context context) {
this(context, null);
}
--- a/mobile/android/base/home/HomePager.java
+++ b/mobile/android/base/home/HomePager.java
@@ -40,17 +40,17 @@ public class HomePager extends ViewPager
private Decor mDecor;
private View mTabStrip;
private HomeBanner mHomeBanner;
private int mDefaultPageIndex = -1;
private final OnAddPanelListener mAddPanelListener;
private final HomeConfig mConfig;
- private ConfigLoaderCallbacks mConfigLoaderCallbacks;
+ private final ConfigLoaderCallbacks mConfigLoaderCallbacks;
private String mInitialPanelId;
// Cached original ViewPager background.
private final Drawable mOriginalBackground;
// Telemetry session for current panel.
private TelemetryContract.Session mCurrentPanelSession;
--- a/mobile/android/base/home/PanelGridView.java
+++ b/mobile/android/base/home/PanelGridView.java
@@ -25,17 +25,17 @@ import android.widget.AdapterView;
import android.widget.GridView;
public class PanelGridView extends GridView
implements DatasetBacked, PanelView {
private static final String LOGTAG = "GeckoPanelGridView";
private final ViewConfig viewConfig;
private final PanelViewAdapter adapter;
- private PanelViewItemHandler itemHandler;
+ private final PanelViewItemHandler itemHandler;
private OnItemOpenListener itemOpenListener;
private HomeContextMenuInfo mContextMenuInfo;
private HomeContextMenuInfo.Factory mContextMenuInfoFactory;
public PanelGridView(Context context, ViewConfig viewConfig) {
super(context, null, R.attr.panelGridViewStyle);
this.viewConfig = viewConfig;
--- a/mobile/android/base/home/PanelInfoManager.java
+++ b/mobile/android/base/home/PanelInfoManager.java
@@ -54,17 +54,17 @@ public class PanelInfoManager implements
}
}
}
public interface RequestCallback {
public void onComplete(List<PanelInfo> panelInfos);
}
- private static AtomicInteger sRequestId = new AtomicInteger(0);
+ private static final AtomicInteger sRequestId = new AtomicInteger(0);
// Stores set of pending request callbacks.
private static final SparseArray<RequestCallback> sCallbacks = new SparseArray<RequestCallback>();
/**
* Asynchronously fetches list of available panels from Gecko
* for the given IDs.
*
--- a/mobile/android/base/home/PanelLayout.java
+++ b/mobile/android/base/home/PanelLayout.java
@@ -674,17 +674,17 @@ abstract class PanelLayout extends Frame
}
}
public interface OnItemOpenListener {
public void onItemOpen(String url, String title);
}
private class PanelOnItemOpenListener implements OnItemOpenListener {
- private ViewState mViewState;
+ private final ViewState mViewState;
public PanelOnItemOpenListener(ViewState viewState) {
mViewState = viewState;
}
@Override
public void onItemOpen(String url, String title) {
if (StringUtils.isFilterUrl(url)) {
@@ -697,17 +697,17 @@ abstract class PanelLayout extends Frame
}
mUrlOpenListener.onUrlOpen(url, flags);
}
}
}
private class PanelKeyListener implements View.OnKeyListener {
- private ViewState mViewState;
+ private final ViewState mViewState;
public PanelKeyListener(ViewState viewState) {
mViewState = viewState;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
--- a/mobile/android/base/home/PinSiteDialog.java
+++ b/mobile/android/base/home/PinSiteDialog.java
@@ -201,17 +201,17 @@ class PinSiteDialog extends DialogFragme
EnumSet.of(FilterFlags.EXCLUDE_PINNED_SITES));
}
public void setOnSiteSelectedListener(OnSiteSelectedListener listener) {
mOnSiteSelectedListener = listener;
}
private static class SearchAdapter extends CursorAdapter {
- private LayoutInflater mInflater;
+ private final LayoutInflater mInflater;
public SearchAdapter(Context context) {
super(context, null, 0);
mInflater = LayoutInflater.from(context);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
--- a/mobile/android/base/home/TopSitesPanel.java
+++ b/mobile/android/base/home/TopSitesPanel.java
@@ -100,18 +100,18 @@ public class TopSitesPanel extends HomeF
// Time in ms until the Gecko thread is reset to normal priority.
private static final long PRIORITY_RESET_TIMEOUT = 10000;
public static TopSitesPanel newInstance() {
return new TopSitesPanel();
}
- private static boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
- private static boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
+ private static final boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
+ private static final boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
private static void debug(final String message) {
if (logDebug) {
Log.d(LOGTAG, message);
}
}
private static void trace(final String message) {
@@ -401,17 +401,17 @@ public class TopSitesPanel extends HomeF
// Gecko to normal priority.
ThreadUtils.resetGeckoPriority();
}
private static class TopSitesLoader extends SimpleCursorLoader {
// Max number of search results.
private static final int SEARCH_LIMIT = 30;
private static final String TELEMETRY_HISTOGRAM_LOAD_CURSOR = "FENNEC_TOPSITES_LOADER_TIME_MS";
- private int mMaxGridEntries;
+ private final int mMaxGridEntries;
public TopSitesLoader(Context context) {
super(context);
mMaxGridEntries = context.getResources().getInteger(R.integer.number_of_top_sites);
}
@Override
public Cursor loadCursor() {
@@ -696,17 +696,17 @@ public class TopSitesPanel extends HomeF
}
/**
* An AsyncTaskLoader to load the thumbnails from a cursor.
*/
@SuppressWarnings("serial")
static class ThumbnailsLoader extends AsyncTaskLoader<Map<String, ThumbnailInfo>> {
private Map<String, ThumbnailInfo> mThumbnailInfos;
- private ArrayList<String> mUrls;
+ private final ArrayList<String> mUrls;
private static final ArrayList<String> COLUMNS = new ArrayList<String>() {{
add(TILE_IMAGE_URL_COLUMN);
add(TILE_COLOR_COLUMN);
}};
public ThumbnailsLoader(Context context, ArrayList<String> urls) {
super(context);
--- a/mobile/android/base/home/TopSitesThumbnailView.java
+++ b/mobile/android/base/home/TopSitesThumbnailView.java
@@ -27,17 +27,17 @@ public class TopSitesThumbnailView exten
// Default filter color for "Add a bookmark" views.
private static final int DEFAULT_COLOR = 0xFFECF0F3;
// Stroke width for the border.
private final float mStrokeWidth = getResources().getDisplayMetrics().density * 2;
// Paint for drawing the border.
- private static Paint sBorderPaint;
+ private static final Paint sBorderPaint;
// Initializing the static border paint.
static {
sBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
sBorderPaint.setColor(0xFFCFD9E1);
sBorderPaint.setStyle(Paint.Style.STROKE);
}
--- a/mobile/android/base/menu/GeckoMenu.java
+++ b/mobile/android/base/menu/GeckoMenu.java
@@ -83,38 +83,38 @@ public class GeckoMenu extends ListView
// Remove an action-item.
public void removeActionItem(View actionItem);
}
protected static final int NO_ID = 0;
// List of all menu items.
- private List<GeckoMenuItem> mItems;
+ private final List<GeckoMenuItem> mItems;
// Map of "always" action-items in action-bar and their views.
- private Map<GeckoMenuItem, View> mPrimaryActionItems;
+ private final Map<GeckoMenuItem, View> mPrimaryActionItems;
// Map of "ifRoom" action-items in action-bar and their views.
- private Map<GeckoMenuItem, View> mSecondaryActionItems;
+ private final Map<GeckoMenuItem, View> mSecondaryActionItems;
// Reference to a callback for menu events.
private Callback mCallback;
// Reference to menu presenter.
private MenuPresenter mMenuPresenter;
// Reference to "always" action-items bar in action-bar.
private ActionItemBarPresenter mPrimaryActionItemBar;
// Reference to "ifRoom" action-items bar in action-bar.
private final ActionItemBarPresenter mSecondaryActionItemBar;
// Adapter to hold the list of menu items.
- private MenuItemsAdapter mAdapter;
+ private final MenuItemsAdapter mAdapter;
// Show/hide icons in the list.
boolean mShowIcons;
public GeckoMenu(Context context) {
this(context, null);
}
@@ -681,17 +681,17 @@ public class GeckoMenu extends ListView
}
}
// Adapter to bind menu items to the list.
private class MenuItemsAdapter extends BaseAdapter {
private static final int VIEW_TYPE_DEFAULT = 0;
private static final int VIEW_TYPE_ACTION_MODE = 1;
- private List<GeckoMenuItem> mItems;
+ private final List<GeckoMenuItem> mItems;
public MenuItemsAdapter() {
mItems = new ArrayList<GeckoMenuItem>();
}
@Override
public int getCount() {
if (mItems == null)
--- a/mobile/android/base/menu/MenuItemDefault.java
+++ b/mobile/android/base/menu/MenuItemDefault.java
@@ -15,17 +15,17 @@ import android.widget.TextView;
public class MenuItemDefault extends TextView
implements GeckoMenuItem.Layout {
private static final int[] STATE_MORE = new int[] { R.attr.state_more };
private static final int[] STATE_CHECKED = new int[] { android.R.attr.state_checkable, android.R.attr.state_checked };
private static final int[] STATE_UNCHECKED = new int[] { android.R.attr.state_checkable };
private Drawable mIcon;
- private Drawable mState;
+ private final Drawable mState;
private static Rect sIconBounds;
private boolean mCheckable;
private boolean mChecked;
private boolean mHasSubMenu;
private boolean mShowIcon;
public MenuItemDefault(Context context) {
--- a/mobile/android/base/mozglue/ByteBufferInputStream.java
+++ b/mobile/android/base/mozglue/ByteBufferInputStream.java
@@ -7,17 +7,17 @@ package org.mozilla.gecko.mozglue;
import java.io.InputStream;
import java.nio.ByteBuffer;
class ByteBufferInputStream extends InputStream {
protected ByteBuffer mBuf;
// Reference to a native object holding the data backing the ByteBuffer.
- private NativeReference mNativeRef;
+ private final NativeReference mNativeRef;
protected ByteBufferInputStream(ByteBuffer buffer, NativeReference ref) {
mBuf = buffer;
mNativeRef = ref;
}
@Override
public int available() {
--- a/mobile/android/base/overlays/ui/SendTabList.java
+++ b/mobile/android/base/overlays/ui/SendTabList.java
@@ -50,17 +50,17 @@ public class SendTabList extends ListVie
// from a secondary menu.
public static final int MAXIMUM_INLINE_ELEMENTS = 2;
private SendTabDeviceListArrayAdapter clientListAdapter;
// Listener to fire when a share target is selected (either directly or via the prompt)
private SendTabTargetSelectedListener listener;
- private State currentState = LOADING;
+ private final State currentState = LOADING;
/**
* Enum defining the states this view may occupy.
*/
public enum State {
// State when no sync targets exist (a generic "Send to Firefox Sync" button which launches
// an activity to set it up)
NONE,
--- a/mobile/android/base/preferences/AndroidImport.java
+++ b/mobile/android/base/preferences/AndroidImport.java
@@ -17,24 +17,24 @@ import android.content.OperationApplicat
import android.database.Cursor;
import android.os.RemoteException;
import android.provider.Browser;
import android.util.Log;
import java.util.ArrayList;
class AndroidImport implements Runnable {
- static final private String LOGTAG = "AndroidImport";
- private Context mContext;
- private Runnable mOnDoneRunnable;
- private ArrayList<ContentProviderOperation> mOperations;
- private ContentResolver mCr;
- private LocalBrowserDB mDB;
- private boolean mImportBookmarks;
- private boolean mImportHistory;
+ private static final String LOGTAG = "AndroidImport";
+ private final Context mContext;
+ private final Runnable mOnDoneRunnable;
+ private final ArrayList<ContentProviderOperation> mOperations;
+ private final ContentResolver mCr;
+ private final LocalBrowserDB mDB;
+ private final boolean mImportBookmarks;
+ private final boolean mImportHistory;
public AndroidImport(Context context, Runnable onDoneRunnable,
boolean doBookmarks, boolean doHistory) {
mContext = context;
mOnDoneRunnable = onDoneRunnable;
mOperations = new ArrayList<ContentProviderOperation>();
mCr = mContext.getContentResolver();
mDB = new LocalBrowserDB(GeckoProfile.get(context).getName());
--- a/mobile/android/base/preferences/AndroidImportPreference.java
+++ b/mobile/android/base/preferences/AndroidImportPreference.java
@@ -11,19 +11,19 @@ import org.mozilla.gecko.util.ThreadUtil
import java.util.Set;
import android.app.ProgressDialog;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
class AndroidImportPreference extends MultiPrefMultiChoicePreference {
- static final private String LOGTAG = "AndroidImport";
+ private static final String LOGTAG = "AndroidImport";
private static final String PREF_KEY_PREFIX = "import_android.data.";
- private Context mContext;
+ private final Context mContext;
public AndroidImportPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
@Override
protected void onDialogClosed(boolean positiveResult) {
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -1023,17 +1023,17 @@ OnSharedPreferenceChangeListener
}
public interface PrefHandler {
public void setupPref(Context context, Preference pref);
public void onChange(Context context, Preference pref, Object newValue);
}
@SuppressWarnings("serial")
- private Map<String, PrefHandler> handlers = new HashMap<String, PrefHandler>() {{
+ private final Map<String, PrefHandler> handlers = new HashMap<String, PrefHandler>() {{
put(ClearOnShutdownPref.PREF, new ClearOnShutdownPref());
}};
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String prefName = preference.getKey();
Log.i(LOGTAG, "Changed " + prefName + " = " + newValue);
--- a/mobile/android/base/preferences/LinkPreference.java
+++ b/mobile/android/base/preferences/LinkPreference.java
@@ -7,17 +7,17 @@ package org.mozilla.gecko.preferences;
import org.mozilla.gecko.Tabs;
import android.content.Context;
import android.preference.Preference;
import android.util.AttributeSet;
class LinkPreference extends Preference {
- private String mUrl;
+ private final String mUrl;
public LinkPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mUrl = attrs.getAttributeValue(null, "url");
}
public LinkPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mUrl = attrs.getAttributeValue(null, "url");
--- a/mobile/android/base/preferences/PanelsPreference.java
+++ b/mobile/android/base/preferences/PanelsPreference.java
@@ -40,17 +40,17 @@ public class PanelsPreference extends Cu
private static final int INDEX_MOVE_UP_BUTTON = 0;
private static final int INDEX_MOVE_DOWN_BUTTON = 1;
private String LABEL_HIDE;
private String LABEL_SHOW;
private View preferenceView;
protected boolean mIsHidden;
- private boolean mIsRemovable;
+ private final boolean mIsRemovable;
private boolean mAnimate;
private static final int ANIMATION_DURATION_MS = 400;
// State for reordering.
private int mPositionState = -1;
private final int mIndex;
--- a/mobile/android/base/preferences/SyncPreference.java
+++ b/mobile/android/base/preferences/SyncPreference.java
@@ -16,17 +16,17 @@ import org.mozilla.gecko.util.HardwareUt
import android.content.Context;
import android.content.Intent;
import android.preference.Preference;
import android.util.AttributeSet;
class SyncPreference extends Preference {
private static final boolean DEFAULT_TO_FXA = true;
- private Context mContext;
+ private final Context mContext;
public SyncPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
private void openSync11Settings() {
// Show Sync setup if no accounts exist; otherwise, show account settings.
--- a/mobile/android/base/prompts/ColorPickerInput.java
+++ b/mobile/android/base/prompts/ColorPickerInput.java
@@ -13,18 +13,18 @@ import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
public class ColorPickerInput extends PromptInput {
public static final String INPUT_TYPE = "color";
public static final String LOGTAG = "GeckoColorPickerInput";
- private boolean mShowAdvancedButton = true;
- private int mInitialColor;
+ private final boolean mShowAdvancedButton = true;
+ private final int mInitialColor;
public ColorPickerInput(JSONObject obj) {
super(obj);
String init = obj.optString("value");
mInitialColor = Color.rgb(Integer.parseInt(init.substring(1,3), 16),
Integer.parseInt(init.substring(3,5), 16),
Integer.parseInt(init.substring(5,7), 16));
}
--- a/mobile/android/base/prompts/IconGridInput.java
+++ b/mobile/android/base/prompts/IconGridInput.java
@@ -35,17 +35,17 @@ public class IconGridInput extends Promp
public static final String LOGTAG = "GeckoIconGridInput";
private ArrayAdapter<IconGridItem> mAdapter; // An adapter holding a list of items to show in the grid
private static int mColumnWidth = -1; // The maximum width of columns
private static int mMaxColumns = -1; // The maximum number of columns to show
private static int mIconSize = -1; // Size of icons in the grid
private int mSelected; // Current selection
- private JSONArray mArray;
+ private final JSONArray mArray;
public IconGridInput(JSONObject obj) {
super(obj);
mArray = obj.optJSONArray("items");
}
@Override
public View getView(Context context) throws UnsupportedOperationException {
--- a/mobile/android/base/prompts/PromptInput.java
+++ b/mobile/android/base/prompts/PromptInput.java
@@ -127,17 +127,17 @@ public class PromptInput {
public Object getValue() {
EditText edit = (EditText)mView;
return edit.getText();
}
}
public static class CheckboxInput extends PromptInput {
public static final String INPUT_TYPE = "checkbox";
- private boolean mChecked;
+ private final boolean mChecked;
public CheckboxInput(JSONObject obj) {
super(obj);
mChecked = obj.optBoolean("checked");
}
public View getView(Context context) throws UnsupportedOperationException {
CheckBox checkbox = new CheckBox(context);
--- a/mobile/android/base/sqlite/ByteBufferInputStream.java
+++ b/mobile/android/base/sqlite/ByteBufferInputStream.java
@@ -9,17 +9,17 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
/*
* Helper class to make the ByteBuffers returned by SQLite BLOB
* easier to use.
*/
public class ByteBufferInputStream extends InputStream {
- private ByteBuffer mByteBuffer;
+ private final ByteBuffer mByteBuffer;
public ByteBufferInputStream(ByteBuffer aByteBuffer) {
mByteBuffer = aByteBuffer;
}
@Override
public synchronized int read() throws IOException {
if (!mByteBuffer.hasRemaining()) {
--- a/mobile/android/base/sqlite/SQLiteBridge.java
+++ b/mobile/android/base/sqlite/SQLiteBridge.java
@@ -21,17 +21,17 @@ import java.util.Map.Entry;
* This class allows using the mozsqlite3 library included with Firefox
* to read SQLite databases, instead of the Android SQLiteDataBase API,
* which might use whatever outdated DB is present on the Android system.
*/
public class SQLiteBridge {
private static final String LOGTAG = "SQLiteBridge";
// Path to the database. If this database was not opened with openDatabase, we reopen it every query.
- private String mDb;
+ private final String mDb;
// Pointer to the database if it was opened with openDatabase. 0 implies closed.
protected volatile long mDbPointer;
// Values remembered after a query.
private long[] mQueryResults;
private boolean mTransactionSuccess;
--- a/mobile/android/base/sync/CommandProcessor.java
+++ b/mobile/android/base/sync/CommandProcessor.java
@@ -37,17 +37,17 @@ import android.net.Uri;
* during an activity completely unrelated to a sync (such as
* <code>SendTabActivity</code>.)</li>
* </ol>
* To provide a processor for both these time frames, we maintain a static
* long-lived singleton.
*/
public class CommandProcessor {
private static final String LOG_TAG = "Command";
- private static AtomicInteger currentId = new AtomicInteger();
+ private static final AtomicInteger currentId = new AtomicInteger();
protected ConcurrentHashMap<String, CommandRunner> commands = new ConcurrentHashMap<String, CommandRunner>();
private final static CommandProcessor processor = new CommandProcessor();
/**
* Get the global singleton command processor.
*
* @return the singleton processor.
--- a/mobile/android/base/sync/JSONRecordFetcher.java
+++ b/mobile/android/base/sync/JSONRecordFetcher.java
@@ -82,17 +82,17 @@ public class JSONRecordFetcher {
} catch (Exception e) {
delegate.handleError(e);
}
}
private class LatchedJSONRecordFetchDelegate implements JSONRecordFetchDelegate {
public ExtendedJSONObject body = null;
public Exception exception = null;
- private CountDownLatch latch;
+ private final CountDownLatch latch;
public LatchedJSONRecordFetchDelegate(CountDownLatch latch) {
this.latch = latch;
}
@Override
public void handleFailure(SyncStorageResponse response) {
this.exception = new HTTPFailureException(response);
--- a/mobile/android/base/sync/SyncConfiguration.java
+++ b/mobile/android/base/sync/SyncConfiguration.java
@@ -21,17 +21,17 @@ import org.mozilla.gecko.sync.stage.Glob
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
public class SyncConfiguration {
public class EditorBranch implements Editor {
- private String prefix;
+ private final String prefix;
private Editor editor;
public EditorBranch(SyncConfiguration config, String prefix) {
if (!prefix.endsWith(".")) {
throw new IllegalArgumentException("No trailing period in prefix.");
}
this.prefix = prefix;
this.editor = config.getEditor();
@@ -100,18 +100,18 @@ public class SyncConfiguration {
/**
* A wrapper around a portion of the SharedPreferences space.
*
* @author rnewman
*
*/
public class ConfigurationBranch implements SharedPreferences {
- private SyncConfiguration config;
- private String prefix; // Including trailing period.
+ private final SyncConfiguration config;
+ private final String prefix; // Including trailing period.
public ConfigurationBranch(SyncConfiguration syncConfiguration,
String prefix) {
if (!prefix.endsWith(".")) {
throw new IllegalArgumentException("No trailing period in prefix.");
}
this.config = syncConfiguration;
this.prefix = prefix;
--- a/mobile/android/base/sync/Utils.java
+++ b/mobile/android/base/sync/Utils.java
@@ -35,17 +35,17 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
public class Utils {
private static final String LOG_TAG = "Utils";
- private static SecureRandom sharedSecureRandom = new SecureRandom();
+ private static final SecureRandom sharedSecureRandom = new SecureRandom();
// See <http://developer.android.com/reference/android/content/Context.html#getSharedPreferences%28java.lang.String,%20int%29>
public static final int SHARED_PREFERENCES_MODE = 0;
public static String generateGuid() {
byte[] encodedBytes = Base64.encodeBase64(generateRandomBytes(9), false);
return new String(encodedBytes).replace("+", "-").replace("/", "_");
}
--- a/mobile/android/base/sync/jpake/JPakeClient.java
+++ b/mobile/android/base/sync/jpake/JPakeClient.java
@@ -33,67 +33,67 @@ import org.mozilla.gecko.sync.jpake.stag
import org.mozilla.gecko.sync.jpake.stage.VerifyPairingStage;
import org.mozilla.gecko.sync.setup.Constants;
import org.mozilla.gecko.sync.setup.activities.SetupSyncActivity;
import ch.boye.httpclientandroidlib.entity.StringEntity;
public class JPakeClient {
- private static String LOG_TAG = "JPakeClient";
+ private static final String LOG_TAG = "JPakeClient";
// J-PAKE constants.
- public final static int REQUEST_TIMEOUT = 60 * 1000; // 1 min
- public final static int KEYEXCHANGE_VERSION = 3;
- public final static String JPAKE_VERIFY_VALUE = "0123456789ABCDEF";
+ public static final int REQUEST_TIMEOUT = 60 * 1000; // 1 min
+ public static final int KEYEXCHANGE_VERSION = 3;
+ public static final String JPAKE_VERIFY_VALUE = "0123456789ABCDEF";
- private final static String JPAKE_SIGNERID_SENDER = "sender";
- private final static String JPAKE_SIGNERID_RECEIVER = "receiver";
- private final static int JPAKE_LENGTH_SECRET = 8;
- private final static int JPAKE_LENGTH_CLIENTID = 256;
+ private static final String JPAKE_SIGNERID_SENDER = "sender";
+ private static final String JPAKE_SIGNERID_RECEIVER = "receiver";
+ private static final int JPAKE_LENGTH_SECRET = 8;
+ private static final int JPAKE_LENGTH_CLIENTID = 256;
- private final static int MAX_TRIES = 10;
- private final static int MAX_TRIES_FIRST_MSG = 300;
- private final static int MAX_TRIES_LAST_MSG = 300;
+ private static final int MAX_TRIES = 10;
+ private static final int MAX_TRIES_FIRST_MSG = 300;
+ private static final int MAX_TRIES_LAST_MSG = 300;
// J-PAKE session values.
- public String clientId;
- public String secret;
+ public String clientId;
+ public String secret;
- public String myEtag;
- public String mySignerId;
- public String theirEtag;
- public String theirSignerId;
- public String jpakeServer;
+ public String myEtag;
+ public String mySignerId;
+ public String theirEtag;
+ public String theirSignerId;
+ public String jpakeServer;
// J-PAKE state.
- public boolean paired = false;
- public boolean finished = false;
+ public boolean paired;
+ public boolean finished;
// J-PAKE values.
- public int jpakePollInterval;
- public int jpakeMaxTries;
- public String channel;
- public volatile String channelUrl;
+ public int jpakePollInterval;
+ public int jpakeMaxTries;
+ public String channel;
+ public volatile String channelUrl;
// J-PAKE session data.
- public KeyBundle myKeyBundle;
- public JSONObject jCreds;
+ public KeyBundle myKeyBundle;
+ public JSONObject jCreds;
- public ExtendedJSONObject jOutgoing;
- public ExtendedJSONObject jIncoming;
+ public ExtendedJSONObject jOutgoing;
+ public ExtendedJSONObject jIncoming;
- public JPakeParty jParty;
- public JPakeNumGenerator numGen;
+ public JPakeParty jParty;
+ public JPakeNumGenerator numGen;
- public int pollTries = 0;
+ public int pollTries;
// UI controller.
- private SetupSyncActivity controllerActivity;
- private Queue<JPakeStage> stages;
+ private final SetupSyncActivity controllerActivity;
+ private Queue<JPakeStage> stages;
public JPakeClient(SetupSyncActivity activity) {
controllerActivity = activity;
jpakeServer = "https://setup.services.mozilla.com/";
jpakePollInterval = 1 * 1000; // 1 second
jpakeMaxTries = MAX_TRIES;
if (!jpakeServer.endsWith("/")) {
--- a/mobile/android/base/sync/jpake/stage/GetRequestStage.java
+++ b/mobile/android/base/sync/jpake/stage/GetRequestStage.java
@@ -23,17 +23,17 @@ import ch.boye.httpclientandroidlib.Head
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.client.ClientProtocolException;
import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase;
import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient;
import ch.boye.httpclientandroidlib.message.BasicHeader;
public class GetRequestStage extends JPakeStage {
- private Timer timerScheduler = new Timer();
+ private final Timer timerScheduler = new Timer();
private int pollTries;
private GetStepTimerTask getStepTimerTask;
private interface GetRequestStageDelegate {
public void handleSuccess(HttpResponse response);
public void handleFailure(String error);
public void handleError(Exception e);
}
@@ -183,17 +183,17 @@ public class GetRequestStage extends JPa
return httpResource;
}
/**
* TimerTask for use with delayed GET requests.
*
*/
public class GetStepTimerTask extends TimerTask {
- private Resource request;
+ private final Resource request;
public GetStepTimerTask(Resource request) {
this.request = request;
}
@Override
public void run() {
request.get();
--- a/mobile/android/base/sync/middleware/Crypto5MiddlewareRepository.java
+++ b/mobile/android/base/sync/middleware/Crypto5MiddlewareRepository.java
@@ -21,18 +21,18 @@ import android.content.Context;
* @author rnewman
*
*/
public class Crypto5MiddlewareRepository extends MiddlewareRepository {
public RecordFactory recordFactory = new IdentityRecordFactory();
public class Crypto5MiddlewareRepositorySessionCreationDelegate extends MiddlewareRepository.SessionCreationDelegate {
- private Crypto5MiddlewareRepository repository;
- private RepositorySessionCreationDelegate outerDelegate;
+ private final Crypto5MiddlewareRepository repository;
+ private final RepositorySessionCreationDelegate outerDelegate;
public Crypto5MiddlewareRepositorySessionCreationDelegate(Crypto5MiddlewareRepository repository, RepositorySessionCreationDelegate outerDelegate) {
this.repository = repository;
this.outerDelegate = outerDelegate;
}
public void onSessionCreateFailed(Exception ex) {
this.outerDelegate.onSessionCreateFailed(ex);
}
@@ -48,17 +48,17 @@ public class Crypto5MiddlewareRepository
this.outerDelegate.onSessionCreateFailed(ex);
return;
}
this.outerDelegate.onSessionCreated(cryptoSession);
}
}
public KeyBundle keyBundle;
- private Repository inner;
+ private final Repository inner;
public Crypto5MiddlewareRepository(Repository inner, KeyBundle keys) {
super();
this.inner = inner;
this.keyBundle = keys;
}
@Override
public void createSession(RepositorySessionCreationDelegate delegate, Context context) {
--- a/mobile/android/base/sync/middleware/Crypto5MiddlewareRepositorySession.java
+++ b/mobile/android/base/sync/middleware/Crypto5MiddlewareRepositorySession.java
@@ -53,29 +53,29 @@ import org.mozilla.gecko.sync.repositori
| Local RepositorySession instance |
+------------------------------------+
* @author rnewman
*
*/
public class Crypto5MiddlewareRepositorySession extends MiddlewareRepositorySession {
- private KeyBundle keyBundle;
- private RecordFactory recordFactory;
+ private final KeyBundle keyBundle;
+ private final RecordFactory recordFactory;
public Crypto5MiddlewareRepositorySession(RepositorySession session, Crypto5MiddlewareRepository repository, RecordFactory recordFactory) {
super(session, repository);
this.keyBundle = repository.keyBundle;
this.recordFactory = recordFactory;
}
public class DecryptingTransformingFetchDelegate implements RepositorySessionFetchRecordsDelegate {
- private RepositorySessionFetchRecordsDelegate next;
- private KeyBundle keyBundle;
- private RecordFactory recordFactory;
+ private final RepositorySessionFetchRecordsDelegate next;
+ private final KeyBundle keyBundle;
+ private final RecordFactory recordFactory;
DecryptingTransformingFetchDelegate(RepositorySessionFetchRecordsDelegate next, KeyBundle bundle, RecordFactory recordFactory) {
this.next = next;
this.keyBundle = bundle;
this.recordFactory = recordFactory;
}
@Override
--- a/mobile/android/base/sync/middleware/MiddlewareRepositorySession.java
+++ b/mobile/android/base/sync/middleware/MiddlewareRepositorySession.java
@@ -27,18 +27,18 @@ public abstract class MiddlewareReposito
@Override
public void wipe(RepositorySessionWipeDelegate delegate) {
inner.wipe(delegate);
}
public class MiddlewareRepositorySessionBeginDelegate implements RepositorySessionBeginDelegate {
- private MiddlewareRepositorySession outerSession;
- private RepositorySessionBeginDelegate next;
+ private final MiddlewareRepositorySession outerSession;
+ private final RepositorySessionBeginDelegate next;
public MiddlewareRepositorySessionBeginDelegate(MiddlewareRepositorySession outerSession, RepositorySessionBeginDelegate next) {
this.outerSession = outerSession;
this.next = next;
}
@Override
public void onBeginFailed(Exception ex) {
--- a/mobile/android/base/sync/net/BaseResource.java
+++ b/mobile/android/base/sync/net/BaseResource.java
@@ -179,17 +179,17 @@ public class BaseResource implements Res
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
final String userAgent = delegate.getUserAgent();
if (userAgent != null) {
HttpProtocolParams.setUserAgent(params, userAgent);
}
delegate.addHeaders(request, client);
}
- private static Object connManagerMonitor = new Object();
+ private static final Object connManagerMonitor = new Object();
private static ClientConnectionManager connManager;
// Call within a synchronized block on connManagerMonitor.
private static ClientConnectionManager enableTLSConnectionManager() throws KeyManagementException, NoSuchAlgorithmException {
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, null, new SecureRandom());
SSLSocketFactory sf = new TLSSocketFactory(sslContext);
SchemeRegistry schemeRegistry = new SchemeRegistry();
--- a/mobile/android/base/sync/repositories/HashSetStoreTracker.java
+++ b/mobile/android/base/sync/repositories/HashSetStoreTracker.java
@@ -10,17 +10,17 @@ import java.util.Iterator;
import org.mozilla.gecko.sync.repositories.domain.Record;
public class HashSetStoreTracker implements StoreTracker {
// Guarded by `this`.
// Used to store GUIDs that were not locally modified but
// have been modified by a call to `store`, and thus
// should not be returned by a subsequent fetch.
- private HashSet<String> guids;
+ private final HashSet<String> guids;
public HashSetStoreTracker() {
guids = new HashSet<String>();
}
@Override
public String toString() {
return "#<Tracker: " + guids.size() + " guids tracked.>";
--- a/mobile/android/base/sync/repositories/Server11RepositorySession.java
+++ b/mobile/android/base/sync/repositories/Server11RepositorySession.java
@@ -90,17 +90,17 @@ public class Server11RepositorySession e
normalizedTimestamp = System.currentTimeMillis();
}
return normalizedTimestamp;
}
/**
* Used to track outstanding requests, so that we can abort them as needed.
*/
- private Set<SyncStorageCollectionRequest> pending = Collections.synchronizedSet(new HashSet<SyncStorageCollectionRequest>());
+ private final Set<SyncStorageCollectionRequest> pending = Collections.synchronizedSet(new HashSet<SyncStorageCollectionRequest>());
@Override
public void abort() {
super.abort();
for (SyncStorageCollectionRequest request : pending) {
request.abort();
}
pending.clear();
@@ -110,17 +110,17 @@ public class Server11RepositorySession e
* Convert HTTP request delegate callbacks into fetch callbacks within the
* context of this RepositorySession.
*
* @author rnewman
*
*/
public class RequestFetchDelegateAdapter extends WBOCollectionRequestDelegate {
RepositorySessionFetchRecordsDelegate delegate;
- private DelayedWorkTracker workTracker = new DelayedWorkTracker();
+ private final DelayedWorkTracker workTracker = new DelayedWorkTracker();
// So that we can clean up.
private SyncStorageCollectionRequest request;
public void setRequest(SyncStorageCollectionRequest request) {
this.request = request;
}
private void removeRequestFromPending() {
@@ -422,19 +422,19 @@ public class Server11RepositorySession e
* store callbacks within the context of this RepositorySession.
*
* @author rnewman
*
*/
protected class RecordUploadRunnable implements Runnable, SyncStorageRequestDelegate {
public final String LOG_TAG = "RecordUploadRunnable";
- private ArrayList<byte[]> outgoing;
+ private final ArrayList<byte[]> outgoing;
private ArrayList<String> outgoingGuids;
- private long byteCount;
+ private final long byteCount;
public RecordUploadRunnable(RepositorySessionStoreDelegate storeDelegate,
ArrayList<byte[]> outgoing,
ArrayList<String> outgoingGuids,
long byteCount) {
Logger.debug(LOG_TAG, "Preparing record upload for " +
outgoing.size() + " records (" +
byteCount + " bytes).");
@@ -551,17 +551,17 @@ public class Server11RepositorySession e
outstream.write(recordSeparator);
outstream.write(outgoing.get(i));
}
outstream.write(recordsEnd);
}
}
public class ByteArraysEntity extends EntityTemplate {
- private long count;
+ private final long count;
public ByteArraysEntity(ArrayList<byte[]> arrays, long totalBytes) {
super(new ByteArraysContentProducer(arrays));
this.count = totalBytes;
this.setContentType("application/json");
// charset is set in BaseResource.
}
@Override
--- a/mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksDataAccessor.java
+++ b/mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksDataAccessor.java
@@ -82,17 +82,17 @@ public class AndroidBrowserBookmarksData
@Override
public void wipe() {
Uri uri = getUri();
Logger.info(LOG_TAG, "wiping (except for special guids): " + uri);
context.getContentResolver().delete(uri, EXCLUDE_SPECIAL_GUIDS_WHERE_CLAUSE, null);
}
- private String[] GUID_AND_ID = new String[] { BrowserContract.Bookmarks.GUID,
+ private final String[] GUID_AND_ID = new String[] { BrowserContract.Bookmarks.GUID,
BrowserContract.Bookmarks._ID };
protected Cursor getGuidsIDsForFolders() throws NullCursorException {
// Exclude items that we don't want to sync (pinned items, reading list,
// tags, the places root), in case they've ended up in the DB.
String where = BOOKMARK_IS_FOLDER + " AND " + GUID_SHOULD_TRACK;
return queryHelper.safeQuery(".getGuidsIDsForFolders", GUID_AND_ID, where, null, null);
}
--- a/mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
+++ b/mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
@@ -37,18 +37,18 @@ import android.net.Uri;
public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepositorySession
implements BookmarksInsertionManager.BookmarkInserter {
public static final int DEFAULT_DELETION_FLUSH_THRESHOLD = 50;
public static final int DEFAULT_INSERTION_FLUSH_THRESHOLD = 50;
// TODO: synchronization for these.
- private HashMap<String, Long> parentGuidToIDMap = new HashMap<String, Long>();
- private HashMap<Long, String> parentIDToGuidMap = new HashMap<Long, String>();
+ private final HashMap<String, Long> parentGuidToIDMap = new HashMap<String, Long>();
+ private final HashMap<Long, String> parentIDToGuidMap = new HashMap<Long, String>();
/**
* Some notes on reparenting/reordering.
*
* Fennec stores new items with a high-negative position, because it doesn't care.
* On the other hand, it also doesn't give us any help managing positions.
*
* We can process records and folders in any order, though we'll usually see folders
@@ -95,21 +95,21 @@ public class AndroidBrowserBookmarksRepo
* we're left with lonely records at the end.
*
* As we modify local folders, perhaps by moving children out of their purview, we
* must bump their modification time so as to cause them to be uploaded on the next
* stage of syncing. The same applies to simple reordering.
*/
// TODO: can we guarantee serial access to these?
- private HashMap<String, ArrayList<String>> missingParentToChildren = new HashMap<String, ArrayList<String>>();
- private HashMap<String, JSONArray> parentToChildArray = new HashMap<String, JSONArray>();
+ private final HashMap<String, ArrayList<String>> missingParentToChildren = new HashMap<String, ArrayList<String>>();
+ private final HashMap<String, JSONArray> parentToChildArray = new HashMap<String, JSONArray>();
private int needsReparenting = 0;
- private AndroidBrowserBookmarksDataAccessor dataAccessor;
+ private final AndroidBrowserBookmarksDataAccessor dataAccessor;
protected BookmarksDeletionManager deletionManager;
protected BookmarksInsertionManager insertionManager;
/**
* An array of known-special GUIDs.
*/
public static String[] SPECIAL_GUIDS = new String[] {
--- a/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataAccessor.java
+++ b/mobile/android/base/sync/repositories/android/AndroidBrowserHistoryDataAccessor.java
@@ -18,17 +18,17 @@ import org.mozilla.gecko.sync.repositori
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
public class AndroidBrowserHistoryDataAccessor extends
AndroidBrowserRepositoryDataAccessor {
- private AndroidBrowserHistoryDataExtender dataExtender;
+ private final AndroidBrowserHistoryDataExtender dataExtender;
public AndroidBrowserHistoryDataAccessor(Context context) {
super(context);
dataExtender = new AndroidBrowserHistoryDataExtender(context);
}
public AndroidBrowserHistoryDataExtender getHistoryDataExtender() {
return dataExtender;
--- a/mobile/android/base/sync/repositories/android/AndroidBrowserRepository.java
+++ b/mobile/android/base/sync/repositories/android/AndroidBrowserRepository.java
@@ -22,18 +22,18 @@ public abstract class AndroidBrowserRepo
public void clean(boolean success, RepositorySessionCleanDelegate delegate, Context context) {
// Only clean deleted records if success
if (success) {
new CleanThread(delegate, context).start();
}
}
class CleanThread extends Thread {
- private RepositorySessionCleanDelegate delegate;
- private Context context;
+ private final RepositorySessionCleanDelegate delegate;
+ private final Context context;
public CleanThread(RepositorySessionCleanDelegate delegate, Context context) {
if (context == null) {
throw new IllegalArgumentException("context is null");
}
this.delegate = delegate;
this.context = context;
}
@@ -51,18 +51,18 @@ public abstract class AndroidBrowserRepo
delegate.onCleaned(AndroidBrowserRepository.this);
}
}
protected abstract AndroidBrowserRepositoryDataAccessor getDataAccessor(Context context);
protected abstract void sessionCreator(RepositorySessionCreationDelegate delegate, Context context);
class CreateSessionThread extends Thread {
- private RepositorySessionCreationDelegate delegate;
- private Context context;
+ private final RepositorySessionCreationDelegate delegate;
+ private final Context context;
public CreateSessionThread(RepositorySessionCreationDelegate delegate, Context context) {
if (context == null) {
throw new IllegalArgumentException("context is null.");
}
this.delegate = delegate;
this.context = context;
}
--- a/mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java
+++ b/mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java
@@ -195,18 +195,18 @@ public abstract class AndroidBrowserRepo
@Override
public void guidsSince(long timestamp, RepositorySessionGuidsSinceDelegate delegate) {
GuidsSinceRunnable command = new GuidsSinceRunnable(timestamp, delegate);
delegateQueue.execute(command);
}
class GuidsSinceRunnable implements Runnable {
- private RepositorySessionGuidsSinceDelegate delegate;
- private long timestamp;
+ private final RepositorySessionGuidsSinceDelegate delegate;
+ private final long timestamp;
public GuidsSinceRunnable(long timestamp,
RepositorySessionGuidsSinceDelegate delegate) {
this.timestamp = timestamp;
this.delegate = delegate;
}
@Override
@@ -295,19 +295,19 @@ public abstract class AndroidBrowserRepo
} finally {
Logger.trace(LOG_TAG, "Closing cursor after fetch.");
cursor.close();
}
}
}
public class FetchRunnable extends FetchingRunnable {
- private String[] guids;
- private long end;
- private RecordFilter filter;
+ private final String[] guids;
+ private final long end;
+ private final RecordFilter filter;
public FetchRunnable(String[] guids,
long end,
RecordFilter filter,
RepositorySessionFetchRecordsDelegate delegate) {
super(delegate);
this.guids = guids;
this.end = end;
@@ -344,19 +344,19 @@ public abstract class AndroidBrowserRepo
}
Logger.debug(LOG_TAG, "Running fetchSince(" + timestamp + ").");
FetchSinceRunnable command = new FetchSinceRunnable(timestamp, now(), this.storeTracker.getFilter(), delegate);
delegateQueue.execute(command);
}
class FetchSinceRunnable extends FetchingRunnable {
- private long since;
- private long end;
- private RecordFilter filter;
+ private final long since;
+ private final long end;
+ private final RecordFilter filter;
public FetchSinceRunnable(long since,
long end,
RecordFilter filter,
RepositorySessionFetchRecordsDelegate delegate) {
super(delegate);
this.since = since;
this.end = end;
--- a/mobile/android/base/sync/repositories/android/FormHistoryRepositorySession.java
+++ b/mobile/android/base/sync/repositories/android/FormHistoryRepositorySession.java
@@ -39,18 +39,18 @@ public class FormHistoryRepositorySessio
StoreTrackingRepositorySession {
public static String LOG_TAG = "FormHistoryRepoSess";
/**
* Number of records to insert in one batch.
*/
public static final int INSERT_ITEM_THRESHOLD = 200;
- private static Uri FORM_HISTORY_CONTENT_URI = BrowserContractHelpers.FORM_HISTORY_CONTENT_URI;
- private static Uri DELETED_FORM_HISTORY_CONTENT_URI = BrowserContractHelpers.DELETED_FORM_HISTORY_CONTENT_URI;
+ private static final Uri FORM_HISTORY_CONTENT_URI = BrowserContractHelpers.FORM_HISTORY_CONTENT_URI;
+ private static final Uri DELETED_FORM_HISTORY_CONTENT_URI = BrowserContractHelpers.DELETED_FORM_HISTORY_CONTENT_URI;
public static class FormHistoryRepository extends Repository {
@Override
public void createSession(RepositorySessionCreationDelegate delegate,
Context context) {
try {
final FormHistoryRepositorySession session = new FormHistoryRepositorySession(this, context);
--- a/mobile/android/base/sync/repositories/android/PasswordsRepositorySession.java
+++ b/mobile/android/base/sync/repositories/android/PasswordsRepositorySession.java
@@ -44,21 +44,21 @@ public class PasswordsRepositorySession
Context context) {
PasswordsRepositorySession session = new PasswordsRepositorySession(PasswordsRepository.this, context);
final RepositorySessionCreationDelegate deferredCreationDelegate = delegate.deferredCreationDelegate();
deferredCreationDelegate.onSessionCreated(session);
}
}
private static final String LOG_TAG = "PasswordsRepoSession";
- private static String COLLECTION = "passwords";
+ private static final String COLLECTION = "passwords";
- private RepoUtils.QueryHelper passwordsHelper;
- private RepoUtils.QueryHelper deletedPasswordsHelper;
- private ContentProviderClient passwordsProvider;
+ private final RepoUtils.QueryHelper passwordsHelper;
+ private final RepoUtils.QueryHelper deletedPasswordsHelper;
+ private final ContentProviderClient passwordsProvider;
private final Context context;
public PasswordsRepositorySession(Repository repository, Context context) {
super(repository);
this.context = context;
this.passwordsHelper = new QueryHelper(context, BrowserContractHelpers.PASSWORDS_CONTENT_URI, LOG_TAG);
this.deletedPasswordsHelper = new QueryHelper(context, BrowserContractHelpers.DELETED_PASSWORDS_CONTENT_URI, LOG_TAG);
--- a/mobile/android/base/sync/repositories/delegates/DeferredRepositorySessionBeginDelegate.java
+++ b/mobile/android/base/sync/repositories/delegates/DeferredRepositorySessionBeginDelegate.java
@@ -4,18 +4,18 @@
package org.mozilla.gecko.sync.repositories.delegates;
import java.util.concurrent.ExecutorService;
import org.mozilla.gecko.sync.repositories.RepositorySession;
public class DeferredRepositorySessionBeginDelegate implements RepositorySessionBeginDelegate {
- private RepositorySessionBeginDelegate inner;
- private ExecutorService executor;
+ private final RepositorySessionBeginDelegate inner;
+ private final ExecutorService executor;
public DeferredRepositorySessionBeginDelegate(final RepositorySessionBeginDelegate inner, final ExecutorService executor) {
this.inner = inner;
this.executor = executor;
}
@Override
public void onBeginSucceeded(final RepositorySession session) {
executor.execute(new Runnable() {
--- a/mobile/android/base/sync/repositories/delegates/DeferredRepositorySessionFetchRecordsDelegate.java
+++ b/mobile/android/base/sync/repositories/delegates/DeferredRepositorySessionFetchRecordsDelegate.java
@@ -4,18 +4,18 @@
package org.mozilla.gecko.sync.repositories.delegates;
import java.util.concurrent.ExecutorService;
import org.mozilla.gecko.sync.repositories.domain.Record;
public class DeferredRepositorySessionFetchRecordsDelegate implements RepositorySessionFetchRecordsDelegate {
- private RepositorySessionFetchRecordsDelegate inner;
- private ExecutorService executor;
+ private final RepositorySessionFetchRecordsDelegate inner;
+ private final ExecutorService executor;
public DeferredRepositorySessionFetchRecordsDelegate(final RepositorySessionFetchRecordsDelegate inner, final ExecutorService executor) {
this.inner = inner;
this.executor = executor;
}
@Override
public void onFetchedRecord(final Record record) {
executor.execute(new Runnable() {
--- a/mobile/android/base/sync/setup/SyncAuthenticatorService.java
+++ b/mobile/android/base/sync/setup/SyncAuthenticatorService.java
@@ -128,17 +128,17 @@ public class SyncAuthenticatorService ex
result.putString(Constants.OPTION_SYNCKEY, syncKey);
// Password.
result.putString(AccountManager.KEY_AUTHTOKEN, password);
return result;
}
private static class SyncAccountAuthenticator extends AbstractAccountAuthenticator {
- private Context mContext;
+ private final Context mContext;
public SyncAccountAuthenticator(Context context) {
super(context);
mContext = context;
}
@Override
public Bundle addAccount(AccountAuthenticatorResponse response,
String accountType, String authTokenType, String[] requiredFeatures,
--- a/mobile/android/base/sync/setup/activities/ClientRecordArrayAdapter.java
+++ b/mobile/android/base/sync/setup/activities/ClientRecordArrayAdapter.java
@@ -19,17 +19,17 @@ import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
public class ClientRecordArrayAdapter extends ArrayAdapter<ClientRecord> {
public static final String LOG_TAG = "ClientRecArrayAdapter";
private boolean[] checkedItems;
- private SendTabActivity sendTabActivity;
+ private final SendTabActivity sendTabActivity;
public ClientRecordArrayAdapter(Context context,
int textViewResourceId) {
super(context, textViewResourceId, new ArrayList<ClientRecord>());
this.checkedItems = new boolean[0];
this.sendTabActivity = (SendTabActivity) context;
}
--- a/mobile/android/base/sync/setup/auth/AccountAuthenticator.java
+++ b/mobile/android/base/sync/setup/auth/AccountAuthenticator.java
@@ -10,17 +10,17 @@ import java.util.Queue;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.sync.ThreadPool;
import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.sync.setup.activities.AccountActivity;
public class AccountAuthenticator {
private final String LOG_TAG = "AccountAuthenticator";
- private AccountActivity activityCallback;
+ private final AccountActivity activityCallback;
private Queue<AuthenticatorStage> stages;
// Values for authentication.
public String password;
public String username;
public String authServer;
public String nodeServer;
--- a/mobile/android/base/sync/stage/FetchMetaGlobalStage.java
+++ b/mobile/android/base/sync/stage/FetchMetaGlobalStage.java
@@ -13,17 +13,17 @@ import org.mozilla.gecko.sync.delegates.
import org.mozilla.gecko.sync.net.SyncStorageResponse;
public class FetchMetaGlobalStage extends AbstractNonRepositorySyncStage {
private static final String LOG_TAG = "FetchMetaGlobalStage";
private static final String META_COLLECTION = "meta";
public class StageMetaGlobalDelegate implements MetaGlobalDelegate {
- private GlobalSession session;
+ private final GlobalSession session;
public StageMetaGlobalDelegate(GlobalSession session) {
this.session = session;
}
@Override
public void handleSuccess(MetaGlobal global, SyncStorageResponse response) {
Logger.trace(LOG_TAG, "Persisting fetched meta/global and last modified.");
PersistedMetaGlobal pmg = session.config.persistedMetaGlobal();
--- a/mobile/android/base/sync/stage/SafeConstrainedServer11Repository.java
+++ b/mobile/android/base/sync/stage/SafeConstrainedServer11Repository.java
@@ -26,17 +26,17 @@ import android.content.Context;
* You must pass an {@link InfoCounts} instance, which will be interrogated
* in the event of a first sync.
*
* "First sync" means that our sync timestamp is not greater than zero.
*/
public class SafeConstrainedServer11Repository extends ConstrainedServer11Repository {
// This can be lazily evaluated if we need it.
- private JSONRecordFetcher countFetcher;
+ private final JSONRecordFetcher countFetcher;
public SafeConstrainedServer11Repository(String collection,
String storageURL,
AuthHeaderProvider authHeaderProvider,
InfoCollections infoCollections,
long limit,
String sort,
JSONRecordFetcher countFetcher)
@@ -56,17 +56,17 @@ public class SafeConstrainedServer11Repo
public class CountCheckingServer11RepositorySession extends Server11RepositorySession {
private static final String LOG_TAG = "CountCheckingServer11RepositorySession";
/**
* The session will report no data available if this is a first sync
* and the server has more data available than this limit.
*/
- private long fetchLimit;
+ private final long fetchLimit;
public CountCheckingServer11RepositorySession(Repository repository, long fetchLimit) {
super(repository);
this.fetchLimit = fetchLimit;
}
@Override
public boolean shouldSkip() {
--- a/mobile/android/base/sync/synchronizer/ConcurrentRecordConsumer.java
+++ b/mobile/android/base/sync/synchronizer/ConcurrentRecordConsumer.java
@@ -24,17 +24,17 @@ class ConcurrentRecordConsumer extends R
*/
protected boolean allRecordsQueued = false;
private long counter = 0;
public ConcurrentRecordConsumer(RecordsConsumerDelegate delegate) {
this.delegate = delegate;
}
- private Object monitor = new Object();
+ private final Object monitor = new Object();
@Override
public void doNotify() {
synchronized (monitor) {
monitor.notify();
}
}
@Override
@@ -49,17 +49,17 @@ class ConcurrentRecordConsumer extends R
@Override
public void halt() {
synchronized (monitor) {
this.stopImmediately = true;
monitor.notify();
}
}
- private Object countMonitor = new Object();
+ private final Object countMonitor = new Object();
@Override
public void stored() {
Logger.trace(LOG_TAG, "Record stored. Notifying.");
synchronized (countMonitor) {
counter++;
}
}
--- a/mobile/android/base/sync/synchronizer/RecordsChannel.java
+++ b/mobile/android/base/sync/synchronizer/RecordsChannel.java
@@ -64,17 +64,17 @@ public class RecordsChannel implements
RepositorySessionFetchRecordsDelegate,
RepositorySessionStoreDelegate,
RecordsConsumerDelegate,
RepositorySessionBeginDelegate {
private static final String LOG_TAG = "RecordsChannel";
public RepositorySession source;
public RepositorySession sink;
- private RecordsChannelDelegate delegate;
+ private final RecordsChannelDelegate delegate;
private long fetchEnd = -1;
protected final AtomicInteger numFetched = new AtomicInteger();
protected final AtomicInteger numFetchFailed = new AtomicInteger();
protected final AtomicInteger numStored = new AtomicInteger();
protected final AtomicInteger numStoreFailed = new AtomicInteger();
public RecordsChannel(RepositorySession source, RepositorySession sink, RecordsChannelDelegate delegate) {
@@ -89,17 +89,17 @@ public class RecordsChannel implements
* When we tell it to stop, it'll stop. We do that when the fetch
* is completed.
* When it stops, we tell the sink that there are no more records,
* and wait for the sink to tell us that storing is done.
* Then we notify our delegate of completion.
*/
private RecordConsumer consumer;
private boolean waitingForQueueDone = false;
- private ConcurrentLinkedQueue<Record> toProcess = new ConcurrentLinkedQueue<Record>();
+ private final ConcurrentLinkedQueue<Record> toProcess = new ConcurrentLinkedQueue<Record>();
@Override
public ConcurrentLinkedQueue<Record> getQueue() {
return toProcess;
}
protected boolean isReady() {
return source.isActive() && sink.isActive();
--- a/mobile/android/base/sync/synchronizer/SerialRecordConsumer.java
+++ b/mobile/android/base/sync/synchronizer/SerialRecordConsumer.java
@@ -16,17 +16,17 @@ class SerialRecordConsumer extends Recor
private static final String LOG_TAG = "SerialRecordConsumer";
protected boolean stopEventually = false;
private volatile long counter = 0;
public SerialRecordConsumer(RecordsConsumerDelegate delegate) {
this.delegate = delegate;
}
- private Object monitor = new Object();
+ private final Object monitor = new Object();
@Override
public void doNotify() {
synchronized (monitor) {
monitor.notify();
}
}
@Override
@@ -43,17 +43,17 @@ class SerialRecordConsumer extends Recor
Logger.debug(LOG_TAG, "Halting.");
synchronized (monitor) {
this.stopEventually = true;
this.stopImmediately = true;
monitor.notify();
}
}
- private Object storeSerializer = new Object();
+ private final Object storeSerializer = new Object();
@Override
public void stored() {
Logger.debug(LOG_TAG, "Record stored. Notifying.");
synchronized (storeSerializer) {
Logger.debug(LOG_TAG, "stored() took storeSerializer.");
counter++;
storeSerializer.notify();
Logger.debug(LOG_TAG, "stored() dropped storeSerializer.");
--- a/mobile/android/base/tabs/PrivateTabsPanel.java
+++ b/mobile/android/base/tabs/PrivateTabsPanel.java
@@ -22,17 +22,17 @@ import android.widget.FrameLayout;
/**
* A container that wraps the private tabs {@link android.widget.AdapterView} and empty
* {@link android.view.View} to manage both of their visibility states by changing the visibility of
* this container as calling {@link android.widget.AdapterView#setVisibility} does not affect the
* empty View's visibility.
*/
class PrivateTabsPanel extends FrameLayout implements CloseAllPanelView {
private TabsPanel tabsPanel;
- private TabsLayout tabsLayout;
+ private final TabsLayout tabsLayout;
public PrivateTabsPanel(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.private_tabs_panel, this);
tabsLayout = (TabsLayout) findViewById(R.id.private_tabs_tray);
final View emptyView = findViewById(R.id.private_tabs_empty);
--- a/mobile/android/base/tabs/TabsGridLayout.java
+++ b/mobile/android/base/tabs/TabsGridLayout.java
@@ -28,22 +28,22 @@ import android.widget.Button;
* Expected to replace TabsListLayout once complete.
*/
class TabsGridLayout extends GridView
implements TabsLayout,
Tabs.OnTabsChangedListener {
private static final String LOGTAG = "Gecko" + TabsGridLayout.class.getSimpleName();
- private Context mContext;
+ private final Context mContext;
private TabsPanel mTabsPanel;
final private boolean mIsPrivate;
- private TabsLayoutAdapter mTabsAdapter;
+ private final TabsLayoutAdapter mTabsAdapter;
public TabsGridLayout(Context context, AttributeSet attrs) {
super(context, attrs, R.attr.tabGridLayoutViewStyle);
mContext = context;
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabsTray);
mIsPrivate = (a.getInt(R.styleable.TabsTray_tabs, 0x0) == 1);
a.recycle();
--- a/mobile/android/base/tabs/TabsLayoutAdapter.java
+++ b/mobile/android/base/tabs/TabsLayoutAdapter.java
@@ -15,19 +15,19 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.ArrayList;
// Adapter to bind tabs into a list
public class TabsLayoutAdapter extends BaseAdapter {
public static final String LOGTAG = "Gecko" + TabsLayoutAdapter.class.getSimpleName();
- private Context mContext;
+ private final Context mContext;
private ArrayList<Tab> mTabs;
- private LayoutInflater mInflater;
+ private final LayoutInflater mInflater;
public TabsLayoutAdapter (Context context) {
mContext = context;
mInflater = LayoutInflater.from(mContext);
}
final void setTabs (ArrayList<Tab> tabs) {
mTabs = tabs;
--- a/mobile/android/base/tabs/TabsListLayout.java
+++ b/mobile/android/base/tabs/TabsListLayout.java
@@ -31,28 +31,28 @@ import android.view.ViewGroup;
import android.view.ViewConfiguration;
import android.widget.Button;
class TabsListLayout extends TwoWayView
implements TabsLayout,
Tabs.OnTabsChangedListener {
private static final String LOGTAG = "Gecko" + TabsListLayout.class.getSimpleName();
- private Context mContext;
+ private final Context mContext;
private TabsPanel mTabsPanel;
final private boolean mIsPrivate;
- private TabsLayoutAdapter mTabsAdapter;
+ private final TabsLayoutAdapter mTabsAdapter;
- private List<View> mPendingClosedTabs;
+ private final List<View> mPendingClosedTabs;
private int mCloseAnimationCount;
private int mCloseAllAnimationCount;
- private TabSwipeGestureListener mSwipeListener;
+ private final TabSwipeGestureListener mSwipeListener;
// Time to animate non-flinged tabs of screen, in milliseconds
private static final int ANIMATION_DURATION = 250;
// Time between starting successive tab animations in closeAllTabs.
private static final int ANIMATION_CASCADE_DELAY = 75;
private int mOriginalSize;
@@ -82,17 +82,17 @@ class TabsListLayout extends TwoWayView
TabsLayoutItemView item = (TabsLayoutItemView) view;
item.setThumbnail(null);
item.setCloseVisibile(true);
}
});
}
private class TabsListLayoutAdapter extends TabsLayoutAdapter {
- private Button.OnClickListener mCloseOnClickListener;
+ private final Button.OnClickListener mCloseOnClickListener;
public TabsListLayoutAdapter (Context context) {
super(context);
mCloseOnClickListener = new Button.OnClickListener() {
@Override
public void onClick(View v) {
// The view here is the close button, which has a reference
// to the parent TabsLayoutItemView in it's tag, hence the getTag() call
@@ -404,20 +404,20 @@ class TabsListLayout extends TwoWayView
animator.start();
}
private class TabSwipeGestureListener implements View.OnTouchListener {
// same value the stock browser uses for after drag animation velocity in pixels/sec
// http://androidxref.com/4.0.4/xref/packages/apps/Browser/src/com/android/browser/NavTabScroller.java#61
private static final float MIN_VELOCITY = 750;
- private int mSwipeThreshold;
- private int mMinFlingVelocity;
+ private final int mSwipeThreshold;
+ private final int mMinFlingVelocity;
- private int mMaxFlingVelocity;
+ private final int mMaxFlingVelocity;
private VelocityTracker mVelocityTracker;
private int mListWidth = 1;
private int mListHeight = 1;
private View mSwipeView;
private Runnable mPendingCheckForTap;
--- a/mobile/android/base/tabs/TabsPanel.java
+++ b/mobile/android/base/tabs/TabsPanel.java
@@ -74,39 +74,39 @@ public class TabsPanel extends LinearLay
return new TabsListLayout(context, attrs);
}
}
public static interface TabsLayoutChangeListener {
public void onTabsLayoutChange(int width, int height);
}
- private Context mContext;
+ private final Context mContext;
private final GeckoApp mActivity;
private final LightweightTheme mTheme;
private RelativeLayout mHeader;
private PanelViewContainer mPanelsContainer;
private PanelView mPanel;
private PanelView mPanelNormal;
private PanelView mPanelPrivate;
private PanelView mPanelRemote;
private RelativeLayout mFooter;
private TabsLayoutChangeListener mLayoutChangeListener;
- private AppStateListener mAppStateListener;
+ private final AppStateListener mAppStateListener;
private IconTabWidget mTabWidget;
private static ImageButton mMenuButton;
private static ImageButton mAddTab;
private Panel mCurrentPanel;
private boolean mIsSideBar;
private boolean mVisible;
private boolean mHeaderVisible;
- private GeckoPopupMenu mPopupMenu;
+ private final GeckoPopupMenu mPopupMenu;
public TabsPanel(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mActivity = (GeckoApp) context;
mTheme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();
setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
--- a/mobile/android/base/tests/AboutHomeTest.java
+++ b/mobile/android/base/tests/AboutHomeTest.java
@@ -30,17 +30,17 @@ abstract class AboutHomeTest extends Pix
protected enum AboutHomeTabs {
RECENT_TABS,
HISTORY,
TOP_SITES,
BOOKMARKS,
READING_LIST
};
- private ArrayList<String> aboutHomeTabs = new ArrayList<String>() {{
+ private final ArrayList<String> aboutHomeTabs = new ArrayList<String>() {{
add("TOP_SITES");
add("BOOKMARKS");
add("READING_LIST");
}};
@Override
public void setUp() throws Exception {
--- a/mobile/android/base/tests/DatabaseHelper.java
+++ b/mobile/android/base/tests/DatabaseHelper.java
@@ -9,18 +9,18 @@ import org.mozilla.gecko.db.BrowserDB;
import android.app.Activity;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
class DatabaseHelper {
protected enum BrowserDataType {BOOKMARKS, HISTORY};
- private Activity mActivity;
- private Assert mAsserter;
+ private final Activity mActivity;
+ private final Assert mAsserter;
public DatabaseHelper(Activity activity, Assert asserter) {
mActivity = activity;
mAsserter = asserter;
}
/**
* This method can be used to check if an URL is present in the bookmarks database
*/
--- a/mobile/android/base/tests/SessionTest.java
+++ b/mobile/android/base/tests/SessionTest.java
@@ -40,18 +40,18 @@ public abstract class SessionTest extend
}
public T[] getItems() {
return mItems;
}
}
protected class PageInfo {
- private String url;
- private String title;
+ private final String url;
+ private final String title;
public PageInfo(String key) {
if (key.startsWith("about:")) {
url = key;
} else {
url = getPage(key);
}
title = key;
--- a/mobile/android/base/tests/testBookmark.java
+++ b/mobile/android/base/tests/testBookmark.java
@@ -1,14 +1,14 @@
package org.mozilla.gecko.tests;
public class testBookmark extends AboutHomeTest {
private static String BOOKMARK_URL;
- private static int WAIT_FOR_BOOKMARKED_TIMEOUT = 10000;
+ private static final int WAIT_FOR_BOOKMARKED_TIMEOUT = 10000;
public void testBookmark() {
BOOKMARK_URL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
runAboutHomeTest();
runMenuTest();
}
public void runMenuTest() {
--- a/mobile/android/base/tests/testNewTab.java
+++ b/mobile/android/base/tests/testNewTab.java
@@ -7,17 +7,17 @@ import android.app.Activity;
import android.view.View;
import com.jayway.android.robotium.solo.Condition;
/* A simple test that creates 2 new tabs and checks that the tab count increases. */
public class testNewTab extends BaseTest {
private Element tabCount = null;
private Element tabs = null;
- private Element closeTab = null;
+ private final Element closeTab = null;
private int tabCountInt = 0;
public void testNewTab() {
String url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String url2 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
blockForGeckoReady();
--- a/mobile/android/base/tests/testReadingListProvider.java
+++ b/mobile/android/base/tests/testReadingListProvider.java
@@ -46,17 +46,17 @@ public class testReadingListProvider ext
private boolean mContentProviderUpdateTested = false;
/**
* Factory function that makes new ReadingListProvider instances.
* <p>
* We want a fresh provider each test, so this should be invoked in
* <code>setUp</code> before each individual test.
*/
- private static Callable<ContentProvider> sProviderFactory = new Callable<ContentProvider>() {
+ private static final Callable<ContentProvider> sProviderFactory = new Callable<ContentProvider>() {
@Override
public ContentProvider call() {
return new ReadingListProvider();
}
};
@Override
public void setUp() throws Exception {
--- a/mobile/android/base/tests/testSearchHistoryProvider.java
+++ b/mobile/android/base/tests/testSearchHistoryProvider.java
@@ -78,17 +78,17 @@ public class testSearchHistoryProvider e
private static final String DB_NAME = "searchhistory.db";
/**
* Boilerplate alert.
* <p/>
* Make sure this method is present and that it returns a new
* instance of your class.
*/
- private static Callable<ContentProvider> sProviderFactory =
+ private static final Callable<ContentProvider> sProviderFactory =
new Callable<ContentProvider>() {
@Override
public ContentProvider call() {
return new SearchHistoryProvider();
}
};
@Override
--- a/mobile/android/base/tests/testThumbnails.java
+++ b/mobile/android/base/tests/testThumbnails.java
@@ -57,18 +57,18 @@ public class testThumbnails extends Base
// drop thumbnails
BrowserDB.removeThumbnails(resolver);
// check that the thumbnail is now null
thumbnailData = BrowserDB.getThumbnailForUrl(resolver, site1Url);
mAsserter.ok(thumbnailData == null || thumbnailData.length == 0, "Checking for thumbnail data", "Thumbnail data found");
}
private class ThumbnailTest implements BooleanTest {
- private String mTitle;
- private int mColor;
+ private final String mTitle;
+ private final int mColor;
public ThumbnailTest(String title, int color) {
mTitle = title;
mColor = color;
}
@Override
public boolean test() {
--- a/mobile/android/base/toolbar/PageActionLayout.java
+++ b/mobile/android/base/toolbar/PageActionLayout.java
@@ -298,22 +298,22 @@ public class PageActionLayout extends Li
}
private static interface OnPageActionClickListeners {
public void onClick(String id);
public boolean onLongClick(String id);
}
private static class PageAction {
- private OnPageActionClickListeners mOnPageActionClickListeners;
+ private final OnPageActionClickListeners mOnPageActionClickListeners;
private Drawable mDrawable;
- private String mTitle;
- private String mId;
- private int key;
- private boolean mImportant;
+ private final String mTitle;
+ private final String mId;
+ private final int key;
+ private final boolean mImportant;
public PageAction(String id,
String title,
Drawable image,
OnPageActionClickListeners onPageActionClickListeners,
boolean important) {
mId = id;
mTitle = title;
--- a/mobile/android/base/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/base/toolbar/ToolbarDisplayLayout.java
@@ -92,39 +92,39 @@ public class ToolbarDisplayLayout extend
}
private final BrowserApp mActivity;
private UIMode mUiMode;
private boolean mIsAttached;
- private ThemedTextView mTitle;
- private int mTitlePadding;
+ private final ThemedTextView mTitle;
+ private final int mTitlePadding;
private ToolbarPrefs mPrefs;
private OnTitleChangeListener mTitleChangeListener;
- private ImageButton mSiteSecurity;
+ private final ImageButton mSiteSecurity;
private boolean mSiteSecurityVisible;
// To de-bounce sets.
private Bitmap mLastFavicon;
- private ImageButton mFavicon;
+ private final ImageButton mFavicon;
private int mFaviconSize;
- private ImageButton mStop;
+ private final ImageButton mStop;
private OnStopListener mStopListener;
- private PageActionLayout mPageActionLayout;
+ private final PageActionLayout mPageActionLayout;
private AlphaAnimation mLockFadeIn;
private TranslateAnimation mTitleSlideLeft;
private TranslateAnimation mTitleSlideRight;
- private SiteIdentityPopup mSiteIdentityPopup;
+ private final SiteIdentityPopup mSiteIdentityPopup;
private SecurityMode mSecurityMode;
private PropertyAnimator mForwardAnim;
private final ForegroundColorSpan mUrlColor;
private final ForegroundColorSpan mBlockedColor;
private final ForegroundColorSpan mDomainColor;
private final ForegroundColorSpan mPrivateDomainColor;
--- a/mobile/android/base/util/ActivityResultHandlerMap.java
+++ b/mobile/android/base/util/ActivityResultHandlerMap.java
@@ -2,17 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.util;
import android.util.SparseArray;
public final class ActivityResultHandlerMap {
- private SparseArray<ActivityResultHandler> mMap = new SparseArray<ActivityResultHandler>();
+ private final SparseArray<ActivityResultHandler> mMap = new SparseArray<ActivityResultHandler>();
private int mCounter;
public synchronized int put(ActivityResultHandler handler) {
mMap.put(mCounter, handler);
return mCounter++;
}
public synchronized ActivityResultHandler getAndRemove(int i) {
--- a/mobile/android/base/util/INIParser.java
+++ b/mobile/android/base/util/INIParser.java
@@ -11,17 +11,17 @@ import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
public final class INIParser extends INISection {
// default file to read and write to
- private File mFile;
+ private final File mFile;
// List of sections in the current iniFile. null if the file has not been parsed yet
private Hashtable<String, INISection> mSections;
// create a parser. The file will not be read until you attempt to
// access sections or properties inside it. At that point its read synchronously
public INIParser(File iniFile) {
super("");
--- a/mobile/android/base/util/NativeJSContainer.java
+++ b/mobile/android/base/util/NativeJSContainer.java
@@ -13,17 +13,17 @@ import org.mozilla.gecko.mozglue.JNITarg
*
* A container must only be used on the thread it is attached to. To use it on another
* thread, call {@link #clone()} to make a copy, and use the copy on the other thread.
* When a copy is first used, it becomes attached to the thread using it.
*/
@JNITarget
public final class NativeJSContainer extends NativeJSObject
{
- private long mNativeObject;
+ private final long mNativeObject;
private NativeJSContainer(long nativeObject) {
mNativeObject = nativeObject;
}
/**
* Make a copy of this container for use by another thread. When the copy is first used,
* it becomes attached to the thread using it.
--- a/mobile/android/base/util/UIAsyncTask.java
+++ b/mobile/android/base/util/UIAsyncTask.java
@@ -67,17 +67,17 @@ public abstract class UIAsyncTask<Param,
if (sHandler == null) {
sHandler = new Handler(Looper.getMainLooper());
}
return sHandler;
}
private final class BackgroundTaskRunnable implements Runnable {
- private Param mParam;
+ private final Param mParam;
public BackgroundTaskRunnable(Param param) {
mParam = param;
}
@Override
public void run() {
final Result result = doInBackground(mParam);
--- a/mobile/android/base/webapp/InstallListener.java
+++ b/mobile/android/base/webapp/InstallListener.java
@@ -17,21 +17,21 @@ import android.content.BroadcastReceiver
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.text.TextUtils;
import android.util.Log;
public class InstallListener extends BroadcastReceiver {
- private static String LOGTAG = "GeckoWebappInstallListener";
- private JSONObject mData;
- private String mManifestUrl;
+ private static final String LOGTAG = "GeckoWebappInstallListener";
+ private final JSONObject mData;
+ private final String mManifestUrl;
private boolean mReceived;
- private File mApkFile;
+ private final File mApkFile;
public InstallListener(String manifestUrl, JSONObject data, File apkFile) {
mData = data;
mApkFile = apkFile;
mManifestUrl = manifestUrl;
Assert.isNotNull(mManifestUrl);
Assert.isTrue(mApkFile != null && mApkFile.exists());
}
--- a/mobile/android/base/webapp/UninstallListener.java
+++ b/mobile/android/base/webapp/UninstallListener.java
@@ -29,17 +29,17 @@ import android.content.pm.PackageManager
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.ArrayList;
public class UninstallListener extends BroadcastReceiver {
- private static String LOGTAG = "GeckoWebappUninstallListener";
+ private static final String LOGTAG = "GeckoWebappUninstallListener";
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
Log.i(LOGTAG, "Package is being replaced; ignoring removal intent");
return;
}
@@ -131,17 +131,17 @@ public class UninstallListener extends B
}
if (uninstalledPackages.size() > 0) {
doUninstall(context, uninstalledPackages);
}
}
public static class DelayedStartupTask implements Runnable {
- private GeckoApp mApp;
+ private final GeckoApp mApp;
public DelayedStartupTask(GeckoApp app) {
mApp = app;
}
@Override
public void run() {
ThreadUtils.assertOnBackgroundThread();
--- a/mobile/android/base/widget/ArrowPopup.java
+++ b/mobile/android/base/widget/ArrowPopup.java
@@ -23,17 +23,17 @@ import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
public abstract class ArrowPopup extends PopupWindow {
View mAnchor;
ImageView mArrow;
int mArrowWidth;
- private int mYOffset;
+ private final int mYOffset;
protected LinearLayout mContent;
protected boolean mInflated;
protected final Context mContext;
public ArrowPopup(Context context) {
super(context);
--- a/mobile/android/base/widget/ButtonToast.java
+++ b/mobile/android/base/widget/ButtonToast.java
@@ -160,15 +160,15 @@ public class ButtonToast {
mView.setVisibility(View.GONE);
}
public void onPropertyAnimationStart() { }
});
animator.start();
}
}
- private Runnable mHideRunnable = new Runnable() {
+ private final Runnable mHideRunnable = new Runnable() {
@Override
public void run() {
hide(false, ReasonHidden.TIMEOUT);
}
};
}
--- a/mobile/android/base/widget/DateTimePicker.java
+++ b/mobile/android/base/widget/DateTimePicker.java
@@ -53,19 +53,19 @@ public class DateTimePicker extends Fram
boolean mWeekEnabled;
boolean mDayEnabled = true;
boolean mHourEnabled = true;
boolean mMinuteEnabled = true;
boolean mIs12HourMode;
private boolean mCalendarEnabled;
// Size of the screen in inches;
- private int mScreenWidth;
- private int mScreenHeight;
- private OnValueChangeListener mOnChangeListener;
+ private final int mScreenWidth;
+ private final int mScreenHeight;
+ private final OnValueChangeListener mOnChangeListener;
private final LinearLayout mPickers;
private final LinearLayout mDateSpinners;
private final LinearLayout mTimeSpinners;
final NumberPicker mDaySpinner;
final NumberPicker mMonthSpinner;
final NumberPicker mWeekSpinner;
final NumberPicker mYearSpinner;
@@ -84,17 +84,17 @@ public class DateTimePicker extends Fram
private String[] mShortMonths;
private String[] mShortAMPMs;
private int mNumberOfMonths;
Calendar mTempDate;
Calendar mCurrentDate;
private Calendar mMinDate;
private Calendar mMaxDate;
- private PickersState mState;
+ private final PickersState mState;
public static enum PickersState { DATE, MONTH, WEEK, TIME, DATETIME };
public class OnValueChangeListener implements NumberPicker.OnValueChangeListener {
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
updateInputState();
mTempDate.setTimeInMillis(mCurrentDate.getTimeInMillis());
--- a/mobile/android/base/widget/Divider.java
+++ b/mobile/android/base/widget/Divider.java
@@ -11,17 +11,17 @@ import android.widget.LinearLayout.Layou
public class Divider extends View {
public static enum Orientation { HORIZONTAL, VERTICAL };
// Orientation of the divider.
private Orientation mOrientation;
// Density of the device.
- private int mDensity;
+ private final int mDensity;
public Divider(Context context, AttributeSet attrs) {
super(context, attrs);
mDensity = (int) context.getResources().getDisplayMetrics().density;
setOrientation(Orientation.HORIZONTAL);
}
--- a/mobile/android/base/widget/DoorHanger.java
+++ b/mobile/android/base/widget/DoorHanger.java
@@ -37,17 +37,17 @@ import java.util.List;
public class DoorHanger extends LinearLayout {
private static final String LOGTAG = "GeckoDoorHanger";
private static int sInputPadding = -1;
private static int sSpinnerTextColor = -1;
private static int sSpinnerTextSize = -1;
- private static LayoutParams sButtonParams;
+ private static final LayoutParams sButtonParams;
static {
sButtonParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f);
}
private final TextView mTextView;
private final ImageView mIcon;
private final LinearLayout mChoicesLayout;
@@ -55,17 +55,17 @@ public class DoorHanger extends LinearLa
private final View mDivider;
// The tab associated with this notification.
private final int mTabId;
// Value used to identify the notification.
private final String mValue;
- private Resources mResources;
+ private final Resources mResources;
private List<PromptInput> mInputs;
private CheckBox mCheckBox;
private int mPersistence;
private boolean mPersistWhileVisible;
private long mTimeout;
--- a/mobile/android/base/widget/EllipsisTextView.java
+++ b/mobile/android/base/widget/EllipsisTextView.java
@@ -13,17 +13,17 @@ import android.util.AttributeSet;
import android.widget.TextView;
/**
* Text view that correctly handles maxLines and ellipsizing for Android < 2.3.
*/
public class EllipsisTextView extends TextView {
private final String ellipsis;
- private int maxLines;
+ private final int maxLines;
private CharSequence originalText;
public EllipsisTextView(Context context) {
this(context, null);
}
public EllipsisTextView(Context context, AttributeSet attrs) {
this(context, attrs, android.R.attr.textViewStyle);
--- a/mobile/android/base/widget/FaviconView.java
+++ b/mobile/android/base/widget/FaviconView.java
@@ -40,20 +40,20 @@ public class FaviconView extends ImageVi
// Dominant color of the favicon.
private int mDominantColor;
// Stroke width for the border.
private static float sStrokeWidth;
// Paint for drawing the stroke.
- private static Paint sStrokePaint;
+ private static final Paint sStrokePaint;
// Paint for drawing the background.
- private static Paint sBackgroundPaint;
+ private static final Paint sBackgroundPaint;
// Size of the stroke rectangle.
private final RectF mStrokeRect;
// Size of the background rectangle.
private final RectF mBackgroundRect;
// Initializing the static paints.
--- a/mobile/android/base/widget/GeckoActionProvider.java
+++ b/mobile/android/base/widget/GeckoActionProvider.java
@@ -22,17 +22,17 @@ import android.view.SubMenu;
import android.view.View;
import android.view.View.OnClickListener;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.HashMap;
public class GeckoActionProvider {
- private static int MAX_HISTORY_SIZE = 2;
+ private static final int MAX_HISTORY_SIZE = 2;
/**
* A listener to know when a target was selected.
* When setting a provider, the activity can listen to this,
* to close the menu.
*/
public interface OnTargetSelectedListener {
public void onTargetSelected();
@@ -46,17 +46,17 @@ public class GeckoActionProvider {
// History file.
String mHistoryFileName = DEFAULT_HISTORY_FILE_NAME;
OnTargetSelectedListener mOnTargetListener;
private final Callbacks mCallbacks = new Callbacks();
- private static HashMap<String, GeckoActionProvider> mProviders = new HashMap<String, GeckoActionProvider>();
+ private static final HashMap<String, GeckoActionProvider> mProviders = new HashMap<String, GeckoActionProvider>();
private static String getFilenameFromMimeType(String mimeType) {
String[] mime = mimeType.split("/");
// All text mimetypes use the default provider
if ("text".equals(mime[0])) {
return DEFAULT_HISTORY_FILE_NAME;
}
--- a/mobile/android/base/widget/GeckoSwipeRefreshLayout.java
+++ b/mobile/android/base/widget/GeckoSwipeRefreshLayout.java
@@ -69,20 +69,20 @@ public class GeckoSwipeRefreshLayout ext
int mFrom;
int mMediumAnimationDuration;
float mFromPercentage;
float mCurrPercentage;
int mCurrentTargetOffsetTop;
private OnRefreshListener mListener;
private MotionEvent mDownEvent;
private boolean mRefreshing;
- private int mTouchSlop;
+ private final int mTouchSlop;
private float mDistanceToTriggerSync = -1;
private float mPrevY;
- private int mProgressBarHeight;
+ private final int mProgressBarHeight;
// Target is returning to its start offset because it was cancelled or a
// refresh was triggered.
boolean mReturningToStart;
final DecelerateInterpolator mDecelerateInterpolator;
private final AccelerateInterpolator mAccelerateInterpolator;
private static final int[] LAYOUT_ATTRS = new int[] {
android.R.attr.enabled
@@ -522,19 +522,19 @@ public class GeckoSwipeRefreshLayout ext
private long mFinishTime;
private boolean mRunning;
// Colors used when rendering the animation,
private int mColor1;
private int mColor2;
private int mColor3;
private int mColor4;
- private View mParent;
+ private final View mParent;
- private Rect mBounds = new Rect();
+ private final Rect mBounds = new Rect();
public SwipeProgressBar(View parent) {
mParent = parent;
mColor1 = COLOR1;
mColor2 = COLOR2;
mColor3 = COLOR3;
mColor4 = COLOR4;
}
--- a/mobile/android/base/widget/GeckoViewFlipper.java
+++ b/mobile/android/base/widget/GeckoViewFlipper.java
@@ -13,17 +13,17 @@ import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ViewFlipper;
/* This extends the normal ViewFlipper only to fix bug 956075 on < 3.0 devices.
* i.e. It ignores touch events on the ViewFlipper when its hidden. */
public class GeckoViewFlipper extends ViewFlipper {
- private Rect mRect = new Rect();
+ private final Rect mRect = new Rect();
public GeckoViewFlipper(Context context) {
super(context);
}
public GeckoViewFlipper(Context context, AttributeSet attrs) {
super(context, attrs);
}
--- a/mobile/android/base/widget/SwipeDismissListViewTouchListener.java
+++ b/mobile/android/base/widget/SwipeDismissListViewTouchListener.java
@@ -71,24 +71,24 @@ import org.mozilla.gecko.R;
*
* <p>For a generalized {@link android.view.View.OnTouchListener} that makes any view dismissable,
* see {@link SwipeDismissTouchListener}.</p>
*
* @see SwipeDismissTouchListener
*/
public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
// Cached ViewConfiguration and system-wide constant values
- private int mSlop;
- private int mMinFlingVelocity;
- private int mMaxFlingVelocity;
- private long mAnimationTime;
+ private final int mSlop;
+ private final int mMinFlingVelocity;
+ private final int mMaxFlingVelocity;
+ private final long mAnimationTime;
// Fixed properties
- private ListView mListView;
- private OnDismissCallback mCallback;
+ private final ListView mListView;
+ private final OnDismissCallback mCallback;
private int mViewWidth = 1; // 1 and not 0 to prevent dividing by zero
// Transient properties
private float mDownX;
private boolean mSwiping;
private VelocityTracker mVelocityTracker;
private int mDownPosition;
private View mDownView;
--- a/mobile/android/search/java/org/mozilla/search/providers/SearchEngine.java
+++ b/mobile/android/search/java/org/mozilla/search/providers/SearchEngine.java
@@ -47,17 +47,17 @@ public class SearchEngine {
// head of a web page. The actual CSS is inserted at `%s`.
private static final String STYLE_INJECTION_SCRIPT =
"javascript:(function(){" +
"var tag=document.createElement('style');" +
"tag.type='text/css';" +
"document.getElementsByTagName('head')[0].appendChild(tag);" +
"tag.innerText='%s'})();";
- private String identifier;
+ private final String identifier;
private String shortName;
private String iconURL;
// Ordered list of preferred results URIs.
private final List<Uri> resultsUris = new ArrayList<Uri>();
private Uri suggestUri;
/**
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/datahandling/DataStorageManager.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/datahandling/DataStorageManager.java
@@ -62,17 +62,17 @@ public class DataStorageManager {
private final File mReportsDir;
private final File mStatsFile;
private final StorageIsEmptyTracker mTracker;
private static DataStorageManager sInstance;
private ReportBatch mCurrentReportsSendBuffer;
private ReportBatchIterator mReportBatchIterator;
- private ReportFileList mFileList;
+ private final ReportFileList mFileList;
private Timer mFlushMemoryBuffersToDiskTimer;
static final String SEP_REPORT_COUNT = "-r";
static final String SEP_WIFI_COUNT = "-w";
static final String SEP_CELL_COUNT = "-c";
static final String SEP_TIME_MS = "-t";
static final String FILENAME_PREFIX = "reports";
static final String MEMORY_BUFFER_NAME = "in memory send buffer";
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/WifiScanner.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/WifiScanner.java
@@ -43,17 +43,17 @@ public class WifiScanner extends Broadca
private static final String LOG_TAG = AppGlobals.LOG_PREFIX + WifiScanner.class.getSimpleName();
private static final long WIFI_MIN_UPDATE_TIME = 5000; // milliseconds
private boolean mStarted;
private final Context mContext;
private WifiLock mWifiLock;
private Timer mWifiScanTimer;
private final Set<String> mAPs = Collections.synchronizedSet(new HashSet<String>());
- private AtomicInteger mVisibleAPs = new AtomicInteger();
+ private final AtomicInteger mVisibleAPs = new AtomicInteger();
/* Testing */
public static boolean sIsTestMode;
public List<ScanResult> mTestModeFakeScanResults = new ArrayList<ScanResult>();
public Set<String> getAccessPoints(android.test.AndroidTestCase restrictedAccessor) { return mAPs; }
/* ------- */
public WifiScanner(Context c) {
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/uploadthread/AsyncUploader.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/uploadthread/AsyncUploader.java
@@ -23,17 +23,17 @@ import org.mozilla.mozstumbler.service.u
* Uploads on a separate thread. ONLY DataStorageManager is thread-safe, do not call
* preferences, do not call any code that isn't thread-safe. You will cause suffering.
* An exception is made for AppGlobals.isDebug, a false reading is of no consequence. */
public class AsyncUploader extends AsyncTask<Void, Void, SyncSummary> {
private static final String LOG_TAG = AppGlobals.LOG_PREFIX + AsyncUploader.class.getSimpleName();
private final UploadSettings mSettings;
private final Object mListenerLock = new Object();
private AsyncUploaderListener mListener;
- private static AtomicBoolean sIsUploading = new AtomicBoolean();
+ private static final AtomicBoolean sIsUploading = new AtomicBoolean();
private String mNickname;
public interface AsyncUploaderListener {
public void onUploadComplete(SyncSummary result);
public void onUploadProgress();
}
public static class UploadSettings {
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/PersistentIntentService.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/PersistentIntentService.java
@@ -23,17 +23,17 @@ import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
/* This code is copied from android IntentService, with stopSelf commented out. */
public abstract class PersistentIntentService extends Service {
private volatile Looper mServiceLooper;
private volatile ServiceHandler mServiceHandler;
- private String mName;
+ private final String mName;
private boolean mRedelivery;
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override