Merge "Implement API feedback for Safety Center QS" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-02-25 21:41:58 +00:00
committed by Android (Google) Code Review
7 changed files with 19 additions and 16 deletions

View File

@@ -10329,7 +10329,6 @@ package android.content {
field public static final String ACTION_VIEW_LOCUS = "android.intent.action.VIEW_LOCUS"; field public static final String ACTION_VIEW_LOCUS = "android.intent.action.VIEW_LOCUS";
field @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE) public static final String ACTION_VIEW_PERMISSION_USAGE = "android.intent.action.VIEW_PERMISSION_USAGE"; field @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE) public static final String ACTION_VIEW_PERMISSION_USAGE = "android.intent.action.VIEW_PERMISSION_USAGE";
field @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE) public static final String ACTION_VIEW_PERMISSION_USAGE_FOR_PERIOD = "android.intent.action.VIEW_PERMISSION_USAGE_FOR_PERIOD"; field @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE) public static final String ACTION_VIEW_PERMISSION_USAGE_FOR_PERIOD = "android.intent.action.VIEW_PERMISSION_USAGE_FOR_PERIOD";
field @RequiresPermission("android.permission.MANAGE_SENSOR_PRIVACY") public static final String ACTION_VIEW_SAFETY_HUB = "android.intent.action.VIEW_SAFETY_HUB";
field public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND"; field public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
field @Deprecated public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED"; field @Deprecated public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
field public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"; field public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH";

View File

@@ -3035,6 +3035,7 @@ package android.content {
field public static final String ACTION_USER_REMOVED = "android.intent.action.USER_REMOVED"; field public static final String ACTION_USER_REMOVED = "android.intent.action.USER_REMOVED";
field public static final String ACTION_USER_SWITCHED = "android.intent.action.USER_SWITCHED"; field public static final String ACTION_USER_SWITCHED = "android.intent.action.USER_SWITCHED";
field @RequiresPermission(android.Manifest.permission.START_VIEW_APP_FEATURES) public static final String ACTION_VIEW_APP_FEATURES = "android.intent.action.VIEW_APP_FEATURES"; field @RequiresPermission(android.Manifest.permission.START_VIEW_APP_FEATURES) public static final String ACTION_VIEW_APP_FEATURES = "android.intent.action.VIEW_APP_FEATURES";
field @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public static final String ACTION_VIEW_SAFETY_CENTER_QS = "android.intent.action.VIEW_SAFETY_CENTER_QS";
field public static final String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST"; 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 CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS";
field public static final String EXTRA_CALLING_PACKAGE = "android.intent.extra.CALLING_PACKAGE"; field public static final String EXTRA_CALLING_PACKAGE = "android.intent.extra.CALLING_PACKAGE";

View File

@@ -1073,7 +1073,7 @@ package android.hardware {
field public static final int DIALOG = 3; // 0x3 field public static final int DIALOG = 3; // 0x3
field public static final int OTHER = 5; // 0x5 field public static final int OTHER = 5; // 0x5
field public static final int QS_TILE = 1; // 0x1 field public static final int QS_TILE = 1; // 0x1
field public static final int SAFETY_HUB = 6; // 0x6 field public static final int SAFETY_CENTER = 6; // 0x6
field public static final int SETTINGS = 2; // 0x2 field public static final int SETTINGS = 2; // 0x2
field public static final int SHELL = 4; // 0x4 field public static final int SHELL = 4; // 0x4
} }

View File

@@ -2054,7 +2054,7 @@ public class Intent implements Parcelable, Cloneable {
"android.intent.action.VIEW_PERMISSION_USAGE_FOR_PERIOD"; "android.intent.action.VIEW_PERMISSION_USAGE_FOR_PERIOD";
/** /**
* Activity action: Launch the Safety Hub UI. * Activity action: Launch the Safety Center Quick Settings UI.
* *
* <p> * <p>
* Input: Nothing. * Input: Nothing.
@@ -2062,11 +2062,14 @@ public class Intent implements Parcelable, Cloneable {
* <p> * <p>
* Output: Nothing. * Output: Nothing.
* </p> * </p>
*
* @hide
*/ */
@SystemApi
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
@RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY) @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY)
public static final String ACTION_VIEW_SAFETY_HUB = public static final String ACTION_VIEW_SAFETY_CENTER_QS =
"android.intent.action.VIEW_SAFETY_HUB"; "android.intent.action.VIEW_SAFETY_CENTER_QS";
/** /**
* Activity action: Launch UI to manage a default app. * Activity action: Launch UI to manage a default app.

View File

@@ -136,9 +136,9 @@ public final class SensorPrivacyManager {
public static final int OTHER = SensorPrivacyToggleSourceProto.OTHER; public static final int OTHER = SensorPrivacyToggleSourceProto.OTHER;
/** /**
* Constant for SAFETY_HUB. * Constant for SAFETY_CENTER.
*/ */
public static final int SAFETY_HUB = SensorPrivacyToggleSourceProto.SAFETY_HUB; public static final int SAFETY_CENTER = SensorPrivacyToggleSourceProto.SAFETY_CENTER;
/** /**
* Source for toggling sensors * Source for toggling sensors
@@ -151,7 +151,7 @@ public final class SensorPrivacyManager {
DIALOG, DIALOG,
SHELL, SHELL,
OTHER, OTHER,
SAFETY_HUB SAFETY_CENTER
}) })
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface Source {} public @interface Source {}
@@ -652,7 +652,7 @@ public final class SensorPrivacyManager {
String packageName = mContext.getOpPackageName(); String packageName = mContext.getOpPackageName();
if (Objects.equals(packageName, if (Objects.equals(packageName,
mContext.getPackageManager().getPermissionControllerPackageName())) { mContext.getPackageManager().getPermissionControllerPackageName())) {
return Sources.SAFETY_HUB; return Sources.SAFETY_CENTER;
} }
return Sources.OTHER; return Sources.OTHER;
} }

View File

@@ -128,7 +128,7 @@ message SensorPrivacyToggleSourceProto {
DIALOG = 3; DIALOG = 3;
SHELL = 4; SHELL = 4;
OTHER = 5; OTHER = 5;
SAFETY_HUB = 6; SAFETY_CENTER = 6;
} }
// Source for which sensor privacy was toggled. // Source for which sensor privacy was toggled.

View File

@@ -118,7 +118,7 @@ class HeaderPrivacyIconsController @Inject constructor(
// If the privacy chip is visible, it means there were some indicators // If the privacy chip is visible, it means there were some indicators
uiEventLogger.log(PrivacyChipEvent.ONGOING_INDICATORS_CHIP_CLICK) uiEventLogger.log(PrivacyChipEvent.ONGOING_INDICATORS_CHIP_CLICK)
if (safetyCenterEnabled) { if (safetyCenterEnabled) {
showSafetyHub() showSafetyCenter()
} else { } else {
privacyDialogController.showDialog(privacyChip.context) privacyDialogController.showDialog(privacyChip.context)
} }
@@ -131,16 +131,16 @@ class HeaderPrivacyIconsController @Inject constructor(
updatePrivacyIconSlots() updatePrivacyIconSlots()
} }
private fun showSafetyHub() { private fun showSafetyCenter() {
backgroundExecutor.execute { backgroundExecutor.execute {
val usage = ArrayList(permGroupUsage()) val usage = ArrayList(permGroupUsage())
privacyLogger.logUnfilteredPermGroupUsage(usage) privacyLogger.logUnfilteredPermGroupUsage(usage)
val startSafetyHub = Intent(Intent.ACTION_VIEW_SAFETY_HUB) val startSafetyCenter = Intent(Intent.ACTION_VIEW_SAFETY_CENTER_QS)
startSafetyHub.putParcelableArrayListExtra(PermissionManager.EXTRA_PERMISSION_USAGES, startSafetyCenter.putParcelableArrayListExtra(PermissionManager.EXTRA_PERMISSION_USAGES,
usage) usage)
startSafetyHub.flags = Intent.FLAG_ACTIVITY_NEW_TASK startSafetyCenter.flags = Intent.FLAG_ACTIVITY_NEW_TASK
uiExecutor.execute { uiExecutor.execute {
activityStarter.startActivity(startSafetyHub, true, activityStarter.startActivity(startSafetyCenter, true,
ActivityLaunchAnimator.Controller.fromView(privacyChip)) ActivityLaunchAnimator.Controller.fromView(privacyChip))
} }
} }