Fixed a bug where the shelf was clickable outside of keyguard
This lead to an issue where notifications on the very bottom weren't clickable. Test: add single notification on the bottom, click it Change-Id: I444a8de60bec6dda2227a2df4d78c2564c59aa2b Fixes: 33643806
This commit is contained in:
@@ -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"
|
||||
>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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) {
|
||||
mHasItemsInStableShelf = 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;
|
||||
|
||||
@@ -663,12 +663,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
array.clear();
|
||||
}
|
||||
|
||||
private final View.OnClickListener mShelfClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mState == StatusBarState.KEYGUARD) {
|
||||
goToLockedShade(null);
|
||||
}
|
||||
private final View.OnClickListener mGoToLockedShadeListener = v -> {
|
||||
if (mState == StatusBarState.KEYGUARD) {
|
||||
goToLockedShade(null);
|
||||
}
|
||||
};
|
||||
private HashMap<ExpandableNotificationRow, List<ExpandableNotificationRow>> mTmpChildOrderMap
|
||||
@@ -1061,8 +1058,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
|
||||
@@ -4598,6 +4596,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
mStackScroller.setStatusBarState(state);
|
||||
updateReportRejectedTouchVisibility();
|
||||
updateDozing();
|
||||
mNotificationShelf.setStatusBarState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user