Extract the not-strictly-modes-related parts of ZenModesBackend
So that when it's moved to SettingsLib, it doesn't need to carry that baggage. Bug: 346519570 Test: atest com.android.settings.notification.modes Flag: android.app.modes_ui Change-Id: I7911a521d96f5dbac2c2395171d324b7b54b8b07
This commit is contained in:
@@ -357,19 +357,6 @@ public class NotificationBackend {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all of a user's packages that have at least one channel that will bypass DND
|
||||
*/
|
||||
public List<String> getPackagesBypassingDnd(int userId,
|
||||
boolean includeConversationChannels) {
|
||||
try {
|
||||
return sINM.getPackagesBypassingDnd(userId, includeConversationChannels);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateChannel(String pkg, int uid, NotificationChannel channel) {
|
||||
try {
|
||||
sINM.updateNotificationChannelForPackage(pkg, uid, channel);
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.notification.modes;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.INotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ParceledListSlice;
|
||||
import android.database.Cursor;
|
||||
import android.os.ServiceManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.service.notification.ConversationChannelWrapper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class used for Settings-system_server interactions that are not <em>directly</em> related to
|
||||
* Mode management, but still used in the UI of its Settings pages (such as listing priority
|
||||
* conversations, contacts, etc).
|
||||
*/
|
||||
class ZenHelperBackend {
|
||||
|
||||
private static final String TAG = "ZenHelperBackend";
|
||||
|
||||
@Nullable // Until first usage
|
||||
private static ZenHelperBackend sInstance;
|
||||
|
||||
private final Context mContext;
|
||||
private final INotificationManager mInm;
|
||||
|
||||
static ZenHelperBackend getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new ZenHelperBackend(context.getApplicationContext());
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
ZenHelperBackend(Context context) {
|
||||
mContext = context;
|
||||
mInm = INotificationManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all of a user's packages that have at least one channel that will bypass DND
|
||||
*/
|
||||
List<String> getPackagesBypassingDnd(int userId,
|
||||
boolean includeConversationChannels) {
|
||||
try {
|
||||
return mInm.getPackagesBypassingDnd(userId, includeConversationChannels);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ParceledListSlice<ConversationChannelWrapper> getConversations(boolean onlyImportant) {
|
||||
try {
|
||||
return mInm.getConversations(onlyImportant);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return ParceledListSlice.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
List<String> getStarredContacts() {
|
||||
try (Cursor cursor = queryStarredContactsData()) {
|
||||
return getStarredContacts(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
List<String> getStarredContacts(Cursor cursor) {
|
||||
List<String> starredContacts = new ArrayList<>();
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
do {
|
||||
String contact = cursor.getString(0);
|
||||
starredContacts.add(contact != null ? contact :
|
||||
mContext.getString(R.string.zen_mode_starred_contacts_empty_name));
|
||||
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
return starredContacts;
|
||||
}
|
||||
|
||||
private Cursor queryStarredContactsData() {
|
||||
return mContext.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
|
||||
new String[]{ContactsContract.Contacts.DISPLAY_NAME_PRIMARY},
|
||||
ContactsContract.Data.STARRED + "=1", null,
|
||||
ContactsContract.Data.TIMES_CONTACTED);
|
||||
}
|
||||
|
||||
Cursor queryAllContactsData() {
|
||||
return mContext.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
|
||||
new String[]{ContactsContract.Contacts.DISPLAY_NAME_PRIMARY},
|
||||
null, null, null);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.notification.NotificationBackend;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -47,14 +46,16 @@ class ZenModeAppsLinkPreferenceController extends AbstractZenModePreferenceContr
|
||||
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
private ApplicationsState.Session mAppSession;
|
||||
private NotificationBackend mNotificationBackend = new NotificationBackend();
|
||||
private final ZenHelperBackend mHelperBackend;
|
||||
private ZenMode mZenMode;
|
||||
private Preference mPreference;
|
||||
|
||||
ZenModeAppsLinkPreferenceController(Context context, String key, Fragment host,
|
||||
ApplicationsState applicationsState, ZenModesBackend backend) {
|
||||
ApplicationsState applicationsState, ZenModesBackend backend,
|
||||
ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(mContext, mBackend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(mContext, helperBackend);
|
||||
mHelperBackend = helperBackend;
|
||||
if (applicationsState != null && host != null) {
|
||||
mAppSession = applicationsState.newSession(mAppSessionCallbacks, host.getLifecycle());
|
||||
}
|
||||
@@ -105,7 +106,7 @@ class ZenModeAppsLinkPreferenceController extends AbstractZenModePreferenceContr
|
||||
pkgLabelMap.put(entry.info.packageName, entry.label);
|
||||
}
|
||||
}
|
||||
for (String pkg : mNotificationBackend.getPackagesBypassingDnd(mContext.getUserId(),
|
||||
for (String pkg : mHelperBackend.getPackagesBypassingDnd(mContext.getUserId(),
|
||||
/* includeConversationChannels= */ false)) {
|
||||
// Settings may hide some packages from the user, so if they're not present here
|
||||
// we skip displaying them, even if they bypass dnd.
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.settings.notification.modes;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
@@ -34,7 +35,7 @@ public class ZenModeCallsFragment extends ZenModeFragmentBase {
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new ZenModePrioritySendersPreferenceController(context,
|
||||
"zen_mode_settings_category_calls", false, mBackend));
|
||||
"zen_mode_settings_category_calls", false, mBackend, mHelperBackend));
|
||||
controllers.add(new ZenModeRepeatCallersPreferenceController(context,
|
||||
"zen_mode_repeat_callers", mBackend,
|
||||
context.getResources().getInteger(com.android.internal.R.integer
|
||||
|
||||
@@ -31,9 +31,9 @@ class ZenModeCallsLinkPreferenceController extends AbstractZenModePreferenceCont
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModeCallsLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend) {
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(context, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(context, helperBackend);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.settings.notification.modes;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
@@ -34,7 +35,7 @@ public class ZenModeDisplayFragment extends ZenModeFragmentBase {
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
List<AbstractPreferenceController> prefControllers = new ArrayList<>();
|
||||
prefControllers.add(new ZenModeNotifVisLinkPreferenceController(
|
||||
context, "notification_visibility", mBackend));
|
||||
context, "notification_visibility", mBackend, mHelperBackend));
|
||||
prefControllers.add(new ZenModeDisplayEffectPreferenceController(
|
||||
context, "effect_greyscale", mBackend));
|
||||
prefControllers.add(new ZenModeDisplayEffectPreferenceController(
|
||||
|
||||
@@ -31,9 +31,9 @@ class ZenModeDisplayLinkPreferenceController extends AbstractZenModePreferenceCo
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModeDisplayLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend) {
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(context, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(context, helperBackend);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,15 +42,15 @@ public class ZenModeFragment extends ZenModeFragmentBase {
|
||||
prefControllers.add(new ZenModeButtonPreferenceController(context, "activate", mBackend));
|
||||
prefControllers.add(new ZenModeActionsPreferenceController(context, "actions", mBackend));
|
||||
prefControllers.add(new ZenModePeopleLinkPreferenceController(
|
||||
context, "zen_mode_people", mBackend));
|
||||
context, "zen_mode_people", mBackend, mHelperBackend));
|
||||
prefControllers.add(new ZenModeAppsLinkPreferenceController(
|
||||
context, "zen_mode_apps", this,
|
||||
ApplicationsState.getInstance((Application) context.getApplicationContext()),
|
||||
mBackend));
|
||||
mBackend, mHelperBackend));
|
||||
prefControllers.add(new ZenModeOtherLinkPreferenceController(
|
||||
context, "zen_other_settings", mBackend));
|
||||
context, "zen_other_settings", mBackend, mHelperBackend));
|
||||
prefControllers.add(new ZenModeDisplayLinkPreferenceController(
|
||||
context, "mode_display_settings", mBackend));
|
||||
context, "mode_display_settings", mBackend, mHelperBackend));
|
||||
prefControllers.add(new ZenModeSetTriggerLinkPreferenceController(context,
|
||||
"zen_automatic_trigger_category", mBackend));
|
||||
return prefControllers;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.settings.notification.modes;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
@@ -34,7 +35,7 @@ public class ZenModeMessagesFragment extends ZenModeFragmentBase {
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new ZenModePrioritySendersPreferenceController(context,
|
||||
"zen_mode_settings_category_messages", true, mBackend));
|
||||
"zen_mode_settings_category_messages", true, mBackend, mHelperBackend));
|
||||
return controllers;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ class ZenModeMessagesLinkPreferenceController extends AbstractZenModePreferenceC
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModeMessagesLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend) {
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(context, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(context, helperBackend);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,9 +31,9 @@ class ZenModeNotifVisLinkPreferenceController extends AbstractZenModePreferenceC
|
||||
private final ZenModeSummaryHelper mSummaryBuilder;
|
||||
|
||||
public ZenModeNotifVisLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend) {
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
mSummaryBuilder = new ZenModeSummaryHelper(context, backend);
|
||||
mSummaryBuilder = new ZenModeSummaryHelper(context, helperBackend);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,9 +34,9 @@ class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceCont
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModeOtherLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend) {
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(mContext, mBackend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(mContext, helperBackend);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.settings.notification.modes;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
@@ -34,9 +35,9 @@ public class ZenModePeopleFragment extends ZenModeFragmentBase {
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
List<AbstractPreferenceController> prefControllers = new ArrayList<>();
|
||||
prefControllers.add(new ZenModeCallsLinkPreferenceController(
|
||||
context, "zen_mode_people_calls", mBackend));
|
||||
context, "zen_mode_people_calls", mBackend, mHelperBackend));
|
||||
prefControllers.add(new ZenModeMessagesLinkPreferenceController(
|
||||
context, "zen_mode_people_messages", mBackend));
|
||||
context, "zen_mode_people_messages", mBackend, mHelperBackend));
|
||||
return prefControllers;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ class ZenModePeopleLinkPreferenceController extends AbstractZenModePreferenceCon
|
||||
private final ZenModeSummaryHelper mSummaryHelper;
|
||||
|
||||
public ZenModePeopleLinkPreferenceController(Context context, String key,
|
||||
ZenModesBackend backend) {
|
||||
ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(mContext, mBackend);
|
||||
mSummaryHelper = new ZenModeSummaryHelper(mContext, helperBackend);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -83,6 +83,7 @@ class ZenModePrioritySendersPreferenceController
|
||||
private static final Intent FALLBACK_INTENT = new Intent(Intent.ACTION_MAIN)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
|
||||
private final ZenHelperBackend mHelperBackend;
|
||||
private final PackageManager mPackageManager;
|
||||
private PreferenceCategory mPreferenceCategory;
|
||||
private List<SelectorWithWidgetPreference> mSelectorPreferences = new ArrayList<>();
|
||||
@@ -90,9 +91,10 @@ class ZenModePrioritySendersPreferenceController
|
||||
private final ZenModeSummaryHelper mZenModeSummaryHelper;
|
||||
|
||||
public ZenModePrioritySendersPreferenceController(Context context, String key,
|
||||
boolean isMessages, ZenModesBackend backend) {
|
||||
boolean isMessages, ZenModesBackend backend, ZenHelperBackend helperBackend) {
|
||||
super(context, key, backend);
|
||||
mIsMessages = isMessages;
|
||||
mHelperBackend = helperBackend;
|
||||
|
||||
String contactsPackage = context.getString(R.string.config_contacts_package_name);
|
||||
ALL_CONTACTS_INTENT.setPackage(contactsPackage);
|
||||
@@ -103,7 +105,7 @@ class ZenModePrioritySendersPreferenceController
|
||||
if (!FALLBACK_INTENT.hasCategory(Intent.CATEGORY_APP_CONTACTS)) {
|
||||
FALLBACK_INTENT.addCategory(Intent.CATEGORY_APP_CONTACTS);
|
||||
}
|
||||
mZenModeSummaryHelper = new ZenModeSummaryHelper(mContext, mBackend);
|
||||
mZenModeSummaryHelper = new ZenModeSummaryHelper(mContext, mHelperBackend);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,7 +166,7 @@ class ZenModePrioritySendersPreferenceController
|
||||
|
||||
private void updateChannelCounts() {
|
||||
ParceledListSlice<ConversationChannelWrapper> impConversations =
|
||||
mBackend.getConversations(true);
|
||||
mHelperBackend.getConversations(true);
|
||||
int numImportantConversations = 0;
|
||||
if (impConversations != null) {
|
||||
for (ConversationChannelWrapper conversation : impConversations.getList()) {
|
||||
|
||||
@@ -60,9 +60,9 @@ import java.util.function.Predicate;
|
||||
class ZenModeSummaryHelper {
|
||||
|
||||
private final Context mContext;
|
||||
private final ZenModesBackend mBackend;
|
||||
private final ZenHelperBackend mBackend;
|
||||
|
||||
public ZenModeSummaryHelper(Context context, ZenModesBackend backend) {
|
||||
ZenModeSummaryHelper(Context context, ZenHelperBackend backend) {
|
||||
mContext = context;
|
||||
mBackend = backend;
|
||||
}
|
||||
|
||||
@@ -19,24 +19,15 @@ package com.android.settings.notification.modes;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AutomaticZenRule;
|
||||
import android.app.INotificationManager;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ParceledListSlice;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.ServiceManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.Settings;
|
||||
import android.service.notification.Condition;
|
||||
import android.service.notification.ConversationChannelWrapper;
|
||||
import android.service.notification.SystemZenRules;
|
||||
import android.service.notification.ZenAdapters;
|
||||
import android.service.notification.ZenModeConfig;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import java.time.Duration;
|
||||
@@ -58,8 +49,6 @@ class ZenModesBackend {
|
||||
private static ZenModesBackend sInstance;
|
||||
|
||||
private final NotificationManager mNotificationManager;
|
||||
static INotificationManager sINM = INotificationManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
@@ -113,54 +102,6 @@ class ZenModesBackend {
|
||||
}
|
||||
}
|
||||
|
||||
public ParceledListSlice<ConversationChannelWrapper> getConversations(boolean onlyImportant) {
|
||||
try {
|
||||
return sINM.getConversations(onlyImportant);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return ParceledListSlice.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getStarredContacts() {
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = queryStarredContactsData();
|
||||
return getStarredContacts(cursor);
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
List<String> getStarredContacts(Cursor cursor) {
|
||||
List<String> starredContacts = new ArrayList<>();
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
do {
|
||||
String contact = cursor.getString(0);
|
||||
starredContacts.add(contact != null ? contact :
|
||||
mContext.getString(R.string.zen_mode_starred_contacts_empty_name));
|
||||
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
return starredContacts;
|
||||
}
|
||||
|
||||
private Cursor queryStarredContactsData() {
|
||||
return mContext.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
|
||||
new String[]{ContactsContract.Contacts.DISPLAY_NAME_PRIMARY},
|
||||
ContactsContract.Data.STARRED + "=1", null,
|
||||
ContactsContract.Data.TIMES_CONTACTED);
|
||||
}
|
||||
|
||||
Cursor queryAllContactsData() {
|
||||
return mContext.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
|
||||
new String[]{ContactsContract.Contacts.DISPLAY_NAME_PRIMARY},
|
||||
null, null, null);
|
||||
}
|
||||
|
||||
private ZenMode getManualDndMode(ZenModeConfig config) {
|
||||
ZenModeConfig.ZenRule manualRule = config.manualRule;
|
||||
// TODO: b/333682392 - Replace with final strings for name & trigger description
|
||||
|
||||
@@ -41,6 +41,7 @@ abstract class ZenModesFragmentBase extends RestrictedDashboardFragment {
|
||||
protected Context mContext;
|
||||
|
||||
protected ZenModesBackend mBackend;
|
||||
protected ZenHelperBackend mHelperBackend;
|
||||
|
||||
// Individual pages must implement this method based on what they should do when
|
||||
// the device's zen mode state changes.
|
||||
@@ -59,6 +60,7 @@ abstract class ZenModesFragmentBase extends RestrictedDashboardFragment {
|
||||
public void onAttach(@NonNull Context context) {
|
||||
mContext = context;
|
||||
mBackend = ZenModesBackend.getInstance(context);
|
||||
mHelperBackend = ZenHelperBackend.getInstance(context);
|
||||
super.onAttach(context);
|
||||
mSettingsObserver.register();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user