diff --git a/core/java/pawletos/device/PawletDevice.java b/core/java/pawletos/device/PawletDevice.java index 9cc878e..56c78c4 100644 --- a/core/java/pawletos/device/PawletDevice.java +++ b/core/java/pawletos/device/PawletDevice.java @@ -1,82 +1,12 @@ package pawletos.device; import android.content.Context; -import android.os.Build; import android.os.SystemProperties; /** - * PawletOS Environment API for apps running on PawletOS builds. + * PawletOS Device API for apps running on PawletOS builds. */ public class PawletDevice { - private static final double PAWLET_SDK_VERSION = 1.0; - - /** - * Check if running on an emulator. - */ - public static boolean isEmulator() { - String fingerprint = android.os.Build.FINGERPRINT; - String model = android.os.Build.MODEL; - String manufacturer = android.os.Build.MANUFACTURER; - String brand = android.os.Build.BRAND; - String device = android.os.Build.DEVICE; - String product = android.os.Build.PRODUCT; - return fingerprint != null && (fingerprint.startsWith("generic") || fingerprint.startsWith("unknown")) - || model != null && model.contains("google_sdk") - || model != null && model.contains("Emulator") - || model != null && model.contains("Android SDK built for x86") - || manufacturer != null && manufacturer.contains("Genymotion") - || brand != null && brand.startsWith("generic") && device != null && device.startsWith("generic") - || product != null && product.equals("google_sdk"); - } - - /** - * Basic check if device is rooted. - */ - public static boolean isRooted() { - String buildTags = android.os.Build.TAGS; - if (buildTags != null && buildTags.contains("test-keys")) { - return true; - } - try { - java.io.File file = new java.io.File("/system/app/Superuser.apk"); - if (file.exists()) { - return true; - } - } catch (Exception e) { - // ignore - } - return false; - } - - /** - * Get the current language/locale. - */ - public static String getCurrentLocale(Context ctx) { - java.util.Locale locale; - if (android.os.Build.VERSION.SDK_INT >= 24) { - locale = ctx.getResources().getConfiguration().getLocales().get(0); - } else { - locale = ctx.getResources().getConfiguration().locale; - } - return locale.toString(); - } - - /** - * Check if device is running PawletOS. - * Returns true if running on PawletOS, false otherwise. - */ - public static boolean isPawletOS() { - // Check manufacturer and system property for OS name - return "Pawlet".equalsIgnoreCase(Build.MANUFACTURER) - || "PawletOS".equalsIgnoreCase(SystemProperties.get("ro.oxmc.os_name", "")); - } - - /** - * Get the PawletSDK version. - */ - public static double getPawletSDKVersion() { - return PAWLET_SDK_VERSION; - } /** * Get the brand name.