Loading packages/SystemUI/res/layout/status_bar_dnd_suppressing_notifications.xml 0 → 100644 +34 −0 Original line number Diff line number Diff line <!-- Copyright 2018, 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. --> <!-- Extends Framelayout --> <com.android.systemui.statusbar.DndSuppressingNotificationsView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/hidden_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone"> <TextView android:id="@+id/hidden_notifications" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="64dp" android:paddingTop="28dp" android:gravity="top|center_horizontal" android:textColor="?attr/wallpaperTextColor" android:textSize="16sp" android:text="@string/dnd_suppressing_shade_text"/> </com.android.systemui.statusbar.DndSuppressingNotificationsView> packages/SystemUI/res/values/strings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -1062,7 +1062,7 @@ <string name="manage_notifications_text">Manage notifications</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> <string name="dnd_suppressing_shade_text">Notifications hidden by Do Not Disturb</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/DndSuppressingNotificationsView.java 0 → 100644 +91 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.systemui.statusbar; import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.IntegerRes; import android.annotation.StringRes; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.graphics.drawable.Icon; import android.util.AttributeSet; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.android.systemui.R; import com.android.systemui.statusbar.stack.ExpandableViewState; import com.android.systemui.statusbar.stack.StackScrollState; public class DndSuppressingNotificationsView extends StackScrollerDecorView { private TextView mText; private @StringRes int mTextId = R.string.dnd_suppressing_shade_text; public DndSuppressingNotificationsView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mText.setText(mTextId); } @Override protected View findContentView() { return findViewById(R.id.hidden_container); } @Override protected View findSecondaryView() { return null; } public void setColor(@ColorInt int color) { mText.setTextColor(color); } public void setOnContentClickListener(OnClickListener listener) { mText.setOnClickListener(listener); } @Override protected void onFinishInflate() { super.onFinishInflate(); mText = findViewById(R.id.hidden_notifications); } @Override public ExpandableViewState createNewViewState(StackScrollState stackScrollState) { return new DndSuppressingViewState(); } public class DndSuppressingViewState extends ExpandableViewState { @Override public void applyToView(View view) { super.applyToView(view); if (view instanceof DndSuppressingNotificationsView) { DndSuppressingNotificationsView dndView = (DndSuppressingNotificationsView) view; boolean visible = this.clipTopAmount <= mText.getPaddingTop() * 0.6f; dndView.performVisibilityAnimation(visible && !dndView.willBeGone()); } } } } packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +8 −3 Original line number Diff line number Diff line Loading @@ -199,6 +199,7 @@ public class NotificationPanelView extends PanelView implements private ValueAnimator mQsSizeChangeAnimator; private boolean mShowEmptyShadeView; private boolean mShowDndView; private boolean mQsScrimEnabled = true; private boolean mLastAnnouncementWasQuickSettings; Loading Loading @@ -1599,8 +1600,8 @@ public class NotificationPanelView extends PanelView implements // When only empty shade view is visible in QS collapsed state, simulate that we would have // it in expanded QS state as well so we don't run into troubles when fading the view in/out // and expanding/collapsing the whole panel from/to quick settings. if (mNotificationStackScroller.getNotGoneChildCount() == 0 && mShowEmptyShadeView) { if ((mNotificationStackScroller.getNotGoneChildCount() == 0 && mShowEmptyShadeView) || mShowDndView) { notificationHeight = mNotificationStackScroller.getEmptyShadeViewHeight(); } int maxQsHeight = mQsMaxExpansionHeight; Loading Loading @@ -2243,13 +2244,17 @@ public class NotificationPanelView extends PanelView implements return mDozing; } public void showDndView(boolean dndViewVisible) { mShowDndView = dndViewVisible; mNotificationStackScroller.updateDndView(mShowDndView && !mQsExpanded); } public void showEmptyShadeView(boolean emptyShadeViewVisible) { mShowEmptyShadeView = emptyShadeViewVisible; updateEmptyShadeView(); } private void updateEmptyShadeView() { // Hide "No notifications" in QS. mNotificationStackScroller.updateEmptyShadeView(mShowEmptyShadeView && !mQsExpanded); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +34 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN; import static android.app.StatusBarManager.WINDOW_STATE_SHOWING; import static android.app.StatusBarManager.windowStateToString; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY; import static android.provider.Settings.Global.ZEN_MODE_OFF; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE; Loading Loading @@ -168,6 +169,7 @@ import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.plugins.qs.QS; import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption; import com.android.systemui.qs.QSFragment; Loading @@ -188,6 +190,7 @@ import com.android.systemui.statusbar.AppOpsListener; import com.android.systemui.statusbar.BackDropView; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.DndSuppressingNotificationsView; import com.android.systemui.statusbar.DragDownHelper; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.ExpandableNotificationRow; Loading Loading @@ -413,7 +416,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected NotificationViewHierarchyManager mViewHierarchyManager; protected AppOpsListener mAppOpsListener; protected KeyguardViewMediator mKeyguardViewMediator; private ZenModeController mZenController; protected ZenModeController mZenController; /** * Helper that is responsible for showing the right toast when a disallowed activity operation Loading Loading @@ -878,6 +881,7 @@ public class StatusBar extends SystemUI implements DemoMode, mVisualStabilityManager.setVisibilityLocationProvider(mStackScroller); inflateEmptyShadeView(); inflateDndView(); inflateFooterView(); mBackdrop = mStatusBarWindow.findViewById(R.id.backdrop); Loading Loading @@ -1145,6 +1149,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected void reevaluateStyles() { inflateFooterView(); updateFooter(); inflateDndView(); inflateEmptyShadeView(); updateEmptyShadeView(); } Loading @@ -1166,6 +1171,19 @@ public class StatusBar extends SystemUI implements DemoMode, mStackScroller.setEmptyShadeView(mEmptyShadeView); } private void inflateDndView() { if (mStackScroller == null) { return; } mDndView = (DndSuppressingNotificationsView) LayoutInflater.from(mContext).inflate( R.layout.status_bar_dnd_suppressing_notifications, mStackScroller, false); mDndView.setOnContentClickListener(v -> { Intent intent = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS); startActivity(intent, true, true, Intent.FLAG_ACTIVITY_SINGLE_TOP); }); mStackScroller.setDndView(mDndView); } private void inflateFooterView() { if (mStackScroller == null) { return; Loading Loading @@ -1460,9 +1478,11 @@ public class StatusBar extends SystemUI implements DemoMode, @VisibleForTesting protected void updateFooter() { boolean showFooterView = mState != StatusBarState.KEYGUARD && !areNotificationsHidden() && mEntryManager.getNotificationData().getActiveNotifications().size() != 0 && !mRemoteInputManager.getController().isRemoteInputActive(); boolean showDismissView = mClearAllEnabled && mState != StatusBarState.KEYGUARD && !areNotificationsHidden() && hasActiveClearableNotifications(); mStackScroller.updateFooterView(showFooterView, showDismissView); Loading @@ -1485,10 +1505,13 @@ public class StatusBar extends SystemUI implements DemoMode, return false; } private void updateEmptyShadeView() { boolean showEmptyShadeView = mState != StatusBarState.KEYGUARD && mEntryManager.getNotificationData().getActiveNotifications().size() == 0; @VisibleForTesting protected void updateEmptyShadeView() { boolean showDndView = mState != StatusBarState.KEYGUARD && areNotificationsHidden(); boolean showEmptyShadeView = !showDndView && mState != StatusBarState.KEYGUARD && mEntryManager.getNotificationData().getActiveNotifications().size() == 0; mNotificationPanel.showDndView(showDndView); mNotificationPanel.showEmptyShadeView(showEmptyShadeView); } Loading Loading @@ -4988,6 +5011,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected NotificationShelf mNotificationShelf; protected FooterView mFooterView; protected EmptyShadeView mEmptyShadeView; protected DndSuppressingNotificationsView mDndView; protected AssistManager mAssistManager; Loading Loading @@ -5472,6 +5496,11 @@ public class StatusBar extends SystemUI implements DemoMode, mStackScroller.getChildCount() - offsetFromEnd++); } if (mDndView != null) { mStackScroller.changeViewPosition(mDndView, mStackScroller.getChildCount() - offsetFromEnd++); } mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - offsetFromEnd++); Loading Loading
packages/SystemUI/res/layout/status_bar_dnd_suppressing_notifications.xml 0 → 100644 +34 −0 Original line number Diff line number Diff line <!-- Copyright 2018, 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. --> <!-- Extends Framelayout --> <com.android.systemui.statusbar.DndSuppressingNotificationsView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/hidden_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone"> <TextView android:id="@+id/hidden_notifications" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="64dp" android:paddingTop="28dp" android:gravity="top|center_horizontal" android:textColor="?attr/wallpaperTextColor" android:textSize="16sp" android:text="@string/dnd_suppressing_shade_text"/> </com.android.systemui.statusbar.DndSuppressingNotificationsView>
packages/SystemUI/res/values/strings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -1062,7 +1062,7 @@ <string name="manage_notifications_text">Manage notifications</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> <string name="dnd_suppressing_shade_text">Notifications hidden by Do Not Disturb</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/DndSuppressingNotificationsView.java 0 → 100644 +91 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.systemui.statusbar; import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.IntegerRes; import android.annotation.StringRes; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.graphics.drawable.Icon; import android.util.AttributeSet; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.android.systemui.R; import com.android.systemui.statusbar.stack.ExpandableViewState; import com.android.systemui.statusbar.stack.StackScrollState; public class DndSuppressingNotificationsView extends StackScrollerDecorView { private TextView mText; private @StringRes int mTextId = R.string.dnd_suppressing_shade_text; public DndSuppressingNotificationsView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mText.setText(mTextId); } @Override protected View findContentView() { return findViewById(R.id.hidden_container); } @Override protected View findSecondaryView() { return null; } public void setColor(@ColorInt int color) { mText.setTextColor(color); } public void setOnContentClickListener(OnClickListener listener) { mText.setOnClickListener(listener); } @Override protected void onFinishInflate() { super.onFinishInflate(); mText = findViewById(R.id.hidden_notifications); } @Override public ExpandableViewState createNewViewState(StackScrollState stackScrollState) { return new DndSuppressingViewState(); } public class DndSuppressingViewState extends ExpandableViewState { @Override public void applyToView(View view) { super.applyToView(view); if (view instanceof DndSuppressingNotificationsView) { DndSuppressingNotificationsView dndView = (DndSuppressingNotificationsView) view; boolean visible = this.clipTopAmount <= mText.getPaddingTop() * 0.6f; dndView.performVisibilityAnimation(visible && !dndView.willBeGone()); } } } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +8 −3 Original line number Diff line number Diff line Loading @@ -199,6 +199,7 @@ public class NotificationPanelView extends PanelView implements private ValueAnimator mQsSizeChangeAnimator; private boolean mShowEmptyShadeView; private boolean mShowDndView; private boolean mQsScrimEnabled = true; private boolean mLastAnnouncementWasQuickSettings; Loading Loading @@ -1599,8 +1600,8 @@ public class NotificationPanelView extends PanelView implements // When only empty shade view is visible in QS collapsed state, simulate that we would have // it in expanded QS state as well so we don't run into troubles when fading the view in/out // and expanding/collapsing the whole panel from/to quick settings. if (mNotificationStackScroller.getNotGoneChildCount() == 0 && mShowEmptyShadeView) { if ((mNotificationStackScroller.getNotGoneChildCount() == 0 && mShowEmptyShadeView) || mShowDndView) { notificationHeight = mNotificationStackScroller.getEmptyShadeViewHeight(); } int maxQsHeight = mQsMaxExpansionHeight; Loading Loading @@ -2243,13 +2244,17 @@ public class NotificationPanelView extends PanelView implements return mDozing; } public void showDndView(boolean dndViewVisible) { mShowDndView = dndViewVisible; mNotificationStackScroller.updateDndView(mShowDndView && !mQsExpanded); } public void showEmptyShadeView(boolean emptyShadeViewVisible) { mShowEmptyShadeView = emptyShadeViewVisible; updateEmptyShadeView(); } private void updateEmptyShadeView() { // Hide "No notifications" in QS. mNotificationStackScroller.updateEmptyShadeView(mShowEmptyShadeView && !mQsExpanded); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +34 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN; import static android.app.StatusBarManager.WINDOW_STATE_SHOWING; import static android.app.StatusBarManager.windowStateToString; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY; import static android.provider.Settings.Global.ZEN_MODE_OFF; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE; Loading Loading @@ -168,6 +169,7 @@ import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.plugins.qs.QS; import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption; import com.android.systemui.qs.QSFragment; Loading @@ -188,6 +190,7 @@ import com.android.systemui.statusbar.AppOpsListener; import com.android.systemui.statusbar.BackDropView; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.DndSuppressingNotificationsView; import com.android.systemui.statusbar.DragDownHelper; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.ExpandableNotificationRow; Loading Loading @@ -413,7 +416,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected NotificationViewHierarchyManager mViewHierarchyManager; protected AppOpsListener mAppOpsListener; protected KeyguardViewMediator mKeyguardViewMediator; private ZenModeController mZenController; protected ZenModeController mZenController; /** * Helper that is responsible for showing the right toast when a disallowed activity operation Loading Loading @@ -878,6 +881,7 @@ public class StatusBar extends SystemUI implements DemoMode, mVisualStabilityManager.setVisibilityLocationProvider(mStackScroller); inflateEmptyShadeView(); inflateDndView(); inflateFooterView(); mBackdrop = mStatusBarWindow.findViewById(R.id.backdrop); Loading Loading @@ -1145,6 +1149,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected void reevaluateStyles() { inflateFooterView(); updateFooter(); inflateDndView(); inflateEmptyShadeView(); updateEmptyShadeView(); } Loading @@ -1166,6 +1171,19 @@ public class StatusBar extends SystemUI implements DemoMode, mStackScroller.setEmptyShadeView(mEmptyShadeView); } private void inflateDndView() { if (mStackScroller == null) { return; } mDndView = (DndSuppressingNotificationsView) LayoutInflater.from(mContext).inflate( R.layout.status_bar_dnd_suppressing_notifications, mStackScroller, false); mDndView.setOnContentClickListener(v -> { Intent intent = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS); startActivity(intent, true, true, Intent.FLAG_ACTIVITY_SINGLE_TOP); }); mStackScroller.setDndView(mDndView); } private void inflateFooterView() { if (mStackScroller == null) { return; Loading Loading @@ -1460,9 +1478,11 @@ public class StatusBar extends SystemUI implements DemoMode, @VisibleForTesting protected void updateFooter() { boolean showFooterView = mState != StatusBarState.KEYGUARD && !areNotificationsHidden() && mEntryManager.getNotificationData().getActiveNotifications().size() != 0 && !mRemoteInputManager.getController().isRemoteInputActive(); boolean showDismissView = mClearAllEnabled && mState != StatusBarState.KEYGUARD && !areNotificationsHidden() && hasActiveClearableNotifications(); mStackScroller.updateFooterView(showFooterView, showDismissView); Loading @@ -1485,10 +1505,13 @@ public class StatusBar extends SystemUI implements DemoMode, return false; } private void updateEmptyShadeView() { boolean showEmptyShadeView = mState != StatusBarState.KEYGUARD && mEntryManager.getNotificationData().getActiveNotifications().size() == 0; @VisibleForTesting protected void updateEmptyShadeView() { boolean showDndView = mState != StatusBarState.KEYGUARD && areNotificationsHidden(); boolean showEmptyShadeView = !showDndView && mState != StatusBarState.KEYGUARD && mEntryManager.getNotificationData().getActiveNotifications().size() == 0; mNotificationPanel.showDndView(showDndView); mNotificationPanel.showEmptyShadeView(showEmptyShadeView); } Loading Loading @@ -4988,6 +5011,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected NotificationShelf mNotificationShelf; protected FooterView mFooterView; protected EmptyShadeView mEmptyShadeView; protected DndSuppressingNotificationsView mDndView; protected AssistManager mAssistManager; Loading Loading @@ -5472,6 +5496,11 @@ public class StatusBar extends SystemUI implements DemoMode, mStackScroller.getChildCount() - offsetFromEnd++); } if (mDndView != null) { mStackScroller.changeViewPosition(mDndView, mStackScroller.getChildCount() - offsetFromEnd++); } mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - offsetFromEnd++); Loading