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

Commit 23e117a5 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Fixed a bug where the shelf was clickable outside of keyguard"

parents cbe76a0f 810bcde1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="@dimen/notification_shelf_height"
    android:contentDescription="@string/notification_shelf_content_description"
    android:focusable="true"
    android:clickable="true"
    >
+3 −0
Original line number Diff line number Diff line
@@ -408,6 +408,9 @@
    <!-- Content description of the button for showing a notifications panel in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_notifications_button">Notifications.</string>

    <!-- Content description of overflow icon container of the notifications for accessibility (not shown on the screen)[CHAR LIMIT=NONE] -->
    <string name="notification_shelf_content_description">Notification overflow container</string>

    <!-- Content description of the button for removing a notification in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_remove_notification">Clear notification.</string>

+20 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public class NotificationShelf extends ActivatableNotificationView {
    private boolean mHasItemsInStableShelf;
    private NotificationIconContainer mCollapsedIcons;
    private int mScrollFastThreshold;
    private int mStatusBarState;

    public NotificationShelf(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -523,7 +524,10 @@ public class NotificationShelf extends ActivatableNotificationView {
    }

    private void setHasItemsInStableShelf(boolean hasItemsInStableShelf) {
        if (mHasItemsInStableShelf != hasItemsInStableShelf) {
            mHasItemsInStableShelf = hasItemsInStableShelf;
            updateInteractiveness();
        }
    }

    /**
@@ -538,6 +542,21 @@ public class NotificationShelf extends ActivatableNotificationView {
        mCollapsedIcons = collapsedIcons;
    }

    public void setStatusBarState(int statusBarState) {
        if (mStatusBarState != statusBarState) {
            mStatusBarState = statusBarState;
            updateInteractiveness();
        }
    }

    private void updateInteractiveness() {
        boolean interactive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf;
        setClickable(interactive);
        setFocusable(interactive);
        setImportantForAccessibility(interactive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
                : View.IMPORTANT_FOR_ACCESSIBILITY_NO);
    }

    private class ShelfState extends ExpandableViewState {
        private float openedAmount;
        private boolean hasItemsInStableShelf;
+6 −7
Original line number Diff line number Diff line
@@ -665,13 +665,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        array.clear();
    }

    private final View.OnClickListener mShelfClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
    private final View.OnClickListener mGoToLockedShadeListener = v -> {
        if (mState == StatusBarState.KEYGUARD) {
            goToLockedShade(null);
        }
        }
    };
    private HashMap<ExpandableNotificationRow, List<ExpandableNotificationRow>> mTmpChildOrderMap
            = new HashMap<>();
@@ -1064,8 +1061,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                (NotificationShelf) LayoutInflater.from(mContext).inflate(
                        R.layout.status_bar_notification_shelf, mStackScroller, false);
        mNotificationShelf.setOnActivatedListener(this);
        mNotificationShelf.setOnClickListener(mShelfClickListener);
        mStackScroller.setShelf(mNotificationShelf);
        mNotificationShelf.setOnClickListener(mGoToLockedShadeListener);
        mNotificationShelf.setStatusBarState(mState);
    }

    @Override
@@ -4609,6 +4607,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mStackScroller.setStatusBarState(state);
        updateReportRejectedTouchVisibility();
        updateDozing();
        mNotificationShelf.setStatusBarState(state);
    }

    @Override