Loading core/java/android/service/wallpaper/WallpaperService.java +13 −4 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.os.SystemClock; import android.util.Log; import android.util.MergedConfiguration; import android.view.Display; import android.view.DisplayCutout; import android.view.Gravity; import android.view.IWindowSession; import android.view.InputChannel; Loading Loading @@ -176,6 +177,9 @@ public abstract class WallpaperService extends Service { final Rect mFinalSystemInsets = new Rect(); final Rect mFinalStableInsets = new Rect(); final Rect mBackdropFrame = new Rect(); final DisplayCutout.ParcelableWrapper mDisplayCutout = new DisplayCutout.ParcelableWrapper(); DisplayCutout mDispatchedDisplayCutout = DisplayCutout.NO_CUTOUT; final MergedConfiguration mMergedConfiguration = new MergedConfiguration(); final WindowManager.LayoutParams mLayout Loading Loading @@ -302,7 +306,8 @@ public abstract class WallpaperService extends Service { public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw, MergedConfiguration mergedConfiguration, Rect backDropRect, boolean forceLayout, boolean alwaysConsumeNavBar, int displayId) { boolean alwaysConsumeNavBar, int displayId, DisplayCutout.ParcelableWrapper displayCutout) { Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED, reportDraw ? 1 : 0, outsets); mCaller.sendMessage(msg); Loading Loading @@ -750,7 +755,7 @@ public abstract class WallpaperService extends Service { mInputChannel = new InputChannel(); if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE, Display.DEFAULT_DISPLAY, mContentInsets, mStableInsets, mOutsets, mInputChannel) < 0) { mDisplayCutout, mInputChannel) < 0) { Log.w(TAG, "Failed to add window while updating wallpaper surface."); return; } Loading @@ -776,7 +781,7 @@ public abstract class WallpaperService extends Service { mWindow, mWindow.mSeq, mLayout, mWidth, mHeight, View.VISIBLE, 0, mWinFrame, mOverscanInsets, mContentInsets, mVisibleInsets, mStableInsets, mOutsets, mBackdropFrame, mMergedConfiguration, mSurfaceHolder.mSurface); mDisplayCutout, mMergedConfiguration, mSurfaceHolder.mSurface); if (DEBUG) Log.v(TAG, "New surface: " + mSurfaceHolder.mSurface + ", frame=" + mWinFrame); Loading @@ -800,6 +805,8 @@ public abstract class WallpaperService extends Service { mStableInsets.top += padding.top; mStableInsets.right += padding.right; mStableInsets.bottom += padding.bottom; mDisplayCutout.set(mDisplayCutout.get().inset(-padding.left, -padding.top, -padding.right, -padding.bottom)); } if (mCurWidth != w) { Loading @@ -819,6 +826,7 @@ public abstract class WallpaperService extends Service { insetsChanged |= !mDispatchedContentInsets.equals(mContentInsets); insetsChanged |= !mDispatchedStableInsets.equals(mStableInsets); insetsChanged |= !mDispatchedOutsets.equals(mOutsets); insetsChanged |= !mDispatchedDisplayCutout.equals(mDisplayCutout.get()); mSurfaceHolder.setSurfaceFrameSize(w, h); mSurfaceHolder.mSurfaceLock.unlock(); Loading Loading @@ -885,12 +893,13 @@ public abstract class WallpaperService extends Service { mDispatchedContentInsets.set(mContentInsets); mDispatchedStableInsets.set(mStableInsets); mDispatchedOutsets.set(mOutsets); mDispatchedDisplayCutout = mDisplayCutout.get(); mFinalSystemInsets.set(mDispatchedOverscanInsets); mFinalStableInsets.set(mDispatchedStableInsets); WindowInsets insets = new WindowInsets(mFinalSystemInsets, null, mFinalStableInsets, getResources().getConfiguration().isScreenRound(), false, null /* displayCutout */); mDispatchedDisplayCutout); if (DEBUG) { Log.v(TAG, "dispatching insets=" + insets); } Loading core/java/android/view/DisplayCutout.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /** * Copyright (c) 2017, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view; parcelable DisplayCutout.ParcelableWrapper; core/java/android/view/IWindow.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.os.ParcelFileDescriptor; import android.view.DragEvent; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.DisplayCutout; import com.android.internal.os.IResultReceiver; import android.util.MergedConfiguration; Loading Loading @@ -50,7 +51,8 @@ oneway interface IWindow { void resized(in Rect frame, in Rect overscanInsets, in Rect contentInsets, in Rect visibleInsets, in Rect stableInsets, in Rect outsets, boolean reportDraw, in MergedConfiguration newMergedConfiguration, in Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeNavBar, int displayId); boolean forceLayout, boolean alwaysConsumeNavBar, int displayId, in DisplayCutout.ParcelableWrapper displayCutout); void moved(int newX, int newY); void dispatchAppVisibility(boolean visible); void dispatchGetNewSurface(); Loading core/java/android/view/IWindowSession.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.graphics.Rect; import android.graphics.Region; import android.os.Bundle; import android.util.MergedConfiguration; import android.view.DisplayCutout; import android.view.InputChannel; import android.view.IWindow; import android.view.IWindowId; Loading @@ -40,7 +41,8 @@ interface IWindowSession { out InputChannel outInputChannel); int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets, out InputChannel outInputChannel); out Rect outStableInsets, out Rect outOutsets, out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel); int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets); int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, Loading Loading @@ -96,6 +98,7 @@ interface IWindowSession { int flags, out Rect outFrame, out Rect outOverscanInsets, out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets, out Rect outOutsets, out Rect outBackdropFrame, out DisplayCutout.ParcelableWrapper displayCutout, out MergedConfiguration outMergedConfiguration, out Surface outSurface); /* Loading core/java/android/view/View.java +3 −0 Original line number Diff line number Diff line Loading @@ -25757,6 +25757,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ final Rect mStableInsets = new Rect(); final DisplayCutout.ParcelableWrapper mDisplayCutout = new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT); /** * For windows that include areas that are not covered by real surface these are the outsets * for real surface. Loading
core/java/android/service/wallpaper/WallpaperService.java +13 −4 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.os.SystemClock; import android.util.Log; import android.util.MergedConfiguration; import android.view.Display; import android.view.DisplayCutout; import android.view.Gravity; import android.view.IWindowSession; import android.view.InputChannel; Loading Loading @@ -176,6 +177,9 @@ public abstract class WallpaperService extends Service { final Rect mFinalSystemInsets = new Rect(); final Rect mFinalStableInsets = new Rect(); final Rect mBackdropFrame = new Rect(); final DisplayCutout.ParcelableWrapper mDisplayCutout = new DisplayCutout.ParcelableWrapper(); DisplayCutout mDispatchedDisplayCutout = DisplayCutout.NO_CUTOUT; final MergedConfiguration mMergedConfiguration = new MergedConfiguration(); final WindowManager.LayoutParams mLayout Loading Loading @@ -302,7 +306,8 @@ public abstract class WallpaperService extends Service { public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw, MergedConfiguration mergedConfiguration, Rect backDropRect, boolean forceLayout, boolean alwaysConsumeNavBar, int displayId) { boolean alwaysConsumeNavBar, int displayId, DisplayCutout.ParcelableWrapper displayCutout) { Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED, reportDraw ? 1 : 0, outsets); mCaller.sendMessage(msg); Loading Loading @@ -750,7 +755,7 @@ public abstract class WallpaperService extends Service { mInputChannel = new InputChannel(); if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE, Display.DEFAULT_DISPLAY, mContentInsets, mStableInsets, mOutsets, mInputChannel) < 0) { mDisplayCutout, mInputChannel) < 0) { Log.w(TAG, "Failed to add window while updating wallpaper surface."); return; } Loading @@ -776,7 +781,7 @@ public abstract class WallpaperService extends Service { mWindow, mWindow.mSeq, mLayout, mWidth, mHeight, View.VISIBLE, 0, mWinFrame, mOverscanInsets, mContentInsets, mVisibleInsets, mStableInsets, mOutsets, mBackdropFrame, mMergedConfiguration, mSurfaceHolder.mSurface); mDisplayCutout, mMergedConfiguration, mSurfaceHolder.mSurface); if (DEBUG) Log.v(TAG, "New surface: " + mSurfaceHolder.mSurface + ", frame=" + mWinFrame); Loading @@ -800,6 +805,8 @@ public abstract class WallpaperService extends Service { mStableInsets.top += padding.top; mStableInsets.right += padding.right; mStableInsets.bottom += padding.bottom; mDisplayCutout.set(mDisplayCutout.get().inset(-padding.left, -padding.top, -padding.right, -padding.bottom)); } if (mCurWidth != w) { Loading @@ -819,6 +826,7 @@ public abstract class WallpaperService extends Service { insetsChanged |= !mDispatchedContentInsets.equals(mContentInsets); insetsChanged |= !mDispatchedStableInsets.equals(mStableInsets); insetsChanged |= !mDispatchedOutsets.equals(mOutsets); insetsChanged |= !mDispatchedDisplayCutout.equals(mDisplayCutout.get()); mSurfaceHolder.setSurfaceFrameSize(w, h); mSurfaceHolder.mSurfaceLock.unlock(); Loading Loading @@ -885,12 +893,13 @@ public abstract class WallpaperService extends Service { mDispatchedContentInsets.set(mContentInsets); mDispatchedStableInsets.set(mStableInsets); mDispatchedOutsets.set(mOutsets); mDispatchedDisplayCutout = mDisplayCutout.get(); mFinalSystemInsets.set(mDispatchedOverscanInsets); mFinalStableInsets.set(mDispatchedStableInsets); WindowInsets insets = new WindowInsets(mFinalSystemInsets, null, mFinalStableInsets, getResources().getConfiguration().isScreenRound(), false, null /* displayCutout */); mDispatchedDisplayCutout); if (DEBUG) { Log.v(TAG, "dispatching insets=" + insets); } Loading
core/java/android/view/DisplayCutout.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /** * Copyright (c) 2017, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view; parcelable DisplayCutout.ParcelableWrapper;
core/java/android/view/IWindow.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.os.ParcelFileDescriptor; import android.view.DragEvent; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.DisplayCutout; import com.android.internal.os.IResultReceiver; import android.util.MergedConfiguration; Loading Loading @@ -50,7 +51,8 @@ oneway interface IWindow { void resized(in Rect frame, in Rect overscanInsets, in Rect contentInsets, in Rect visibleInsets, in Rect stableInsets, in Rect outsets, boolean reportDraw, in MergedConfiguration newMergedConfiguration, in Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeNavBar, int displayId); boolean forceLayout, boolean alwaysConsumeNavBar, int displayId, in DisplayCutout.ParcelableWrapper displayCutout); void moved(int newX, int newY); void dispatchAppVisibility(boolean visible); void dispatchGetNewSurface(); Loading
core/java/android/view/IWindowSession.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.graphics.Rect; import android.graphics.Region; import android.os.Bundle; import android.util.MergedConfiguration; import android.view.DisplayCutout; import android.view.InputChannel; import android.view.IWindow; import android.view.IWindowId; Loading @@ -40,7 +41,8 @@ interface IWindowSession { out InputChannel outInputChannel); int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets, out InputChannel outInputChannel); out Rect outStableInsets, out Rect outOutsets, out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel); int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, out Rect outContentInsets, out Rect outStableInsets); int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, Loading Loading @@ -96,6 +98,7 @@ interface IWindowSession { int flags, out Rect outFrame, out Rect outOverscanInsets, out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets, out Rect outOutsets, out Rect outBackdropFrame, out DisplayCutout.ParcelableWrapper displayCutout, out MergedConfiguration outMergedConfiguration, out Surface outSurface); /* Loading
core/java/android/view/View.java +3 −0 Original line number Diff line number Diff line Loading @@ -25757,6 +25757,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ final Rect mStableInsets = new Rect(); final DisplayCutout.ParcelableWrapper mDisplayCutout = new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT); /** * For windows that include areas that are not covered by real surface these are the outsets * for real surface.