summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2013-10-16 01:41:21 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-16 01:41:22 +0000
commit49b6d38fe7308d4641046af4a2d062cdc6033c30 (patch)
tree8ba3fdaf3189ebfce5f5c0d428e239b3e452c7c4
parent905c50a21238aa1de38989f1f9169cf40ebe02d5 (diff)
parentbdb5ac7ddbabec0ba947a32937d8b95738d513dc (diff)
downloadframeworks_base-49b6d38fe7308d4641046af4a2d062cdc6033c30.zip
frameworks_base-49b6d38fe7308d4641046af4a2d062cdc6033c30.tar.gz
frameworks_base-49b6d38fe7308d4641046af4a2d062cdc6033c30.tar.bz2
Merge "Fix dodgy states of keyguard transport controls" into klp-dev
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java25
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardWidgetPager.java1
2 files changed, 17 insertions, 9 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
index fdc06a6..e94cf18 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
@@ -16,10 +16,6 @@
package com.android.keyguard;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
-import com.android.keyguard.KeyguardUpdateMonitor.DisplayClientState;
-
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
@@ -55,6 +51,9 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.RemoteViews.OnClickHandler;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
+import com.android.keyguard.KeyguardUpdateMonitor.DisplayClientState;
import java.io.File;
import java.lang.ref.WeakReference;
@@ -280,7 +279,7 @@ public class KeyguardHostView extends KeyguardViewBase {
if (newState != mTransportState) {
mTransportState = newState;
if (DEBUGXPORT) Log.v(TAG, "update widget: transport state changed");
- KeyguardHostView.this.post(mSwitchPageRunnable);
+ KeyguardHostView.this.postShowAppropriateWidgetPage();
}
}
@Override
@@ -292,7 +291,7 @@ public class KeyguardHostView extends KeyguardViewBase {
if (newState != mTransportState) {
mTransportState = newState;
if (DEBUGXPORT) Log.v(TAG, "update widget: play state changed");
- KeyguardHostView.this.post(mSwitchPageRunnable);
+ KeyguardHostView.this.postShowAppropriateWidgetPage();
}
}
}
@@ -496,6 +495,7 @@ public class KeyguardHostView extends KeyguardViewBase {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
+ removeCallbacks(mSwitchPageRunnable);
mAppWidgetHost.stopListening();
KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitorCallbacks);
}
@@ -1438,7 +1438,7 @@ public class KeyguardHostView extends KeyguardViewBase {
mAppWidgetToShow = ss.appWidgetToShow;
setInsets(ss.insets);
if (DEBUG) Log.d(TAG, "onRestoreInstanceState, transport=" + mTransportState);
- post(mSwitchPageRunnable);
+ postShowAppropriateWidgetPage();
}
@Override
@@ -1471,13 +1471,22 @@ public class KeyguardHostView extends KeyguardViewBase {
}
}
- private void showAppropriateWidgetPage() {
+ void showAppropriateWidgetPage() {
int state = mTransportState;
ensureTransportPresentOrRemoved(state);
+ if (mAppWidgetContainer.isLayoutRequested()) {
+ postShowAppropriateWidgetPage();
+ return;
+ }
int pageToShow = getAppropriateWidgetPage(state);
mAppWidgetContainer.setCurrentPage(pageToShow);
}
+ void postShowAppropriateWidgetPage() {
+ removeCallbacks(mSwitchPageRunnable);
+ post(mSwitchPageRunnable);
+ }
+
/**
* Examines the current state and adds the transport to the widget pager when the state changes.
*
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetPager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetPager.java
index 704af6e..e07e0d0 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetPager.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetPager.java
@@ -40,7 +40,6 @@ import android.view.accessibility.AccessibilityManager;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.TextClock;
-
import com.android.internal.widget.LockPatternUtils;
import java.util.ArrayList;