From 9a0573f2af6dac04fd53056010cd5450b8d3bbc7 Mon Sep 17 00:00:00 2001 From: Pyuli Naithani Date: Thu, 7 Oct 2021 18:24:21 +0000 Subject: [PATCH] Add an API for launching intent to view an apps list of services. Adding a new intent action for the permission controller or settings to ask an app to show its list of services to help the user understand the services that an app can own. We are adding a permission to protect this action to prevent non-system apps to access this. Test: compiles BUG: 188920241 Change-Id: Ie5b048fbc31580183ce88b148175f9b613d426f0 --- core/api/current.txt | 1 + core/api/system-current.txt | 1 + core/java/android/content/Intent.java | 20 ++++++++++++++++++++ core/res/AndroidManifest.xml | 9 +++++++++ core/res/res/values/strings.xml | 5 +++++ 5 files changed, 36 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index 0f0e928194fd0..0ba8de4684dce 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -169,6 +169,7 @@ package android { field public static final String SIGNAL_PERSISTENT_PROCESSES = "android.permission.SIGNAL_PERSISTENT_PROCESSES"; field @Deprecated public static final String SMS_FINANCIAL_TRANSACTIONS = "android.permission.SMS_FINANCIAL_TRANSACTIONS"; field public static final String START_FOREGROUND_SERVICES_FROM_BACKGROUND = "android.permission.START_FOREGROUND_SERVICES_FROM_BACKGROUND"; + field public static final String START_VIEW_APP_FEATURES = "android.permission.START_VIEW_APP_FEATURES"; field public static final String START_VIEW_PERMISSION_USAGE = "android.permission.START_VIEW_PERMISSION_USAGE"; field public static final String STATUS_BAR = "android.permission.STATUS_BAR"; field public static final String SYSTEM_ALERT_WINDOW = "android.permission.SYSTEM_ALERT_WINDOW"; diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 786b7876fb35c..8887c142640b8 100755 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -2448,6 +2448,7 @@ package android.content { field public static final String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP"; field public static final String ACTION_USER_ADDED = "android.intent.action.USER_ADDED"; field public static final String ACTION_USER_REMOVED = "android.intent.action.USER_REMOVED"; + field @RequiresPermission(android.Manifest.permission.START_VIEW_APP_FEATURES) public static final String ACTION_VIEW_APP_FEATURES = "android.intent.action.VIEW_APP_FEATURES"; field public static final String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST"; field public static final String CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS"; field public static final String EXTRA_CALLING_PACKAGE = "android.intent.extra.CALLING_PACKAGE"; diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index b2142550244c4..6446b44153ece 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -2346,6 +2346,26 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_MANAGE_PERMISSION_USAGE = "android.intent.action.MANAGE_PERMISSION_USAGE"; + /** + * Activity action: Launch UI to view the app's feature's information. + * + *

+ * Output: Nothing. + *

+ *

+ * You must protect the activity that handles this action with the + * {@link android.Manifest.permission#START_VIEW_APP_FEATURES} permission to ensure that + * only the system can launch this activity. The system will not launch activities + * that are not properly protected. + *

+ * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.START_VIEW_APP_FEATURES) + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_VIEW_APP_FEATURES = + "android.intent.action.VIEW_APP_FEATURES"; + // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Standard intent broadcast actions (see action variable). diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 9948b36eb7d56..a043e469962ae 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -5333,6 +5333,15 @@ android:description="@string/permdesc_startViewPermissionUsage" android:protectionLevel="signature|installer" /> + + + diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 6f4c7ab0af536..391c7dc3f6951 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1925,6 +1925,11 @@ Allows the holder to start the permission usage for an app. Should never be needed for normal apps. + + start view app features + + Allows the holder to start viewing the features info for an app. + access sensor data at a high sampling rate