summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorFilip Gruszczynski <gruszczy@google.com>2015-05-26 11:32:08 -0700
committerFilip Gruszczynski <gruszczy@google.com>2015-05-27 15:36:10 -0700
commit2217f61e51ba4b19c56b19297c1e9cf74d7d860f (patch)
tree8e6794696b4517c2cc7304b2c4358dea2296fa07 /core/java/com
parentb2849d9a20ac080c1b29a3b54a1d636080faccc3 (diff)
downloadframeworks_base-2217f61e51ba4b19c56b19297c1e9cf74d7d860f.zip
frameworks_base-2217f61e51ba4b19c56b19297c1e9cf74d7d860f.tar.gz
frameworks_base-2217f61e51ba4b19c56b19297c1e9cf74d7d860f.tar.bz2
Revert "Revert "resolved conflicts for merge of 47249f2a to mnc-dev""
This includes the fix for the broken dialog windows. The outsets will only be calculated and applied if the window is full screen, since they don't make much sense otherwise. This reverts commit 4bb6b751fbbb218e8a298db4aa008472a0aa8d31. Change-Id: I977a85a78c990c1840784dc0be0dddd5a6d84e6b
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/os/SomeArgs.java2
-rw-r--r--core/java/com/android/internal/policy/PhoneWindow.java56
-rw-r--r--core/java/com/android/internal/util/ScreenShapeHelper.java12
-rw-r--r--core/java/com/android/internal/view/BaseIWindow.java4
4 files changed, 32 insertions, 42 deletions
diff --git a/core/java/com/android/internal/os/SomeArgs.java b/core/java/com/android/internal/os/SomeArgs.java
index c977997..b0d24fd 100644
--- a/core/java/com/android/internal/os/SomeArgs.java
+++ b/core/java/com/android/internal/os/SomeArgs.java
@@ -46,6 +46,7 @@ public final class SomeArgs {
public Object arg4;
public Object arg5;
public Object arg6;
+ public Object arg7;
public int argi1;
public int argi2;
public int argi3;
@@ -97,6 +98,7 @@ public final class SomeArgs {
arg4 = null;
arg5 = null;
arg6 = null;
+ arg7 = null;
argi1 = 0;
argi2 = 0;
argi3 = 0;
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index bc64373..a04218a 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -56,7 +56,6 @@ import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowManager;
import com.android.internal.R;
-import com.android.internal.util.ScreenShapeHelper;
import com.android.internal.view.FloatingActionMode;
import com.android.internal.view.RootViewSurfaceTaker;
import com.android.internal.view.StandaloneActionMode;
@@ -156,7 +155,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
TypedValue mFixedWidthMinor;
TypedValue mFixedHeightMajor;
TypedValue mFixedHeightMinor;
- int mOutsetBottomPx;
// This is the top-level view of the window, containing the window decor.
private DecorView mDecor;
@@ -289,6 +287,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private Boolean mSharedElementsUseOverlay;
private Rect mTempRect;
+ private Rect mOutsets = new Rect();
static class WindowManagerHolder {
static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface(
@@ -2401,19 +2400,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
@Override
- public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
- if (mOutsetBottomPx != 0) {
- WindowInsets newInsets = insets.replaceSystemWindowInsets(
- insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(),
- insets.getSystemWindowInsetRight(), mOutsetBottomPx);
- return super.dispatchApplyWindowInsets(newInsets);
- } else {
- return super.dispatchApplyWindowInsets(insets);
- }
- }
-
-
- @Override
public boolean onTouchEvent(MotionEvent event) {
return onInterceptTouchEvent(event);
}
@@ -2624,11 +2610,21 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
}
- if (mOutsetBottomPx != 0) {
+ getOutsets(mOutsets);
+ if (mOutsets.top > 0 || mOutsets.bottom > 0) {
int mode = MeasureSpec.getMode(heightMeasureSpec);
if (mode != MeasureSpec.UNSPECIFIED) {
int height = MeasureSpec.getSize(heightMeasureSpec);
- heightMeasureSpec = MeasureSpec.makeMeasureSpec(height + mOutsetBottomPx, mode);
+ heightMeasureSpec = MeasureSpec.makeMeasureSpec(
+ height + mOutsets.top + mOutsets.bottom, mode);
+ }
+ }
+ if (mOutsets.left > 0 || mOutsets.right > 0) {
+ int mode = MeasureSpec.getMode(widthMeasureSpec);
+ if (mode != MeasureSpec.UNSPECIFIED) {
+ int width = MeasureSpec.getSize(widthMeasureSpec);
+ widthMeasureSpec = MeasureSpec.makeMeasureSpec(
+ width + mOutsets.left + mOutsets.right, mode);
}
}
@@ -2666,6 +2662,18 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
@Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+ getOutsets(mOutsets);
+ if (mOutsets.left > 0) {
+ offsetLeftAndRight(-mOutsets.left);
+ }
+ if (mOutsets.top > 0) {
+ offsetTopAndBottom(-mOutsets.top);
+ }
+ }
+
+ @Override
public void draw(Canvas canvas) {
super.draw(canvas);
@@ -2674,7 +2682,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
}
-
@Override
public boolean showContextMenuForChild(View originalView) {
// Reuse the context menu builder
@@ -3583,19 +3590,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
requestFeature(FEATURE_ACTIVITY_TRANSITIONS);
}
- final WindowManager windowService = (WindowManager) getContext().getSystemService(
- Context.WINDOW_SERVICE);
- if (windowService != null) {
- final Display display = windowService.getDefaultDisplay();
- final boolean shouldUseBottomOutset =
- display.getDisplayId() == Display.DEFAULT_DISPLAY
- || (getForcedWindowFlags() & FLAG_FULLSCREEN) != 0;
- if (shouldUseBottomOutset) {
- mOutsetBottomPx = ScreenShapeHelper.getWindowOutsetBottomPx(
- getContext().getResources().getDisplayMetrics(), a);
- }
- }
-
final Context context = getContext();
final int targetSdk = context.getApplicationInfo().targetSdkVersion;
final boolean targetPreHoneycomb = targetSdk < android.os.Build.VERSION_CODES.HONEYCOMB;
diff --git a/core/java/com/android/internal/util/ScreenShapeHelper.java b/core/java/com/android/internal/util/ScreenShapeHelper.java
index 58ae853..4a196f8 100644
--- a/core/java/com/android/internal/util/ScreenShapeHelper.java
+++ b/core/java/com/android/internal/util/ScreenShapeHelper.java
@@ -18,19 +18,13 @@ public class ScreenShapeHelper {
/**
* Return the bottom pixel window outset of a window given its style attributes.
- * @param displayMetrics Display metrics of the current device
- * @param windowStyle Window style attributes for the window.
* @return An outset dimension in pixels or 0 if no outset should be applied.
*/
- public static int getWindowOutsetBottomPx(DisplayMetrics displayMetrics,
- TypedArray windowStyle) {
+ public static int getWindowOutsetBottomPx(Resources resources) {
if (IS_EMULATOR) {
return SystemProperties.getInt(ViewRootImpl.PROPERTY_EMULATOR_WIN_OUTSET_BOTTOM_PX, 0);
- } else if (windowStyle.hasValue(R.styleable.Window_windowOutsetBottom)) {
- TypedValue outsetBottom = new TypedValue();
- windowStyle.getValue(R.styleable.Window_windowOutsetBottom, outsetBottom);
- return (int) outsetBottom.getDimension(displayMetrics);
+ } else {
+ return resources.getInteger(com.android.internal.R.integer.config_windowOutsetBottom);
}
- return 0;
}
}
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index e27ba13..3eeabcd 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -34,8 +34,8 @@ public class BaseIWindow extends IWindow.Stub {
}
@Override
- public void resized(Rect frame, Rect overscanInsets, Rect contentInsets,
- Rect visibleInsets, Rect stableInsets, boolean reportDraw, Configuration newConfig) {
+ public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets,
+ Rect stableInsets, Rect outsets, boolean reportDraw, Configuration newConfig) {
if (reportDraw) {
try {
mSession.finishDrawing(this);