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

Commit 7f765cf5 authored by Christopher Tate's avatar Christopher Tate
Browse files

Make sure to properly default the screen size during wallpaper restore

The wallpaper service claims a desired width/height of (-1,-1) during
initial setup, so look to the default display's metrics if necessary.

Change-Id: I341f12fb7b0b9d6b7761c277f23fc68fa5355256
parent 6c2193a7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import android.content.Context;
import android.graphics.BitmapFactory;
import android.os.ParcelFileDescriptor;
import android.util.Slog;
import android.view.Display;
import android.view.WindowManager;

import java.io.File;

@@ -65,6 +67,13 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu
        mDesiredMinWidth = (double) wpm.getDesiredMinimumWidth();
        mDesiredMinHeight = (double) wpm.getDesiredMinimumHeight();

        if (mDesiredMinWidth <= 0 || mDesiredMinHeight <= 0) {
            WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
            Display d = wm.getDefaultDisplay();
            mDesiredMinWidth = d.getWidth();
            mDesiredMinHeight = d.getHeight();
        }

        if (DEBUG) {
            Slog.d(TAG, "dmW=" + mDesiredMinWidth + " dmH=" + mDesiredMinHeight);
        }