Set up correct ComponentName for test mode of Parental Controls
Test: manual Bug: 222339681 Change-Id: I9c141b8f04a69c914a55ed176c2f1c101d22a34c
This commit is contained in:
@@ -41,16 +41,19 @@ public class ParentalControlsUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Public version that enables test paths, see
|
* Public version that enables test paths, see
|
||||||
* {@link android.hardware.biometrics.ParentalControlsUtilsInternal#isTestModeEnabled(Context)}
|
* {@link android.hardware.biometrics.ParentalControlsUtilsInternal#getTestComponentName}
|
||||||
* @return non-null EnforcedAdmin if parental consent is required
|
* @return non-null EnforcedAdmin if parental consent is required
|
||||||
*/
|
*/
|
||||||
public static RestrictedLockUtils.EnforcedAdmin parentConsentRequired(@NonNull Context context,
|
public static RestrictedLockUtils.EnforcedAdmin parentConsentRequired(@NonNull Context context,
|
||||||
@BiometricAuthenticator.Modality int modality) {
|
@BiometricAuthenticator.Modality int modality) {
|
||||||
|
|
||||||
final UserHandle userHandle = new UserHandle(UserHandle.myUserId());
|
final int userId = UserHandle.myUserId();
|
||||||
if (ParentalControlsUtilsInternal.isTestModeEnabled(context)) {
|
final UserHandle userHandle = new UserHandle(userId);
|
||||||
|
final ComponentName testComponentName = ParentalControlsUtilsInternal.getTestComponentName(
|
||||||
|
context, userId);
|
||||||
|
if (testComponentName != null) {
|
||||||
Log.d(TAG, "Requiring consent for test flow");
|
Log.d(TAG, "Requiring consent for test flow");
|
||||||
return new RestrictedLockUtils.EnforcedAdmin(null /* ComponentName */,
|
return new RestrictedLockUtils.EnforcedAdmin(testComponentName,
|
||||||
UserManager.DISALLOW_BIOMETRIC, userHandle);
|
UserManager.DISALLOW_BIOMETRIC, userHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user