Loading core/java/android/app/AppOpsManager.java +15 −4 Original line number Diff line number Diff line Loading @@ -2687,7 +2687,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // READ_ICC_SMS AppOpsManager.MODE_ALLOWED, // WRITE_ICC_SMS AppOpsManager.MODE_DEFAULT, // WRITE_SETTINGS getSystemAlertWindowDefault(), // SYSTEM_ALERT_WINDOW AppOpsManager.MODE_DEFAULT, // SYSTEM_ALERT_WINDOW /*Overridden in opToDefaultMode()*/ AppOpsManager.MODE_ALLOWED, // ACCESS_NOTIFICATIONS AppOpsManager.MODE_ALLOWED, // CAMERA AppOpsManager.MODE_ALLOWED, // RECORD_AUDIO Loading Loading @@ -3011,6 +3011,8 @@ public class AppOpsManager { private static final String DEBUG_LOGGING_OPS_PROP = "appops.logging_ops"; private static final String DEBUG_LOGGING_TAG = "AppOpsManager"; private static volatile Integer sOpSystemAlertWindowDefaultMode; /** * Retrieve the op switch that controls the given operation. * @hide Loading Loading @@ -3109,6 +3111,9 @@ public class AppOpsManager { * @hide */ public static @Mode int opToDefaultMode(int op) { if (op == OP_SYSTEM_ALERT_WINDOW) { return getSystemAlertWindowDefault(); } return sOpDefaultMode[op]; } Loading Loading @@ -10113,6 +10118,11 @@ public class AppOpsManager { } private static int getSystemAlertWindowDefault() { // This is indeed racy but we aren't expecting the result to change so it's not worth // the synchronization. if (sOpSystemAlertWindowDefaultMode != null) { return sOpSystemAlertWindowDefaultMode; } final Context context = ActivityThread.currentApplication(); if (context == null) { return AppOpsManager.MODE_DEFAULT; Loading @@ -10123,10 +10133,11 @@ public class AppOpsManager { // TVs are constantly plugged in and has less concern for memory/power if (ActivityManager.isLowRamDeviceStatic() && !pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK, 0)) { return AppOpsManager.MODE_IGNORED; sOpSystemAlertWindowDefaultMode = AppOpsManager.MODE_IGNORED; } else { sOpSystemAlertWindowDefaultMode = AppOpsManager.MODE_DEFAULT; } return AppOpsManager.MODE_DEFAULT; return sOpSystemAlertWindowDefaultMode; } /** Loading Loading
core/java/android/app/AppOpsManager.java +15 −4 Original line number Diff line number Diff line Loading @@ -2687,7 +2687,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // READ_ICC_SMS AppOpsManager.MODE_ALLOWED, // WRITE_ICC_SMS AppOpsManager.MODE_DEFAULT, // WRITE_SETTINGS getSystemAlertWindowDefault(), // SYSTEM_ALERT_WINDOW AppOpsManager.MODE_DEFAULT, // SYSTEM_ALERT_WINDOW /*Overridden in opToDefaultMode()*/ AppOpsManager.MODE_ALLOWED, // ACCESS_NOTIFICATIONS AppOpsManager.MODE_ALLOWED, // CAMERA AppOpsManager.MODE_ALLOWED, // RECORD_AUDIO Loading Loading @@ -3011,6 +3011,8 @@ public class AppOpsManager { private static final String DEBUG_LOGGING_OPS_PROP = "appops.logging_ops"; private static final String DEBUG_LOGGING_TAG = "AppOpsManager"; private static volatile Integer sOpSystemAlertWindowDefaultMode; /** * Retrieve the op switch that controls the given operation. * @hide Loading Loading @@ -3109,6 +3111,9 @@ public class AppOpsManager { * @hide */ public static @Mode int opToDefaultMode(int op) { if (op == OP_SYSTEM_ALERT_WINDOW) { return getSystemAlertWindowDefault(); } return sOpDefaultMode[op]; } Loading Loading @@ -10113,6 +10118,11 @@ public class AppOpsManager { } private static int getSystemAlertWindowDefault() { // This is indeed racy but we aren't expecting the result to change so it's not worth // the synchronization. if (sOpSystemAlertWindowDefaultMode != null) { return sOpSystemAlertWindowDefaultMode; } final Context context = ActivityThread.currentApplication(); if (context == null) { return AppOpsManager.MODE_DEFAULT; Loading @@ -10123,10 +10133,11 @@ public class AppOpsManager { // TVs are constantly plugged in and has less concern for memory/power if (ActivityManager.isLowRamDeviceStatic() && !pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK, 0)) { return AppOpsManager.MODE_IGNORED; sOpSystemAlertWindowDefaultMode = AppOpsManager.MODE_IGNORED; } else { sOpSystemAlertWindowDefaultMode = AppOpsManager.MODE_DEFAULT; } return AppOpsManager.MODE_DEFAULT; return sOpSystemAlertWindowDefaultMode; } /** Loading