Bug 905223 - Part 0 - Add target API annotations to get rid of errors in Android Studio. r=margaret
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 23 Apr 2016 22:29:03 +0200
changeset 340508 17386d25f2603d769aa169f5d9719b03a1387005
parent 340507 5f457ebb26a91f69161ace4c1e56109ed4698709
child 340509 5fc62e209fc7c7dd276f1cfd2830e7fe5f7721fa
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs905223
milestone49.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 905223 - Part 0 - Add target API annotations to get rid of errors in Android Studio. r=margaret Android Studio doesn't recognise our version guards and is consequentially always showing two errors in GeckoApp, which makes it more difficult to spot when you've introduced an actual error. MozReview-Commit-ID: LpNIwHOhEWE
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -44,16 +44,17 @@ import org.mozilla.gecko.util.GeckoEvent
 import org.mozilla.gecko.util.GeckoRequest;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.NativeEventListener;
 import org.mozilla.gecko.util.NativeJSObject;
 import org.mozilla.gecko.util.PrefUtils;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager.NameNotFoundException;
@@ -1596,16 +1597,17 @@ public abstract class GeckoApp
 
         if (ACTION_ALERT_CALLBACK.equals(action)) {
             processAlertCallback(intent);
         } else if (NotificationHelper.HELPER_BROADCAST_ACTION.equals(action)) {
             NotificationHelper.getInstance(getApplicationContext()).handleNotificationIntent(intent);
         }
     }
 
+    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
     @Override
     public void onGlobalLayout() {
         if (Versions.preJB) {
             mMainLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
         } else {
             mMainLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
         }
         if (!mInitialized) {
@@ -2324,16 +2326,17 @@ public abstract class GeckoApp
         Log.d(LOGTAG, "doRestart(\"" + restartIntent + "\")");
 
         doShutdown();
     }
 
     private void doShutdown() {
         // Shut down GeckoApp activity.
         runOnUiThread(new Runnable() {
+            @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
             @Override public void run() {
                 if (!isFinishing() && (Versions.preJBMR1 || !isDestroyed())) {
                     finish();
                 }
             }
         });
     }