diff options
author | Filip Gruszczynski <gruszczy@google.com> | 2015-06-01 15:42:40 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-01 15:42:42 +0000 |
commit | 99bcc3eee23ed8bd15bd108d068d6f9f694e4393 (patch) | |
tree | 7264c5e939601112f2fc17ca02aea96e4bbe1d1d /services/core/java | |
parent | c4e5ec3f7fcc99de6aa070d463bfaeedbfd86802 (diff) | |
parent | 2217f61e51ba4b19c56b19297c1e9cf74d7d860f (diff) | |
download | frameworks_base-99bcc3eee23ed8bd15bd108d068d6f9f694e4393.zip frameworks_base-99bcc3eee23ed8bd15bd108d068d6f9f694e4393.tar.gz frameworks_base-99bcc3eee23ed8bd15bd108d068d6f9f694e4393.tar.bz2 |
Merge "Revert "Revert "resolved conflicts for merge of 47249f2a to mnc-dev""" into mnc-dev
Diffstat (limited to 'services/core/java')
4 files changed, 87 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index a1e1aef..7d383fa 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -108,6 +108,7 @@ import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import com.android.internal.R; import com.android.internal.statusbar.IStatusBarService; +import com.android.internal.util.ScreenShapeHelper; import com.android.internal.widget.PointerLocationView; import com.android.server.LocalServices; import com.android.server.policy.keyguard.KeyguardServiceDelegate; @@ -472,6 +473,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final Rect mTmpDecorFrame = new Rect(); static final Rect mTmpStableFrame = new Rect(); static final Rect mTmpNavigationFrame = new Rect(); + static final Rect mTmpOutsetFrame = new Rect(); WindowState mTopFullscreenOpaqueWindowState; WindowState mTopFullscreenOpaqueOrDimmingWindowState; @@ -3363,6 +3365,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final Rect of = mTmpOverscanFrame; final Rect vf = mTmpVisibleFrame; final Rect dcf = mTmpDecorFrame; + final Rect osf = mTmpOutsetFrame; pf.left = df.left = of.left = vf.left = mDockLeft; pf.top = df.top = of.top = vf.top = mDockTop; pf.right = df.right = of.right = vf.right = mDockRight; @@ -3472,7 +3475,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // And compute the final frame. mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame, mTmpNavigationFrame, mTmpNavigationFrame, mTmpNavigationFrame, dcf, - mTmpNavigationFrame); + mTmpNavigationFrame, mTmpNavigationFrame); if (DEBUG_LAYOUT) Slog.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame); if (mNavigationBarController.checkHiddenLw()) { updateSysUiVisibility = true; @@ -3497,7 +3500,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { mStatusBarLayer = mStatusBar.getSurfaceLayer(); // Let the status bar determine its size. - mStatusBar.computeFrameLw(pf, df, vf, vf, vf, dcf, vf); + mStatusBar.computeFrameLw(pf /* parentFrame */, df /* displayFrame */, + vf /* overlayFrame */, vf /* contentFrame */, vf /* visibleFrame */, + dcf /* decorFrame */, vf /* stableFrame */, vf /* outsetFrame */); // For layout, the status bar is always at the top with our fixed height. mStableTop = mUnrestrictedScreenTop + mStatusBarHeight; @@ -3680,6 +3685,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final Rect vf = mTmpVisibleFrame; final Rect dcf = mTmpDecorFrame; final Rect sf = mTmpStableFrame; + Rect osf = null; dcf.setEmpty(); final boolean hasNavBar = (isDefaultDisplay && mHasNavigationBar @@ -4073,6 +4079,32 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } + // If the device has a chin (e.g. some watches), a dead area at the bottom of the screen we + // need to provide information to the clients that want to pretend that you can draw there. + if (isDefaultDisplay && (fl & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0) { + osf = mTmpOutsetFrame; + osf.set(cf.left, cf.top, cf.right, cf.bottom); + int outset = ScreenShapeHelper.getWindowOutsetBottomPx(mContext.getResources()); + if (outset > 0) { + int rotation = Surface.ROTATION_0; + try { + rotation = mWindowManager.getRotation(); + } catch (RemoteException e) { + } + if (rotation == Surface.ROTATION_0) { + osf.bottom += outset; + } else if (rotation == Surface.ROTATION_90) { + osf.right += outset; + } else if (rotation == Surface.ROTATION_180) { + osf.top -= outset; + } else if (rotation == Surface.ROTATION_270) { + osf.left -= outset; + } + if (DEBUG_LAYOUT) Slog.v(TAG, "applying bottom outset of " + outset + + " with rotation " + rotation + ", result: " + osf); + } + } + if (DEBUG_LAYOUT) Slog.v(TAG, "Compute frame " + attrs.getTitle() + ": sim=#" + Integer.toHexString(sim) + " attach=" + attached + " type=" + attrs.type @@ -4081,9 +4113,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { + " of=" + of.toShortString() + " cf=" + cf.toShortString() + " vf=" + vf.toShortString() + " dcf=" + dcf.toShortString() - + " sf=" + sf.toShortString()); + + " sf=" + sf.toShortString() + + " osf=" + (osf == null ? "null" : osf.toShortString())); - win.computeFrameLw(pf, df, of, cf, vf, dcf, sf); + win.computeFrameLw(pf, df, of, cf, vf, dcf, sf, osf); // Dock windows carve out the bottom of the screen, so normal windows // can't appear underneath them. diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java index 487483e..e9c5ac7 100644 --- a/services/core/java/com/android/server/wm/Session.java +++ b/services/core/java/com/android/server/wm/Session.java @@ -190,14 +190,15 @@ final class Session extends IWindowSession.Stub public int relayout(IWindow window, int seq, WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewFlags, int flags, Rect outFrame, Rect outOverscanInsets, Rect outContentInsets, - Rect outVisibleInsets, Rect outStableInsets, Configuration outConfig, + Rect outVisibleInsets, Rect outStableInsets, Rect outsets, Configuration + outConfig, Surface outSurface) { if (false) Slog.d(WindowManagerService.TAG, ">>>>>> ENTERED relayout from " + Binder.getCallingPid()); int res = mService.relayoutWindow(this, window, seq, attrs, requestedWidth, requestedHeight, viewFlags, flags, outFrame, outOverscanInsets, outContentInsets, outVisibleInsets, - outStableInsets, outConfig, outSurface); + outStableInsets, outsets, outConfig, outSurface); if (false) Slog.d(WindowManagerService.TAG, "<<<<<< EXITING relayout to " + Binder.getCallingPid()); return res; @@ -522,4 +523,4 @@ final class Session extends IWindowSession.Stub public String toString() { return mStringName; } -}
\ No newline at end of file +} diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 6042c27..7671293 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -3052,7 +3052,7 @@ public class WindowManagerService extends IWindowManager.Stub WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, Rect outFrame, Rect outOverscanInsets, Rect outContentInsets, - Rect outVisibleInsets, Rect outStableInsets, Configuration outConfig, + Rect outVisibleInsets, Rect outStableInsets, Rect outOutsets, Configuration outConfig, Surface outSurface) { boolean toBeDisplayed = false; boolean inTouchMode; @@ -3340,6 +3340,7 @@ public class WindowManagerService extends IWindowManager.Stub outContentInsets.set(win.mContentInsets); outVisibleInsets.set(win.mVisibleInsets); outStableInsets.set(win.mStableInsets); + outOutsets.set(win.mOutsets); if (localLOGV) Slog.v( TAG, "Relayout given client " + client.asBinder() + ", requestedWidth=" + requestedWidth @@ -9613,6 +9614,7 @@ public class WindowManagerService extends IWindowManager.Stub w.mLastContentInsets.set(w.mContentInsets); w.mLastVisibleInsets.set(w.mVisibleInsets); w.mLastStableInsets.set(w.mStableInsets); + w.mLastOutsets.set(w.mOutsets); makeWindowFreezingScreenIfNeededLocked(w); // If the orientation is changing, then we need to // hold off on unfreezing the display until this diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 193d812..b8b243c 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -180,6 +180,14 @@ final class WindowState implements WindowManagerPolicy.WindowState { boolean mStableInsetsChanged; /** + * Outsets determine the area outside of the surface where we want to pretend that it's possible + * to draw anyway. + */ + final Rect mOutsets = new Rect(); + final Rect mLastOutsets = new Rect(); + boolean mOutsetsChanged = false; + + /** * Set to true if we are waiting for this window to receive its * given internal insets before laying out other windows based on it. */ @@ -261,6 +269,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { // displays hint text. final Rect mVisibleFrame = new Rect(); + // Frame that includes dead area outside of the surface but where we want to pretend that it's + // possible to draw. + final Rect mOutsetFrame = new Rect(); + boolean mContentChanged; // If a window showing a wallpaper: the requested offset for the @@ -519,7 +531,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { } @Override - public void computeFrameLw(Rect pf, Rect df, Rect of, Rect cf, Rect vf, Rect dcf, Rect sf) { + public void computeFrameLw(Rect pf, Rect df, Rect of, Rect cf, Rect vf, Rect dcf, Rect sf, + Rect osf) { mHaveFrame = true; final TaskStack stack = mAppToken != null ? getStack() : null; @@ -594,6 +607,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { mVisibleFrame.set(vf); mDecorFrame.set(dcf); mStableFrame.set(sf); + final boolean hasOutsets = osf != null; + if (hasOutsets) { + mOutsetFrame.set(osf); + } final int fw = mFrame.width(); final int fh = mFrame.height(); @@ -658,6 +675,16 @@ final class WindowState implements WindowManagerPolicy.WindowState { Math.max(mFrame.right - mStableFrame.right, 0), Math.max(mFrame.bottom - mStableFrame.bottom, 0)); + if (hasOutsets) { + // We need to calculate outsets + mOutsets.set(Math.max(mContentFrame.left - mOutsetFrame.left, 0), + Math.max(mContentFrame.top - mOutsetFrame.top, 0), + Math.max(mOutsetFrame.right - mContentFrame.right, 0), + Math.max(mOutsetFrame.bottom - mContentFrame.bottom, 0)); + } else { + mOutsets.set(0, 0, 0, 0); + } + mCompatFrame.set(mFrame); if (mEnforceSizeCompat) { // If there is a size compatibility scale being applied to the @@ -667,6 +694,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mContentInsets.scale(mInvGlobalScale); mVisibleInsets.scale(mInvGlobalScale); mStableInsets.scale(mInvGlobalScale); + mOutsets.scale(mInvGlobalScale); // Also the scaled frame that we report to the app needs to be // adjusted to be in its coordinate space. @@ -689,7 +717,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { + "): frame=" + mFrame.toShortString() + " ci=" + mContentInsets.toShortString() + " vi=" + mVisibleInsets.toShortString() - + " vi=" + mStableInsets.toShortString()); + + " vi=" + mStableInsets.toShortString() + + " of=" + mOutsets.toShortString()); } @Override @@ -804,7 +833,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { mContentInsetsChanged |= !mLastContentInsets.equals(mContentInsets); mVisibleInsetsChanged |= !mLastVisibleInsets.equals(mVisibleInsets); mStableInsetsChanged |= !mLastStableInsets.equals(mStableInsets); - return mOverscanInsetsChanged || mContentInsetsChanged || mVisibleInsetsChanged; + mOutsetsChanged |= !mLastOutsets.equals(mOutsets); + return mOverscanInsetsChanged || mContentInsetsChanged || mVisibleInsetsChanged + || mOutsetsChanged; } public DisplayContent getDisplayContent() { @@ -1472,6 +1503,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { final Rect contentInsets = mLastContentInsets; final Rect visibleInsets = mLastVisibleInsets; final Rect stableInsets = mLastStableInsets; + final Rect outsets = mLastOutsets; final boolean reportDraw = mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING; final Configuration newConfig = configChanged ? mConfiguration : null; if (mAttrs.type != WindowManager.LayoutParams.TYPE_APPLICATION_STARTING @@ -1482,7 +1514,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { public void run() { try { mClient.resized(frame, overscanInsets, contentInsets, - visibleInsets, stableInsets, reportDraw, newConfig); + visibleInsets, stableInsets, outsets, reportDraw, newConfig); } catch (RemoteException e) { // Not a remote call, RemoteException won't be raised. } @@ -1490,7 +1522,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { }); } else { mClient.resized(frame, overscanInsets, contentInsets, visibleInsets, stableInsets, - reportDraw, newConfig); + outsets, reportDraw, newConfig); } //TODO (multidisplay): Accessibility supported only for the default display. @@ -1503,6 +1535,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mContentInsetsChanged = false; mVisibleInsetsChanged = false; mStableInsetsChanged = false; + mOutsetsChanged = false; mWinAnimator.mSurfaceResized = false; } catch (RemoteException e) { mOrientationChanging = false; @@ -1664,17 +1697,22 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.println(); pw.print(prefix); pw.print(" decor="); mDecorFrame.printShortString(pw); pw.println(); + pw.print(prefix); pw.print(" outset="); mOutsetFrame.printShortString(pw); + pw.println(); pw.print(prefix); pw.print("Cur insets: overscan="); mOverscanInsets.printShortString(pw); pw.print(" content="); mContentInsets.printShortString(pw); pw.print(" visible="); mVisibleInsets.printShortString(pw); pw.print(" stable="); mStableInsets.printShortString(pw); + pw.print(" outsets="); mOutsets.printShortString(pw); pw.println(); pw.print(prefix); pw.print("Lst insets: overscan="); mLastOverscanInsets.printShortString(pw); pw.print(" content="); mLastContentInsets.printShortString(pw); pw.print(" visible="); mLastVisibleInsets.printShortString(pw); pw.print(" stable="); mLastStableInsets.printShortString(pw); + pw.print(" physical="); mLastOutsets.printShortString(pw); + pw.print(" outset="); mLastOutsets.printShortString(pw); pw.println(); } pw.print(prefix); pw.print(mWinAnimator); pw.println(":"); |