Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64593a87 authored by Alexander Roederer's avatar Alexander Roederer
Browse files

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
parent 21ef3025
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -226,7 +226,10 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
                        .setArguments(channelArgs)
                        .setUserHandle(UserHandle.of(mAppRow.userId))
                        .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();
                return true;
            });
+3 −1
Original line number Diff line number Diff line
@@ -40,7 +40,9 @@ public class AppChannelsBypassingDndSettings extends NotificationSettings {

    @Override
    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
+3 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.app.AutomaticZenRule.TYPE_THEATER;
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;

import android.app.ActionBar;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
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)
            // from some app that is waiting for the result.
            if (updated) {
                ZenSubSettingLauncher.forMode(this, modeId)
                ZenSubSettingLauncher.forModeFragment(this, ZenModeFragment.class, modeId,
                                SettingsEnums.ZEN_MODE_INTERSTITIAL)
                        .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT).launch();
            }
            finish();
+1 −2
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ public class ZenModeAppsFragment extends ZenModeFragmentBase {

    @Override
    public int getMetricsCategory() {
        // TODO: b/332937635 - make this the correct metrics category
        return SettingsEnums.NOTIFICATION_ZEN_MODE_PRIORITY;
        return SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APPS;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;

import android.app.Application;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.Bundle;
import android.os.UserHandle;
@@ -93,10 +94,9 @@ class ZenModeAppsLinkPreferenceController extends AbstractZenModePreferenceContr
    public void updateState(Preference preference, @NonNull ZenMode zenMode) {
        Bundle bundle = new Bundle();
        bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
        // TODO(b/332937635): Update metrics category
        preference.setIntent(
                ZenSubSettingLauncher.forModeFragment(mContext, ZenModeAppsFragment.class,
                        zenMode.getId(), 0).toIntent());
                        zenMode.getId(), SettingsEnums.ZEN_PRIORITY_MODE).toIntent());
        preference.setEnabled(zenMode.isEnabled());

        mZenMode = zenMode;
Loading