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

Commit bd3e3a17 authored by Joseph Vincent's avatar Joseph Vincent Committed by Android (Google) Code Review
Browse files

Merge "In Private space settings when no face support show only fingerprint unlock" into main

parents 60274949 1741f535
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1231,6 +1231,10 @@
    <string name="private_space_screen_lock_title">Use device screen lock</string>
    <!-- Title for the Face and Fingerprint preference. [CHAR LIMIT=60] -->
    <string name="private_space_biometric_title">Face &amp; Fingerprint Unlock</string>
    <!-- Title for the Fingerprint preference when face hardware is not supported on device. [CHAR LIMIT=40] -->
    <string name="private_space_fingerprint_title">Fingerprint Unlock</string>
    <!-- Title for the Face preference when fingerprint unlock is not supported on device. [CHAR LIMIT=40] -->
    <string name="private_space_face_title">Face Unlock</string>
    <!-- Summary for the Face and Fingerprint preference when no biometric is set. [CHAR LIMIT=60] -->
    <string name="private_space_biometric_summary">Tap to set up</string>
    <!-- Title for the Fingerprint unlock for private space preference. [CHAR LIMIT=60] -->
+26 −0
Original line number Diff line number Diff line
@@ -20,8 +20,13 @@ import android.content.Context;
import android.os.UserHandle;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.biometrics.combination.BiometricFaceStatusPreferenceController;
import com.android.settings.privatespace.PrivateSpaceMaintainer;

@@ -62,4 +67,25 @@ public class PrivateSpaceFacePreferenceController extends BiometricFaceStatusPre
                ? AVAILABLE
                : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public void updateState(@NonNull Preference preference) {
        if (mLockPatternUtils.isSeparateProfileChallengeEnabled(getUserId())) {
            super.updateState(preference);
            preference.setEnabled(true);
        } else {
            preference.setSummary(
                    mContext.getString(R.string.lock_settings_profile_unified_summary));
            preference.setEnabled(false);
        }
    }

    @Override
    public void displayPreference(@NonNull PreferenceScreen screen) {
        super.displayPreference(screen);
        Preference preference = screen.findPreference(getPreferenceKey());
        if (!Utils.isMultipleBiometricsSupported(mContext)) {
            preference.setTitle(R.string.private_space_face_title);
        }
    }
}
+26 −0
Original line number Diff line number Diff line
@@ -20,8 +20,13 @@ import android.content.Context;
import android.os.UserHandle;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.biometrics.combination.BiometricFingerprintStatusPreferenceController;
import com.android.settings.privatespace.PrivateSpaceMaintainer;

@@ -64,4 +69,25 @@ public class PrivateSpaceFingerprintPreferenceController
                ? AVAILABLE
                : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public void updateState(@NonNull Preference preference) {
        if (mLockPatternUtils.isSeparateProfileChallengeEnabled(getUserId())) {
            super.updateState(preference);
            preference.setEnabled(true);
        } else {
            preference.setSummary(
                    mContext.getString(R.string.lock_settings_profile_unified_summary));
            preference.setEnabled(false);
        }
    }

    @Override
    public void displayPreference(@NonNull PreferenceScreen screen) {
        super.displayPreference(screen);
        Preference preference = screen.findPreference(getPreferenceKey());
        if (!Utils.isMultipleBiometricsSupported(mContext)) {
            preference.setTitle(R.string.private_space_fingerprint_title);
        }
    }
}
+12 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.Bundle;
import androidx.annotation.Nullable;

import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.privatespace.PrivateSpaceMaintainer;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -71,7 +72,17 @@ public class UseOneLockSettingsFragment extends DashboardFragment {
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        controllers.add(new UseOneLockControllerSwitch(context, this));
        controllers.add(new PrivateSpaceLockController(context, this));
        if (Utils.isMultipleBiometricsSupported(context)) {
            controllers.add(new FaceFingerprintUnlockController(context, getSettingsLifecycle()));
        } else if (Utils.hasFingerprintHardware(context)) {
            controllers.add(
                    new PrivateSpaceFingerprintPreferenceController(
                            context, "private_space_biometrics", getSettingsLifecycle()));
        } else if (Utils.hasFaceHardware(context)) {
            controllers.add(
                    new PrivateSpaceFacePreferenceController(
                            context, "private_space_biometrics", getSettingsLifecycle()));
        }
        return controllers;
    }