Bug 1261040 - Remove code code guarded by AppConstants.Versions.preICS. r=sebastian
authorJorick Caberio <jorick.caberio@gmail.com>
Thu, 07 Apr 2016 17:17:21 +0800
changeset 331499 4bc053de842538e99e56927b3c03fdc539374a16
parent 331498 1a103681b59fd604cdfa9fded1e4ff2eae68282f
child 331500 8975734f1546f7ab475037441e9a0591af299e32
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1261040
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1261040 - Remove code code guarded by AppConstants.Versions.preICS. r=sebastian MozReview-Commit-ID: Jmwl6sfEdx0
mobile/android/base/AppConstants.java.in
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/MemoryMonitor.java
mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenuItem.java
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/java/org/mozilla/gecko/util/InputOptionsUtils.java
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -63,17 +63,16 @@ public class AppConstants {
          * If our MAX_SDK_VERSION is lower than ICS, we must not be an ICS device.
          * Otherwise, we need a range check.
          */
         public static final boolean preMarshmallow = MAX_SDK_VERSION < 23 || (MIN_SDK_VERSION < 23 && Build.VERSION.SDK_INT < 23);
         public static final boolean preLollipop = MAX_SDK_VERSION < 21 || (MIN_SDK_VERSION < 21 && Build.VERSION.SDK_INT < 21);
         public static final boolean preJBMR2 = MAX_SDK_VERSION < 18 || (MIN_SDK_VERSION < 18 && Build.VERSION.SDK_INT < 18);
         public static final boolean preJBMR1 = MAX_SDK_VERSION < 17 || (MIN_SDK_VERSION < 17 && Build.VERSION.SDK_INT < 17);
         public static final boolean preJB = MAX_SDK_VERSION < 16 || (MIN_SDK_VERSION < 16 && Build.VERSION.SDK_INT < 16);
-        public static final boolean preICS = MAX_SDK_VERSION < 14 || (MIN_SDK_VERSION < 14 && Build.VERSION.SDK_INT < 14);
     }
 
     /**
      * The name of the Java class that represents the android application.
      */
     public static final String MOZ_ANDROID_APPLICATION_CLASS = "@MOZ_ANDROID_APPLICATION_CLASS@";
     /**
      * The name of the Java class that launches the browser activity.
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3207,18 +3207,17 @@ public class BrowserApp extends GeckoApp
         final MenuItem desktopMode = aMenu.findItem(R.id.desktop_mode);
         final MenuItem enterGuestMode = aMenu.findItem(R.id.new_guest_session);
         final MenuItem exitGuestMode = aMenu.findItem(R.id.exit_guest_session);
 
         // Only show the "Quit" menu item on pre-ICS, television devices,
         // or if the user has explicitly enabled the clear on shutdown pref.
         // (We check the pref last to save the pref read.)
         // In ICS+, it's easy to kill an app through the task switcher.
-        final boolean visible = Versions.preICS ||
-                                HardwareUtils.isTelevision() ||
+        final boolean visible = HardwareUtils.isTelevision() ||
                                 !PrefUtils.getStringSet(GeckoSharedPrefs.forProfile(this),
                                                         ClearOnShutdownPref.PREF,
                                                         new HashSet<String>()).isEmpty();
         aMenu.findItem(R.id.quit).setVisible(visible);
 
         // If tab data is unavailable we disable most of the context menu and related items and
         // return early.
         if (tab == null || tab.getURL() == null) {
--- a/mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
@@ -323,21 +323,16 @@ public class DoorHangerPopup extends Anc
         // Make the popup focusable for accessibility. This gets done here
         // so the node can be accessibility focused, but on pre-ICS devices this
         // causes crashes, so it is done after the popup is shown.
         if (Versions.feature14Plus) {
             setFocusable(true);
         }
 
         show();
-
-        if (Versions.preICS) {
-            // Make the popup focusable for keyboard accessibility.
-            setFocusable(true);
-        }
     }
 
     //Show all inter-DoorHanger dividers (ie. Dividers on all visible DoorHangers except the last one)
     private void showDividers() {
         int count = mContent.getChildCount();
         DoorHanger lastVisibleDoorHanger = null;
 
         for (int i = 0; i < count; i++) {
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -1404,24 +1404,16 @@ public abstract class GeckoApp
         // cause a loop! See Bug 1011008, Comment 12.
         super.onConfigurationChanged(getResources().getConfiguration());
     }
 
     protected void initializeChrome() {
         mDoorHangerPopup = new DoorHangerPopup(this);
         mPluginContainer = (AbsoluteLayout) findViewById(R.id.plugin_container);
         mFormAssistPopup = (FormAssistPopup) findViewById(R.id.form_assist_popup);
-
-        if (mCameraView == null) {
-            // Pre-ICS devices need the camera surface in a visible layout.
-            if (Versions.preICS) {
-                mCameraView = new SurfaceView(this);
-                ((SurfaceView)mCameraView).getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
-            }
-        }
     }
 
     /**
      * Loads the initial tab at Fennec startup. If we don't restore tabs, this
      * tab will be about:home, or the homepage if the use has set one.
      * If we restore tabs, we don't need to create a new tab.
      */
     protected void loadStartupTab(final int flags) {
@@ -2695,20 +2687,16 @@ public abstract class GeckoApp
         if (resultant == null) {
             return;
         }
 
         onLocaleChanged(resultant);
     }
 
     private void setSystemUiVisible(final boolean visible) {
-        if (Versions.preICS) {
-            return;
-        }
-
         ThreadUtils.postToUiThread(new Runnable() {
             @Override
             public void run() {
                 if (visible) {
                     mMainLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
                 } else {
                     mMainLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
                 }
--- a/mobile/android/base/java/org/mozilla/gecko/MemoryMonitor.java
+++ b/mobile/android/base/java/org/mozilla/gecko/MemoryMonitor.java
@@ -1,16 +1,15 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * 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;
 
-import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.BrowserContract;
 import org.mozilla.gecko.favicons.Favicons;
 import org.mozilla.gecko.home.ImageLoader;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.content.BroadcastReceiver;
 import android.content.ComponentCallbacks2;
@@ -87,21 +86,16 @@ class MemoryMonitor extends BroadcastRec
             if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
                 GeckoThread.waitOnGecko();
             }
         }
     }
 
     public void onTrimMemory(int level) {
         Log.d(LOGTAG, "onTrimMemory() notification received with level " + level);
-        if (Versions.preICS) {
-            // This won't even get called pre-ICS.
-            return;
-        }
-
         if (level == ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
             // We seem to get this just by entering the task switcher or hitting the home button.
             // Seems bogus, because we are the foreground app, or at least not at the end of the LRU list.
             // Just ignore it, and if there is a real memory pressure event (CRITICAL, MODERATE, etc),
             // we'll respond appropriately.
             return;
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenuItem.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenuItem.java
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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.menu;
 
-import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.widget.GeckoActionProvider;
 
 import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
 import android.view.ActionProvider;
 import android.view.ContextMenu;
@@ -112,20 +111,16 @@ public class GeckoMenuItem implements Me
     }
 
     @Override
     public boolean expandActionView() {
         return false;
     }
 
     public boolean hasActionProvider() {
-        if (Versions.preICS) {
-            return false;
-        }
-
         return (mActionProvider != null);
     }
 
     public int getActionEnum() {
         return mActionEnum;
     }
 
     public GeckoActionProvider getGeckoActionProvider() {
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -1460,22 +1460,17 @@ OnSharedPreferenceChangeListener
                     ((TwoStatePreference) preference).setChecked(value);
                 }
             }
         }
 
         @Override
         public void prefValue(String prefName, final boolean value) {
             final Preference pref = getField(prefName);
-            final CheckBoxPrefSetter prefSetter;
-            if (Versions.preICS) {
-                prefSetter = new CheckBoxPrefSetter();
-            } else {
-                prefSetter = new TwoStatePrefSetter();
-            }
+            final CheckBoxPrefSetter prefSetter = new TwoStatePrefSetter();
             ThreadUtils.postToUiThread(new Runnable() {
                 @Override
                 public void run() {
                     prefSetter.setBooleanPref(pref, value);
                 }
             });
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/util/InputOptionsUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/InputOptionsUtils.java
@@ -3,23 +3,19 @@
  * 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.content.Context;
 import android.content.Intent;
 import android.speech.RecognizerIntent;
-import org.mozilla.gecko.AppConstants.Versions;
 
 public class InputOptionsUtils {
     public static boolean supportsVoiceRecognizer(Context context, String prompt) {
-        if (Versions.preICS) {
-            return false;
-        }
         final Intent intent = createVoiceRecognizerIntent(prompt);
         return intent.resolveActivity(context.getPackageManager()) != null;
     }
 
     public static Intent createVoiceRecognizerIntent(String prompt) {
         final Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
         intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
         intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);