Loading core/java/android/companion/virtual/flags/flags.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -65,14 +65,6 @@ flag { is_exported: true } flag { namespace: "virtual_devices" name: "display_power_manager_apis" description: "Make relevant PowerManager APIs display aware by default" bug: "365042486" is_fixed_read_only: true } flag { name: "status_bar_and_insets" namespace: "virtual_devices" Loading core/java/android/os/PowerManager.java +3 −15 Original line number Diff line number Diff line Loading @@ -1464,13 +1464,8 @@ public final class PowerManager { * @see #ON_AFTER_RELEASE */ public WakeLock newWakeLock(int levelAndFlags, String tag) { if (android.companion.virtualdevice.flags.Flags.displayPowerManagerApis()) { return newWakeLock(levelAndFlags, tag, mContext.getDisplayId()); } validateWakeLockParameters(levelAndFlags, tag); return new WakeLock(levelAndFlags, tag, mContext.getOpPackageName(), Display.INVALID_DISPLAY); } /** * Creates a new wake lock with the specified level and flags. Loading Loading @@ -1928,11 +1923,7 @@ public final class PowerManager { */ public boolean isWakeLockLevelSupported(int level) { try { if (android.companion.virtualdevice.flags.Flags.displayPowerManagerApis()) { return mService.isWakeLockLevelSupportedWithDisplayId( level, mContext.getDisplayId()); } return mService.isWakeLockLevelSupported(level); return mService.isWakeLockLevelSupportedWithDisplayId(level, mContext.getDisplayId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -1995,11 +1986,8 @@ public final class PowerManager { * @see android.content.Intent#ACTION_SCREEN_OFF */ public boolean isInteractive() { if (android.companion.virtualdevice.flags.Flags.displayPowerManagerApis()) { return isInteractive(mContext.getDisplayId()); } return mInteractiveCache.query(null); } /** * Returns true if the specified display is in an interactive state. This may not be the Loading services/core/java/com/android/server/power/PowerManagerService.java +1 −2 Original line number Diff line number Diff line Loading @@ -6432,8 +6432,7 @@ public final class PowerManagerService extends SystemService public float getBrightnessConstraint( int displayId, @PowerManager.BrightnessConstraint int constraint) { DisplayInfo info = null; if (android.companion.virtualdevice.flags.Flags.displayPowerManagerApis() && mDisplayManagerInternal != null) { if (mDisplayManagerInternal != null) { info = mDisplayManagerInternal.getDisplayInfo(displayId); } switch (constraint) { Loading services/tests/powerservicetests/src/com/android/server/power/PowerManagerServiceTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -1542,9 +1542,7 @@ public class PowerManagerServiceTest { .isEqualTo(expectedNonDefaultGroupWakefullness); } @EnableFlags({ android.companion.virtualdevice.flags.Flags.FLAG_DEVICE_AWARE_DISPLAY_POWER, android.companion.virtualdevice.flags.Flags.FLAG_DISPLAY_POWER_MANAGER_APIS}) @EnableFlags(android.companion.virtualdevice.flags.Flags.FLAG_DEVICE_AWARE_DISPLAY_POWER) @Test public void getBrightnessConstraint_valuesMatchDisplayInfo() { final int displayId = 7; Loading Loading
core/java/android/companion/virtual/flags/flags.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -65,14 +65,6 @@ flag { is_exported: true } flag { namespace: "virtual_devices" name: "display_power_manager_apis" description: "Make relevant PowerManager APIs display aware by default" bug: "365042486" is_fixed_read_only: true } flag { name: "status_bar_and_insets" namespace: "virtual_devices" Loading
core/java/android/os/PowerManager.java +3 −15 Original line number Diff line number Diff line Loading @@ -1464,13 +1464,8 @@ public final class PowerManager { * @see #ON_AFTER_RELEASE */ public WakeLock newWakeLock(int levelAndFlags, String tag) { if (android.companion.virtualdevice.flags.Flags.displayPowerManagerApis()) { return newWakeLock(levelAndFlags, tag, mContext.getDisplayId()); } validateWakeLockParameters(levelAndFlags, tag); return new WakeLock(levelAndFlags, tag, mContext.getOpPackageName(), Display.INVALID_DISPLAY); } /** * Creates a new wake lock with the specified level and flags. Loading Loading @@ -1928,11 +1923,7 @@ public final class PowerManager { */ public boolean isWakeLockLevelSupported(int level) { try { if (android.companion.virtualdevice.flags.Flags.displayPowerManagerApis()) { return mService.isWakeLockLevelSupportedWithDisplayId( level, mContext.getDisplayId()); } return mService.isWakeLockLevelSupported(level); return mService.isWakeLockLevelSupportedWithDisplayId(level, mContext.getDisplayId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -1995,11 +1986,8 @@ public final class PowerManager { * @see android.content.Intent#ACTION_SCREEN_OFF */ public boolean isInteractive() { if (android.companion.virtualdevice.flags.Flags.displayPowerManagerApis()) { return isInteractive(mContext.getDisplayId()); } return mInteractiveCache.query(null); } /** * Returns true if the specified display is in an interactive state. This may not be the Loading
services/core/java/com/android/server/power/PowerManagerService.java +1 −2 Original line number Diff line number Diff line Loading @@ -6432,8 +6432,7 @@ public final class PowerManagerService extends SystemService public float getBrightnessConstraint( int displayId, @PowerManager.BrightnessConstraint int constraint) { DisplayInfo info = null; if (android.companion.virtualdevice.flags.Flags.displayPowerManagerApis() && mDisplayManagerInternal != null) { if (mDisplayManagerInternal != null) { info = mDisplayManagerInternal.getDisplayInfo(displayId); } switch (constraint) { Loading
services/tests/powerservicetests/src/com/android/server/power/PowerManagerServiceTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -1542,9 +1542,7 @@ public class PowerManagerServiceTest { .isEqualTo(expectedNonDefaultGroupWakefullness); } @EnableFlags({ android.companion.virtualdevice.flags.Flags.FLAG_DEVICE_AWARE_DISPLAY_POWER, android.companion.virtualdevice.flags.Flags.FLAG_DISPLAY_POWER_MANAGER_APIS}) @EnableFlags(android.companion.virtualdevice.flags.Flags.FLAG_DEVICE_AWARE_DISPLAY_POWER) @Test public void getBrightnessConstraint_valuesMatchDisplayInfo() { final int displayId = 7; Loading