Settings changes for changing default for zen policy.
This change sets a rule's ZenPolicy to the device default right before entering the customization screen, rather than setting it to a copy of the global DND policy. Further, because all policies are now fully specified, when the MODES_API flag is on, skip the radio button screen for selecting between a default and a custom setting and jump straight to the page for setting custom settings. Bug: 312739308 Test: manual -- entered settings for rules created before and after V, modified settings, verified they took Change-Id: I1e3a777b60a8fcf06732879f823b033826a52a43
This commit is contained in:
@@ -19,7 +19,9 @@ package com.android.settings.notification.zen;
|
|||||||
import static android.app.NotificationManager.EXTRA_AUTOMATIC_RULE_ID;
|
import static android.app.NotificationManager.EXTRA_AUTOMATIC_RULE_ID;
|
||||||
|
|
||||||
import android.app.AutomaticZenRule;
|
import android.app.AutomaticZenRule;
|
||||||
|
import android.app.Flags;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -100,10 +102,21 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase {
|
|||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(ZenCustomRuleSettings.RULE_ID, mId);
|
bundle.putString(ZenCustomRuleSettings.RULE_ID, mId);
|
||||||
|
|
||||||
|
// When modes_api flag is on, we skip the radio button screen distinguishing
|
||||||
|
// between "default" and "custom" and take users directly to the custom
|
||||||
|
// settings screen.
|
||||||
|
String destination = ZenCustomRuleSettings.class.getName();
|
||||||
|
int sourceMetricsCategory = 0;
|
||||||
|
if (Flags.modesApi()) {
|
||||||
|
// From ZenRuleCustomPolicyPreferenceController#launchCustomSettings
|
||||||
|
destination = ZenCustomRuleConfigSettings.class.getName();
|
||||||
|
sourceMetricsCategory = SettingsEnums.ZEN_CUSTOM_RULE_SOUND_SETTINGS;
|
||||||
|
}
|
||||||
new SubSettingLauncher(mContext)
|
new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenCustomRuleSettings.class.getName())
|
.setDestination(destination)
|
||||||
.setArguments(bundle)
|
.setArguments(bundle)
|
||||||
.setSourceMetricsCategory(0) // TODO
|
.setSourceMetricsCategory(sourceMetricsCategory)
|
||||||
.launch();
|
.launch();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user