diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 67fbc5a46832d..9cc13abcbabc6 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -243,8 +243,10 @@ public class AppOpsManager { public static final int OP_AUDIO_ACCESSIBILITY_VOLUME = 64; /** @hide Read the phone number. */ public static final int OP_READ_PHONE_NUMBER = 65; + /** @hide Request package installs through package installer */ + public static final int OP_REQUEST_INSTALL_PACKAGES = 66; /** @hide */ - public static final int _NUM_OP = 66; + public static final int _NUM_OP = 67; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -461,6 +463,7 @@ public class AppOpsManager { OP_RUN_IN_BACKGROUND, OP_AUDIO_ACCESSIBILITY_VOLUME, OP_READ_PHONE_NUMBER, + OP_REQUEST_INSTALL_PACKAGES, }; /** @@ -534,6 +537,7 @@ public class AppOpsManager { null, null, // OP_AUDIO_ACCESSIBILITY_VOLUME OPSTR_READ_PHONE_NUMBER, + null, // OP_REQUEST_INSTALL_PACKAGES }; /** @@ -607,6 +611,7 @@ public class AppOpsManager { "RUN_IN_BACKGROUND", "AUDIO_ACCESSIBILITY_VOLUME", "READ_PHONE_NUMBER", + "REQUEST_INSTALL_PACKAGES", }; /** @@ -680,6 +685,7 @@ public class AppOpsManager { null, // no permission for running in background null, // no permission for changing accessibility volume Manifest.permission.READ_PHONE_NUMBER, + Manifest.permission.REQUEST_INSTALL_PACKAGES, }; /** @@ -754,6 +760,7 @@ public class AppOpsManager { null, // RUN_IN_BACKGROUND UserManager.DISALLOW_ADJUST_VOLUME, //AUDIO_ACCESSIBILITY_VOLUME null, // READ_PHONE_NUMBER + null, // REQUEST_INSTALL_PACKAGES }; /** @@ -827,6 +834,7 @@ public class AppOpsManager { false, // RUN_IN_BACKGROUND false, // AUDIO_ACCESSIBILITY_VOLUME false, // READ_PHONE_NUMBER + false, // REQUEST_INSTALL_PACKAGES }; /** @@ -899,6 +907,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // OP_RUN_IN_BACKGROUND AppOpsManager.MODE_ALLOWED, // OP_AUDIO_ACCESSIBILITY_VOLUME AppOpsManager.MODE_ALLOWED, + AppOpsManager.MODE_DEFAULT, // OP_REQUEST_INSTALL_PACKAGES }; /** @@ -975,6 +984,7 @@ public class AppOpsManager { false, false, // OP_AUDIO_ACCESSIBILITY_VOLUME false, + false, // OP_REQUEST_INSTALL_PACKAGES }; /** diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 371c0f3b90ca7..a87c88a8e2cfe 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -285,6 +285,21 @@ public final class Settings { public static final String ACTION_SECURITY_SETTINGS = "android.settings.SECURITY_SETTINGS"; + /** + * Activity Action: Show settings to allow configuration of trusted external sources + *

+ * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

+ * Input: Nothing. + *

+ * Output: Nothing. + * @hide + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_MANAGE_EXTERNAL_SOURCES = + "android.settings.action.MANAGE_EXTERNAL_SOURCES"; + /** * Activity Action: Show trusted credentials settings, opening to the user tab, * to allow management of installed credentials. diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 7f25cf3546398..8b4a576629ad9 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2480,14 +2480,14 @@ android:protectionLevel="signature" /> + android:protectionLevel="signature|appop" /> diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index 1339c50cf5ab4..88bc99fc14d72 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -3306,6 +3306,11 @@ message MetricsEvent { // ACTION: "Force stop" action on an app ACTION_APP_FORCE_STOP = 807; + // OPEN: Settings > Apps > Gear > Special Access > Install other apps + // CATEGORY: SETTINGS + // OS: 8.0 + MANAGE_EXTERNAL_SOURCES = 808; + // ---- End O Constants, all O constants go above this line ---- // Add new aosp constants above this line.