summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/Window.java7
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java26
2 files changed, 33 insertions, 0 deletions
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index a24289523560..06974d31e86e 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -89,6 +89,13 @@ public abstract class Window {
* If overlay is enabled, the action mode UI will be allowed to cover existing window content.
*/
public static final int FEATURE_ACTION_MODE_OVERLAY = 10;
+
+ /**
+ * Max value used as a feature ID
+ * @hide
+ */
+ public static final int FEATURE_MAX = FEATURE_ACTION_MODE_OVERLAY;
+
/** Flag for setting the progress bar's visibility to VISIBLE */
public static final int PROGRESS_VISIBILITY_ON = -1;
/** Flag for setting the progress bar's visibility to GONE */
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index e761847b788c..bba2c7fd8b6b 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -192,6 +192,20 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private int mUiOptions = 0;
+ private boolean mInvalidatePanelMenuPosted;
+ private int mInvalidatePanelMenuFeatures;
+ private final Runnable mInvalidatePanelMenuRunnable = new Runnable() {
+ @Override public void run() {
+ for (int i = 0; i <= FEATURE_MAX; i++) {
+ if ((mInvalidatePanelMenuFeatures & 1 << i) != 0) {
+ doInvalidatePanelMenu(i);
+ }
+ }
+ mInvalidatePanelMenuPosted = false;
+ mInvalidatePanelMenuFeatures = 0;
+ }
+ };
+
static class WindowManagerHolder {
static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService("window"));
@@ -722,6 +736,15 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
@Override
public void invalidatePanelMenu(int featureId) {
+ mInvalidatePanelMenuFeatures |= 1 << featureId;
+
+ if (!mInvalidatePanelMenuPosted && mDecor != null) {
+ mDecor.postOnAnimation(mInvalidatePanelMenuRunnable);
+ mInvalidatePanelMenuPosted = true;
+ }
+ }
+
+ void doInvalidatePanelMenu(int featureId) {
PanelFeatureState st = getPanelState(featureId, true);
Bundle savedActionViewStates = null;
if (st.menu != null) {
@@ -2842,6 +2865,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
mDecor.setIsRootNamespace(true);
mDecor.setLayoutDirection(
getContext().getResources().getConfiguration().getLayoutDirection());
+ if (!mInvalidatePanelMenuPosted && mInvalidatePanelMenuFeatures != 0) {
+ mDecor.postOnAnimation(mInvalidatePanelMenuRunnable);
+ }
}
if (mContentParent == null) {
mContentParent = generateLayout(mDecor);