diff options
author | Felipe Leme <felipeal@google.com> | 2020-11-03 12:04:05 -0800 |
---|---|---|
committer | Jordan Jozwiak <jjoz@google.com> | 2020-11-11 22:43:19 +0000 |
commit | b7c8877ba14e47c3a6d02a77b87ad7f36542e96f (patch) | |
tree | 697ce8bd08c92b43a55f729ea25a426717a6eaf7 /services/devicepolicy | |
parent | 5df07126d5741970d757767cf9d3eacaf39876cf (diff) |
Do not power off display on lockNow() on automotive builds.
Test: manual verification
Fixes: 171517112
Change-Id: I410e06b911b099c0ed4b7b4e3ac493c9a272fa6b
Merged-In: I410e06b911b099c0ed4b7b4e3ac493c9a272fa6b
(cherry picked from commit fc586009b1fc381dbbc4061f876fc52c11a79814)
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 c6b93d6ca4f4..ce3cdeab232a 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); |