Special handling for intent coming from "welcome" notification.

This notification is an introduction to new notification permission changes in T and is shown to the user upon upgrade; this change records that the user has seen/interacted with the notification already so we don't have to keep showing it.

This change essentially makes a copy of the existing functionality of NotificationAppListActivity, but meant only for access internally (so that neither the activity nor the associated action is exported/publicly accessible).

Bug: 225373531
Test: manual with the change that sends the notification
Change-Id: I20c6084652ea11a8d0a002a21561fe50b9cf5de3
This commit is contained in:
Yuri Lin
2022-04-12 17:05:49 -04:00
parent e79605c652
commit 554ab1fe3e
3 changed files with 31 additions and 3 deletions

View File

@@ -3319,6 +3319,22 @@
android:value="@string/menu_key_notifications"/> android:value="@string/menu_key_notifications"/>
</activity> </activity>
<!-- Application-level notification settings page, same as above but only accessible
internally from system server -->
<activity android:name="Settings$NotificationReviewPermissionsActivity"
android:label="@string/app_notifications_title"
android:icon="@drawable/ic_notifications"
android:exported="false">
<intent-filter android:priority="1">
<action android:name="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.manageapplications.ManageApplications" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_notifications"/>
</activity>
<!-- Show application-level notification settings (app passed in as extras) --> <!-- Show application-level notification settings (app passed in as extras) -->
<activity android:name="Settings$AppNotificationSettingsActivity" <activity android:name="Settings$AppNotificationSettingsActivity"
android:exported="true"> android:exported="true">

View File

@@ -295,6 +295,7 @@ public class Settings extends SettingsActivity {
public static class AppBubbleNotificationSettingsActivity extends SettingsActivity { /* empty */ } public static class AppBubbleNotificationSettingsActivity extends SettingsActivity { /* empty */ }
public static class NotificationAssistantSettingsActivity extends SettingsActivity{ /* empty */ } public static class NotificationAssistantSettingsActivity extends SettingsActivity{ /* empty */ }
public static class NotificationAppListActivity extends SettingsActivity { /* empty */ } public static class NotificationAppListActivity extends SettingsActivity { /* empty */ }
public static class NotificationReviewPermissionsActivity extends SettingsActivity { /* empty */ }
public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ } public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
public static class ChannelNotificationSettingsActivity extends SettingsActivity { /* empty */ } public static class ChannelNotificationSettingsActivity extends SettingsActivity { /* empty */ }
public static class ChannelGroupNotificationSettingsActivity extends SettingsActivity { /* empty */ } public static class ChannelGroupNotificationSettingsActivity extends SettingsActivity { /* empty */ }

View File

@@ -319,12 +319,21 @@ public class ManageApplications extends InstrumentedFragment
mListType = LIST_TYPE_MEDIA_MANAGEMENT_APPS; mListType = LIST_TYPE_MEDIA_MANAGEMENT_APPS;
} else if (className.equals(Settings.AlarmsAndRemindersActivity.class.getName())) { } else if (className.equals(Settings.AlarmsAndRemindersActivity.class.getName())) {
mListType = LIST_TYPE_ALARMS_AND_REMINDERS; mListType = LIST_TYPE_ALARMS_AND_REMINDERS;
} else if (className.equals(Settings.NotificationAppListActivity.class.getName())) { } else if (className.equals(Settings.NotificationAppListActivity.class.getName())
|| className.equals(
Settings.NotificationReviewPermissionsActivity.class.getName())) {
mListType = LIST_TYPE_NOTIFICATION; mListType = LIST_TYPE_NOTIFICATION;
mUsageStatsManager = IUsageStatsManager.Stub.asInterface( mUsageStatsManager = IUsageStatsManager.Stub.asInterface(
ServiceManager.getService(Context.USAGE_STATS_SERVICE)); ServiceManager.getService(Context.USAGE_STATS_SERVICE));
mNotificationBackend = new NotificationBackend(); mNotificationBackend = new NotificationBackend();
mSortOrder = R.id.sort_order_recent_notification; mSortOrder = R.id.sort_order_recent_notification;
if (className.equals(Settings.NotificationReviewPermissionsActivity.class.getName())) {
// Special-case for a case where a user is directed to the all apps notification
// preferences page via a notification prompt to review permissions settings.
android.provider.Settings.Secure.putInt(getContext().getContentResolver(),
android.provider.Settings.Secure.REVIEW_PERMISSIONS_NOTIFICATION_STATE,
1); // USER_INTERACTED
}
} else if (className.equals(AppLocaleDetails.class.getName())) { } else if (className.equals(AppLocaleDetails.class.getName())) {
mListType = LIST_TYPE_APPS_LOCALE; mListType = LIST_TYPE_APPS_LOCALE;
} else { } else {
@@ -915,7 +924,9 @@ public class ManageApplications extends InstrumentedFragment
screenTitle = R.string.media_management_apps_title; screenTitle = R.string.media_management_apps_title;
} else if (className.equals(Settings.AlarmsAndRemindersActivity.class.getName())) { } else if (className.equals(Settings.AlarmsAndRemindersActivity.class.getName())) {
screenTitle = R.string.alarms_and_reminders_title; screenTitle = R.string.alarms_and_reminders_title;
} else if (className.equals(Settings.NotificationAppListActivity.class.getName())) { } else if (className.equals(Settings.NotificationAppListActivity.class.getName())
|| className.equals(
Settings.NotificationReviewPermissionsActivity.class.getName())) {
screenTitle = R.string.app_notifications_title; screenTitle = R.string.app_notifications_title;
} else if (className.equals(AppLocaleDetails.class.getName())) { } else if (className.equals(AppLocaleDetails.class.getName())) {
screenTitle = R.string.app_locales_picker_menu_title; screenTitle = R.string.app_locales_picker_menu_title;