Merge "Move the NotificationAccessConfirmationActivity component name to resource config so that it can be overlayed." into sc-v2-dev am: 9260cf2831

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15634240

Change-Id: I8a97b36fb9e58ba97cab7c96dbe85ec02a969c05
This commit is contained in:
Gaurav Bhola
2021-09-14 19:38:05 +00:00
committed by Automerger Merge Worker
4 changed files with 21 additions and 6 deletions

View File

@@ -17,19 +17,27 @@
package com.android.internal.notification; package com.android.internal.notification;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import com.android.internal.R;
/**
* This class provides methods to create intents for NotificationAccessConfirmationActivity.
*/
public final class NotificationAccessConfirmationActivityContract { public final class NotificationAccessConfirmationActivityContract {
private static final ComponentName COMPONENT_NAME = new ComponentName(
"com.android.settings",
"com.android.settings.notification.NotificationAccessConfirmationActivity");
public static final String EXTRA_USER_ID = "user_id"; public static final String EXTRA_USER_ID = "user_id";
public static final String EXTRA_COMPONENT_NAME = "component_name"; public static final String EXTRA_COMPONENT_NAME = "component_name";
public static final String EXTRA_PACKAGE_TITLE = "package_title"; public static final String EXTRA_PACKAGE_TITLE = "package_title";
public static Intent launcherIntent(int userId, ComponentName component, String packageTitle) { /**
* Creates a launcher intent for NotificationAccessConfirmationActivity.
*/
public static Intent launcherIntent(Context context, int userId, ComponentName component,
String packageTitle) {
return new Intent() return new Intent()
.setComponent(COMPONENT_NAME) .setComponent(ComponentName.unflattenFromString(context.getString(
R.string.config_notificationAccessConfirmationActivity)))
.putExtra(EXTRA_USER_ID, userId) .putExtra(EXTRA_USER_ID, userId)
.putExtra(EXTRA_COMPONENT_NAME, component) .putExtra(EXTRA_COMPONENT_NAME, component)
.putExtra(EXTRA_PACKAGE_TITLE, packageTitle); .putExtra(EXTRA_PACKAGE_TITLE, packageTitle);

View File

@@ -5174,6 +5174,12 @@
<item>@array/config_secondaryBuiltInDisplayWaterfallCutout</item> <item>@array/config_secondaryBuiltInDisplayWaterfallCutout</item>
</array> </array>
<!-- The component name of the activity for the companion-device-manager notification access
confirmation. -->
<string name="config_notificationAccessConfirmationActivity" translatable="false">
com.android.settings/com.android.settings.notification.NotificationAccessConfirmationActivity
</string>
<!-- Whether the airplane mode should be reset when device boots in non-safemode after exiting <!-- Whether the airplane mode should be reset when device boots in non-safemode after exiting
from safemode. from safemode.
This flag should be enabled only when the product does not have any UI to toggle airplane This flag should be enabled only when the product does not have any UI to toggle airplane

View File

@@ -2221,6 +2221,7 @@
<java-symbol type="bool" name="config_enableSecondaryLocationTimeZoneProvider" /> <java-symbol type="bool" name="config_enableSecondaryLocationTimeZoneProvider" />
<java-symbol type="string" name="config_secondaryLocationTimeZoneProviderPackageName" /> <java-symbol type="string" name="config_secondaryLocationTimeZoneProviderPackageName" />
<java-symbol type="bool" name="config_autoResetAirplaneMode" /> <java-symbol type="bool" name="config_autoResetAirplaneMode" />
<java-symbol type="string" name="config_notificationAccessConfirmationActivity" />
<java-symbol type="layout" name="resolver_list" /> <java-symbol type="layout" name="resolver_list" />
<java-symbol type="id" name="resolver_list" /> <java-symbol type="id" name="resolver_list" />

View File

@@ -566,7 +566,7 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
return PendingIntent.getActivityAsUser(getContext(), return PendingIntent.getActivityAsUser(getContext(),
0 /* request code */, 0 /* request code */,
NotificationAccessConfirmationActivityContract.launcherIntent( NotificationAccessConfirmationActivityContract.launcherIntent(
userId, component, packageTitle), getContext(), userId, component, packageTitle),
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_ONE_SHOT PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_ONE_SHOT
| PendingIntent.FLAG_CANCEL_CURRENT, | PendingIntent.FLAG_CANCEL_CURRENT,
null /* options */, null /* options */,