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

Commit a57a4dd0 authored by Joshua Mccloskey's avatar Joshua Mccloskey Committed by Automerger Merge Worker
Browse files

Merge "Update require attention in stats pull service" into rvc-qpr-dev am: 55b11b16

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12878949

Change-Id: Ia10507fddb9c73554f2d3624e2da2e62ab5ebbc3
parents 16e5486a 55b11b16
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -77,8 +77,10 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
import android.content.pm.UserInfo;
import android.hardware.biometrics.BiometricFaceConstants;
import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.face.FaceManager;
import android.hardware.face.FaceManager.GetFeatureCallback;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.health.V2_0.IHealth;
import android.net.ConnectivityManager;
@@ -3327,9 +3329,30 @@ public class StatsPullAtomService extends SystemService {
        try {
            List<UserInfo> users = mContext.getSystemService(UserManager.class).getUsers();
            int numUsers = users.size();
            FaceManager faceManager = mContext.getSystemService(FaceManager.class);

            for (int userNum = 0; userNum < numUsers; userNum++) {
                int userId = users.get(userNum).getUserHandle().getIdentifier();

                if (faceManager != null) {
                    // Store the current setting from the Face HAL, and upon next upload the value
                    // reported will be correct (given the user did not modify it).
                    faceManager.getFeature(userId, BiometricFaceConstants.FEATURE_REQUIRE_ATTENTION,
                            new GetFeatureCallback() {
                                @Override
                                public void onCompleted(boolean success, int feature,
                                        boolean value) {
                                    if (feature == FaceManager.FEATURE_REQUIRE_ATTENTION
                                            && success) {
                                        Settings.Secure.putIntForUser(mContext.getContentResolver(),
                                                Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED,
                                                value ? 1 : 0, userId);
                                    }
                                }
                            }
                    );
                }

                int unlockKeyguardEnabled = Settings.Secure.getIntForUser(
                          mContext.getContentResolver(),
                          Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED, 1, userId);