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

Commit 1741f535 authored by josephpv's avatar josephpv
Browse files

In Private space settings when no face support show only fingerprint unlock

This contains fix for PS biometrics issue in Pixel devices without
face hardware support.

In private space separate lock settings page
- without face support only fingerprint unlock controller is shown
- with face support controller for both face and fingerprint is shown.

Screenshot:
-Without Face support
go/ss/qhDqdyqYLCTYaJq.png
go/ss/4Jw54XKJPNYm4R6.png
go/ss/5LPjRQ76cVPZy7j.png

-if without Fingerprint
go/ss/ACGqKU7j24G3Q9Q.png

-With Face support
go/ss/7jV385WCFsXajZM.png
go/ss/ZrGTdiYUN5MFY3r.png
go/ss/6QNKqaFuZvuMJZ9.png
go/ss/9ZcSvXULHuPK2ps.png
go/ss/7GfABcYE4h8BkCo.png

Bug: 319794904
Test: Manual
Change-Id: I053e8584d036ca0d6e3d8157d0fdef6d465492aa
parent 306df3be
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1225,6 +1225,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;
    }