Bug 1335968 - Check SDK version at startup draft
authorAndrzej Hunt <ahunt@mozilla.com>
Wed, 01 Feb 2017 17:29:05 -0800
changeset 480043 f60bfbbb7e532eb919ef516727e48531a88e7760
parent 479958 e677ba018b22558fef1d07b74d416fd3a28a5dc3
child 544853 760a099f020706e7374dd43fab936554a95f5cb9
push id44434
push userahunt@mozilla.com
push dateTue, 07 Feb 2017 18:42:22 +0000
bugs1335968
milestone54.0a1
Bug 1335968 - Check SDK version at startup This shouldn't ever be true - but we have crash reports from devices running API 10 (Android 2.3), despite having a minimum requirement of API 15 (Android 4). The cause is unknown, but could be caused by Google Play bugs (e.g. if it were to ignore an increase in the minimum SDK), or some other override. MozReview-Commit-ID: 12uHsDxGPp
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
@@ -1,15 +1,16 @@
 /* -*- 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.util;
 
+import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.SysInfo;
 
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.os.Build;
 import android.util.Log;
 
@@ -86,16 +87,22 @@ public final class HardwareUtils {
     public static boolean isX86System() {
         return Build.CPU_ABI != null && Build.CPU_ABI.startsWith("x86");
     }
 
     /**
      * @return false if the current system is not supported (e.g. APK/system ABI mismatch).
      */
     public static boolean isSupportedSystem() {
+        // We've had crash reports from users on API 10 (with minSDK==15). That shouldn't even install,
+        // but since it does we need to protect against it:
+        if (Build.VERSION.SDK_INT < AppConstants.Versions.MIN_SDK_VERSION) {
+            return false;
+        }
+
         // See http://developer.android.com/ndk/guides/abis.html
         final boolean isSystemARM = isARMSystem();
         final boolean isSystemX86 = isX86System();
 
         boolean isAppARM = BuildConfig.ANDROID_CPU_ARCH.startsWith("arm");
         boolean isAppX86 = BuildConfig.ANDROID_CPU_ARCH.startsWith("x86");
 
         // Only reject known incompatible ABIs. Better safe than sorry.