Migrate Settings intents
to our new modes ui Fixes: 333909883 Test: manual - created test app that launches each intent, launched each with flag on and flag off Test: atest com.android.settings.notification.modes Flag: android.app.modes_ui Change-Id: I8259b554fe34b453880890c667165547033ccd06
This commit is contained in:
@@ -125,6 +125,9 @@ android_library {
|
|||||||
"telephony-common",
|
"telephony-common",
|
||||||
"ims-common",
|
"ims-common",
|
||||||
],
|
],
|
||||||
|
flags_packages: [
|
||||||
|
"android.app.flags-aconfig",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_compat_config {
|
platform_compat_config {
|
||||||
@@ -155,6 +158,9 @@ android_app {
|
|||||||
optimize: {
|
optimize: {
|
||||||
proguard_flags_files: ["proguard.flags"],
|
proguard_flags_files: ["proguard.flags"],
|
||||||
},
|
},
|
||||||
|
flags_packages: [
|
||||||
|
"android.app.flags-aconfig",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
android_library_import {
|
android_library_import {
|
||||||
|
@@ -1287,20 +1287,63 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="Settings$ZenModeSettingsActivity"
|
android:name="Settings$ModesSettingsActivity"
|
||||||
android:label="@string/zen_mode_settings_title"
|
android:label="@string/zen_mode_settings_title"
|
||||||
android:icon="@drawable/ic_homepage_notification"
|
android:icon="@drawable/ic_homepage_notification"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="1"
|
||||||
|
android:featureFlag="android.app.modes_ui">
|
||||||
<action android:name="android.settings.ZEN_MODE_SETTINGS" />
|
<action android:name="android.settings.ZEN_MODE_SETTINGS" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="1"
|
||||||
|
android:featureFlag="android.app.modes_ui">
|
||||||
<action android:name="android.settings.ZEN_MODE_PRIORITY_SETTINGS" />
|
<action android:name="android.settings.ZEN_MODE_PRIORITY_SETTINGS" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter android:priority="41">
|
<intent-filter android:priority="41"
|
||||||
|
android:featureFlag="android.app.modes_ui">
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="com.android.settings.SHORTCUT" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter android:priority="10"
|
||||||
|
android:featureFlag="android.app.modes_ui">
|
||||||
|
<action android:name="android.settings.ZEN_MODE_AUTOMATION_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter android:priority="10"
|
||||||
|
android:featureFlag="android.app.modes_ui">
|
||||||
|
<action android:name="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
|
android:value="com.android.settings.notification.modes.ZenModesListFragment"/>
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
|
android:value="true" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="Settings$ZenModeSettingsActivity"
|
||||||
|
android:label="@string/zen_mode_settings_title"
|
||||||
|
android:icon="@drawable/ic_homepage_notification"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter android:priority="1"
|
||||||
|
android:featureFlag="!android.app.modes_ui">
|
||||||
|
<action android:name="android.settings.ZEN_MODE_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter android:priority="1"
|
||||||
|
android:featureFlag="!android.app.modes_ui">
|
||||||
|
<action android:name="android.settings.ZEN_MODE_PRIORITY_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter android:priority="41"
|
||||||
|
android:featureFlag="!android.app.modes_ui">
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="com.android.settings.SHORTCUT" />
|
<category android:name="com.android.settings.SHORTCUT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
@@ -1312,6 +1355,20 @@
|
|||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="Settings$ModeSettingsActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter android:priority="1"
|
||||||
|
android:featureFlag="android.app.modes_ui">
|
||||||
|
<action android:name="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
|
android:value="com.android.settings.notification.modes.ZenModeFragment"/>
|
||||||
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
|
android:value="true" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".notification.zen.ZenSuggestionActivity"
|
android:name=".notification.zen.ZenSuggestionActivity"
|
||||||
android:label="@string/zen_mode_settings_title"
|
android:label="@string/zen_mode_settings_title"
|
||||||
@@ -1351,11 +1408,13 @@
|
|||||||
android:label="@string/zen_mode_automation_settings_title"
|
android:label="@string/zen_mode_automation_settings_title"
|
||||||
android:icon="@drawable/ic_notifications"
|
android:icon="@drawable/ic_notifications"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="10"
|
||||||
|
android:featureFlag="!android.app.modes_ui">
|
||||||
<action android:name="android.settings.ZEN_MODE_AUTOMATION_SETTINGS" />
|
<action android:name="android.settings.ZEN_MODE_AUTOMATION_SETTINGS" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="10"
|
||||||
|
android:featureFlag="!android.app.modes_ui">
|
||||||
<action android:name="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS" />
|
<action android:name="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
@@ -18,6 +18,8 @@ package com.android.settings;
|
|||||||
|
|
||||||
import static android.provider.Settings.ACTION_PRIVACY_SETTINGS;
|
import static android.provider.Settings.ACTION_PRIVACY_SETTINGS;
|
||||||
|
|
||||||
|
import android.annotation.FlaggedApi;
|
||||||
|
import android.app.Flags;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -317,11 +319,13 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class PrintSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class PrintSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class PrintJobSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class PrintJobSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ZenModeSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ZenModeSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ZenModeBehaviorSettingsActivity extends SettingsActivity { /* empty */ }
|
|
||||||
public static class ZenModeBlockedEffectsSettingsActivity extends SettingsActivity { /* empty */ }
|
|
||||||
public static class ZenModeAutomationSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ZenModeAutomationSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ZenModeScheduleRuleSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ZenModeScheduleRuleSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ZenModeEventRuleSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ZenModeEventRuleSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@FlaggedApi(Flags.FLAG_MODES_UI)
|
||||||
|
public static class ModeSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@FlaggedApi(Flags.FLAG_MODES_UI)
|
||||||
|
public static class ModesSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class SoundSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class SoundSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ConfigureNotificationSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ConfigureNotificationSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ConversationListSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ConversationListSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@@ -162,6 +162,8 @@ import com.android.settings.notification.app.AppNotificationSettings;
|
|||||||
import com.android.settings.notification.app.ChannelNotificationSettings;
|
import com.android.settings.notification.app.ChannelNotificationSettings;
|
||||||
import com.android.settings.notification.app.ConversationListSettings;
|
import com.android.settings.notification.app.ConversationListSettings;
|
||||||
import com.android.settings.notification.history.NotificationStation;
|
import com.android.settings.notification.history.NotificationStation;
|
||||||
|
import com.android.settings.notification.modes.ZenModeFragment;
|
||||||
|
import com.android.settings.notification.modes.ZenModesListFragment;
|
||||||
import com.android.settings.notification.zen.ZenAccessSettings;
|
import com.android.settings.notification.zen.ZenAccessSettings;
|
||||||
import com.android.settings.notification.zen.ZenModeAutomationSettings;
|
import com.android.settings.notification.zen.ZenModeAutomationSettings;
|
||||||
import com.android.settings.notification.zen.ZenModeBlockedEffectsSettings;
|
import com.android.settings.notification.zen.ZenModeBlockedEffectsSettings;
|
||||||
@@ -396,6 +398,8 @@ public class SettingsGateway {
|
|||||||
CellularSecuritySettingsFragment.class.getName(),
|
CellularSecuritySettingsFragment.class.getName(),
|
||||||
AccessibilityHearingAidsFragment.class.getName(),
|
AccessibilityHearingAidsFragment.class.getName(),
|
||||||
HearingDevicePairingFragment.class.getName(),
|
HearingDevicePairingFragment.class.getName(),
|
||||||
|
ZenModesListFragment.class.getName(),
|
||||||
|
ZenModeFragment.class.getName()
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final String[] SETTINGS_FOR_RESTRICTED = {
|
public static final String[] SETTINGS_FOR_RESTRICTED = {
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -50,7 +50,7 @@ class ZenModeActionsPreferenceController extends AbstractZenModePreferenceContro
|
|||||||
buttonsPreference.setButton2Enabled(zenMode.canEditIcon());
|
buttonsPreference.setButton2Enabled(zenMode.canEditIcon());
|
||||||
buttonsPreference.setButton2OnClickListener(v -> {
|
buttonsPreference.setButton2OnClickListener(v -> {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(MODE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
new SubSettingLauncher(mContext)
|
new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeIconPickerFragment.class.getName())
|
.setDestination(ZenModeIconPickerFragment.class.getName())
|
||||||
// TODO: b/332937635 - Update metrics category
|
// TODO: b/332937635 - Update metrics category
|
||||||
|
@@ -17,8 +17,7 @@
|
|||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
||||||
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -72,7 +71,7 @@ class ZenModeAppsLinkPreferenceController extends AbstractZenModePreferenceContr
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(MODE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeAppsFragment.class.getName())
|
.setDestination(ZenModeAppsFragment.class.getName())
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -103,7 +103,7 @@ public class ZenModeAppsPreferenceController extends
|
|||||||
private void launchPrioritySettings() {
|
private void launchPrioritySettings() {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
if (mModeId != null) {
|
if (mModeId != null) {
|
||||||
bundle.putString(MODE_ID, mModeId);
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, mModeId);
|
||||||
}
|
}
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
new SubSettingLauncher(mContext)
|
new SubSettingLauncher(mContext)
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -39,7 +39,7 @@ class ZenModeCallsLinkPreferenceController extends AbstractZenModePreferenceCont
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(MODE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeCallsFragment.class.getName())
|
.setDestination(ZenModeCallsFragment.class.getName())
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -39,7 +39,7 @@ class ZenModeDisplayLinkPreferenceController extends AbstractZenModePreferenceCo
|
|||||||
@Override
|
@Override
|
||||||
void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(MODE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeDisplayFragment.class.getName())
|
.setDestination(ZenModeDisplayFragment.class.getName())
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.app.AutomaticZenRule;
|
import android.app.AutomaticZenRule;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -37,7 +39,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
abstract class ZenModeFragmentBase extends ZenModesFragmentBase {
|
abstract class ZenModeFragmentBase extends ZenModesFragmentBase {
|
||||||
static final String TAG = "ZenModeSettings";
|
static final String TAG = "ZenModeSettings";
|
||||||
static final String MODE_ID = "MODE_ID";
|
|
||||||
|
|
||||||
@Nullable // only until reloadMode() is called
|
@Nullable // only until reloadMode() is called
|
||||||
private ZenMode mZenMode;
|
private ZenMode mZenMode;
|
||||||
@@ -46,17 +47,21 @@ abstract class ZenModeFragmentBase extends ZenModesFragmentBase {
|
|||||||
public void onAttach(@NonNull Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
|
||||||
// TODO: b/322373473 - Update if modes page ends up using a different method of passing id
|
String id = null;
|
||||||
|
if (getActivity() != null && getActivity().getIntent() != null) {
|
||||||
|
id = getActivity().getIntent().getStringExtra(EXTRA_AUTOMATIC_ZEN_RULE_ID);
|
||||||
|
}
|
||||||
Bundle bundle = getArguments();
|
Bundle bundle = getArguments();
|
||||||
if (bundle != null && bundle.containsKey(MODE_ID)) {
|
if (id == null && bundle != null && bundle.containsKey(EXTRA_AUTOMATIC_ZEN_RULE_ID)) {
|
||||||
String id = bundle.getString(MODE_ID);
|
id = bundle.getString(EXTRA_AUTOMATIC_ZEN_RULE_ID);
|
||||||
if (!reloadMode(id)) {
|
}
|
||||||
Log.e(TAG, "Mode id " + id + " not found");
|
if (id == null) {
|
||||||
|
Log.d(TAG, "No id provided");
|
||||||
toastAndFinish();
|
toastAndFinish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
if (!reloadMode(id)) {
|
||||||
Log.e(TAG, "Mode id required to set mode config settings");
|
Log.d(TAG, "Mode id " + id + " not found");
|
||||||
toastAndFinish();
|
toastAndFinish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -38,7 +38,7 @@ class ZenModeMessagesLinkPreferenceController extends AbstractZenModePreferenceC
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(MODE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeMessagesFragment.class.getName())
|
.setDestination(ZenModeMessagesFragment.class.getName())
|
||||||
|
@@ -17,8 +17,7 @@
|
|||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
||||||
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -46,7 +45,7 @@ class ZenModeNotifVisLinkPreferenceController extends AbstractZenModePreferenceC
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(MODE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeNotifVisFragment.class.getName())
|
.setDestination(ZenModeNotifVisFragment.class.getName())
|
||||||
|
@@ -17,8 +17,7 @@
|
|||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
||||||
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -49,7 +48,7 @@ class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceCont
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(MODE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeOtherFragment.class.getName())
|
.setDestination(ZenModeOtherFragment.class.getName())
|
||||||
.setSourceMetricsCategory(0)
|
.setSourceMetricsCategory(0)
|
||||||
|
@@ -17,8 +17,7 @@
|
|||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
||||||
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -49,7 +48,7 @@ class ZenModePeopleLinkPreferenceController extends AbstractZenModePreferenceCon
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(MODE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModePeopleFragment.class.getName())
|
.setDestination(ZenModePeopleFragment.class.getName())
|
||||||
|
@@ -63,7 +63,6 @@ class ZenModeSetTriggerLinkPreferenceController extends AbstractZenModePreferenc
|
|||||||
}
|
}
|
||||||
switchPref.setChecked(zenMode.getRule().isEnabled());
|
switchPref.setChecked(zenMode.getRule().isEnabled());
|
||||||
switchPref.setOnPreferenceChangeListener(mSwitchChangeListener);
|
switchPref.setOnPreferenceChangeListener(mSwitchChangeListener);
|
||||||
|
|
||||||
switchPref.setSummary(zenMode.getRule().getTriggerDescription());
|
switchPref.setSummary(zenMode.getRule().getTriggerDescription());
|
||||||
switchPref.setIcon(null);
|
switchPref.setIcon(null);
|
||||||
switchPref.setOnPreferenceClickListener(null);
|
switchPref.setOnPreferenceClickListener(null);
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -33,7 +35,7 @@ class ZenSubSettingLauncher {
|
|||||||
Class<? extends ZenModeFragmentBase> fragmentClass, String modeId,
|
Class<? extends ZenModeFragmentBase> fragmentClass, String modeId,
|
||||||
int sourceMetricsCategory) {
|
int sourceMetricsCategory) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(ZenModeFragmentBase.MODE_ID, modeId);
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, modeId);
|
||||||
|
|
||||||
return new SubSettingLauncher(context)
|
return new SubSettingLauncher(context)
|
||||||
.setDestination(fragmentClass.getName())
|
.setDestination(fragmentClass.getName())
|
||||||
|
@@ -17,8 +17,7 @@
|
|||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY;
|
import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY;
|
||||||
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
import static com.android.settings.notification.modes.ZenModeFragmentBase.MODE_ID;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -138,7 +137,7 @@ public final class ZenModeAppsLinkPreferenceControllerTest {
|
|||||||
Bundle bundle = launcherIntent.getBundleExtra(
|
Bundle bundle = launcherIntent.getBundleExtra(
|
||||||
SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
|
SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
|
||||||
assertThat(bundle).isNotNull();
|
assertThat(bundle).isNotNull();
|
||||||
assertThat(bundle.getString(MODE_ID)).isEqualTo("id");
|
assertThat(bundle.getString(EXTRA_AUTOMATIC_ZEN_RULE_ID)).isEqualTo("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user