Merge "Always set source status, even when null." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
6fd9cd771b
@@ -35,6 +35,7 @@ import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils;
|
||||
import com.android.settings.biometrics.combination.CombinedBiometricStatusUtils;
|
||||
import com.android.settings.biometrics.face.FaceStatusUtils;
|
||||
import com.android.settings.biometrics.fingerprint.FingerprintStatusUtils;
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
|
||||
/** Combined Biometrics Safety Source for Safety Center. */
|
||||
@@ -49,6 +50,10 @@ public final class BiometricsSafetySource {
|
||||
if (!SafetyCenterManagerWrapper.get().isEnabled(context)) {
|
||||
return;
|
||||
}
|
||||
if (Flags.biometricsOnboardingEducation()) { // this source is effectively turned off
|
||||
sendNullData(context, safetyEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
UserHandle userHandle = Process.myUserHandle();
|
||||
int userId = userHandle.getIdentifier();
|
||||
@@ -63,9 +68,7 @@ public final class BiometricsSafetySource {
|
||||
&& userManager.isPrivateProfile()) {
|
||||
// SC always expects a response from the source if the broadcast has been sent for this
|
||||
// source, therefore, we need to send a null SafetySourceData.
|
||||
SafetyCenterManagerWrapper.get()
|
||||
.setSafetySourceData(
|
||||
context, SAFETY_SOURCE_ID, /* safetySourceData= */ null, safetyEvent);
|
||||
sendNullData(context, safetyEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,6 +177,10 @@ public final class BiometricsSafetySource {
|
||||
return;
|
||||
}
|
||||
|
||||
sendNullData(context, safetyEvent);
|
||||
}
|
||||
|
||||
private static void sendNullData(Context context, SafetyEvent safetyEvent) {
|
||||
SafetyCenterManagerWrapper.get()
|
||||
.setSafetySourceData(
|
||||
context, SAFETY_SOURCE_ID, /* safetySourceData= */ null, safetyEvent);
|
||||
|
@@ -29,6 +29,7 @@ import android.safetycenter.SafetyEvent;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.biometrics.BiometricNavigationUtils;
|
||||
import com.android.settings.biometrics.face.FaceStatusUtils;
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
|
||||
@@ -44,6 +45,10 @@ public final class FaceSafetySource {
|
||||
if (!SafetyCenterManagerWrapper.get().isEnabled(context)) {
|
||||
return;
|
||||
}
|
||||
if (!Flags.biometricsOnboardingEducation()) { // this source is effectively turned off
|
||||
sendNullData(context, safetyEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle private profile case
|
||||
UserManager userManager = UserManager.get(context);
|
||||
@@ -52,9 +57,7 @@ public final class FaceSafetySource {
|
||||
&& userManager.isPrivateProfile()) {
|
||||
// SC always expects a response from the source if the broadcast has been sent for this
|
||||
// source, therefore, we need to send a null SafetySourceData.
|
||||
SafetyCenterManagerWrapper.get()
|
||||
.setSafetySourceData(
|
||||
context, SAFETY_SOURCE_ID, /* safetySourceData= */ null, safetyEvent);
|
||||
sendNullData(context, safetyEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,6 +98,10 @@ public final class FaceSafetySource {
|
||||
return;
|
||||
}
|
||||
|
||||
sendNullData(context, safetyEvent);
|
||||
}
|
||||
|
||||
private static void sendNullData(Context context, SafetyEvent safetyEvent) {
|
||||
SafetyCenterManagerWrapper.get()
|
||||
.setSafetySourceData(
|
||||
context, SAFETY_SOURCE_ID, /* safetySourceData= */ null, safetyEvent);
|
||||
|
@@ -29,6 +29,7 @@ import android.safetycenter.SafetyEvent;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.biometrics.BiometricNavigationUtils;
|
||||
import com.android.settings.biometrics.fingerprint.FingerprintStatusUtils;
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
|
||||
@@ -44,6 +45,10 @@ public final class FingerprintSafetySource {
|
||||
if (!SafetyCenterManagerWrapper.get().isEnabled(context)) {
|
||||
return;
|
||||
}
|
||||
if (!Flags.biometricsOnboardingEducation()) { // this source is effectively turned off
|
||||
sendNullData(context, safetyEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle private profile case
|
||||
UserManager userManager = UserManager.get(context);
|
||||
@@ -52,9 +57,7 @@ public final class FingerprintSafetySource {
|
||||
&& userManager.isPrivateProfile()) {
|
||||
// SC always expects a response from the source if the broadcast has been sent for this
|
||||
// source, therefore, we need to send a null SafetySourceData.
|
||||
SafetyCenterManagerWrapper.get()
|
||||
.setSafetySourceData(
|
||||
context, SAFETY_SOURCE_ID, /* safetySourceData= */ null, safetyEvent);
|
||||
sendNullData(context, safetyEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,6 +99,10 @@ public final class FingerprintSafetySource {
|
||||
return;
|
||||
}
|
||||
|
||||
sendNullData(context, safetyEvent);
|
||||
}
|
||||
|
||||
private static void sendNullData(Context context, SafetyEvent safetyEvent) {
|
||||
SafetyCenterManagerWrapper.get()
|
||||
.setSafetySourceData(
|
||||
context, SAFETY_SOURCE_ID, /* safetySourceData= */ null, safetyEvent);
|
||||
|
@@ -28,7 +28,6 @@ import android.content.Intent;
|
||||
import android.safetycenter.SafetyCenterManager;
|
||||
import android.safetycenter.SafetyEvent;
|
||||
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settings.privatespace.PrivateSpaceSafetySource;
|
||||
import com.android.settings.security.ScreenLockPreferenceDetailsUtils;
|
||||
|
||||
@@ -75,20 +74,16 @@ public class SafetySourceBroadcastReceiver extends BroadcastReceiver {
|
||||
context, new ScreenLockPreferenceDetailsUtils(context), safetyEvent);
|
||||
}
|
||||
|
||||
if (sourceIds.contains(BiometricsSafetySource.SAFETY_SOURCE_ID)
|
||||
&& !Flags.biometricsOnboardingEducation()) {
|
||||
if (sourceIds.contains(BiometricsSafetySource.SAFETY_SOURCE_ID)) {
|
||||
BiometricsSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
}
|
||||
|
||||
if (sourceIds.contains(PrivateSpaceSafetySource.SAFETY_SOURCE_ID)) {
|
||||
PrivateSpaceSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
}
|
||||
if (sourceIds.contains(FaceSafetySource.SAFETY_SOURCE_ID)
|
||||
&& Flags.biometricsOnboardingEducation()) {
|
||||
if (sourceIds.contains(FaceSafetySource.SAFETY_SOURCE_ID)) {
|
||||
FaceSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
}
|
||||
if (sourceIds.contains(FingerprintSafetySource.SAFETY_SOURCE_ID)
|
||||
&& Flags.biometricsOnboardingEducation()) {
|
||||
if (sourceIds.contains(FingerprintSafetySource.SAFETY_SOURCE_ID)) {
|
||||
FingerprintSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
}
|
||||
}
|
||||
@@ -96,13 +91,9 @@ public class SafetySourceBroadcastReceiver extends BroadcastReceiver {
|
||||
private static void refreshAllSafetySources(Context context, SafetyEvent safetyEvent) {
|
||||
LockScreenSafetySource.setSafetySourceData(
|
||||
context, new ScreenLockPreferenceDetailsUtils(context), safetyEvent);
|
||||
if (!Flags.biometricsOnboardingEducation()) {
|
||||
BiometricsSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
}
|
||||
BiometricsSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
PrivateSpaceSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
if (Flags.biometricsOnboardingEducation()) {
|
||||
FaceSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
FingerprintSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
}
|
||||
FaceSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
FingerprintSafetySource.setSafetySourceData(context, safetyEvent);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user