summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorGriff Hazen <griff@google.com>2015-03-13 10:01:41 -0700
committerGriff Hazen <griff@google.com>2015-03-13 10:01:41 -0700
commita0938021718867edd267d4905f3c17ef2944aa65 (patch)
tree36ae39857999246c225560d6a68e4a3d0de40962 /policy
parent5be1afedd8f2289ba047473b242cd0535a4493fe (diff)
downloadframeworks_base-a0938021718867edd267d4905f3c17ef2944aa65.zip
frameworks_base-a0938021718867edd267d4905f3c17ef2944aa65.tar.gz
frameworks_base-a0938021718867edd267d4905f3c17ef2944aa65.tar.bz2
Allow emulator to select a window outset bottom
And clean up some copied around code. Bug: 17440607 Change-Id: I5cf9c58b49110c4be1a77dc9c410fedc6b99aef3
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index cd26c31..c9028c4 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -25,6 +25,7 @@ import static android.view.WindowManager.LayoutParams.*;
import android.app.SearchManager;
import android.os.UserHandle;
import com.android.internal.R;
+import com.android.internal.util.ScreenShapeHelper;
import com.android.internal.view.RootViewSurfaceTaker;
import com.android.internal.view.StandaloneActionMode;
import com.android.internal.view.menu.ContextMenuBuilder;
@@ -61,6 +62,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionInflater;
@@ -145,7 +147,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
TypedValue mFixedWidthMinor;
TypedValue mFixedHeightMajor;
TypedValue mFixedHeightMinor;
- TypedValue mOutsetBottom;
+ int mOutsetBottomPx;
// This is the top-level view of the window, containing the window decor.
private DecorView mDecor;
@@ -2379,12 +2381,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
@Override
public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
- if (mOutsetBottom != null) {
- final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
- int bottom = (int) mOutsetBottom.getDimension(metrics);
+ if (mOutsetBottomPx != 0) {
WindowInsets newInsets = insets.replaceSystemWindowInsets(
insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(),
- insets.getSystemWindowInsetRight(), bottom);
+ insets.getSystemWindowInsetRight(), mOutsetBottomPx);
return super.dispatchApplyWindowInsets(newInsets);
} else {
return super.dispatchApplyWindowInsets(insets);
@@ -2603,12 +2603,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
}
- if (mOutsetBottom != null) {
+ if (mOutsetBottomPx != 0) {
int mode = MeasureSpec.getMode(heightMeasureSpec);
if (mode != MeasureSpec.UNSPECIFIED) {
- int outset = (int) mOutsetBottom.getDimension(metrics);
int height = MeasureSpec.getSize(heightMeasureSpec);
- heightMeasureSpec = MeasureSpec.makeMeasureSpec(height + outset, mode);
+ heightMeasureSpec = MeasureSpec.makeMeasureSpec(height + mOutsetBottomPx, mode);
}
}
@@ -3441,10 +3440,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
final boolean shouldUseBottomOutset =
display.getDisplayId() == Display.DEFAULT_DISPLAY
|| (getForcedWindowFlags() & FLAG_FULLSCREEN) != 0;
- if (shouldUseBottomOutset && a.hasValue(R.styleable.Window_windowOutsetBottom)) {
- if (mOutsetBottom == null) mOutsetBottom = new TypedValue();
- a.getValue(R.styleable.Window_windowOutsetBottom,
- mOutsetBottom);
+ if (shouldUseBottomOutset) {
+ mOutsetBottomPx = ScreenShapeHelper.getWindowOutsetBottomPx(
+ getContext().getResources().getDisplayMetrics(), a);
}
}