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

Commit 21caae3b authored by wilsonshih's avatar wilsonshih
Browse files

InsetsState isn't needed when drawing snapshot with aspect ratio match

Allow there to draw snapshot starting window when InsetsState is null.

Flag: com.android.window.flags.draw_snapshot_aspect_ratio_match
Bug: 353951909
Test: hot launch app and verify snapshot starting window would shown.
Change-Id: If8fca8ef51742a230fc6d581b548a02874f99006
parent 81096d0d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -412,8 +412,7 @@ public class SnapshotDrawerUtils {
        final WindowManager.LayoutParams attrs = Flags.drawSnapshotAspectRatioMatch()
                ? info.mainWindowLayoutParams : info.topOpaqueWindowLayoutParams;
        final WindowManager.LayoutParams mainWindowParams = info.mainWindowLayoutParams;
        final InsetsState topWindowInsetsState = info.topOpaqueWindowInsetsState;
        if (attrs == null || mainWindowParams == null || topWindowInsetsState == null) {
        if (attrs == null || mainWindowParams == null) {
            Log.w(TAG, "unable to create taskSnapshot surface ");
            return null;
        }
@@ -456,7 +455,10 @@ public class SnapshotDrawerUtils {
        return layoutParams;
    }

    static Rect getSystemBarInsets(Rect frame, InsetsState state) {
    static Rect getSystemBarInsets(Rect frame, @Nullable InsetsState state) {
        if (state == null) {
            return new Rect();
        }
        return state.calculateInsets(frame, WindowInsets.Type.systemBars(),
                false /* ignoreVisibility */).toRect();
    }