Add ActiveUnlock check when picking preference

Modify BiometricsSettingBase to also track if the hardware is supported
and if the controller is a work profile controller. If the hardware is
supported and active unlock is enabled, non-work profile controllers
will still be displayed.

Test: make RunSettingsRoboTests
Test: manually flip flags on device with active unlock, confirm new
layout used
Bug: 264813302

Change-Id: Idb0e994453d4fd5c078c45f87d5d8cee339053a2
This commit is contained in:
Derek Jedral
2023-01-22 15:20:00 -08:00
parent 590eefb55a
commit d828e0abf5
18 changed files with 728 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ import android.content.Context;
import android.provider.Settings;
import com.android.settings.Utils;
import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils;
import com.android.settings.core.TogglePreferenceController;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtilsInternal;
@@ -63,9 +64,18 @@ public class BiometricSettingsKeyguardPreferenceController extends TogglePrefere
@Override
public int getAvailabilityStatus() {
final ActiveUnlockStatusUtils activeUnlockStatusUtils =
new ActiveUnlockStatusUtils(mContext);
if (activeUnlockStatusUtils.isAvailable()) {
return getAvailabilityFromRestrictingAdmin();
}
if (!Utils.isMultipleBiometricsSupported(mContext)) {
return UNSUPPORTED_ON_DEVICE;
}
return getAvailabilityFromRestrictingAdmin();
}
private int getAvailabilityFromRestrictingAdmin() {
return getRestrictingAdmin() != null ? DISABLED_FOR_USER : AVAILABLE;
}