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

Commit 34f14968 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Revert "Update 'dnd is hiding notifications' view"

This reverts commit 85bad9b5.

Change-Id: Ic68475a8df0ae377c4fc357017b7d2a6b5311433
Fixes: 79155510
Fixes: 79156480
parent 85bad9b5
Loading
Loading
Loading
Loading
+0 −34
Original line number Original line 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>
+1 −1
Original line number Original line Diff line number Diff line
@@ -1062,7 +1062,7 @@
    <string name="manage_notifications_text">Manage notifications</string>
    <string name="manage_notifications_text">Manage notifications</string>


    <!-- The text to show in the notifications shade when dnd is suppressing notifications. [CHAR LIMIT=100] -->
    <!-- The text to show in the notifications shade when dnd is suppressing notifications. [CHAR LIMIT=100] -->
    <string name="dnd_suppressing_shade_text">Notifications hidden by Do Not Disturb</string>
    <string name="dnd_suppressing_shade_text">Do Not Disturb is hiding notifications</string>


    <!-- Media projection permission dialog action text. [CHAR LIMIT=60] -->
    <!-- Media projection permission dialog action text. [CHAR LIMIT=60] -->
    <string name="media_projection_action_text">Start now</string>
    <string name="media_projection_action_text">Start now</string>
+0 −91
Original line number Original line 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());
            }
        }
    }
}
+3 −8
Original line number Original line Diff line number Diff line
@@ -199,7 +199,6 @@ public class NotificationPanelView extends PanelView implements
    private ValueAnimator mQsSizeChangeAnimator;
    private ValueAnimator mQsSizeChangeAnimator;


    private boolean mShowEmptyShadeView;
    private boolean mShowEmptyShadeView;
    private boolean mShowDndView;


    private boolean mQsScrimEnabled = true;
    private boolean mQsScrimEnabled = true;
    private boolean mLastAnnouncementWasQuickSettings;
    private boolean mLastAnnouncementWasQuickSettings;
@@ -1600,8 +1599,8 @@ public class NotificationPanelView extends PanelView implements
        // When only empty shade view is visible in QS collapsed state, simulate that we would have
        // 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
        // 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.
        // and expanding/collapsing the whole panel from/to quick settings.
        if ((mNotificationStackScroller.getNotGoneChildCount() == 0
        if (mNotificationStackScroller.getNotGoneChildCount() == 0
                && mShowEmptyShadeView) || mShowDndView) {
                && mShowEmptyShadeView) {
            notificationHeight = mNotificationStackScroller.getEmptyShadeViewHeight();
            notificationHeight = mNotificationStackScroller.getEmptyShadeViewHeight();
        }
        }
        int maxQsHeight = mQsMaxExpansionHeight;
        int maxQsHeight = mQsMaxExpansionHeight;
@@ -2244,17 +2243,13 @@ public class NotificationPanelView extends PanelView implements
        return mDozing;
        return mDozing;
    }
    }


    public void showDndView(boolean dndViewVisible) {
        mShowDndView = dndViewVisible;
        mNotificationStackScroller.updateDndView(mShowDndView && !mQsExpanded);
    }

    public void showEmptyShadeView(boolean emptyShadeViewVisible) {
    public void showEmptyShadeView(boolean emptyShadeViewVisible) {
        mShowEmptyShadeView = emptyShadeViewVisible;
        mShowEmptyShadeView = emptyShadeViewVisible;
        updateEmptyShadeView();
        updateEmptyShadeView();
    }
    }


    private void updateEmptyShadeView() {
    private void updateEmptyShadeView() {

        // Hide "No notifications" in QS.
        // Hide "No notifications" in QS.
        mNotificationStackScroller.updateEmptyShadeView(mShowEmptyShadeView && !mQsExpanded);
        mNotificationStackScroller.updateEmptyShadeView(mShowEmptyShadeView && !mQsExpanded);
    }
    }
+5 −34
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.windowStateToString;
import static android.app.StatusBarManager.windowStateToString;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY;
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_ASLEEP;
import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE;
import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE;
@@ -169,7 +168,6 @@ import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;
import com.android.systemui.qs.QSFragment;
import com.android.systemui.qs.QSFragment;
@@ -190,7 +188,6 @@ import com.android.systemui.statusbar.AppOpsListener;
import com.android.systemui.statusbar.BackDropView;
import com.android.systemui.statusbar.BackDropView;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.DndSuppressingNotificationsView;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.ExpandableNotificationRow;
@@ -416,7 +413,7 @@ public class StatusBar extends SystemUI implements DemoMode,
    protected NotificationViewHierarchyManager mViewHierarchyManager;
    protected NotificationViewHierarchyManager mViewHierarchyManager;
    protected AppOpsListener mAppOpsListener;
    protected AppOpsListener mAppOpsListener;
    protected KeyguardViewMediator mKeyguardViewMediator;
    protected KeyguardViewMediator mKeyguardViewMediator;
    protected ZenModeController mZenController;
    private ZenModeController mZenController;


    /**
    /**
     * Helper that is responsible for showing the right toast when a disallowed activity operation
     * Helper that is responsible for showing the right toast when a disallowed activity operation
@@ -881,7 +878,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        mVisualStabilityManager.setVisibilityLocationProvider(mStackScroller);
        mVisualStabilityManager.setVisibilityLocationProvider(mStackScroller);


        inflateEmptyShadeView();
        inflateEmptyShadeView();
        inflateDndView();
        inflateFooterView();
        inflateFooterView();


        mBackdrop = mStatusBarWindow.findViewById(R.id.backdrop);
        mBackdrop = mStatusBarWindow.findViewById(R.id.backdrop);
@@ -1149,7 +1145,6 @@ public class StatusBar extends SystemUI implements DemoMode,
    protected void reevaluateStyles() {
    protected void reevaluateStyles() {
        inflateFooterView();
        inflateFooterView();
        updateFooter();
        updateFooter();
        inflateDndView();
        inflateEmptyShadeView();
        inflateEmptyShadeView();
        updateEmptyShadeView();
        updateEmptyShadeView();
    }
    }
@@ -1171,19 +1166,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        mStackScroller.setEmptyShadeView(mEmptyShadeView);
        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() {
    private void inflateFooterView() {
        if (mStackScroller == null) {
        if (mStackScroller == null) {
            return;
            return;
@@ -1478,11 +1460,9 @@ public class StatusBar extends SystemUI implements DemoMode,
    @VisibleForTesting
    @VisibleForTesting
    protected void updateFooter() {
    protected void updateFooter() {
        boolean showFooterView = mState != StatusBarState.KEYGUARD
        boolean showFooterView = mState != StatusBarState.KEYGUARD
                && !areNotificationsHidden()
                && mEntryManager.getNotificationData().getActiveNotifications().size() != 0
                && mEntryManager.getNotificationData().getActiveNotifications().size() != 0
                && !mRemoteInputManager.getController().isRemoteInputActive();
                && !mRemoteInputManager.getController().isRemoteInputActive();
        boolean showDismissView = mClearAllEnabled && mState != StatusBarState.KEYGUARD
        boolean showDismissView = mClearAllEnabled && mState != StatusBarState.KEYGUARD
                && !areNotificationsHidden()
                && hasActiveClearableNotifications();
                && hasActiveClearableNotifications();


        mStackScroller.updateFooterView(showFooterView, showDismissView);
        mStackScroller.updateFooterView(showFooterView, showDismissView);
@@ -1505,13 +1485,10 @@ public class StatusBar extends SystemUI implements DemoMode,
        return false;
        return false;
    }
    }


    @VisibleForTesting
    private void updateEmptyShadeView() {
    protected void updateEmptyShadeView() {
        boolean showEmptyShadeView =
        boolean showDndView = mState != StatusBarState.KEYGUARD && areNotificationsHidden();
                mState != StatusBarState.KEYGUARD &&
        boolean showEmptyShadeView = !showDndView
                        mEntryManager.getNotificationData().getActiveNotifications().size() == 0;
                && mState != StatusBarState.KEYGUARD
                && mEntryManager.getNotificationData().getActiveNotifications().size() == 0;
        mNotificationPanel.showDndView(showDndView);
        mNotificationPanel.showEmptyShadeView(showEmptyShadeView);
        mNotificationPanel.showEmptyShadeView(showEmptyShadeView);
    }
    }


@@ -5011,7 +4988,6 @@ public class StatusBar extends SystemUI implements DemoMode,
    protected NotificationShelf mNotificationShelf;
    protected NotificationShelf mNotificationShelf;
    protected FooterView mFooterView;
    protected FooterView mFooterView;
    protected EmptyShadeView mEmptyShadeView;
    protected EmptyShadeView mEmptyShadeView;
    protected DndSuppressingNotificationsView mDndView;


    protected AssistManager mAssistManager;
    protected AssistManager mAssistManager;


@@ -5496,11 +5472,6 @@ public class StatusBar extends SystemUI implements DemoMode,
                    mStackScroller.getChildCount() - offsetFromEnd++);
                    mStackScroller.getChildCount() - offsetFromEnd++);
        }
        }


        if (mDndView != null) {
            mStackScroller.changeViewPosition(mDndView,
                    mStackScroller.getChildCount() - offsetFromEnd++);
        }

        mStackScroller.changeViewPosition(mEmptyShadeView,
        mStackScroller.changeViewPosition(mEmptyShadeView,
                mStackScroller.getChildCount() - offsetFromEnd++);
                mStackScroller.getChildCount() - offsetFromEnd++);


Loading