Loading packages/SystemUI/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1062,6 +1062,9 @@ <!-- The text to clear all notifications. [CHAR LIMIT=60] --> <string name="clear_all_notifications_text">Clear all</string> <!-- The text to show in the notifications shade when dnd is suppressing notifications. [CHAR LIMIT=100] --> <string name="dnd_suppressing_shade_text">Do Not disturb is hiding notifications</string> <!-- Media projection permission dialog action text. [CHAR LIMIT=60] --> <string name="media_projection_action_text">Start now</string> Loading packages/SystemUI/src/com/android/systemui/statusbar/EmptyShadeView.java +8 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.statusbar; import android.annotation.ColorInt; import android.annotation.StringRes; import android.content.Context; import android.content.res.Configuration; import android.util.AttributeSet; Loading @@ -30,6 +31,7 @@ import com.android.systemui.statusbar.stack.StackScrollState; public class EmptyShadeView extends StackScrollerDecorView { private TextView mEmptyText; private @StringRes int mText = R.string.empty_shade_text; public EmptyShadeView(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -38,7 +40,7 @@ public class EmptyShadeView extends StackScrollerDecorView { @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mEmptyText.setText(R.string.empty_shade_text); mEmptyText.setText(mText); } @Override Loading @@ -50,6 +52,11 @@ public class EmptyShadeView extends StackScrollerDecorView { mEmptyText.setTextColor(color); } public void setText(@StringRes int text) { mText = text; mEmptyText.setText(mText); } @Override protected void onFinishInflate() { super.onFinishInflate(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +7 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,7 @@ import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.statusbar.policy.UserInfoController; import com.android.systemui.statusbar.policy.UserInfoControllerImpl; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.util.NotificationChannels; import com.android.systemui.volume.VolumeComponent; Loading Loading @@ -407,6 +408,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected NotificationEntryManager mEntryManager; protected NotificationViewHierarchyManager mViewHierarchyManager; protected AppOpsListener mAppOpsListener; private ZenModeController mZenController; /** * Helper that is responsible for showing the right toast when a disallowed activity operation Loading Loading @@ -626,6 +628,7 @@ public class StatusBar extends SystemUI implements DemoMode, mViewHierarchyManager = Dependency.get(NotificationViewHierarchyManager.class); mAppOpsListener = Dependency.get(AppOpsListener.class); mAppOpsListener.setUpWithPresenter(this, mEntryManager); mZenController = Dependency.get(ZenModeController.class); mColorExtractor = Dependency.get(SysuiColorExtractor.class); mColorExtractor.addOnColorsChangedListener(this); Loading Loading @@ -1166,6 +1169,7 @@ public class StatusBar extends SystemUI implements DemoMode, } mEmptyShadeView = (EmptyShadeView) LayoutInflater.from(mContext).inflate( R.layout.status_bar_no_notifications, mStackScroller, false); mEmptyShadeView.setText(R.string.empty_shade_text); mStackScroller.setEmptyShadeView(mEmptyShadeView); } Loading Loading @@ -1498,6 +1502,9 @@ public class StatusBar extends SystemUI implements DemoMode, return entry.row.getParent() instanceof NotificationStackScrollLayout; } public boolean areNotificationsHidden() { return mZenController.areNotificationsHiddenInShade(); } public void requestNotificationUpdate() { mEntryManager.updateNotifications(); Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ public interface ZenModeController extends CallbackController<Callback> { boolean isCountdownConditionSupported(); int getCurrentUser(); boolean isVolumeRestricted(); boolean areNotificationsHiddenInShade(); public static interface Callback { default void onZenChanged(int zen) {} Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java +19 −27 Original line number Diff line number Diff line Loading @@ -33,13 +33,11 @@ import android.os.UserManager; import android.provider.Settings.Global; import android.provider.Settings.Secure; import android.service.notification.Condition; import android.service.notification.IConditionListener; import android.service.notification.ZenModeConfig; import android.service.notification.ZenModeConfig.ZenRule; import android.support.annotation.VisibleForTesting; import android.util.Log; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.qs.GlobalSetting; import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.util.Utils; Loading @@ -64,9 +62,9 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode private final UserManager mUserManager; private int mUserId; private boolean mRequesting; private boolean mRegistered; private ZenModeConfig mConfig; private int mZenMode; public ZenModeControllerImpl(Context context, Handler handler) { super(context); Loading @@ -74,6 +72,7 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode mModeSetting = new GlobalSetting(mContext, handler, Global.ZEN_MODE) { @Override protected void handleValueChanged(int value) { updateZenMode(value); fireZenChanged(value); } }; Loading @@ -86,7 +85,9 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode mNoMan = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); mConfig = mNoMan.getZenModeConfig(); mModeSetting.setListening(true); updateZenMode(mModeSetting.getValue()); mConfigSetting.setListening(true); updateZenModeConfig(); mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); mSetupObserver = new SetupObserver(handler); mSetupObserver.register(); Loading @@ -100,6 +101,15 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode new UserHandle(mUserId)); } @Override public boolean areNotificationsHiddenInShade() { if (mZenMode != Global.ZEN_MODE_OFF) { return (mConfig.suppressedVisualEffects & NotificationManager.Policy .SUPPRESSED_EFFECT_NOTIFICATION_LIST) != 0; } return false; } @Override public void addCallback(Callback callback) { mCallbacks.add(callback); Loading Loading @@ -186,10 +196,6 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode Utils.safeForeach(mCallbacks, c -> c.onZenAvailableChanged(available)); } private void fireConditionsChanged(Condition[] conditions) { Utils.safeForeach(mCallbacks, c -> c.onConditionsChanged(conditions)); } private void fireManualRuleChanged(ZenRule rule) { Utils.safeForeach(mCallbacks, c -> c.onManualRuleChanged(rule)); } Loading @@ -199,17 +205,13 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode Utils.safeForeach(mCallbacks, c -> c.onConfigChanged(config)); } private void updateConditions(Condition[] conditions) { if (conditions == null || conditions.length == 0) return; for (Condition c : conditions) { if ((c.flags & Condition.FLAG_RELEVANT_NOW) == 0) continue; mConditions.put(c.id, c); } fireConditionsChanged( mConditions.values().toArray(new Condition[mConditions.values().size()])); @VisibleForTesting protected void updateZenMode(int mode) { mZenMode = mode; } private void updateZenModeConfig() { @VisibleForTesting protected void updateZenModeConfig() { final ZenModeConfig config = mNoMan.getZenModeConfig(); if (Objects.equals(config, mConfig)) return; final ZenRule oldRule = mConfig != null ? mConfig.manualRule : null; Loading @@ -220,16 +222,6 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode fireManualRuleChanged(newRule); } private final IConditionListener mListener = new IConditionListener.Stub() { @Override public void onConditionsReceived(Condition[] conditions) { if (DEBUG) Slog.d(TAG, "onConditionsReceived " + (conditions == null ? 0 : conditions.length) + " mRequesting=" + mRequesting); if (!mRequesting) return; updateConditions(conditions); } }; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading Loading
packages/SystemUI/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1062,6 +1062,9 @@ <!-- The text to clear all notifications. [CHAR LIMIT=60] --> <string name="clear_all_notifications_text">Clear all</string> <!-- The text to show in the notifications shade when dnd is suppressing notifications. [CHAR LIMIT=100] --> <string name="dnd_suppressing_shade_text">Do Not disturb is hiding notifications</string> <!-- Media projection permission dialog action text. [CHAR LIMIT=60] --> <string name="media_projection_action_text">Start now</string> Loading
packages/SystemUI/src/com/android/systemui/statusbar/EmptyShadeView.java +8 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.statusbar; import android.annotation.ColorInt; import android.annotation.StringRes; import android.content.Context; import android.content.res.Configuration; import android.util.AttributeSet; Loading @@ -30,6 +31,7 @@ import com.android.systemui.statusbar.stack.StackScrollState; public class EmptyShadeView extends StackScrollerDecorView { private TextView mEmptyText; private @StringRes int mText = R.string.empty_shade_text; public EmptyShadeView(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -38,7 +40,7 @@ public class EmptyShadeView extends StackScrollerDecorView { @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mEmptyText.setText(R.string.empty_shade_text); mEmptyText.setText(mText); } @Override Loading @@ -50,6 +52,11 @@ public class EmptyShadeView extends StackScrollerDecorView { mEmptyText.setTextColor(color); } public void setText(@StringRes int text) { mText = text; mEmptyText.setText(mText); } @Override protected void onFinishInflate() { super.onFinishInflate(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +7 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,7 @@ import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.statusbar.policy.UserInfoController; import com.android.systemui.statusbar.policy.UserInfoControllerImpl; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.util.NotificationChannels; import com.android.systemui.volume.VolumeComponent; Loading Loading @@ -407,6 +408,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected NotificationEntryManager mEntryManager; protected NotificationViewHierarchyManager mViewHierarchyManager; protected AppOpsListener mAppOpsListener; private ZenModeController mZenController; /** * Helper that is responsible for showing the right toast when a disallowed activity operation Loading Loading @@ -626,6 +628,7 @@ public class StatusBar extends SystemUI implements DemoMode, mViewHierarchyManager = Dependency.get(NotificationViewHierarchyManager.class); mAppOpsListener = Dependency.get(AppOpsListener.class); mAppOpsListener.setUpWithPresenter(this, mEntryManager); mZenController = Dependency.get(ZenModeController.class); mColorExtractor = Dependency.get(SysuiColorExtractor.class); mColorExtractor.addOnColorsChangedListener(this); Loading Loading @@ -1166,6 +1169,7 @@ public class StatusBar extends SystemUI implements DemoMode, } mEmptyShadeView = (EmptyShadeView) LayoutInflater.from(mContext).inflate( R.layout.status_bar_no_notifications, mStackScroller, false); mEmptyShadeView.setText(R.string.empty_shade_text); mStackScroller.setEmptyShadeView(mEmptyShadeView); } Loading Loading @@ -1498,6 +1502,9 @@ public class StatusBar extends SystemUI implements DemoMode, return entry.row.getParent() instanceof NotificationStackScrollLayout; } public boolean areNotificationsHidden() { return mZenController.areNotificationsHiddenInShade(); } public void requestNotificationUpdate() { mEntryManager.updateNotifications(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ public interface ZenModeController extends CallbackController<Callback> { boolean isCountdownConditionSupported(); int getCurrentUser(); boolean isVolumeRestricted(); boolean areNotificationsHiddenInShade(); public static interface Callback { default void onZenChanged(int zen) {} Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java +19 −27 Original line number Diff line number Diff line Loading @@ -33,13 +33,11 @@ import android.os.UserManager; import android.provider.Settings.Global; import android.provider.Settings.Secure; import android.service.notification.Condition; import android.service.notification.IConditionListener; import android.service.notification.ZenModeConfig; import android.service.notification.ZenModeConfig.ZenRule; import android.support.annotation.VisibleForTesting; import android.util.Log; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.qs.GlobalSetting; import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.util.Utils; Loading @@ -64,9 +62,9 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode private final UserManager mUserManager; private int mUserId; private boolean mRequesting; private boolean mRegistered; private ZenModeConfig mConfig; private int mZenMode; public ZenModeControllerImpl(Context context, Handler handler) { super(context); Loading @@ -74,6 +72,7 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode mModeSetting = new GlobalSetting(mContext, handler, Global.ZEN_MODE) { @Override protected void handleValueChanged(int value) { updateZenMode(value); fireZenChanged(value); } }; Loading @@ -86,7 +85,9 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode mNoMan = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); mConfig = mNoMan.getZenModeConfig(); mModeSetting.setListening(true); updateZenMode(mModeSetting.getValue()); mConfigSetting.setListening(true); updateZenModeConfig(); mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); mSetupObserver = new SetupObserver(handler); mSetupObserver.register(); Loading @@ -100,6 +101,15 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode new UserHandle(mUserId)); } @Override public boolean areNotificationsHiddenInShade() { if (mZenMode != Global.ZEN_MODE_OFF) { return (mConfig.suppressedVisualEffects & NotificationManager.Policy .SUPPRESSED_EFFECT_NOTIFICATION_LIST) != 0; } return false; } @Override public void addCallback(Callback callback) { mCallbacks.add(callback); Loading Loading @@ -186,10 +196,6 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode Utils.safeForeach(mCallbacks, c -> c.onZenAvailableChanged(available)); } private void fireConditionsChanged(Condition[] conditions) { Utils.safeForeach(mCallbacks, c -> c.onConditionsChanged(conditions)); } private void fireManualRuleChanged(ZenRule rule) { Utils.safeForeach(mCallbacks, c -> c.onManualRuleChanged(rule)); } Loading @@ -199,17 +205,13 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode Utils.safeForeach(mCallbacks, c -> c.onConfigChanged(config)); } private void updateConditions(Condition[] conditions) { if (conditions == null || conditions.length == 0) return; for (Condition c : conditions) { if ((c.flags & Condition.FLAG_RELEVANT_NOW) == 0) continue; mConditions.put(c.id, c); } fireConditionsChanged( mConditions.values().toArray(new Condition[mConditions.values().size()])); @VisibleForTesting protected void updateZenMode(int mode) { mZenMode = mode; } private void updateZenModeConfig() { @VisibleForTesting protected void updateZenModeConfig() { final ZenModeConfig config = mNoMan.getZenModeConfig(); if (Objects.equals(config, mConfig)) return; final ZenRule oldRule = mConfig != null ? mConfig.manualRule : null; Loading @@ -220,16 +222,6 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode fireManualRuleChanged(newRule); } private final IConditionListener mListener = new IConditionListener.Stub() { @Override public void onConditionsReceived(Condition[] conditions) { if (DEBUG) Slog.d(TAG, "onConditionsReceived " + (conditions == null ? 0 : conditions.length) + " mRequesting=" + mRequesting); if (!mRequesting) return; updateConditions(conditions); } }; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading