Loading apct-tests/perftests/windowmanager/src/android/wm/WindowAddRemovePerfTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase private static class TestWindow extends BaseIWindow { final WindowManager.LayoutParams mLayoutParams = new WindowManager.LayoutParams(); final InsetsState mRequestedVisibility = new InsetsState(); final Rect mOutFrame = new Rect(); final Rect mOutContentInsets = new Rect(); final Rect mOutStableInsets = new Rect(); Loading @@ -108,7 +109,8 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase long startTime = SystemClock.elapsedRealtimeNanos(); session.addToDisplay(this, mLayoutParams, View.VISIBLE, Display.DEFAULT_DISPLAY, mOutFrame, mOutContentInsets, mOutStableInsets, Display.DEFAULT_DISPLAY, mRequestedVisibility, mOutFrame, mOutContentInsets, mOutStableInsets, mOutDisplayCutout, inputChannel, mOutInsetsState, mOutControls); final long elapsedTimeNsOfAdd = SystemClock.elapsedRealtimeNanos() - startTime; state.addExtraResult("add", elapsedTimeNsOfAdd); Loading core/java/android/service/wallpaper/WallpaperService.java +4 −3 Original line number Diff line number Diff line Loading @@ -877,9 +877,10 @@ public abstract class WallpaperService extends Service { InputChannel inputChannel = new InputChannel(); if (mSession.addToDisplay(mWindow, mLayout, View.VISIBLE, mDisplay.getDisplayId(), mWinFrames.frame, mWinFrames.contentInsets, mWinFrames.stableInsets, mWinFrames.displayCutout, inputChannel, mInsetsState, mTempControls) < 0) { mDisplay.getDisplayId(), mInsetsState, mWinFrames.frame, mWinFrames.contentInsets, mWinFrames.stableInsets, mWinFrames.displayCutout, inputChannel, mInsetsState, mTempControls) < 0) { Log.w(TAG, "Failed to add window while updating wallpaper surface."); return; } Loading core/java/android/view/IWindowSession.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -45,12 +45,13 @@ import java.util.List; */ interface IWindowSession { int addToDisplay(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outFrame, out Rect outContentInsets, out Rect outStableInsets, in int viewVisibility, in int layerStackId, in InsetsState requestedVisibility, out Rect outFrame, out Rect outContentInsets, out Rect outStableInsets, out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl[] activeControls); int addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, in int userId, in InsetsState requestedVisibility, out Rect outFrame, out Rect outContentInsets, out Rect outStableInsets, out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl[] activeControls); Loading core/java/android/view/InsetsAnimationControlImpl.java +15 −13 Original line number Diff line number Diff line Loading @@ -212,21 +212,21 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll /** * @return Whether the finish callback of this animation should be invoked. */ public boolean applyChangeInsets(InsetsState state) { public boolean applyChangeInsets(@Nullable InsetsState outState) { if (mCancelled) { if (DEBUG) Log.d(TAG, "applyChangeInsets canceled"); return false; } final Insets offset = Insets.subtract(mShownInsets, mPendingInsets); ArrayList<SurfaceParams> params = new ArrayList<>(); updateLeashesForSide(ISIDE_LEFT, offset.left, mShownInsets.left, mPendingInsets.left, params, state, mPendingAlpha); updateLeashesForSide(ISIDE_TOP, offset.top, mShownInsets.top, mPendingInsets.top, params, state, mPendingAlpha); updateLeashesForSide(ISIDE_RIGHT, offset.right, mShownInsets.right, mPendingInsets.right, params, state, mPendingAlpha); updateLeashesForSide(ISIDE_BOTTOM, offset.bottom, mShownInsets.bottom, mPendingInsets.bottom, params, state, mPendingAlpha); updateLeashesForSide(ISIDE_LEFT, offset.left, mPendingInsets.left, params, outState, mPendingAlpha); updateLeashesForSide(ISIDE_TOP, offset.top, mPendingInsets.top, params, outState, mPendingAlpha); updateLeashesForSide(ISIDE_RIGHT, offset.right, mPendingInsets.right, params, outState, mPendingAlpha); updateLeashesForSide(ISIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params, outState, mPendingAlpha); mController.applySurfaceParams(params.toArray(new SurfaceParams[params.size()])); mCurrentInsets = mPendingInsets; Loading Loading @@ -357,8 +357,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll return alpha >= 1 ? 1 : (alpha <= 0 ? 0 : alpha); } private void updateLeashesForSide(@InternalInsetsSide int side, int offset, int maxInset, int inset, ArrayList<SurfaceParams> surfaceParams, InsetsState state, Float alpha) { private void updateLeashesForSide(@InternalInsetsSide int side, int offset, int inset, ArrayList<SurfaceParams> surfaceParams, @Nullable InsetsState outState, float alpha) { ArraySet<InsetsSourceControl> items = mSideSourceMap.get(side); if (items == null) { return; Loading @@ -377,8 +377,10 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll ? (mAnimationType == ANIMATION_TYPE_SHOW ? true : !mFinished) : inset != 0; state.getSource(source.getType()).setVisible(visible); state.getSource(source.getType()).setFrame(mTmpFrame); if (outState != null) { outState.getSource(source.getType()).setVisible(visible); outState.getSource(source.getType()).setFrame(mTmpFrame); } // If the system is controlling the insets source, the leash can be null. if (leash != null) { Loading core/java/android/view/InsetsAnimationThreadControlRunner.java +1 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro private final InsetsAnimationControlImpl mControl; private final InsetsAnimationControlCallbacks mOuterCallbacks; private final Handler mMainThreadHandler; private final InsetsState mState = new InsetsState(); private final InsetsAnimationControlCallbacks mCallbacks = new InsetsAnimationControlCallbacks() { Loading @@ -60,7 +59,7 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro @Override public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) { mControl.applyChangeInsets(mState); mControl.applyChangeInsets(null /* outState */); } @Override Loading Loading
apct-tests/perftests/windowmanager/src/android/wm/WindowAddRemovePerfTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase private static class TestWindow extends BaseIWindow { final WindowManager.LayoutParams mLayoutParams = new WindowManager.LayoutParams(); final InsetsState mRequestedVisibility = new InsetsState(); final Rect mOutFrame = new Rect(); final Rect mOutContentInsets = new Rect(); final Rect mOutStableInsets = new Rect(); Loading @@ -108,7 +109,8 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase long startTime = SystemClock.elapsedRealtimeNanos(); session.addToDisplay(this, mLayoutParams, View.VISIBLE, Display.DEFAULT_DISPLAY, mOutFrame, mOutContentInsets, mOutStableInsets, Display.DEFAULT_DISPLAY, mRequestedVisibility, mOutFrame, mOutContentInsets, mOutStableInsets, mOutDisplayCutout, inputChannel, mOutInsetsState, mOutControls); final long elapsedTimeNsOfAdd = SystemClock.elapsedRealtimeNanos() - startTime; state.addExtraResult("add", elapsedTimeNsOfAdd); Loading
core/java/android/service/wallpaper/WallpaperService.java +4 −3 Original line number Diff line number Diff line Loading @@ -877,9 +877,10 @@ public abstract class WallpaperService extends Service { InputChannel inputChannel = new InputChannel(); if (mSession.addToDisplay(mWindow, mLayout, View.VISIBLE, mDisplay.getDisplayId(), mWinFrames.frame, mWinFrames.contentInsets, mWinFrames.stableInsets, mWinFrames.displayCutout, inputChannel, mInsetsState, mTempControls) < 0) { mDisplay.getDisplayId(), mInsetsState, mWinFrames.frame, mWinFrames.contentInsets, mWinFrames.stableInsets, mWinFrames.displayCutout, inputChannel, mInsetsState, mTempControls) < 0) { Log.w(TAG, "Failed to add window while updating wallpaper surface."); return; } Loading
core/java/android/view/IWindowSession.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -45,12 +45,13 @@ import java.util.List; */ interface IWindowSession { int addToDisplay(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outFrame, out Rect outContentInsets, out Rect outStableInsets, in int viewVisibility, in int layerStackId, in InsetsState requestedVisibility, out Rect outFrame, out Rect outContentInsets, out Rect outStableInsets, out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl[] activeControls); int addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, in int userId, in InsetsState requestedVisibility, out Rect outFrame, out Rect outContentInsets, out Rect outStableInsets, out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel, out InsetsState insetsState, out InsetsSourceControl[] activeControls); Loading
core/java/android/view/InsetsAnimationControlImpl.java +15 −13 Original line number Diff line number Diff line Loading @@ -212,21 +212,21 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll /** * @return Whether the finish callback of this animation should be invoked. */ public boolean applyChangeInsets(InsetsState state) { public boolean applyChangeInsets(@Nullable InsetsState outState) { if (mCancelled) { if (DEBUG) Log.d(TAG, "applyChangeInsets canceled"); return false; } final Insets offset = Insets.subtract(mShownInsets, mPendingInsets); ArrayList<SurfaceParams> params = new ArrayList<>(); updateLeashesForSide(ISIDE_LEFT, offset.left, mShownInsets.left, mPendingInsets.left, params, state, mPendingAlpha); updateLeashesForSide(ISIDE_TOP, offset.top, mShownInsets.top, mPendingInsets.top, params, state, mPendingAlpha); updateLeashesForSide(ISIDE_RIGHT, offset.right, mShownInsets.right, mPendingInsets.right, params, state, mPendingAlpha); updateLeashesForSide(ISIDE_BOTTOM, offset.bottom, mShownInsets.bottom, mPendingInsets.bottom, params, state, mPendingAlpha); updateLeashesForSide(ISIDE_LEFT, offset.left, mPendingInsets.left, params, outState, mPendingAlpha); updateLeashesForSide(ISIDE_TOP, offset.top, mPendingInsets.top, params, outState, mPendingAlpha); updateLeashesForSide(ISIDE_RIGHT, offset.right, mPendingInsets.right, params, outState, mPendingAlpha); updateLeashesForSide(ISIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params, outState, mPendingAlpha); mController.applySurfaceParams(params.toArray(new SurfaceParams[params.size()])); mCurrentInsets = mPendingInsets; Loading Loading @@ -357,8 +357,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll return alpha >= 1 ? 1 : (alpha <= 0 ? 0 : alpha); } private void updateLeashesForSide(@InternalInsetsSide int side, int offset, int maxInset, int inset, ArrayList<SurfaceParams> surfaceParams, InsetsState state, Float alpha) { private void updateLeashesForSide(@InternalInsetsSide int side, int offset, int inset, ArrayList<SurfaceParams> surfaceParams, @Nullable InsetsState outState, float alpha) { ArraySet<InsetsSourceControl> items = mSideSourceMap.get(side); if (items == null) { return; Loading @@ -377,8 +377,10 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll ? (mAnimationType == ANIMATION_TYPE_SHOW ? true : !mFinished) : inset != 0; state.getSource(source.getType()).setVisible(visible); state.getSource(source.getType()).setFrame(mTmpFrame); if (outState != null) { outState.getSource(source.getType()).setVisible(visible); outState.getSource(source.getType()).setFrame(mTmpFrame); } // If the system is controlling the insets source, the leash can be null. if (leash != null) { Loading
core/java/android/view/InsetsAnimationThreadControlRunner.java +1 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro private final InsetsAnimationControlImpl mControl; private final InsetsAnimationControlCallbacks mOuterCallbacks; private final Handler mMainThreadHandler; private final InsetsState mState = new InsetsState(); private final InsetsAnimationControlCallbacks mCallbacks = new InsetsAnimationControlCallbacks() { Loading @@ -60,7 +59,7 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro @Override public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) { mControl.applyChangeInsets(mState); mControl.applyChangeInsets(null /* outState */); } @Override Loading