From d66ba06a8727fa27d1f4bcb867be17b5f576384c Mon Sep 17 00:00:00 2001 From: Filip Gruszczynski Date: Mon, 23 Mar 2015 12:59:02 -0700 Subject: Don't use windowOutsetBottom for insets, depend on display padding only. I am not sure if this is the correct approach to the problem. Right now we are reporting double chin (60 vs 30). The reason for this is that we setDisplayPadding from Clockwork Home activity (bottom=30) and add windowOutsetBottom. We use display padding to set surface frame size (320x320) and both outset bottom and display padding for inset. I think we should use only one of these. I decided to go with display padding, because that's what was suggested to me the last time I visited this. I removed the dependency on windowOutsetBottom altogether. However, I don't feel confident this is the correct way to do this. We depend on Home activity to send the display padding now to get the correct result, so wallpapers behind other activities will not work correctly. Maybe instead of setting display padding from the outside, the windowOutsetBottom should be added to display padding bottom for the purpose of calculating surface frame and generating insets. Advice on what is the right approach here would be greatly appreciated. Bug: 19881056 Change-Id: Ifb655528d8f85ef01d942bf1e64e8b08475689ca --- .../android/service/wallpaper/WallpaperService.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'core') diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index d46b6f5..1674950 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -155,7 +155,6 @@ public abstract class WallpaperService extends Service { WindowManager.LayoutParams.PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS; int mCurWindowFlags = mWindowFlags; int mCurWindowPrivateFlags = mWindowPrivateFlags; - int mOutsetBottomPx; final Rect mVisibleInsets = new Rect(); final Rect mWinFrame = new Rect(); final Rect mOverscanInsets = new Rect(); @@ -624,18 +623,9 @@ public abstract class WallpaperService extends Service { mLayout.token = mWindowToken; if (!mCreated) { - // Retrieve watch round and outset info - final WindowManager windowService = (WindowManager)getSystemService( - Context.WINDOW_SERVICE); + // Retrieve watch round info TypedArray windowStyle = obtainStyledAttributes( com.android.internal.R.styleable.Window); - final Display display = windowService.getDefaultDisplay(); - final boolean shouldUseBottomOutset = - display.getDisplayId() == Display.DEFAULT_DISPLAY; - if (shouldUseBottomOutset) { - mOutsetBottomPx = ScreenShapeHelper.getWindowOutsetBottomPx( - getResources().getDisplayMetrics(), windowStyle); - } mWindowIsRound = ScreenShapeHelper.getWindowIsRound(getResources()); windowStyle.recycle(); @@ -770,10 +760,7 @@ public abstract class WallpaperService extends Service { mDispatchedStableInsets.set(mStableInsets); mFinalSystemInsets.set(mDispatchedOverscanInsets); mFinalStableInsets.set(mDispatchedStableInsets); - if (mOutsetBottomPx != 0) { - mFinalSystemInsets.bottom = - mIWallpaperEngine.mDisplayPadding.bottom + mOutsetBottomPx; - } + mFinalSystemInsets.bottom = mIWallpaperEngine.mDisplayPadding.bottom; WindowInsets insets = new WindowInsets(mFinalSystemInsets, null, mFinalStableInsets, mWindowIsRound); onApplyWindowInsets(insets); -- cgit v1.1