Merge "Give mConsolidatedPolicy a default value" into rvc-dev

This commit is contained in:
Beverly Tai
2020-03-17 21:19:25 +00:00
committed by Android (Google) Code Review
3 changed files with 8 additions and 9 deletions

View File

@@ -5995,7 +5995,7 @@ package android.app {
method public android.service.notification.StatusBarNotification[] getActiveNotifications();
method public android.app.AutomaticZenRule getAutomaticZenRule(String);
method public java.util.Map<java.lang.String,android.app.AutomaticZenRule> getAutomaticZenRules();
method @Nullable public android.app.NotificationManager.Policy getConsolidatedNotificationPolicy();
method @NonNull public android.app.NotificationManager.Policy getConsolidatedNotificationPolicy();
method public final int getCurrentInterruptionFilter();
method public int getImportance();
method public android.app.NotificationChannel getNotificationChannel(String);

View File

@@ -1015,14 +1015,15 @@ public class NotificationManager {
}
/**
* Returns the currently applied notification policy.
*
* <p>
* Gets the currently applied notification policy. If {@link #getCurrentInterruptionFilter}
* is equal to {@link #INTERRUPTION_FILTER_ALL}, then the consolidated notification policy
* will match the default notification policy returned by {@link #getNotificationPolicy}.
* If {@link #getCurrentInterruptionFilter} is equal to {@link #INTERRUPTION_FILTER_ALL},
* then the consolidated notification policy will match the default notification policy
* returned by {@link #getNotificationPolicy}.
* </p>
*/
@Nullable
public NotificationManager.Policy getConsolidatedNotificationPolicy() {
public @NonNull NotificationManager.Policy getConsolidatedNotificationPolicy() {
INotificationManager service = getService();
try {
return service.getConsolidatedNotificationPolicy();

View File

@@ -141,6 +141,7 @@ public class ZenModeHelper {
updateDefaultAutomaticRuleNames();
mConfig = mDefaultConfig.copy();
mConfigs.put(UserHandle.USER_SYSTEM, mConfig);
mConsolidatedPolicy = mConfig.toNotificationPolicy();
mSettingsObserver = new SettingsObserver(mHandler);
mSettingsObserver.observe();
@@ -821,9 +822,6 @@ public class ZenModeHelper {
* @return a copy of the zen mode consolidated policy
*/
public Policy getConsolidatedNotificationPolicy() {
if (mConsolidatedPolicy == null) {
return null;
}
return mConsolidatedPolicy.copy();
}