Skip to content

Commit

Permalink
Attempt to fix invisible Keyguard #2
Browse files Browse the repository at this point in the history
Bug: 17439581
Change-Id: Ib38d9be3271081b33c23b3b17b2ed7790c71729b
  • Loading branch information
XSJoJo committed Sep 12, 2014
1 parent 2418d73 commit d41083a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private final void logf(String fmt, Object... args) {
private String mViewName;
private float mInitialTouchY;
private float mInitialTouchX;
private boolean mTouchDisabled;

private Interpolator mLinearOutSlowInInterpolator;
private Interpolator mFastOutSlowInInterpolator;
Expand Down Expand Up @@ -207,9 +208,13 @@ private void trackMovement(MotionEvent event) {
event.offsetLocation(-deltaX, -deltaY);
}

public void setTouchDisabled(boolean disabled) {
mTouchDisabled = disabled;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
if (mInstantExpanding) {
if (mInstantExpanding || mTouchDisabled) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,12 @@ public void onChange(boolean selfChange) {
private int mNavigationBarMode;
private Boolean mScreenOn;

// The second field is a bit different from the first one because it only listens to screen on/
// screen of events from Keyguard. We need this so we don't have a race condition with the
// broadcast. In the future, we should remove the first field altogether and rename the second
// field.
private boolean mScreenOnFromKeyguard;

private ViewMediatorCallback mKeyguardViewMediatorCallback;
private ScrimController mScrimController;

Expand Down Expand Up @@ -3466,6 +3472,13 @@ public int getBarState() {
public void showKeyguard() {
setBarState(StatusBarState.KEYGUARD);
updateKeyguardState(false /* goingToFullShade */, false /* fromShadeLocked */);
if (!mScreenOnFromKeyguard) {

// If the screen is off already, we need to disable touch events because these might
// collapse the panel after we expanded it, and thus we would end up with a blank
// Keyguard.
mNotificationPanel.setTouchDisabled(true);
}
instantExpandNotificationsPanel();
mLeaveOpenOnKeyguardHide = false;
if (mDraggedDownRow != null) {
Expand Down Expand Up @@ -3870,12 +3883,15 @@ public void setBouncerShowing(boolean bouncerShowing) {
}

public void onScreenTurnedOff() {
mScreenOnFromKeyguard = false;
mStackScroller.setAnimationsEnabled(false);
}

public void onScreenTurnedOn() {
mScreenOnFromKeyguard = true;
mStackScroller.setAnimationsEnabled(true);
mNotificationPanel.onScreenTurnedOn();
mNotificationPanel.setTouchDisabled(false);
}

/**
Expand Down

0 comments on commit d41083a

Please sign in to comment.