diff --git a/core/java/com/android/internal/view/StandaloneActionMode.java b/core/java/com/android/internal/view/StandaloneActionMode.java
index d38190109144a..b54daba3b96d5 100644
--- a/core/java/com/android/internal/view/StandaloneActionMode.java
+++ b/core/java/com/android/internal/view/StandaloneActionMode.java
@@ -87,7 +87,6 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call
mFinished = true;
mCallback.onDestroyActionMode(this);
- mContextView.setVisibility(View.GONE);
}
@Override
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java
index 5d663725cbcd0..38f76d34c926d 100644
--- a/core/java/com/android/internal/widget/ActionBarContextView.java
+++ b/core/java/com/android/internal/widget/ActionBarContextView.java
@@ -213,7 +213,7 @@ public class ActionBarContextView extends ViewGroup {
}
final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
- if (heightMode != MeasureSpec.AT_MOST) {
+ if (heightMode == MeasureSpec.UNSPECIFIED) {
throw new IllegalStateException(getClass().getSimpleName() + " can only be used " +
"with android:layout_height=\"wrap_content\"");
}
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index b226aa00819cc..d698ab3b08ba7 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -1143,6 +1143,7 @@
- @android:style/Animation.Holo.Dialog
- stateUnspecified|adjustPan
- false
+ - true
- @null
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index db5f6c15d323f..39224ba3a0d1f 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -58,6 +58,7 @@ import android.util.Config;
import android.util.EventLog;
import android.util.Log;
import android.util.SparseArray;
+import android.util.TypedValue;
import android.view.ActionMode;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
@@ -83,6 +84,7 @@ import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
+import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -1700,6 +1702,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private ActionMode mActionMode;
private ActionBarContextView mActionModeView;
+ private PopupWindow mActionModePopup;
public DecorView(Context context, int featureId) {
super(context);
@@ -2019,9 +2022,18 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (mActionModeView == null) {
if (hasFeature(FEATURE_ACTION_MODE_OVERLAY)) {
mActionModeView = new ActionBarContextView(mContext);
- FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
- MATCH_PARENT, WRAP_CONTENT);
- addView(mActionModeView, params);
+ mActionModePopup = new PopupWindow(mContext);
+ mActionModePopup.setLayoutInScreenEnabled(true);
+ mActionModePopup.setClippingEnabled(false);
+ mActionModePopup.setContentView(mActionModeView);
+ mActionModePopup.setWidth(MATCH_PARENT);
+
+ TypedValue heightValue = new TypedValue();
+ mContext.getTheme().resolveAttribute(
+ com.android.internal.R.attr.actionBarSize, heightValue, false);
+ final int height = TypedValue.complexToDimensionPixelSize(heightValue.data,
+ mContext.getResources().getDisplayMetrics());
+ mActionModePopup.setHeight(height);
} else {
ViewStub stub = (ViewStub) findViewById(
com.android.internal.R.id.action_mode_bar_stub);
@@ -2038,6 +2050,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
mActionModeView.initForMode(mode);
mActionModeView.setVisibility(View.VISIBLE);
mActionMode = mode;
+ if (mActionModePopup != null) {
+ mActionModePopup.showAtLocation(this,
+ Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
+ }
} else {
mActionMode = null;
}
@@ -2250,6 +2266,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
public void onDestroyActionMode(ActionMode mode) {
mWrapped.onDestroyActionMode(mode);
+ if (mActionModePopup != null) {
+ mActionModePopup.dismiss();
+ } else if (mActionModeView != null) {
+ mActionModeView.setVisibility(GONE);
+ }
if (mActionModeView != null) {
mActionModeView.removeAllViews();
}