diff --git a/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java b/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java index e5d1182903f4d..f007ea436c3a5 100644 --- a/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java +++ b/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java @@ -856,43 +856,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { pulledData.add(e); } - private void pullFaceSettings(int tagId, long elapsedNanos, long wallClockNanos, - List pulledData) { - long callingToken = Binder.clearCallingIdentity(); - try { - List users = mContext.getSystemService(UserManager.class).getUsers(); - int numUsers = users.size(); - for (int userNum = 0; userNum < numUsers; userNum++) { - int userId = users.get(userNum).getUserHandle().getIdentifier(); - - StatsLogEventWrapper e = - new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); - e.writeBoolean(Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED, 1, - userId) != 0); - e.writeBoolean(Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, - 0, userId) != 0); - e.writeBoolean(Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED, 1, - userId) != 0); - e.writeBoolean(Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.FACE_UNLOCK_APP_ENABLED, 1, - userId) != 0); - e.writeBoolean(Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, 0, - userId) != 0); - e.writeBoolean(Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED, 1, - userId) != 0); - - pulledData.add(e); - } - } finally { - Binder.restoreCallingIdentity(callingToken); - } - } - /** * Pulls various data. */ @@ -928,11 +891,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { break; } - case StatsLog.FACE_SETTINGS: { - pullFaceSettings(tagId, elapsedNanos, wallClockNanos, ret); - break; - } - default: Slog.w(TAG, "No such tagId data as " + tagId); return null; diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp index b4fde1666b173..edf0524074dec 100644 --- a/cmds/statsd/src/external/StatsPullerManager.cpp +++ b/cmds/statsd/src/external/StatsPullerManager.cpp @@ -115,10 +115,6 @@ std::map StatsPullerManager::kAllPullAtomInfo = { {{.atomTag = android::util::GPU_STATS_APP_INFO}, {.puller = new GpuStatsPuller(android::util::GPU_STATS_APP_INFO)}}, - // Face Settings - {{.atomTag = android::util::FACE_SETTINGS}, - {.puller = new StatsCompanionServicePuller(android::util::FACE_SETTINGS)}}, - // VmsClientStats {{.atomTag = android::util::VMS_CLIENT_STATS}, {.additiveFields = {5, 6, 7, 8, 9, 10}, diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java index b11ec6fd97fb6..6418b2cc20933 100644 --- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java @@ -2497,11 +2497,57 @@ public class StatsPullAtomService extends SystemService { } private void registerFaceSettings() { - // No op. + int tagId = StatsLog.FACE_SETTINGS; + mStatsManager.registerPullAtomCallback( + tagId, + null, // use default PullAtomMetadata values + (atomTag, data) -> pullFaceSettings(atomTag, data), + BackgroundThread.getExecutor() + ); } - private void pullRegisterFaceSettings() { - // No op. + private int pullFaceSettings(int atomTag, List pulledData) { + final long callingToken = Binder.clearCallingIdentity(); + try { + List users = mContext.getSystemService(UserManager.class).getUsers(); + int numUsers = users.size(); + for (int userNum = 0; userNum < numUsers; userNum++) { + int userId = users.get(userNum).getUserHandle().getIdentifier(); + + int unlockKeyguardEnabled = Settings.Secure.getIntForUser( + mContext.getContentResolver(), + Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED, 1, userId); + int unlockDismissesKeyguard = Settings.Secure.getIntForUser( + mContext.getContentResolver(), + Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, 0, userId); + int unlockAttentionRequired = Settings.Secure.getIntForUser( + mContext.getContentResolver(), + Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED, 1, userId); + int unlockAppEnabled = Settings.Secure.getIntForUser( + mContext.getContentResolver(), + Settings.Secure.FACE_UNLOCK_APP_ENABLED, 1, userId); + int unlockAlwaysRequireConfirmation = Settings.Secure.getIntForUser( + mContext.getContentResolver(), + Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, 0, userId); + int unlockDiversityRequired = Settings.Secure.getIntForUser( + mContext.getContentResolver(), + Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED, 1, userId); + + StatsEvent e = StatsEvent.newBuilder() + .setAtomId(atomTag) + .writeBoolean(unlockKeyguardEnabled != 0) + .writeBoolean(unlockDismissesKeyguard != 0) + .writeBoolean(unlockAttentionRequired != 0) + .writeBoolean(unlockAppEnabled != 0) + .writeBoolean(unlockAlwaysRequireConfirmation != 0) + .writeBoolean(unlockDiversityRequired != 0) + .build(); + pulledData.add(e); + } + } finally { + Binder.restoreCallingIdentity(callingToken); + } + return StatsManager.PULL_SUCCESS; } private void registerAppOps() {