Make isInteractive(display) a testAPI
The API would be required in CTS to check the interactiveness of individual displays. In case of MUMD (multi user multi display) devices, it is possible that only one display (ex. driver display) is off, and PM#isInteractive returns true.
Flag: NONE hidden to test API
Bug: 369415968
Test: m
Change-Id: Id0d194984e37779c805eed8509025e43fccb89f1
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 1ff8c51..ff15b56 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -2463,6 +2463,7 @@
method public boolean areAutoPowerSaveModesEnabled();
method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_LOW_POWER_STANDBY, android.Manifest.permission.DEVICE_POWER}) public void forceLowPowerStandbyActive(boolean);
method @FlaggedApi("android.os.battery_saver_supported_check_api") public boolean isBatterySaverSupported();
+ method public boolean isInteractive(int);
field public static final String ACTION_ENHANCED_DISCHARGE_PREDICTION_CHANGED = "android.os.action.ENHANCED_DISCHARGE_PREDICTION_CHANGED";
field @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public static final int SYSTEM_WAKELOCK = -2147483648; // 0x80000000
}
diff --git a/core/api/test-lint-baseline.txt b/core/api/test-lint-baseline.txt
index b4a3abc..dd90e84 100644
--- a/core/api/test-lint-baseline.txt
+++ b/core/api/test-lint-baseline.txt
@@ -2127,6 +2127,8 @@
New API must be flagged with @FlaggedApi: field android.os.BugreportParams.BUGREPORT_MODE_MAX_VALUE
UnflaggedApi: android.os.PowerManager#isBatterySaverSupported():
New API must be flagged with @FlaggedApi: method android.os.PowerManager.isBatterySaverSupported()
+UnflaggedApi: android.os.PowerManager#isInteractive(int):
+ New API must be flagged with @FlaggedApi: method android.os.PowerManager.isInteractive(int)
UnflaggedApi: android.os.UserHandle#USER_CURRENT:
New API must be flagged with @FlaggedApi: field android.os.UserHandle.USER_CURRENT
UnflaggedApi: android.os.UserManager#getAliveUsers():
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 32db3be..8e26ef1 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -1811,14 +1811,16 @@
}
/**
- * Returns the interactive state for a specific display, which may not be the same as the
- * global wakefulness (which is true when any display is awake).
+ * Returns true if the specified display is in an interactive state. This may not be the
+ * same as the global wakefulness (which is true when any display is interactive).
+ * @see #isInteractive()
*
- * @param displayId
- * @return whether the given display is present and interactive, or false
+ * @param displayId The Display ID to check for interactivity.
+ * @return True if the display is in an interactive state.
*
* @hide
*/
+ @TestApi
public boolean isInteractive(int displayId) {
return mInteractiveCache.query(displayId);
}