author | Jim Chen <nchen@mozilla.com> |
Wed, 15 Feb 2017 17:12:56 -0500 | |
changeset 343197 | a792d73dc3454fb61f75cce5ae9f340da5a07868 |
parent 343196 | b1d2452c7c176f8004b20e01096334ff1234e055 |
child 343198 | e0daea02c01fda3ec2a6ebbfc1fc11c8843c53c3 |
push id | 31372 |
push user | cbook@mozilla.com |
push date | Thu, 16 Feb 2017 12:16:10 +0000 |
treeherder | mozilla-central@2737f66ad6ac [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | snorp |
bugs | 1337290 |
milestone | 54.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
|
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java @@ -2388,17 +2388,18 @@ public abstract class GeckoApp } super.onDestroy(); Tabs.unregisterOnTabsChangedListener(this); } public void showSDKVersionError() { - final String message = getString(R.string.unsupported_sdk_version, Build.CPU_ABI, Integer.toString(Build.VERSION.SDK_INT)); + final String message = getString(R.string.unsupported_sdk_version, + HardwareUtils.getRealAbi(), Integer.toString(Build.VERSION.SDK_INT)); Toast.makeText(this, message, Toast.LENGTH_LONG).show(); } // Get a temporary directory, may return null public static File getTempDirectory(@NonNull Context context) { return context.getApplicationContext().getExternalFilesDir("temp"); }
--- 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 @@ -7,16 +7,17 @@ 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.system.Os; import android.util.Log; import org.mozilla.gecko.SysInfo; import org.mozilla.geckoview.BuildConfig; public final class HardwareUtils { private static final String LOGTAG = "GeckoHardwareUtils"; @@ -80,32 +81,52 @@ public final class HardwareUtils { return SysInfo.getMemSize(); } public static boolean isARMSystem() { return Build.CPU_ABI != null && Build.CPU_ABI.equals("armeabi-v7a"); } public static boolean isX86System() { - return Build.CPU_ABI != null && Build.CPU_ABI.equals("x86"); + if (Build.CPU_ABI != null && Build.CPU_ABI.equals("x86")) { + return true; + } + if (Build.VERSION.SDK_INT >= 21) { + // On some devices we have to look into the kernel release string. + try { + return Os.uname().release.contains("-x86_"); + } catch (final Exception e) { + Log.w(LOGTAG, "Cannot get uname", e); + } + } + return false; + } + + public static String getRealAbi() { + if (isX86System() && isARMSystem()) { + // Some x86 devices try to make us believe we're ARM, + // in which case CPU_ABI is not reliable. + return "x86"; + } + return Build.CPU_ABI; } /** * @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(); + final boolean isSystemARM = !isSystemX86 && isARMSystem(); boolean isAppARM = BuildConfig.ANDROID_CPU_ARCH.startsWith("armeabi-v7a"); boolean isAppX86 = BuildConfig.ANDROID_CPU_ARCH.startsWith("x86"); // Only reject known incompatible ABIs. Better safe than sorry. if ((isSystemX86 && isAppARM) || (isSystemARM && isAppX86)) { return false; }