зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1624675 - Remove dead code in HardwareUtils. r=snorp
Differential Revision: https://phabricator.services.mozilla.com/D68438 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
36484178dc
Коммит
a234c36ad9
|
@ -6,14 +6,11 @@
|
|||
package org.mozilla.gecko.util;
|
||||
|
||||
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.geckoview.BuildConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -22,17 +19,11 @@ import java.io.IOException;
|
|||
public final class HardwareUtils {
|
||||
private static final String LOGTAG = "GeckoHardwareUtils";
|
||||
|
||||
private static final boolean IS_AMAZON_DEVICE = Build.MANUFACTURER.equalsIgnoreCase("Amazon");
|
||||
public static final boolean IS_KINDLE_DEVICE = IS_AMAZON_DEVICE &&
|
||||
(Build.MODEL.equals("Kindle Fire") ||
|
||||
Build.MODEL.startsWith("KF"));
|
||||
|
||||
private static volatile boolean sInited;
|
||||
|
||||
// These are all set once, during init.
|
||||
private static volatile boolean sIsLargeTablet;
|
||||
private static volatile boolean sIsSmallTablet;
|
||||
private static volatile boolean sIsTelevision;
|
||||
|
||||
private static volatile File sLibDir;
|
||||
private static volatile int sMachineType = -1;
|
||||
|
@ -52,11 +43,6 @@ public final class HardwareUtils {
|
|||
} else if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_LARGE) {
|
||||
sIsSmallTablet = true;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
|
||||
sIsTelevision = true;
|
||||
}
|
||||
}
|
||||
|
||||
sLibDir = new File(context.getApplicationInfo().nativeLibraryDir);
|
||||
sInited = true;
|
||||
|
@ -66,18 +52,6 @@ public final class HardwareUtils {
|
|||
return sIsLargeTablet || sIsSmallTablet;
|
||||
}
|
||||
|
||||
public static boolean isLargeTablet() {
|
||||
return sIsLargeTablet;
|
||||
}
|
||||
|
||||
public static boolean isSmallTablet() {
|
||||
return sIsSmallTablet;
|
||||
}
|
||||
|
||||
public static boolean isTelevision() {
|
||||
return sIsTelevision;
|
||||
}
|
||||
|
||||
private static String getPreferredAbi() {
|
||||
String abi = null;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
|
@ -183,40 +157,4 @@ public final class HardwareUtils {
|
|||
|
||||
return machineTypeToString(sMachineType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 < BuildConfig.MIN_SDK_VERSION) {
|
||||
return false;
|
||||
}
|
||||
|
||||
initMachineType();
|
||||
|
||||
// See http://developer.android.com/ndk/guides/abis.html
|
||||
final boolean isSystemX86 = isX86System();
|
||||
final boolean isSystemARM = !isSystemX86 && isARMSystem();
|
||||
final boolean isSystemARM64 = isARM64System();
|
||||
|
||||
final boolean isAppARM = sMachineType == ELF_MACHINE_ARM;
|
||||
final boolean isAppARM64 = sMachineType == ELF_MACHINE_AARCH64;
|
||||
final boolean isAppX86 = sMachineType == ELF_MACHINE_X86;
|
||||
|
||||
// Only reject known incompatible ABIs. Better safe than sorry.
|
||||
if ((isSystemX86 && isAppARM) || (isSystemARM && isAppX86)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((isSystemX86 && isAppX86) || (isSystemARM && isAppARM) ||
|
||||
(isSystemARM64 && (isAppARM64 || isAppARM))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Log.w(LOGTAG, "Unknown app/system ABI combination: " +
|
||||
machineTypeToString(sMachineType) + " / " + getRealAbi());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче