Bug 1360321 - 7. Add AArch64 check to Fennec hardware checks; r=snorp

Add checks for "arm64-v8a" when we check for supported platforms.

MozReview-Commit-ID: IHklaZ7Q6BD
This commit is contained in:
Jim Chen 2017-05-17 13:06:23 -04:00
Родитель 14dbe23a6c
Коммит 65efbc986a
3 изменённых файлов: 11 добавлений и 3 удалений

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

@ -291,7 +291,7 @@ public class AppConstants {
//#endif //#endif
/** /**
* Target CPU architecture: "armeabi-v7a", "x86, "mips", .. * Target CPU architecture: "armeabi-v7a", "arm64-v8a", "x86", "mips", ..
*/ */
public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@"; public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@";

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

@ -51,7 +51,7 @@ public class BuildConfig {
MOZ_APP_VERSION; MOZ_APP_VERSION;
/** /**
* Target CPU architecture: "armeabi-v7a", "x86, "mips", .. * Target CPU architecture: "armeabi-v7a", "arm64-v8a", "x86", "mips", ..
*/ */
public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@"; public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@";
} }

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

@ -85,6 +85,11 @@ public final class HardwareUtils {
return Build.CPU_ABI != null && Build.CPU_ABI.equals("armeabi-v7a"); return Build.CPU_ABI != null && Build.CPU_ABI.equals("armeabi-v7a");
} }
public static boolean isARM64System() {
// 64-bit support was introduced in 21.
return Build.VERSION.SDK_INT >= 21 && "arm64-v8a".equals(Build.SUPPORTED_ABIS[0]);
}
public static boolean isX86System() { public static boolean isX86System() {
if (Build.CPU_ABI != null && Build.CPU_ABI.equals("x86")) { if (Build.CPU_ABI != null && Build.CPU_ABI.equals("x86")) {
return true; return true;
@ -122,8 +127,10 @@ public final class HardwareUtils {
// See http://developer.android.com/ndk/guides/abis.html // See http://developer.android.com/ndk/guides/abis.html
final boolean isSystemX86 = isX86System(); final boolean isSystemX86 = isX86System();
final boolean isSystemARM = !isSystemX86 && isARMSystem(); final boolean isSystemARM = !isSystemX86 && isARMSystem();
final boolean isSystemARM64 = isARM64System();
boolean isAppARM = BuildConfig.ANDROID_CPU_ARCH.startsWith("armeabi-v7a"); boolean isAppARM = BuildConfig.ANDROID_CPU_ARCH.startsWith("armeabi-v7a");
boolean isAppARM64 = BuildConfig.ANDROID_CPU_ARCH.startsWith("arm64-v8a");
boolean isAppX86 = BuildConfig.ANDROID_CPU_ARCH.startsWith("x86"); boolean isAppX86 = BuildConfig.ANDROID_CPU_ARCH.startsWith("x86");
// Only reject known incompatible ABIs. Better safe than sorry. // Only reject known incompatible ABIs. Better safe than sorry.
@ -131,7 +138,8 @@ public final class HardwareUtils {
return false; return false;
} }
if ((isSystemX86 && isAppX86) || (isSystemARM && isAppARM)) { if ((isSystemX86 && isAppX86) || (isSystemARM && isAppARM) ||
(isSystemARM64 && (isAppARM64 || isAppARM))) {
return true; return true;
} }