From 1c82568b6c14b91ae8cadd40cb71a328583da4b6 Mon Sep 17 00:00:00 2001 From: Philip Junker Date: Tue, 15 Feb 2022 16:17:20 +0100 Subject: [PATCH] Deprecate ACQUIRE_CAUSES_WAKEUP flag. Bug: 216114297 Test: javadocs only, no tests were run Change-Id: Iba8521e47151b84e4a59f32884041ea13f82e36b --- core/api/current.txt | 2 +- core/java/android/os/PowerManager.java | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 56415ec14564f..b689dcba8ba84 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -31786,7 +31786,7 @@ package android.os { method public android.os.PowerManager.WakeLock newWakeLock(int, String); method @RequiresPermission(android.Manifest.permission.REBOOT) public void reboot(@Nullable String); method public void removeThermalStatusListener(@NonNull android.os.PowerManager.OnThermalStatusChangedListener); - field public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000 + field @Deprecated public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000 field public static final String ACTION_DEVICE_IDLE_MODE_CHANGED = "android.os.action.DEVICE_IDLE_MODE_CHANGED"; field public static final String ACTION_DEVICE_LIGHT_IDLE_MODE_CHANGED = "android.os.action.LIGHT_DEVICE_IDLE_MODE_CHANGED"; field public static final String ACTION_LOW_POWER_STANDBY_ENABLED_CHANGED = "android.os.action.LOW_POWER_STANDBY_ENABLED_CHANGED"; diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 315eef78724ef..e3be4d32a014a 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -183,25 +183,29 @@ public final class PowerManager { /** * Wake lock flag: Turn the screen on when the wake lock is acquired. *

- * Normally wake locks don't actually wake the device, they just cause - * the screen to remain on once it's already on. Think of the video player - * application as the normal behavior. Notifications that pop up and want - * the device to be on are the exception; use this flag to be like them. + * Normally wake locks don't actually wake the device, they just cause the screen to remain on + * once it's already on. This flag will cause the device to wake up when the wake lock is + * acquired. *

* Android TV playback devices attempt to turn on the HDMI-connected TV via HDMI-CEC on any * wake-up, including wake-ups triggered by wake locks. *

* Cannot be used with {@link #PARTIAL_WAKE_LOCK}. *

+ * + * @deprecated Most applications should use {@link android.R.attr#turnScreenOn} or + * {@link android.app.Activity#setTurnScreenOn(boolean)} instead, as this prevents the previous + * foreground app from being resumed first when the screen turns on. Note that this flag may + * require a permission in the future. */ + @Deprecated public static final int ACQUIRE_CAUSES_WAKEUP = 0x10000000; /** * Wake lock flag: When this wake lock is released, poke the user activity timer * so the screen stays on for a little longer. *

- * Will not turn the screen on if it is not already on. - * See {@link #ACQUIRE_CAUSES_WAKEUP} if you want that. + * This will not turn the screen on if it is not already on. *

* Cannot be used with {@link #PARTIAL_WAKE_LOCK}. *