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

Commit cc0f7f99 authored by Valentin Iftime's avatar Valentin Iftime
Browse files

Check for mSurfaceController in setWallpaperPositionAndScale

 WindowSurfacePlacer#performSurfacePlacement calls WallpaperController#updateWallpaperOffset
 before the wallpaper window creates its surface control

Test: adb reboot;
 adb shell logcat | grep 'Attempt to invoke virtual method 'void com.android.server.wm.WindowSurfaceController.setPositionInTransaction(float, float, boolean)' on a null object reference'
Bug: 155998607
Change-Id: Ib1483a5849192b1a42c14383e6dd9e96684de2cc
parent e6e7cdf1
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -1257,8 +1257,11 @@ class WindowStateAnimator {
        mYOffset = dy;
        mWallpaperScale = scale;

        if (mSurfaceController != null) {
            try {
            if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setWallpaperOffset");
                if (SHOW_LIGHT_TRANSACTIONS) {
                    Slog.i(TAG, ">>> OPEN TRANSACTION setWallpaperOffset");
                }
                mService.openSurfaceTransaction();
                setWallpaperPositionAndScale(dx, dy, scale, false);
            } catch (RuntimeException e) {
@@ -1266,11 +1269,14 @@ class WindowStateAnimator {
                        + " pos=(" + dx + "," + dy + ")", e);
            } finally {
                mService.closeSurfaceTransaction("setWallpaperOffset");
            if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                    "<<< CLOSE TRANSACTION setWallpaperOffset");
            return true;
                if (SHOW_LIGHT_TRANSACTIONS) {
                    Slog.i(TAG, "<<< CLOSE TRANSACTION setWallpaperOffset");
                }
            }
        }

        return true;
    }

    private void setWallpaperPositionAndScale(int dx, int dy, float scale,
            boolean recoveringMemory) {