diff options
author | Jordan Jozwiak <jjoz@google.com> | 2020-11-18 18:11:11 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-11-18 18:11:11 +0000 |
commit | a26bcb66cfd7b55ba4636f28d29803e35bb08bbd (patch) | |
tree | b0a2704bd4f42bd44a2ca994b9b5e067962f3290 /services/devicepolicy | |
parent | 0a9852039faf6dab98513e9646320a01ac7f7de8 (diff) | |
parent | cad8a4f55edace067b3021ee106bce2231e80f4e (diff) |
Merge "Do not power off display on lockNow() on automotive builds." into rvc-qpr-dev am: cad8a4f55e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13037790
Change-Id: I2eae34c713b8ebc41e7332eca7a89f594da84c59
Diffstat (limited to 'services/devicepolicy')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index faf3f06a3035..bf10526aeec2 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -641,6 +641,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final boolean mIsWatch; /** + * Whether or not this device is an automotive. + */ + private final boolean mIsAutomotive; + + /** * Whether this device has the telephony feature. */ final boolean mHasTelephonyFeature; @@ -2567,6 +2572,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { .hasSystemFeature(PackageManager.FEATURE_WATCH); mHasTelephonyFeature = mInjector.getPackageManager() .hasSystemFeature(PackageManager.FEATURE_TELEPHONY); + mIsAutomotive = mInjector.getPackageManager() + .hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE); mBackgroundHandler = BackgroundThread.getHandler(); // Needed when mHasFeature == false, because it controls the certificate warning text. @@ -6080,9 +6087,16 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { // Require authentication for the device or profile if (userToLock == UserHandle.USER_ALL) { - // Power off the display - mInjector.powerManagerGoToSleep(SystemClock.uptimeMillis(), - PowerManager.GO_TO_SLEEP_REASON_DEVICE_ADMIN, 0); + if (mIsAutomotive) { + if (VERBOSE_LOG) { + Slog.v(LOG_TAG, "lockNow(): not powering off display on automotive" + + " build"); + } + } else { + // Power off the display + mInjector.powerManagerGoToSleep(SystemClock.uptimeMillis(), + PowerManager.GO_TO_SLEEP_REASON_DEVICE_ADMIN, 0); + } mInjector.getIWindowManager().lockNow(null); } else { mInjector.getTrustManager().setDeviceLockedForUser(userToLock, true); |