Adding Face Setting Stats.
Test: Verified that fields are set.
Bug: 128349976
Change-Id: I49b30401ebf3063adf7d137ff40505d6504226ab
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 048e8fc..d3aa56a 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -279,7 +279,7 @@
}
// Pulled events will start at field 10000.
- // Next: 10058
+ // Next: 10059
oneof pulled {
WifiBytesTransfer wifi_bytes_transfer = 10000;
WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
@@ -339,6 +339,7 @@
GpuStatsAppInfo gpu_stats_app_info = 10055;
SystemIonHeapSize system_ion_heap_size = 10056;
AppsOnExternalStorageInfo apps_on_external_storage_info = 10057;
+ FaceSettings face_settings = 10058;
}
// DO NOT USE field numbers above 100,000 in AOSP.
@@ -5925,3 +5926,23 @@
// The name of the package that is installed on the external storage.
optional string package_name = 2;
}
+
+/**
+ * Logs the settings related to Face.
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/stats
+ */
+message FaceSettings {
+ // Whether or not face unlock is allowed on Keyguard.
+ optional bool unlock_keyguard_enabled = 1;
+ // Whether or not face unlock dismisses the Keyguard.
+ optional bool unlock_dismisses_keyguard = 2;
+ // Whether or not face unlock requires attention.
+ optional bool unlock_attention_required = 3;
+ // Whether or not face unlock is allowed for apps (through BiometricPrompt).
+ optional bool unlock_app_enabled = 4;
+ // Whether or not face unlock always requires user confirmation.
+ optional bool unlock_always_require_confirmation = 5;
+ // Whether or not a diverse set of poses are required during enrollment.
+ optional bool unlock_diversity_required = 6;
+}
diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp
index d6411a7..51839c4 100644
--- a/cmds/statsd/src/external/StatsPullerManager.cpp
+++ b/cmds/statsd/src/external/StatsPullerManager.cpp
@@ -254,6 +254,9 @@
// AppsOnExternalStorageInfo
{android::util::APPS_ON_EXTERNAL_STORAGE_INFO,
{.puller = new StatsCompanionServicePuller(android::util::APPS_ON_EXTERNAL_STORAGE_INFO)}},
+ // Face Settings
+ {android::util::FACE_SETTINGS,
+ {.puller = new StatsCompanionServicePuller(android::util::FACE_SETTINGS)}},
};
StatsPullerManager::StatsPullerManager() : mNextPullTimeNs(NO_ALARM_UPDATE) {
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index 96924c04..10ed88f 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -92,6 +92,7 @@
import android.os.storage.DiskInfo;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
+import android.provider.Settings;
import android.stats.storage.StorageEnums;
import android.telephony.ModemActivityInfo;
import android.telephony.TelephonyManager;
@@ -2057,6 +2058,40 @@
}
}
+ private void pullFaceSettings(int tagId, long elapsedNanos, long wallClockNanos,
+ List<StatsLogEventWrapper> pulledData) {
+ long callingToken = Binder.clearCallingIdentity();
+ try {
+ List<UserInfo> 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);
+
+ pulledData.add(e);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(callingToken);
+ }
+ }
+
/**
* Pulls various data.
*/
@@ -2261,6 +2296,10 @@
pullAppsOnExternalStorageInfo(tagId, elapsedNanos, wallClockNanos, ret);
break;
}
+ case StatsLog.FACE_SETTINGS: {
+ pullFaceSettings(tagId, elapsedNanos, wallClockNanos, ret);
+ break;
+ }
default:
Slog.w(TAG, "No such tagId data as " + tagId);
return null;