Bug 1419268: Make some static fields final r=nalexander

This allows compile-time initialization instead of runtime in clinit.
This commit is contained in:
Andrew Gaul 2017-11-20 21:01:10 -08:00
Родитель 516bcd71a7
Коммит ea51a3fcd3
15 изменённых файлов: 24 добавлений и 21 удалений

Просмотреть файл

@ -60,11 +60,11 @@ public final class IntentHelper implements BundleEventListener {
};
// via http://developer.android.com/distribute/tools/promote/linking.html
private static String MARKET_INTENT_URI_PACKAGE_PREFIX = "market://details?id=";
private static String EXTRA_BROWSER_FALLBACK_URL = "browser_fallback_url";
private static final String MARKET_INTENT_URI_PACKAGE_PREFIX = "market://details?id=";
private static final String EXTRA_BROWSER_FALLBACK_URL = "browser_fallback_url";
/** A partial URI to an error page - the encoded error URI should be appended before loading. */
private static String UNKNOWN_PROTOCOL_URI_PREFIX = "about:neterror?e=unknownProtocolFound&u=";
private static final String UNKNOWN_PROTOCOL_URI_PREFIX = "about:neterror?e=unknownProtocolFound&u=";
private static IntentHelper instance;

Просмотреть файл

@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit;
*/
public class PocketStoriesLoader extends AsyncTaskLoader<List<TopStory>> {
public static String LOGTAG = "PocketStoriesLoader";
public static final String LOGTAG = "PocketStoriesLoader";
public static final String POCKET_REFERRER_URI = "https://getpocket.com/recommendations";

Просмотреть файл

@ -106,8 +106,8 @@ public class DBUtils {
}
}
private static String HISTOGRAM_DATABASE_LOCKED = "DATABASE_LOCKED_EXCEPTION";
private static String HISTOGRAM_DATABASE_UNLOCKED = "DATABASE_SUCCESSFUL_UNLOCK";
private static final String HISTOGRAM_DATABASE_LOCKED = "DATABASE_LOCKED_EXCEPTION";
private static final String HISTOGRAM_DATABASE_UNLOCKED = "DATABASE_SUCCESSFUL_UNLOCK";
public static void ensureDatabaseIsNotLocked(SQLiteOpenHelper dbHelper, String databasePath) {
final int maxAttempts = 5;
int attempt = 0;

Просмотреть файл

@ -25,7 +25,7 @@ import static org.mozilla.gecko.home.CombinedHistoryPanel.OnPanelLevelChangeList
public class CombinedHistoryRecyclerView extends RecyclerView
implements RecyclerViewClickSupport.OnItemClickListener, RecyclerViewClickSupport.OnItemLongClickListener {
public static String LOGTAG = "CombinedHistoryRecycView";
public static final String LOGTAG = "CombinedHistoryRecycView";
protected interface AdapterContextMenuBuilder {
HomeContextMenuInfo makeContextMenuInfoFromPosition(View view, int position);

Просмотреть файл

@ -65,7 +65,7 @@ public class MmaDelegate {
public static final String KEY_ANDROID_PREF_STRING_LEANPLUM_DEVICE_ID = "android.not_a_preference.leanplum.device_id";
private static final String DEBUG_LEANPLUM_DEVICE_ID = "8effda84-99df-11e7-abc4-cec278b6b50a";
private static MmaInterface mmaHelper = MmaConstants.getMma();
private static final MmaInterface mmaHelper = MmaConstants.getMma();
private static WeakReference<Context> applicationContext;
public static void init(Activity activity) {

Просмотреть файл

@ -14,7 +14,7 @@ import java.util.List;
* RestrictionConfiguration implementation for guest profiles.
*/
public class GuestProfileConfiguration implements RestrictionConfiguration {
static List<Restrictable> DISABLED_FEATURES = Arrays.asList(
static final List<Restrictable> DISABLED_FEATURES = Arrays.asList(
Restrictable.DOWNLOAD,
Restrictable.INSTALL_EXTENSION,
Restrictable.INSTALL_APPS,

Просмотреть файл

@ -25,7 +25,7 @@ import java.util.Map;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public class RestrictedProfileConfiguration implements RestrictionConfiguration {
// Mapping from restrictable feature to default state (on/off)
private static Map<Restrictable, Boolean> configuration = new LinkedHashMap<>();
private static final Map<Restrictable, Boolean> configuration = new LinkedHashMap<>();
static {
configuration.put(Restrictable.INSTALL_EXTENSION, false);
configuration.put(Restrictable.PRIVATE_BROWSING, false);
@ -44,7 +44,7 @@ public class RestrictedProfileConfiguration implements RestrictionConfiguration
/**
* These restrictions are hidden from the admin configuration UI.
*/
private static List<Restrictable> hiddenRestrictions = new ArrayList<>();
private static final List<Restrictable> hiddenRestrictions = new ArrayList<>();
static {
hiddenRestrictions.add(Restrictable.MASTER_PASSWORD);
hiddenRestrictions.add(Restrictable.GUEST_BROWSING);

Просмотреть файл

@ -8,8 +8,8 @@ import android.widget.RelativeLayout;
public class SplashScreen extends RelativeLayout {
private static long MIN_DISPLAY_TIME = 0;
private static long MAX_DISPLAY_TIME = 2000;
private static final long MIN_DISPLAY_TIME = 0;
private static final long MAX_DISPLAY_TIME = 2000;
private boolean hasReachedThreshold = false;
private boolean shouldHideAsap = false;

Просмотреть файл

@ -19,7 +19,7 @@ import org.mozilla.gecko.annotation.WrapForJNI;
public final class GeckoSurface extends Surface {
private static final String LOGTAG = "GeckoSurface";
private static HashMap<Integer, GeckoSurfaceTexture> sSurfaceTextures = new HashMap<Integer, GeckoSurfaceTexture>();
private static final HashMap<Integer, GeckoSurfaceTexture> sSurfaceTextures = new HashMap<Integer, GeckoSurfaceTexture>();
private int mHandle;
private boolean mIsSingleBuffer;

Просмотреть файл

@ -18,7 +18,7 @@ import org.mozilla.gecko.annotation.WrapForJNI;
public final class GeckoSurfaceTexture extends SurfaceTexture {
private static final String LOGTAG = "GeckoSurfaceTexture";
private static volatile int sNextHandle = 1;
private static HashMap<Integer, GeckoSurfaceTexture> sSurfaceTextures = new HashMap<Integer, GeckoSurfaceTexture>();
private static final HashMap<Integer, GeckoSurfaceTexture> sSurfaceTextures = new HashMap<Integer, GeckoSurfaceTexture>();
private static HashMap<Long, LinkedList<GeckoSurfaceTexture>> sUnusedTextures =

Просмотреть файл

@ -14,7 +14,7 @@ import android.util.Log;
public class SurfaceAllocatorService extends Service {
static private String LOGTAG = "SurfaceAllocatorService";
private static final String LOGTAG = "SurfaceAllocatorService";
public int onStartCommand(final Intent intent, final int flags, final int startId) {
return Service.START_STICKY;

Просмотреть файл

@ -50,7 +50,7 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
private static final int MAX_TIMELINE_ITEM_LINES = 3;
private static final boolean DEBUG = BuildConfig.NIGHTLY_BUILD || BuildConfig.DEBUG_BUILD;
private static AtomicInteger sPlayerId = new AtomicInteger(0);
private static final AtomicInteger sPlayerId = new AtomicInteger(0);
/*
* Because we treat GeckoHlsPlayer as a source data provider.
* It will be created and initialized with a URL by HLSResource in

Просмотреть файл

@ -28,7 +28,7 @@ final class RemoteMediaDrmBridgeStub extends IMediaDrmBridge.Stub implements IBi
// from MediaDrmProxy -> MediaDrmCDMProxy -> RemoteDataDecoder => IPC => Codec.
private String mStubId = "";
public static ArrayList<RemoteMediaDrmBridgeStub> mBridgeStubs =
public static final ArrayList<RemoteMediaDrmBridgeStub> mBridgeStubs =
new ArrayList<RemoteMediaDrmBridgeStub>();
private String getId() {

Просмотреть файл

@ -16,7 +16,7 @@ import java.lang.reflect.Method;
public class SharedMemory implements Parcelable {
private static final String LOGTAG = "GeckoShmem";
private static Method sGetFDMethod = null; // MemoryFile.getFileDescriptor() is hidden. :(
private static final Method sGetFDMethod;
private ParcelFileDescriptor mDescriptor;
private int mSize;
private int mId;
@ -24,12 +24,15 @@ public class SharedMemory implements Parcelable {
private boolean mIsMapped;
private MemoryFile mBackedFile;
// MemoryFile.getFileDescriptor() is hidden. :(
static {
Method method = null;
try {
sGetFDMethod = MemoryFile.class.getDeclaredMethod("getFileDescriptor");
method = MemoryFile.class.getDeclaredMethod("getFileDescriptor");
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
sGetFDMethod = method;
}
private SharedMemory(Parcel in) {

Просмотреть файл

@ -24,7 +24,7 @@ import android.util.Log;
public class GeckoServiceChildProcess extends Service {
static private String LOGTAG = "GeckoServiceChildProcess";
private static final String LOGTAG = "GeckoServiceChildProcess";
private static IProcessManager sProcessManager;