From 921c7dfc80e6872014e7d6a033f148a4c2a5f87f Mon Sep 17 00:00:00 2001 From: Svet Ganov Date: Mon, 29 Jun 2015 21:51:41 -0700 Subject: Add read/write external storage app ops bug:22104418 Change-Id: Ic9088f95bc02622c1163c1393e44382df6597707 --- api/current.txt | 2 ++ api/system-current.txt | 2 ++ core/java/android/app/AppOpsManager.java | 42 ++++++++++++++++++++++++++------ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/api/current.txt b/api/current.txt index 280206243382..7e03d0865a82 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3879,6 +3879,7 @@ package android.app { field public static final java.lang.String OPSTR_READ_CALL_LOG = "android:read_call_log"; field public static final java.lang.String OPSTR_READ_CELL_BROADCASTS = "android:read_cell_broadcasts"; field public static final java.lang.String OPSTR_READ_CONTACTS = "android:read_contacts"; + field public static final java.lang.String OPSTR_READ_EXTERNAL_STORAGE = "android:read_external_storage"; field public static final java.lang.String OPSTR_READ_PHONE_STATE = "android:read_phone_state"; field public static final java.lang.String OPSTR_READ_SMS = "android:read_sms"; field public static final java.lang.String OPSTR_RECEIVE_MMS = "android:receive_mms"; @@ -3891,6 +3892,7 @@ package android.app { field public static final java.lang.String OPSTR_WRITE_CALENDAR = "android:write_calendar"; field public static final java.lang.String OPSTR_WRITE_CALL_LOG = "android:write_call_log"; field public static final java.lang.String OPSTR_WRITE_CONTACTS = "android:write_contacts"; + field public static final java.lang.String OPSTR_WRITE_EXTERNAL_STORAGE = "android:write_external_storage"; } public static abstract interface AppOpsManager.OnOpChangedListener { diff --git a/api/system-current.txt b/api/system-current.txt index 5713af21c413..52fb24c520ad 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3989,6 +3989,7 @@ package android.app { field public static final java.lang.String OPSTR_READ_CALL_LOG = "android:read_call_log"; field public static final java.lang.String OPSTR_READ_CELL_BROADCASTS = "android:read_cell_broadcasts"; field public static final java.lang.String OPSTR_READ_CONTACTS = "android:read_contacts"; + field public static final java.lang.String OPSTR_READ_EXTERNAL_STORAGE = "android:read_external_storage"; field public static final java.lang.String OPSTR_READ_PHONE_STATE = "android:read_phone_state"; field public static final java.lang.String OPSTR_READ_SMS = "android:read_sms"; field public static final java.lang.String OPSTR_RECEIVE_MMS = "android:receive_mms"; @@ -4001,6 +4002,7 @@ package android.app { field public static final java.lang.String OPSTR_WRITE_CALENDAR = "android:write_calendar"; field public static final java.lang.String OPSTR_WRITE_CALL_LOG = "android:write_call_log"; field public static final java.lang.String OPSTR_WRITE_CONTACTS = "android:write_contacts"; + field public static final java.lang.String OPSTR_WRITE_EXTERNAL_STORAGE = "android:write_external_storage"; } public static abstract interface AppOpsManager.OnOpChangedListener { diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 8a61ec6f3e1c..9faadd34da11 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -229,8 +229,12 @@ public class AppOpsManager { public static final int OP_READ_CELL_BROADCASTS = 57; /** @hide Inject mock location into the system. */ public static final int OP_MOCK_LOCATION = 58; + /** @hide Read external storage. */ + public static final int OP_READ_EXTERNAL_STORAGE = 59; + /** @hide Write external storage. */ + public static final int OP_WRITE_EXTERNAL_STORAGE = 60; /** @hide */ - public static final int _NUM_OP = 59; + public static final int _NUM_OP = 61; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -313,6 +317,12 @@ public class AppOpsManager { /** Inject mock location into the system. */ public static final String OPSTR_MOCK_LOCATION = "android:mock_location"; + /** Read external storage. */ + public static final String OPSTR_READ_EXTERNAL_STORAGE + = "android:read_external_storage"; + /** Write external storage. */ + public static final String OPSTR_WRITE_EXTERNAL_STORAGE + = "android:write_external_storage"; /** * This maps each operation to the operation that serves as the @@ -381,7 +391,9 @@ public class AppOpsManager { OP_USE_FINGERPRINT, OP_BODY_SENSORS, OP_READ_CELL_BROADCASTS, - OP_MOCK_LOCATION + OP_MOCK_LOCATION, + OP_READ_EXTERNAL_STORAGE, + OP_WRITE_EXTERNAL_STORAGE }; /** @@ -447,7 +459,9 @@ public class AppOpsManager { OPSTR_USE_FINGERPRINT, OPSTR_BODY_SENSORS, OPSTR_READ_CELL_BROADCASTS, - OPSTR_MOCK_LOCATION + OPSTR_MOCK_LOCATION, + OPSTR_READ_EXTERNAL_STORAGE, + OPSTR_WRITE_EXTERNAL_STORAGE }; /** @@ -513,7 +527,9 @@ public class AppOpsManager { "USE_FINGERPRINT", "BODY_SENSORS", "READ_CELL_BROADCASTS", - "MOCK_LOCATION" + "MOCK_LOCATION", + "OPSTR_READ_EXTERNAL_STORAGE", + "OPSTR_WRITE_EXTERNAL_STORAGE", }; /** @@ -579,7 +595,9 @@ public class AppOpsManager { Manifest.permission.USE_FINGERPRINT, Manifest.permission.BODY_SENSORS, Manifest.permission.READ_CELL_BROADCASTS, - null + null, + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE, }; /** @@ -646,7 +664,9 @@ public class AppOpsManager { null, // USE_FINGERPRINT null, // BODY_SENSORS null, // READ_CELL_BROADCASTS - null // MOCK_LOCATION + null, // MOCK_LOCATION + null, // READ_EXTERNAL_STORAGE + null // WRITE_EXTERNAL_STORAGE }; /** @@ -712,7 +732,9 @@ public class AppOpsManager { false, // USE_FINGERPRINT false, // BODY_SENSORS false, // READ_CELL_BROADCASTS - false // MOCK_LOCATION + false, // MOCK_LOCATION + false, // READ_EXTERNAL_STORAGE + false // WRITE_EXTERNAL_STORAGE }; /** @@ -777,7 +799,9 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, AppOpsManager.MODE_ALLOWED, AppOpsManager.MODE_ALLOWED, - AppOpsManager.MODE_ERRORED // OP_MOCK_LOCATION + AppOpsManager.MODE_ERRORED, // OP_MOCK_LOCATION + AppOpsManager.MODE_ALLOWED, + AppOpsManager.MODE_ALLOWED }; /** @@ -846,6 +870,8 @@ public class AppOpsManager { false, false, false, + false, + false, false }; -- cgit v1.2.3-59-g8ed1b