Fixed Focusability issues with heads up

The panel was focusable when a heads up came in which
lead to several bugs. Sometimes the user was not able to
type anymore and focus listeners fired.

Bug: 21153703
Bug: 20892889
Change-Id: Iab86e651ef827767225ca092bb2c1e3fe1ddf385
This commit is contained in:
Selim Cinek
2015-05-19 11:00:38 -07:00
parent 5deaa13844
commit 4a21a7fab6
3 changed files with 31 additions and 11 deletions

View File

@@ -117,6 +117,7 @@ public class NotificationPanelView extends PanelView implements
* intercepted yet.
*/
private boolean mIntercepting;
private boolean mPanelExpanded;
private boolean mQsExpanded;
private boolean mQsExpandedWhenExpandingStarted;
private boolean mQsFullyExpanded;
@@ -1496,13 +1497,22 @@ public class NotificationPanelView extends PanelView implements
updateHeader();
updateUnlockIcon();
updateNotificationTranslucency();
mHeadsUpManager.setIsExpanded(!isFullyCollapsed());
updatePanelExpanded();
mNotificationStackScroller.setShadeExpanded(!isFullyCollapsed());
if (DEBUG) {
invalidate();
}
}
private void updatePanelExpanded() {
boolean isExpanded = !isFullyCollapsed();
if (mPanelExpanded != isExpanded) {
mHeadsUpManager.setIsExpanded(isExpanded);
mStatusBar.setPanelExpanded(isExpanded);
mPanelExpanded = isExpanded;
}
}
/**
* @return a temporary override of {@link #mQsMaxExpansionHeight}, which is needed when
* collapsing QS / the panel when QS was scrolled

View File

@@ -1967,6 +1967,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return !mUnlockMethodCache.isCurrentlyInsecure();
}
public void setPanelExpanded(boolean isExpanded) {
mStatusBarWindowManager.setPanelExpanded(isExpanded);
}
/**
* All changes to the status bar and notifications funnel through here and are batched.
*/
@@ -2027,7 +2031,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// Expand the window to encompass the full screen in anticipation of the drag.
// This is only possible to do atomically because the status bar is at the top of the screen!
mStatusBarWindowManager.setStatusBarExpanded(true);
mStatusBarWindowManager.setPanelVisible(true);
mStatusBarView.setFocusable(false);
visibilityChanged(true);
@@ -2156,7 +2160,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
visibilityChanged(false);
// Shrink the window to the size of the status bar only
mStatusBarWindowManager.setStatusBarExpanded(false);
mStatusBarWindowManager.setPanelVisible(false);
mStatusBarWindowManager.setForceStatusBarVisible(false);
mStatusBarView.setFocusable(true);

View File

@@ -114,12 +114,12 @@ public class StatusBarWindowManager {
}
private void applyFocusableFlag(State state) {
boolean panelFocusable = state.statusBarFocusable && state.panelExpanded;
if (state.isKeyguardShowingAndNotOccluded() && state.keyguardNeedsInput
&& state.bouncerShowing
|| BaseStatusBar.ENABLE_REMOTE_INPUT && state.statusBarExpanded) {
&& state.bouncerShowing || BaseStatusBar.ENABLE_REMOTE_INPUT && panelFocusable) {
mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
} else if (state.isKeyguardShowingAndNotOccluded() || state.statusBarFocusable) {
} else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mLpChanged.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
} else {
@@ -130,7 +130,7 @@ public class StatusBarWindowManager {
private void applyHeight(State state) {
boolean expanded = !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
|| state.statusBarExpanded || state.keyguardFadingAway || state.bouncerShowing
|| state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
|| state.headsUpShowing);
if (expanded) {
mLpChanged.height = ViewGroup.LayoutParams.MATCH_PARENT;
@@ -213,9 +213,9 @@ public class StatusBarWindowManager {
apply(mCurrentState);
}
public void setStatusBarExpanded(boolean expanded) {
mCurrentState.statusBarExpanded = expanded;
mCurrentState.statusBarFocusable = expanded;
public void setPanelVisible(boolean visible) {
mCurrentState.panelVisible = visible;
mCurrentState.statusBarFocusable = visible;
apply(mCurrentState);
}
@@ -267,11 +267,17 @@ public class StatusBarWindowManager {
apply(mCurrentState);
}
public void setPanelExpanded(boolean isExpanded) {
mCurrentState.panelExpanded = isExpanded;
apply(mCurrentState);
}
private static class State {
boolean keyguardShowing;
boolean keyguardOccluded;
boolean keyguardNeedsInput;
boolean statusBarExpanded;
boolean panelVisible;
boolean panelExpanded;
boolean statusBarFocusable;
boolean bouncerShowing;
boolean keyguardFadingAway;