Allow Watch Unlock to exit back to Device Unlock settings.
Seeking to imitate the behavior from fingerprint and face unlock. In GMS Core we will control when to send the RESULT_TIMEOUT resultCode, but we should generally exit all the way out to Device Unlock, where there is a passcode entry requirement, when we swipe away from Watch Unlock's settings. Flag: com.android.settings.flags.active_unlock_finish_parent Test: Manually Bug: 343576960 Change-Id: Ia9a1564295a44ab6925ea9fceebf92f437e03731
This commit is contained in:
@@ -14,3 +14,10 @@ flag {
|
||||
description: "This flag enables or disables the Fingerprint v2 enrollment"
|
||||
bug: "295206723"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "active_unlock_finish_parent"
|
||||
namespace: "biometrics_framework"
|
||||
description: "This flag enables the Active Unlock settings activity to finish its parent activity"
|
||||
bug: "343576960"
|
||||
}
|
||||
|
@@ -24,14 +24,19 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import androidx.activity.result.ActivityResult;
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||
import com.android.settings.biometrics.activeunlock.ActiveUnlockContentListener.OnContentChangedListener;
|
||||
import com.android.settings.biometrics.activeunlock.ActiveUnlockDeviceNameListener;
|
||||
import com.android.settings.biometrics.activeunlock.ActiveUnlockRequireBiometricSetup;
|
||||
import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils;
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
@@ -52,6 +57,10 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
|
||||
private CombinedBiometricStatusUtils mCombinedBiometricStatusUtils;
|
||||
@Nullable private ActiveUnlockDeviceNameListener mActiveUnlockDeviceNameListener;
|
||||
|
||||
private final ActivityResultLauncher<Intent> mActiveUnlockPreferenceLauncher =
|
||||
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
|
||||
this::onActiveUnlockPreferenceResult);
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
@@ -158,12 +167,25 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
|
||||
intent = mActiveUnlockStatusUtils.getIntent();
|
||||
}
|
||||
if (intent != null) {
|
||||
startActivityForResult(intent, ACTIVE_UNLOCK_REQUEST);
|
||||
if (Flags.activeUnlockFinishParent()) {
|
||||
mActiveUnlockPreferenceLauncher.launch(intent);
|
||||
} else {
|
||||
startActivityForResult(intent, ACTIVE_UNLOCK_REQUEST);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private void onActiveUnlockPreferenceResult(@Nullable ActivityResult result) {
|
||||
if (result != null && result.getResultCode() == BiometricEnrollBase.RESULT_TIMEOUT) {
|
||||
mDoNotFinishActivity = false;
|
||||
// When "Watch Unlock" is closed due to entering onStop(),
|
||||
// "Face & Fingerprint Unlock" shall also close itself and back to "Security" page.
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUseAnyBiometricSummary() {
|
||||
// either Active Unlock is not enabled or no device is enrolled.
|
||||
|
Reference in New Issue
Block a user