Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 570540b1 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Do not show work profile strings for parent-managed enrollment

Work profiles and parental management both utilize the
DevicePolicyManager KEYGUARD_DISABLE_* flags. This CL ensures that
work profile strings are only shown for work profiles, and not
parent-managed devices.

Bug: 196060286
Bug: 196443744
Test: Set up child account, then enroll from Settings > Security
Change-Id: Ib5ed1d63dd5d58ac64caf30010e340ac7784c38f
parent 715e337a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.admin.DevicePolicyManager;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.hardware.biometrics.BiometricAuthenticator;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
@@ -62,6 +63,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
    private TextView mErrorText;
    protected boolean mConfirmingCredentials;
    protected boolean mNextClicked;
    private boolean mParentalConsentRequired;

    @Nullable private PorterDuffColorFilter mIconColorFilter;

@@ -138,6 +140,8 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
     */
    public abstract void onClick(LinkSpan span);

    public abstract @BiometricAuthenticator.Modality int getModality();

    protected interface GenerateChallengeCallback {
        void onChallengeGenerated(int sensorId, int userId, long challenge);
    }
@@ -161,7 +165,9 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
        mBiometricUnlockDisabledByAdmin = isDisabledByAdmin();

        setContentView(getLayoutResource());
        if (mBiometricUnlockDisabledByAdmin) {
        mParentalConsentRequired = ParentalControlsUtils.parentConsentRequired(this, getModality())
                != null;
        if (mBiometricUnlockDisabledByAdmin && !mParentalConsentRequired) {
            setHeaderText(getHeaderResDisabledByAdmin());
        } else {
            setHeaderText(getHeaderResDefault());
@@ -399,7 +405,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
    protected void initViews() {
        super.initViews();

        if (mBiometricUnlockDisabledByAdmin) {
        if (mBiometricUnlockDisabledByAdmin && !mParentalConsentRequired) {
            setDescriptionText(getDescriptionResDisabledByAdmin());
        }
    }
+6 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.settings.biometrics.face;
import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.Intent;
import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorPropertiesInternal;
import android.os.Bundle;
@@ -287,6 +288,11 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
        // TODO(b/110906762)
    }

    @Override
    public @BiometricAuthenticator.Modality int getModality() {
        return BiometricAuthenticator.TYPE_FACE;
    }

    @Override
    @NonNull
    protected FooterButton getPrimaryFooterButton() {
+6 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
@@ -272,6 +273,11 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
        }
    }

    @Override
    public @BiometricAuthenticator.Modality int getModality() {
        return BiometricAuthenticator.TYPE_FINGERPRINT;
    }

    @Override
    @NonNull
    protected FooterButton getPrimaryFooterButton() {