Loading src/com/android/settings/notification/AppNotificationSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ public class AppNotificationSettings extends NotificationSettingsBase { mControllers.add(new VibrationPreferenceController(context, mBackend)); mControllers.add(new VisibilityPreferenceController(context, new LockPatternUtils(context), mBackend)); mControllers.add(new DndPreferenceController(context, getLifecycle(), mBackend)); mControllers.add(new DndPreferenceController(context, mBackend)); mControllers.add(new AppLinkPreferenceController(context)); mControllers.add(new DescriptionPreferenceController(context)); mControllers.add(new NotificationsOffPreferenceController(context)); Loading src/com/android/settings/notification/ChannelNotificationSettings.java +17 −1 Original line number Diff line number Diff line Loading @@ -18,13 +18,16 @@ package com.android.settings.notification; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.preference.PreferenceScreen; import android.text.TextUtils; import android.util.Log; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.widget.LockPatternUtils; import com.android.settings.R; import com.android.settings.applications.AppInfoBase; import com.android.settingslib.core.AbstractPreferenceController; import java.util.ArrayList; Loading @@ -38,6 +41,19 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { return MetricsEvent.NOTIFICATION_TOPIC_NOTIFICATION; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final PreferenceScreen screen = getPreferenceScreen(); Bundle args = getArguments(); // If linking to this screen from an external app, expand settings if (screen != null && args != null) { if (!args.getBoolean(ARG_FROM_SETTINGS, false)) { screen.setInitialExpandedChildrenCount(Integer.MAX_VALUE); } } } @Override public void onResume() { super.onResume(); Loading Loading @@ -92,7 +108,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { mBackend)); mControllers.add(new LightsPreferenceController(context, mBackend)); mControllers.add(new BadgePreferenceController(context, mBackend)); mControllers.add(new DndPreferenceController(context, getLifecycle(), mBackend)); mControllers.add(new DndPreferenceController(context, mBackend)); mControllers.add(new NotificationsOffPreferenceController(context)); return new ArrayList<>(mControllers); } Loading src/com/android/settings/notification/DndPreferenceController.java +2 −7 Original line number Diff line number Diff line Loading @@ -28,17 +28,12 @@ import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.events.OnResume; public class DndPreferenceController extends NotificationPreferenceController implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener, LifecycleObserver { implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener { private static final String KEY_BYPASS_DND = "bypass_dnd"; public DndPreferenceController(Context context, Lifecycle lifecycle, NotificationBackend backend) { public DndPreferenceController(Context context, NotificationBackend backend) { super(context, backend); if (lifecycle != null) { lifecycle.addObserver(this); } } @Override Loading src/com/android/settings/notification/NotificationSettingsBase.java +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import java.util.List; abstract public class NotificationSettingsBase extends DashboardFragment { private static final String TAG = "NotifiSettingsBase"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); protected static final String ARG_FROM_SETTINGS = "fromSettings"; protected PackageManager mPm; protected NotificationBackend mBackend = new NotificationBackend(); Loading Loading @@ -249,6 +250,7 @@ abstract public class NotificationSettingsBase extends DashboardFragment { channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, mUid); channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mPkg); channelArgs.putString(Settings.EXTRA_CHANNEL_ID, channel.getId()); channelArgs.putBoolean(ARG_FROM_SETTINGS, true); channelPref.setIntent(new SubSettingLauncher(getActivity()) .setDestination(ChannelNotificationSettings.class.getName()) .setArguments(channelArgs) Loading tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -64,8 +64,6 @@ public class DndPreferenceControllerTest { private UserManager mUm; @Mock(answer = Answers.RETURNS_DEEP_STUBS) private PreferenceScreen mScreen; @Mock private Lifecycle mLifecycle; private DndPreferenceController mController; Loading @@ -76,7 +74,7 @@ public class DndPreferenceControllerTest { shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm); shadowApplication.setSystemService(Context.USER_SERVICE, mUm); mContext = RuntimeEnvironment.application; mController = spy(new DndPreferenceController(mContext, mLifecycle, mBackend)); mController = spy(new DndPreferenceController(mContext, mBackend)); } @Test Loading Loading
src/com/android/settings/notification/AppNotificationSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ public class AppNotificationSettings extends NotificationSettingsBase { mControllers.add(new VibrationPreferenceController(context, mBackend)); mControllers.add(new VisibilityPreferenceController(context, new LockPatternUtils(context), mBackend)); mControllers.add(new DndPreferenceController(context, getLifecycle(), mBackend)); mControllers.add(new DndPreferenceController(context, mBackend)); mControllers.add(new AppLinkPreferenceController(context)); mControllers.add(new DescriptionPreferenceController(context)); mControllers.add(new NotificationsOffPreferenceController(context)); Loading
src/com/android/settings/notification/ChannelNotificationSettings.java +17 −1 Original line number Diff line number Diff line Loading @@ -18,13 +18,16 @@ package com.android.settings.notification; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.preference.PreferenceScreen; import android.text.TextUtils; import android.util.Log; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.widget.LockPatternUtils; import com.android.settings.R; import com.android.settings.applications.AppInfoBase; import com.android.settingslib.core.AbstractPreferenceController; import java.util.ArrayList; Loading @@ -38,6 +41,19 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { return MetricsEvent.NOTIFICATION_TOPIC_NOTIFICATION; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final PreferenceScreen screen = getPreferenceScreen(); Bundle args = getArguments(); // If linking to this screen from an external app, expand settings if (screen != null && args != null) { if (!args.getBoolean(ARG_FROM_SETTINGS, false)) { screen.setInitialExpandedChildrenCount(Integer.MAX_VALUE); } } } @Override public void onResume() { super.onResume(); Loading Loading @@ -92,7 +108,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { mBackend)); mControllers.add(new LightsPreferenceController(context, mBackend)); mControllers.add(new BadgePreferenceController(context, mBackend)); mControllers.add(new DndPreferenceController(context, getLifecycle(), mBackend)); mControllers.add(new DndPreferenceController(context, mBackend)); mControllers.add(new NotificationsOffPreferenceController(context)); return new ArrayList<>(mControllers); } Loading
src/com/android/settings/notification/DndPreferenceController.java +2 −7 Original line number Diff line number Diff line Loading @@ -28,17 +28,12 @@ import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.events.OnResume; public class DndPreferenceController extends NotificationPreferenceController implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener, LifecycleObserver { implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener { private static final String KEY_BYPASS_DND = "bypass_dnd"; public DndPreferenceController(Context context, Lifecycle lifecycle, NotificationBackend backend) { public DndPreferenceController(Context context, NotificationBackend backend) { super(context, backend); if (lifecycle != null) { lifecycle.addObserver(this); } } @Override Loading
src/com/android/settings/notification/NotificationSettingsBase.java +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import java.util.List; abstract public class NotificationSettingsBase extends DashboardFragment { private static final String TAG = "NotifiSettingsBase"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); protected static final String ARG_FROM_SETTINGS = "fromSettings"; protected PackageManager mPm; protected NotificationBackend mBackend = new NotificationBackend(); Loading Loading @@ -249,6 +250,7 @@ abstract public class NotificationSettingsBase extends DashboardFragment { channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, mUid); channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mPkg); channelArgs.putString(Settings.EXTRA_CHANNEL_ID, channel.getId()); channelArgs.putBoolean(ARG_FROM_SETTINGS, true); channelPref.setIntent(new SubSettingLauncher(getActivity()) .setDestination(ChannelNotificationSettings.class.getName()) .setArguments(channelArgs) Loading
tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -64,8 +64,6 @@ public class DndPreferenceControllerTest { private UserManager mUm; @Mock(answer = Answers.RETURNS_DEEP_STUBS) private PreferenceScreen mScreen; @Mock private Lifecycle mLifecycle; private DndPreferenceController mController; Loading @@ -76,7 +74,7 @@ public class DndPreferenceControllerTest { shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm); shadowApplication.setSystemService(Context.USER_SERVICE, mUm); mContext = RuntimeEnvironment.application; mController = spy(new DndPreferenceController(mContext, mLifecycle, mBackend)); mController = spy(new DndPreferenceController(mContext, mBackend)); } @Test Loading