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

Commit cee39f9d authored by Lucas Dupin's avatar Lucas Dupin Committed by Automerger Merge Worker
Browse files

Merge "keyguardGoingAway wallpaperCommand" into udc-dev am: bf38e649

parents 5dab4d74 bf38e649
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -230,6 +230,16 @@ public class WallpaperManager {
     */
    public static final String COMMAND_WAKING_UP = "android.wallpaper.wakingup";

    /**
     * Command for {@link #sendWallpaperCommand}: reported by System UI when the device keyguard
     * starts going away.
     * This command is triggered by {@link android.app.IActivityTaskManager#keyguardGoingAway(int)}.
     *
     * @hide
     */
    public static final String COMMAND_KEYGUARD_GOING_AWAY =
            "android.wallpaper.keyguardgoingaway";

    /**
     * Command for {@link #sendWallpaperCommand}: reported by System UI when the device is going to
     * sleep. The x and y arguments are a location (possibly very roughly) corresponding to the
+3 −0
Original line number Diff line number Diff line
@@ -33,4 +33,7 @@ public abstract class WallpaperManagerInternal {

    /** Notifies when the screen starts turning on and is not yet visible to the user. */
    public abstract void onScreenTurningOn(int displayId);

    /** Notifies when the keyguard is going away. Sent right after the bouncer is gone. */
    public abstract void onKeyguardGoingAway();
}
+44 −0
Original line number Diff line number Diff line
@@ -1617,6 +1617,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        public void onScreenTurningOn(int displayId) {
            notifyScreenTurningOn(displayId);
        }

        @Override
        public void onKeyguardGoingAway() {
            notifyKeyguardGoingAway();
        }
    }

    void initialize() {
@@ -2654,6 +2659,45 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        }
    }

    /**
     * Propagate a keyguard going away event to the wallpaper engine.
     */
    private void notifyKeyguardGoingAway() {
        synchronized (mLock) {
            if (mIsLockscreenLiveWallpaperEnabled) {
                for (WallpaperData data : getActiveWallpapers()) {
                    data.connection.forEachDisplayConnector(displayConnector -> {
                        if (displayConnector.mEngine != null) {
                            try {
                                displayConnector.mEngine.dispatchWallpaperCommand(
                                        WallpaperManager.COMMAND_KEYGUARD_GOING_AWAY,
                                        -1, -1, -1, new Bundle());
                            } catch (RemoteException e) {
                                Slog.w(TAG, "Failed to notify that the keyguard is going away", e);
                            }
                        }
                    });
                }
                return;
            }

            final WallpaperData data = mWallpaperMap.get(mCurrentUserId);
            if (data != null && data.connection != null) {
                data.connection.forEachDisplayConnector(displayConnector -> {
                    if (displayConnector.mEngine != null) {
                        try {
                            displayConnector.mEngine.dispatchWallpaperCommand(
                                    WallpaperManager.COMMAND_KEYGUARD_GOING_AWAY,
                                    -1, -1, -1, new Bundle());
                        } catch (RemoteException e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        }
    }

    @Override
    public boolean setLockWallpaperCallback(IWallpaperManagerCallback cb) {
        checkPermission(android.Manifest.permission.INTERNAL_SYSTEM_WINDOW);
+10 −0
Original line number Diff line number Diff line
@@ -276,6 +276,7 @@ import com.android.server.sdksandbox.SdkSandboxManagerLocal;
import com.android.server.statusbar.StatusBarManagerInternal;
import com.android.server.uri.NeededUriGrants;
import com.android.server.uri.UriGrantsManagerInternal;
import com.android.server.wallpaper.WallpaperManagerInternal;

import java.io.BufferedReader;
import java.io.File;
@@ -365,6 +366,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    private ComponentName mSysUiServiceComponent;
    private PermissionPolicyInternal mPermissionPolicyInternal;
    private StatusBarManagerInternal mStatusBarManagerInternal;
    private WallpaperManagerInternal mWallpaperManagerInternal;
    @VisibleForTesting
    final ActivityTaskManagerInternal mInternal;
    private PowerManagerInternal mPowerManagerInternal;
@@ -3553,6 +3555,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                mRootWindowContainer.forAllDisplays(displayContent -> {
                    mKeyguardController.keyguardGoingAway(displayContent.getDisplayId(), flags);
                });
                getWallpaperManagerInternal().onKeyguardGoingAway();
            }
        } finally {
            Binder.restoreCallingIdentity(token);
@@ -5232,6 +5235,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        return mStatusBarManagerInternal;
    }

    WallpaperManagerInternal getWallpaperManagerInternal() {
        if (mWallpaperManagerInternal == null) {
            mWallpaperManagerInternal = LocalServices.getService(WallpaperManagerInternal.class);
        }
        return mWallpaperManagerInternal;
    }

    AppWarnings getAppWarningsLocked() {
        return mAppWarnings;
    }