From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MSe1969 Date: Sun, 17 Jun 2018 10:49:09 +0200 Subject: [PATCH] - AppOps/PrivacyGuard: New Sensor checks [base] Add two AppOps for sensor access: - OP_MOTION_SENSORS (default: allow, strict) - OP_OTHER_SENSORS (default: allow) Change-Id: Id12b91720f1e02ea5ca606ecefb30121d19b92bb --- core/java/android/app/AppOpsManager.java | 34 +++++++++++++++++++++--- core/res/res/values-de/cm_strings.xml | 2 ++ core/res/res/values-fr/cm_strings.xml | 2 ++ core/res/res/values/cm_strings.xml | 2 ++ core/res/res/values/lineage_arrays.xml | 4 +++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 2db36c8f4e02..e59869c11e90 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -280,8 +280,12 @@ public class AppOpsManager { public static final int OP_DATA_CONNECT_CHANGE = 74; /** @hide SU access */ public static final int OP_SU = 75; + /** @hide Motion Sensors */ + public static final int OP_MOTION_SENSORS = 76; + /** @hide Other Sensors */ + public static final int OP_OTHER_SENSORS = 77; /** @hide */ - public static final int _NUM_OP = 76; + public static final int _NUM_OP = 78; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -407,6 +411,10 @@ public class AppOpsManager { = "android:data_connect_change"; private static final String OPSTR_SU = "android:su"; + private static final String OPSTR_MOTION_SENSORS = + "android:motion_sensors"; + private static final String OPSTR_OTHER_SENSORS = + "android:other_sensors"; // Warning: If an permission is added here it also has to be added to // com.android.packageinstaller.permission.utils.EventLogger @@ -540,7 +548,9 @@ public class AppOpsManager { OP_BOOT_COMPLETED, OP_NFC_CHANGE, OP_DATA_CONNECT_CHANGE, - OP_SU + OP_SU, + OP_MOTION_SENSORS, + OP_OTHER_SENSORS }; /** @@ -624,6 +634,8 @@ public class AppOpsManager { OPSTR_NFC_CHANGE, OPSTR_DATA_CONNECT_CHANGE, OPSTR_SU, + OPSTR_MOTION_SENSORS, + OPSTR_OTHER_SENSORS, }; /** @@ -707,6 +719,8 @@ public class AppOpsManager { "NFC_CHANGE", "DATA_CONNECT_CHANGE", "SU", + "MOTION_SENSORS", + "OTHER_SENSORS", }; /** @@ -790,6 +804,8 @@ public class AppOpsManager { Manifest.permission.NFC, Manifest.permission.MODIFY_PHONE_STATE, null, + null, + null, }; /** @@ -874,6 +890,8 @@ public class AppOpsManager { null, //NFC_CHANGE null, //DATA_CONNECT_CHANGE UserManager.DISALLOW_SU, //SU TODO: this should really be investigated. + null, //MOTION_SENSORS + null, //OTHER_SENSORS }; /** @@ -957,6 +975,8 @@ public class AppOpsManager { true, // NFC_CHANGE true, //DATA_CONNECT_CHANGE false, //SU + false, //MOTION_SENSORS + false, //OTHER_SENSORS }; /** @@ -1038,7 +1058,9 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // OP_BOOT_COMPLETED AppOpsManager.MODE_ALLOWED, // OP_NFC_CHANGE AppOpsManager.MODE_ALLOWED, - AppOpsManager.MODE_ASK, // OP_SU + AppOpsManager.MODE_ASK, // OP_SU + AppOpsManager.MODE_ALLOWED, // OP_MOTION_SENSORS + AppOpsManager.MODE_ALLOWED, // OP_OTHER_SENSORS }; /** @@ -1122,6 +1144,8 @@ public class AppOpsManager { AppOpsManager.MODE_ASK, // OP_NFC_CHANGE AppOpsManager.MODE_ASK, // OP_DATA_CONNECT_CHANGE AppOpsManager.MODE_ASK, // OP_SU + AppOpsManager.MODE_ALLOWED, // OP_MOTION_SENSORS + AppOpsManager.MODE_ALLOWED, // OP_OTHER_SENSORS }; /** @@ -1204,6 +1228,8 @@ public class AppOpsManager { true, // OP_NFC_CHANGE true, // OP_DATA_CONNECT_CHANGE true, // OP_SU + true, // OP_MOTION_SENSORS + false, // OP_OTHER_SENSORS }; /** @@ -1290,6 +1316,8 @@ public class AppOpsManager { false, // OP_NFC_CHANGE false, // OP_DATA_CONNECT_CHANGE false, // OP_SU + false, // OP_MOTION_SENSORS + false, // OP_OTHER_SENSORS }; /** diff --git a/core/res/res/values-de/cm_strings.xml b/core/res/res/values-de/cm_strings.xml index af5c3fbe12f0..6a8a1e0fc45a 100644 --- a/core/res/res/values-de/cm_strings.xml +++ b/core/res/res/values-de/cm_strings.xml @@ -57,7 +57,9 @@ die Zwischenablage zu ändern Kontakte zu ändern Einstellungen zu ändern + Bewegungssensoren zu nutzen das Mikrofon zu aktivieren/deaktivieren + sonstige Sensoren zu nutzen Anrufe zu beantworten Bild im Bild zu verwenden Audio wiederzugeben diff --git a/core/res/res/values-fr/cm_strings.xml b/core/res/res/values-fr/cm_strings.xml index c223ccbc5dd8..28ee5ba28dcf 100644 --- a/core/res/res/values-fr/cm_strings.xml +++ b/core/res/res/values-fr/cm_strings.xml @@ -57,7 +57,9 @@ modifier le presse-papiers mettre à jour vos contacts mettre à jour les paramètres du système + utiliser les capteurs de mouvement activer/désactiver le microphone + utiliser d\'autres capteurs répondre aux appels téléphoniques utiliser le mode Picture-in-Picture lecture audio diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml index 4c34888c94ab..d0ec04891c8d 100644 --- a/core/res/res/values/cm_strings.xml +++ b/core/res/res/values/cm_strings.xml @@ -70,7 +70,9 @@ modify the clipboard update your contacts update system settings + use the motion sensors mute/unmute the microphone + use other sensors answer phone calls use picture in picture play audio diff --git a/core/res/res/values/lineage_arrays.xml b/core/res/res/values/lineage_arrays.xml index 65149d2a9e54..5cb3120dbc47 100644 --- a/core/res/res/values/lineage_arrays.xml +++ b/core/res/res/values/lineage_arrays.xml @@ -170,6 +170,10 @@ @string/app_ops_toggle_mobile_data @string/app_ops_su + + @string/app_ops_motion_sensors + + @string/app_ops_other_sensors