Fix bug in isManagedKiosk

Fixes: 279567430
Test: atest com.google.android.gts.devicepolicy.DeviceOwnerTest#testIsManagedKiosk_lockTaskSystemInfoFeature_returnsFalse
Change-Id: I29e63ef20571f1d29cd7372ab068567da62c1e5d
This commit is contained in:
Kholoud Mohamed
2023-04-25 15:03:09 +00:00
parent 29ddb4d350
commit abe0cd49d1

View File

@@ -20156,9 +20156,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
private boolean isLockTaskFeatureEnabled(int lockTaskFeature) throws RemoteException {
//TODO(b/175285301): Explicitly get the user's identity to check.
int lockTaskFeatures =
getUserData(getCurrentForegroundUserId()).mLockTaskFeatures;
int lockTaskFeatures = 0;
if (isPolicyEngineForFinanceFlagEnabled()) {
LockTaskPolicy policy = mDevicePolicyEngine.getResolvedPolicy(
PolicyDefinition.LOCK_TASK, getCurrentForegroundUserId());
lockTaskFeatures = policy == null
// We default on the power button menu, in order to be consistent with pre-P
// behaviour.
? DevicePolicyManager.LOCK_TASK_FEATURE_GLOBAL_ACTIONS
: policy.getFlags();
} else {
//TODO(b/175285301): Explicitly get the user's identity to check.
lockTaskFeatures =
getUserData(getCurrentForegroundUserId()).mLockTaskFeatures;
}
return (lockTaskFeatures & lockTaskFeature) == lockTaskFeature;
}