Loading core/java/android/app/admin/DevicePolicyManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -4271,6 +4271,9 @@ public class DevicePolicyManager { * This method can be called on the {@link DevicePolicyManager} instance returned by * {@link #getParentProfileInstance(ComponentName)} in order to lock the parent profile. * <p> * NOTE: on {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE automotive builds}, this * method doesn't turn off the screen as it would be a driving safety distraction. * <p> * Equivalent to calling {@link #lockNow(int)} with no flags. * * @throws SecurityException if the calling application does not own an active administrator Loading Loading @@ -4314,6 +4317,9 @@ public class DevicePolicyManager { * Calling the method twice in this order ensures that all users are locked and does not * stop the device admin on the managed profile from issuing a second call to lock its own * profile. * <p> * NOTE: on {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE automotive builds}, this * method doesn't turn off the screen as it would be a driving safety distraction. * * @param flags May be 0 or {@link #FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY}. * @throws SecurityException if the calling application does not own an active administrator Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +18 −3 Original line number Diff line number Diff line Loading @@ -566,6 +566,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. */ Loading Loading @@ -1383,6 +1388,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. Loading Loading @@ -4794,9 +4801,16 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { // Require authentication for the device or profile if (userToLock == UserHandle.USER_ALL) { 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); Loading Loading @@ -8527,6 +8541,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { pw.increaseIndent(); pw.printf("mHasFeature=%b\n", mHasFeature); pw.printf("mIsWatch=%b\n", mIsWatch); pw.printf("mIsAutomotive=%b\n", mIsAutomotive); pw.printf("mHasTelephonyFeature=%b\n", mHasTelephonyFeature); pw.decreaseIndent(); } Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -4271,6 +4271,9 @@ public class DevicePolicyManager { * This method can be called on the {@link DevicePolicyManager} instance returned by * {@link #getParentProfileInstance(ComponentName)} in order to lock the parent profile. * <p> * NOTE: on {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE automotive builds}, this * method doesn't turn off the screen as it would be a driving safety distraction. * <p> * Equivalent to calling {@link #lockNow(int)} with no flags. * * @throws SecurityException if the calling application does not own an active administrator Loading Loading @@ -4314,6 +4317,9 @@ public class DevicePolicyManager { * Calling the method twice in this order ensures that all users are locked and does not * stop the device admin on the managed profile from issuing a second call to lock its own * profile. * <p> * NOTE: on {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE automotive builds}, this * method doesn't turn off the screen as it would be a driving safety distraction. * * @param flags May be 0 or {@link #FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY}. * @throws SecurityException if the calling application does not own an active administrator Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +18 −3 Original line number Diff line number Diff line Loading @@ -566,6 +566,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. */ Loading Loading @@ -1383,6 +1388,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. Loading Loading @@ -4794,9 +4801,16 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { // Require authentication for the device or profile if (userToLock == UserHandle.USER_ALL) { 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); Loading Loading @@ -8527,6 +8541,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { pw.increaseIndent(); pw.printf("mHasFeature=%b\n", mHasFeature); pw.printf("mIsWatch=%b\n", mIsWatch); pw.printf("mIsAutomotive=%b\n", mIsAutomotive); pw.printf("mHasTelephonyFeature=%b\n", mHasTelephonyFeature); pw.decreaseIndent(); } Loading