Merge "Migrate pulFaceSettings to new API"
This commit is contained in:
committed by
Android (Google) Code Review
commit
25f5eaea72
@@ -856,43 +856,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
pulledData.add(e);
|
||||
}
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
@@ -115,10 +115,6 @@ std::map<PullerKey, PullAtomInfo> 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},
|
||||
|
||||
@@ -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<StatsEvent> pulledData) {
|
||||
final 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();
|
||||
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user