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

Commit ab65473b authored by Aurélien Pomini's avatar Aurélien Pomini Committed by Automerger Merge Worker
Browse files

Merge "Only force wallpaper visibility events for wearOS" into udc-dev am: 3d82cd59

parents ce06d1d4 3d82cd59
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@ import android.app.WallpaperManager;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.graphics.BLASTBufferQueue;
import android.graphics.BLASTBufferQueue;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
@@ -190,6 +191,9 @@ public abstract class WallpaperService extends Service {
    private Handler mBackgroundHandler;
    private Handler mBackgroundHandler;
    private HandlerThread mBackgroundThread;
    private HandlerThread mBackgroundThread;


    // TODO (b/287037772) remove this flag and the forceReport argument in reportVisibility
    private boolean mIsWearOs;

    static final class WallpaperCommand {
    static final class WallpaperCommand {
        String action;
        String action;
        int x;
        int x;
@@ -2282,7 +2286,8 @@ public abstract class WallpaperService extends Service {
                    @Override
                    @Override
                    public void onDisplayChanged(int displayId) {
                    public void onDisplayChanged(int displayId) {
                        if (mDisplay.getDisplayId() == displayId) {
                        if (mDisplay.getDisplayId() == displayId) {
                            boolean forceReport = mDisplay.getState() != Display.STATE_DOZE_SUSPEND;
                            boolean forceReport = mIsWearOs
                                    && mDisplay.getState() != Display.STATE_DOZE_SUSPEND;
                            reportVisibility(forceReport);
                            reportVisibility(forceReport);
                        }
                        }
                    }
                    }
@@ -2734,6 +2739,7 @@ public abstract class WallpaperService extends Service {
        mBackgroundThread = new HandlerThread("DefaultWallpaperLocalColorExtractor");
        mBackgroundThread = new HandlerThread("DefaultWallpaperLocalColorExtractor");
        mBackgroundThread.start();
        mBackgroundThread.start();
        mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
        mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
        mIsWearOs = getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
        super.onCreate();
        super.onCreate();
        Trace.endSection();
        Trace.endSection();
    }
    }