Adds Zen metrics categories
Assigns metrics categories to all modes pages under ZenModesListFragment. Includes new metrics categories where appropriate. Bug: 332937635 Test: Build and flash Flag: android.app.modes_ui Change-Id: Ic19862ec194b40eae294d3c30240fe3f51304665
This commit is contained in:
@@ -226,7 +226,10 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
|
|||||||
.setArguments(channelArgs)
|
.setArguments(channelArgs)
|
||||||
.setUserHandle(UserHandle.of(mAppRow.userId))
|
.setUserHandle(UserHandle.of(mAppRow.userId))
|
||||||
.setTitleRes(com.android.settings.R.string.notification_channel_title)
|
.setTitleRes(com.android.settings.R.string.notification_channel_title)
|
||||||
.setSourceMetricsCategory(SettingsEnums.DND_APPS_BYPASSING)
|
.setSourceMetricsCategory(
|
||||||
|
android.app.Flags.modesUi()
|
||||||
|
? SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APP_CHANNELS
|
||||||
|
: SettingsEnums.DND_APPS_BYPASSING)
|
||||||
.launch();
|
.launch();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@@ -40,7 +40,9 @@ public class AppChannelsBypassingDndSettings extends NotificationSettings {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return SettingsEnums.DND_APPS_BYPASSING;
|
return android.app.Flags.modesUi()
|
||||||
|
? SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APP_CHANNELS
|
||||||
|
: SettingsEnums.DND_APPS_BYPASSING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -25,6 +25,7 @@ import static android.app.AutomaticZenRule.TYPE_THEATER;
|
|||||||
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -164,7 +165,8 @@ public class SetupInterstitialActivity extends FragmentActivity {
|
|||||||
// they happen to go back. Forward the activity result in case we got here (indirectly)
|
// they happen to go back. Forward the activity result in case we got here (indirectly)
|
||||||
// from some app that is waiting for the result.
|
// from some app that is waiting for the result.
|
||||||
if (updated) {
|
if (updated) {
|
||||||
ZenSubSettingLauncher.forMode(this, modeId)
|
ZenSubSettingLauncher.forModeFragment(this, ZenModeFragment.class, modeId,
|
||||||
|
SettingsEnums.ZEN_MODE_INTERSTITIAL)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT).launch();
|
.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT).launch();
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
|
@@ -47,7 +47,6 @@ public class ZenModeAppsFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
return SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APPS;
|
||||||
return SettingsEnums.NOTIFICATION_ZEN_MODE_PRIORITY;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
|
|||||||
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
@@ -93,10 +94,9 @@ class ZenModeAppsLinkPreferenceController extends AbstractZenModePreferenceContr
|
|||||||
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(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
|
||||||
preference.setIntent(
|
preference.setIntent(
|
||||||
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeAppsFragment.class,
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeAppsFragment.class,
|
||||||
zenMode.getId(), 0).toIntent());
|
zenMode.getId(), SettingsEnums.ZEN_PRIORITY_MODE).toIntent());
|
||||||
preference.setEnabled(zenMode.isEnabled());
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
|
|
||||||
mZenMode = zenMode;
|
mZenMode = zenMode;
|
||||||
|
@@ -106,10 +106,9 @@ public class ZenModeAppsPreferenceController extends
|
|||||||
if (mModeId != null) {
|
if (mModeId != null) {
|
||||||
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, mModeId);
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, mModeId);
|
||||||
}
|
}
|
||||||
// TODO(b/332937635): Update metrics category
|
|
||||||
new SubSettingLauncher(mContext)
|
new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeSelectBypassingAppsFragment.class.getName())
|
.setDestination(ZenModeSelectBypassingAppsFragment.class.getName())
|
||||||
.setSourceMetricsCategory(SettingsEnums.SETTINGS_ZEN_NOTIFICATIONS)
|
.setSourceMetricsCategory(SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APPS)
|
||||||
.setArguments(bundle)
|
.setArguments(bundle)
|
||||||
.launch();
|
.launch();
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,6 @@ public class ZenModeCallsFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
|
||||||
return SettingsEnums.DND_CALLS;
|
return SettingsEnums.DND_CALLS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.notification.modes;
|
|||||||
|
|
||||||
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@@ -41,10 +42,9 @@ class ZenModeCallsLinkPreferenceController extends AbstractZenModePreferenceCont
|
|||||||
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(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeCallsFragment.class.getName())
|
.setDestination(ZenModeCallsFragment.class.getName())
|
||||||
.setSourceMetricsCategory(0)
|
.setSourceMetricsCategory(SettingsEnums.DND_PEOPLE)
|
||||||
.setArguments(bundle)
|
.setArguments(bundle)
|
||||||
.toIntent());
|
.toIntent());
|
||||||
preference.setSummary(mSummaryHelper.getCallsSettingSummary(zenMode));
|
preference.setSummary(mSummaryHelper.getCallsSettingSummary(zenMode));
|
||||||
|
@@ -54,7 +54,6 @@ public class ZenModeDisplayFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
return SettingsEnums.ZEN_MODE_DISPLAY_SETTINGS;
|
||||||
return SettingsEnums.DND_PEOPLE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.notification.modes;
|
|||||||
|
|
||||||
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@@ -41,10 +42,9 @@ class ZenModeDisplayLinkPreferenceController extends AbstractZenModePreferenceCo
|
|||||||
void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
|
||||||
preference.setIntent(
|
preference.setIntent(
|
||||||
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeDisplayFragment.class,
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeDisplayFragment.class,
|
||||||
zenMode.getId(), 0).toIntent());
|
zenMode.getId(), SettingsEnums.ZEN_PRIORITY_MODE).toIntent());
|
||||||
preference.setEnabled(zenMode.isEnabled());
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,8 +72,7 @@ public class ZenModeEditNameIconFragment extends ZenModeEditNameIconFragmentBase
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
return SettingsEnums.ZEN_MODE_EDIT_NAME_ICON;
|
||||||
return SettingsEnums.NOTIFICATION_ZEN_MODE_AUTOMATION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -129,8 +129,7 @@ public class ZenModeFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
return SettingsEnums.ZEN_PRIORITY_MODE;
|
||||||
return SettingsEnums.NOTIFICATION_ZEN_MODE_AUTOMATION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -164,9 +163,8 @@ public class ZenModeFragment extends ZenModeFragmentBase {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemSelected(@NonNull MenuItem menuItem) {
|
public boolean onMenuItemSelected(@NonNull MenuItem menuItem) {
|
||||||
if (menuItem.getItemId() == RENAME_MODE) {
|
if (menuItem.getItemId() == RENAME_MODE) {
|
||||||
// TODO: b/332937635 - Update metrics category
|
|
||||||
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeEditNameIconFragment.class,
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeEditNameIconFragment.class,
|
||||||
mZenMode.getId(), 0).launch();
|
mZenMode.getId(), getMetricsCategory()).launch();
|
||||||
} else if (menuItem.getItemId() == DELETE_MODE) {
|
} else if (menuItem.getItemId() == DELETE_MODE) {
|
||||||
new AlertDialog.Builder(mContext)
|
new AlertDialog.Builder(mContext)
|
||||||
.setTitle(mContext.getString(R.string.zen_mode_delete_mode_confirmation,
|
.setTitle(mContext.getString(R.string.zen_mode_delete_mode_confirmation,
|
||||||
|
@@ -46,7 +46,6 @@ public class ZenModeMessagesFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
|
||||||
return SettingsEnums.DND_MESSAGES;
|
return SettingsEnums.DND_MESSAGES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.notification.modes;
|
|||||||
|
|
||||||
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@@ -40,10 +41,9 @@ class ZenModeMessagesLinkPreferenceController extends AbstractZenModePreferenceC
|
|||||||
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(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeMessagesFragment.class.getName())
|
.setDestination(ZenModeMessagesFragment.class.getName())
|
||||||
.setSourceMetricsCategory(0)
|
.setSourceMetricsCategory(SettingsEnums.DND_PEOPLE)
|
||||||
.setArguments(bundle)
|
.setArguments(bundle)
|
||||||
.toIntent());
|
.toIntent());
|
||||||
|
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -50,15 +52,15 @@ public class ZenModeNewCustomFragment extends ZenModeEditNameIconFragmentBase {
|
|||||||
if (created != null) {
|
if (created != null) {
|
||||||
// Open the mode view fragment and close the "add mode" fragment, so exiting the mode
|
// Open the mode view fragment and close the "add mode" fragment, so exiting the mode
|
||||||
// view goes back to previous screen (which should be the modes list).
|
// view goes back to previous screen (which should be the modes list).
|
||||||
ZenSubSettingLauncher.forMode(requireContext(), created.getId()).launch();
|
ZenSubSettingLauncher.forModeFragment(requireContext(), ZenModeFragment.class,
|
||||||
|
created.getId(), getMetricsCategory()).launch();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
return SettingsEnums.ZEN_MODE_ADD_NEW;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.notification.modes;
|
|||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.service.notification.ZenPolicy;
|
import android.service.notification.ZenPolicy;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
|
|
||||||
@@ -57,7 +58,6 @@ public class ZenModeNotifVisFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
return SettingsEnums.ZEN_CUSTOM_RULE_VIS_EFFECTS;
|
||||||
return SettingsEnums.DND_PEOPLE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ 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 android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@@ -47,10 +48,9 @@ class ZenModeNotifVisLinkPreferenceController extends AbstractZenModePreferenceC
|
|||||||
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(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(new SubSettingLauncher(mContext)
|
||||||
.setDestination(ZenModeNotifVisFragment.class.getName())
|
.setDestination(ZenModeNotifVisFragment.class.getName())
|
||||||
.setSourceMetricsCategory(0)
|
.setSourceMetricsCategory(SettingsEnums.ZEN_MODE_DISPLAY_SETTINGS)
|
||||||
.setArguments(bundle)
|
.setArguments(bundle)
|
||||||
.toIntent());
|
.toIntent());
|
||||||
}
|
}
|
||||||
|
@@ -16,14 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_ALARMS;
|
|
||||||
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_EVENTS;
|
|
||||||
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_MEDIA;
|
|
||||||
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_REMINDERS;
|
|
||||||
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_SYSTEM;
|
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
|
|
||||||
@@ -58,7 +53,6 @@ public class ZenModeOtherFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
|
||||||
return SettingsEnums.NOTIFICATION_ZEN_MODE_PRIORITY;
|
return SettingsEnums.NOTIFICATION_ZEN_MODE_PRIORITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@ import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_MEDIA;
|
|||||||
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_REMINDERS;
|
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_REMINDERS;
|
||||||
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_SYSTEM;
|
import static android.service.notification.ZenPolicy.PRIORITY_CATEGORY_SYSTEM;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.service.notification.ZenPolicy;
|
import android.service.notification.ZenPolicy;
|
||||||
|
|
||||||
@@ -65,10 +66,9 @@ class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceCont
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
// TODO: b/332937635 - Update metrics category
|
|
||||||
preference.setIntent(
|
preference.setIntent(
|
||||||
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeOtherFragment.class,
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeOtherFragment.class,
|
||||||
zenMode.getId(), 0).toIntent());
|
zenMode.getId(), SettingsEnums.ZEN_PRIORITY_MODE).toIntent());
|
||||||
|
|
||||||
preference.setEnabled(zenMode.isEnabled());
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
preference.setSummary(mSummaryHelper.getOtherSoundCategoriesSummary(zenMode));
|
preference.setSummary(mSummaryHelper.getOtherSoundCategoriesSummary(zenMode));
|
||||||
|
@@ -48,7 +48,6 @@ public class ZenModePeopleFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
|
||||||
return SettingsEnums.DND_PEOPLE;
|
return SettingsEnums.DND_PEOPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@ import static android.service.notification.ZenPolicy.PEOPLE_TYPE_NONE;
|
|||||||
import static android.service.notification.ZenPolicy.PEOPLE_TYPE_STARRED;
|
import static android.service.notification.ZenPolicy.PEOPLE_TYPE_STARRED;
|
||||||
import static android.service.notification.ZenPolicy.STATE_ALLOW;
|
import static android.service.notification.ZenPolicy.STATE_ALLOW;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.LauncherApps;
|
import android.content.pm.LauncherApps;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@@ -88,10 +89,10 @@ class ZenModePeopleLinkPreferenceController extends AbstractZenModePreferenceCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
// TODO(b/332937635): Update metrics category
|
// Passes in source ZenModeFragment metric category.
|
||||||
preference.setIntent(
|
preference.setIntent(
|
||||||
ZenSubSettingLauncher.forModeFragment(mContext, ZenModePeopleFragment.class,
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModePeopleFragment.class,
|
||||||
zenMode.getId(), 0).toIntent());
|
zenMode.getId(), SettingsEnums.ZEN_PRIORITY_MODE).toIntent());
|
||||||
|
|
||||||
preference.setEnabled(zenMode.isEnabled());
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
preference.setSummary(mSummaryHelper.getPeopleSummary(zenMode.getPolicy()));
|
preference.setSummary(mSummaryHelper.getPeopleSummary(zenMode.getPolicy()));
|
||||||
|
@@ -270,10 +270,9 @@ class ZenModePrioritySendersPreferenceController
|
|||||||
mContext.startActivity(ALL_CONTACTS_INTENT);
|
mContext.startActivity(ALL_CONTACTS_INTENT);
|
||||||
} else if (KEY_ANY_CONVERSATIONS.equals(key)
|
} else if (KEY_ANY_CONVERSATIONS.equals(key)
|
||||||
|| KEY_IMPORTANT_CONVERSATIONS.equals(key)) {
|
|| KEY_IMPORTANT_CONVERSATIONS.equals(key)) {
|
||||||
// TODO: b/332937635 - set correct metrics category
|
|
||||||
new SubSettingLauncher(mContext)
|
new SubSettingLauncher(mContext)
|
||||||
.setDestination(ConversationListSettings.class.getName())
|
.setDestination(ConversationListSettings.class.getName())
|
||||||
.setSourceMetricsCategory(SettingsEnums.DND_CONVERSATIONS)
|
.setSourceMetricsCategory(SettingsEnums.DND_MESSAGES)
|
||||||
.launch();
|
.launch();
|
||||||
} else {
|
} else {
|
||||||
mContext.startActivity(FALLBACK_INTENT);
|
mContext.startActivity(FALLBACK_INTENT);
|
||||||
|
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -70,8 +71,7 @@ public class ZenModeScheduleChooserDialog extends InstrumentedDialogFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - Update metrics category
|
return SettingsEnums.ZEN_SCHEDULE_CHOOSER_DIALOG;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show(DashboardFragment parent, OnScheduleOptionListener optionListener) {
|
static void show(DashboardFragment parent, OnScheduleOptionListener optionListener) {
|
||||||
|
@@ -74,8 +74,7 @@ public class ZenModeSelectBypassingAppsFragment extends ZenModeFragmentBase impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO(b/332937635): Update metrics category
|
return SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APP;
|
||||||
return SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APPS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -46,7 +46,6 @@ public class ZenModeSetCalendarFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
|
||||||
return SettingsEnums.NOTIFICATION_ZEN_MODE_EVENT_RULE;
|
return SettingsEnums.NOTIFICATION_ZEN_MODE_EVENT_RULE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,6 @@ public class ZenModeSetScheduleFragment extends ZenModeFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - make this the correct metrics category
|
|
||||||
return SettingsEnums.NOTIFICATION_ZEN_MODE_SCHEDULE_RULE;
|
return SettingsEnums.NOTIFICATION_ZEN_MODE_SCHEDULE_RULE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,6 @@ public class ZenModeTimePickerFragment extends InstrumentedDialogFragment implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - set correct metrics category (or decide to keep this one?)
|
|
||||||
return SettingsEnums.DIALOG_ZEN_TIMEPICKER;
|
return SettingsEnums.DIALOG_ZEN_TIMEPICKER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ import static android.service.notification.ZenModeConfig.tryParseScheduleConditi
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@@ -97,9 +98,9 @@ class ZenModeTriggerUpdatePreferenceController extends AbstractZenModePreference
|
|||||||
|
|
||||||
private void setUpForSystemOwnedTrigger(Preference preference, ZenMode mode) {
|
private void setUpForSystemOwnedTrigger(Preference preference, ZenMode mode) {
|
||||||
if (mode.getType() == TYPE_SCHEDULE_TIME) {
|
if (mode.getType() == TYPE_SCHEDULE_TIME) {
|
||||||
// TODO: b/332937635 - set correct metrics category
|
|
||||||
preference.setIntent(ZenSubSettingLauncher.forModeFragment(mContext,
|
preference.setIntent(ZenSubSettingLauncher.forModeFragment(mContext,
|
||||||
ZenModeSetScheduleFragment.class, mode.getId(), 0).toIntent());
|
ZenModeSetScheduleFragment.class, mode.getId(),
|
||||||
|
SettingsEnums.ZEN_PRIORITY_MODE).toIntent());
|
||||||
|
|
||||||
// [Clock Icon] 9:00 - 17:00 / Sun-Mon
|
// [Clock Icon] 9:00 - 17:00 / Sun-Mon
|
||||||
preference.setIcon(com.android.internal.R.drawable.ic_zen_mode_type_schedule_time);
|
preference.setIcon(com.android.internal.R.drawable.ic_zen_mode_type_schedule_time);
|
||||||
@@ -115,9 +116,9 @@ class ZenModeTriggerUpdatePreferenceController extends AbstractZenModePreference
|
|||||||
preference.setSummary(null);
|
preference.setSummary(null);
|
||||||
}
|
}
|
||||||
} else if (mode.getType() == TYPE_SCHEDULE_CALENDAR) {
|
} else if (mode.getType() == TYPE_SCHEDULE_CALENDAR) {
|
||||||
// TODO: b/332937635 - set correct metrics category
|
|
||||||
preference.setIntent(ZenSubSettingLauncher.forModeFragment(mContext,
|
preference.setIntent(ZenSubSettingLauncher.forModeFragment(mContext,
|
||||||
ZenModeSetCalendarFragment.class, mode.getId(), 0).toIntent());
|
ZenModeSetCalendarFragment.class, mode.getId(),
|
||||||
|
SettingsEnums.ZEN_PRIORITY_MODE).toIntent());
|
||||||
|
|
||||||
// [Event Icon] Calendar Events / <Calendar name>
|
// [Event Icon] Calendar Events / <Calendar name>
|
||||||
preference.setIcon(
|
preference.setIcon(
|
||||||
|
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -56,8 +57,7 @@ public class ZenModesListAddModeTypeChooserDialog extends InstrumentedDialogFrag
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - Update metrics category
|
return SettingsEnums.ZEN_MODE_NEW_TYPE_CHOOSER_DIALOG;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show(DashboardFragment parent,
|
static void show(DashboardFragment parent,
|
||||||
|
@@ -74,8 +74,7 @@ public class ZenModesListFragment extends ZenModesFragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
// TODO: b/332937635 - add new & set metrics categories correctly
|
return SettingsEnums.ZEN_PRIORITY_MODES_LIST;
|
||||||
return SettingsEnums.NOTIFICATION_ZEN_MODE_AUTOMATION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onAvailableModeTypesForAdd(List<ModeType> types) {
|
private void onAvailableModeTypesForAdd(List<ModeType> types) {
|
||||||
@@ -97,10 +96,9 @@ public class ZenModesListFragment extends ZenModesFragmentBase {
|
|||||||
startActivityForResult(type.creationActivityIntent(), REQUEST_NEW_MODE);
|
startActivityForResult(type.creationActivityIntent(), REQUEST_NEW_MODE);
|
||||||
} else {
|
} else {
|
||||||
// Custom-manual mode -> "add a mode" screen.
|
// Custom-manual mode -> "add a mode" screen.
|
||||||
// TODO: b/332937635 - set metrics categories correctly
|
|
||||||
new SubSettingLauncher(requireContext())
|
new SubSettingLauncher(requireContext())
|
||||||
.setDestination(ZenModeNewCustomFragment.class.getName())
|
.setDestination(ZenModeNewCustomFragment.class.getName())
|
||||||
.setSourceMetricsCategory(0)
|
.setSourceMetricsCategory(SettingsEnums.ZEN_PRIORITY_MODES_LIST)
|
||||||
.launch();
|
.launch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +123,9 @@ public class ZenModesListFragment extends ZenModesFragmentBase {
|
|||||||
.filter(m -> m.getRule().getPackageName().equals(activityInvoked.getPackageName()))
|
.filter(m -> m.getRule().getPackageName().equals(activityInvoked.getPackageName()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
createdZenMode.ifPresent(
|
createdZenMode.ifPresent(
|
||||||
mode -> ZenSubSettingLauncher.forMode(mContext, mode.getId()).launch());
|
mode ->
|
||||||
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeFragment.class,
|
||||||
|
mode.getId(), getMetricsCategory()).launch());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.settings.notification.modes;
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -63,7 +64,8 @@ class ZenModesListItemPreference extends RestrictedPreference {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
ZenSubSettingLauncher.forMode(mContext, mZenMode.getId()).launch();
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeFragment.class, mZenMode.getId(),
|
||||||
|
SettingsEnums.ZEN_PRIORITY_MODES_LIST).launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZenMode(ZenMode zenMode) {
|
public void setZenMode(ZenMode zenMode) {
|
||||||
|
@@ -18,7 +18,6 @@ package com.android.settings.notification.modes;
|
|||||||
|
|
||||||
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@@ -26,12 +25,6 @@ import com.android.settings.core.SubSettingLauncher;
|
|||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
|
|
||||||
class ZenSubSettingLauncher {
|
class ZenSubSettingLauncher {
|
||||||
|
|
||||||
static SubSettingLauncher forMode(Context context, String modeId) {
|
|
||||||
return forModeFragment(context, ZenModeFragment.class, modeId,
|
|
||||||
SettingsEnums.NOTIFICATION_ZEN_MODE_AUTOMATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
static SubSettingLauncher forModeFragment(Context context,
|
static SubSettingLauncher forModeFragment(Context context,
|
||||||
Class<? extends DashboardFragment> fragmentClass, String modeId,
|
Class<? extends DashboardFragment> fragmentClass, String modeId,
|
||||||
int sourceMetricsCategory) {
|
int sourceMetricsCategory) {
|
||||||
|
@@ -34,6 +34,7 @@ import static org.mockito.Mockito.when;
|
|||||||
import static org.robolectric.Shadows.shadowOf;
|
import static org.robolectric.Shadows.shadowOf;
|
||||||
|
|
||||||
import android.app.Flags;
|
import android.app.Flags;
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@@ -163,7 +164,7 @@ public final class ZenModeAppsLinkPreferenceControllerTest {
|
|||||||
assertThat(launcherIntent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT))
|
assertThat(launcherIntent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT))
|
||||||
.isEqualTo("com.android.settings.notification.modes.ZenModeAppsFragment");
|
.isEqualTo("com.android.settings.notification.modes.ZenModeAppsFragment");
|
||||||
assertThat(launcherIntent.getIntExtra(MetricsFeatureProvider.EXTRA_SOURCE_METRICS_CATEGORY,
|
assertThat(launcherIntent.getIntExtra(MetricsFeatureProvider.EXTRA_SOURCE_METRICS_CATEGORY,
|
||||||
-1)).isEqualTo(0);
|
-1)).isEqualTo(SettingsEnums.ZEN_PRIORITY_MODE);
|
||||||
|
|
||||||
Bundle bundle = launcherIntent.getBundleExtra(
|
Bundle bundle = launcherIntent.getBundleExtra(
|
||||||
SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
|
SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
|
||||||
|
Reference in New Issue
Block a user