From a35b76999991c4cf3ce422c9fbfe35f0256c256f Mon Sep 17 00:00:00 2001 From: Yuncheol Heo Date: Fri, 16 Apr 2021 21:15:06 +0000 Subject: [PATCH] Revert "Use the existing wallpaper command API to send wake/sleep events to the wallpaper." This reverts commit bde980759e036c53be6c2e40619fa13bf9ac052e. Reason for revert: b/185615919 Change-Id: I4906f109de478361790e459c117bd5d6a88a778c --- core/java/android/app/IWallpaperManager.aidl | 14 --- core/java/android/app/WallpaperManager.java | 24 ---- .../keyguard/WakefulnessLifecycle.java | 103 +----------------- .../keyguard/WakefulnessLifecycleTest.java | 6 +- .../statusbar/phone/StatusBarTest.java | 5 +- .../wallpaper/WallpaperManagerService.java | 40 ------- 6 files changed, 4 insertions(+), 188 deletions(-) diff --git a/core/java/android/app/IWallpaperManager.aidl b/core/java/android/app/IWallpaperManager.aidl index 4f7c6841d6bb8..e83557c18f8f7 100644 --- a/core/java/android/app/IWallpaperManager.aidl +++ b/core/java/android/app/IWallpaperManager.aidl @@ -190,18 +190,4 @@ interface IWallpaperManager { * Called from SystemUI when it shows the AoD UI. */ oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration); - - /** - * Called from SystemUI when the device is waking up. - * - * @hide - */ - oneway void notifyWakingUp(int x, int y, in Bundle extras); - - /** - * Called from SystemUI when the device is going to sleep. - * - * @hide - */ - void notifyGoingToSleep(int x, int y, in Bundle extras); } diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index 8d332ab1d58b5..6a71c92fbc37d 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -189,30 +189,6 @@ public class WallpaperManager { */ public static final String COMMAND_DROP = "android.home.drop"; - /** - * Command for {@link #sendWallpaperCommand}: reported by System UI when the device is waking - * up. The x and y arguments are a location (possibly very roughly) corresponding to the action - * that caused the device to wake up. For example, if the power button was pressed, this will be - * the location on the screen nearest the power button. - * - * If the location is unknown or not applicable, x and y will be -1. - * - * @hide - */ - public static final String COMMAND_WAKING_UP = "android.wallpaper.wakingup"; - - /** - * 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 - * action that caused the device to go to sleep. For example, if the power button was pressed, - * this will be the location on the screen nearest the power button. - * - * If the location is unknown or not applicable, x and y will be -1. - * - * @hide - */ - public static final String COMMAND_GOING_TO_SLEEP = "android.wallpaper.goingtosleep"; - /** * Command for {@link #sendWallpaperCommand}: reported when the wallpaper that was already * set is re-applied by the user. diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java index 1a94473f18d4b..de00d50b6e361 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java @@ -17,20 +17,10 @@ package com.android.systemui.keyguard; import android.annotation.IntDef; -import android.app.IWallpaperManager; -import android.content.Context; -import android.content.res.Configuration; -import android.graphics.Point; -import android.os.Bundle; import android.os.PowerManager; -import android.os.RemoteException; import android.os.Trace; -import android.util.DisplayMetrics; - -import androidx.annotation.Nullable; import com.android.systemui.Dumpable; -import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; import java.io.FileDescriptor; @@ -41,7 +31,7 @@ import java.lang.annotation.RetentionPolicy; import javax.inject.Inject; /** - * Tracks the wakefulness lifecycle, including why we're waking or sleeping. + * Tracks the wakefulness lifecycle. */ @SysUISingleton public class WakefulnessLifecycle extends Lifecycle implements @@ -61,30 +51,13 @@ public class WakefulnessLifecycle extends Lifecycle { - if (displayConnector.mEngine != null) { - try { - displayConnector.mEngine.dispatchWallpaperCommand( - WallpaperManager.COMMAND_WAKING_UP, x, y, -1, extras); - } catch (RemoteException e) { - e.printStackTrace(); - } - } - }); - } - } - - /** - * Propagate a sleep event to the wallpaper engine. - */ - public void notifyGoingToSleep(int x, int y, @NonNull Bundle extras) { - synchronized (mLock) { - final WallpaperData data = mWallpaperMap.get(mCurrentUserId); - data.connection.forEachDisplayConnector( - displayConnector -> { - if (displayConnector.mEngine != null) { - try { - displayConnector.mEngine.dispatchWallpaperCommand( - WallpaperManager.COMMAND_GOING_TO_SLEEP, x, y, -1, extras); - } catch (RemoteException e) { - e.printStackTrace(); - } - } - }); - } - } - @Override public boolean setLockWallpaperCallback(IWallpaperManagerCallback cb) { checkPermission(android.Manifest.permission.INTERNAL_SYSTEM_WINDOW);