Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d66ba06a authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

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
parent eded9424
Loading
Loading
Loading
Loading
+2 −15
Original line number Diff line number Diff line
@@ -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);