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

Commit 329c767f authored by Ruchir Rastogi's avatar Ruchir Rastogi
Browse files

Migrate pulFaceSettings to new API

Test: adb shell cmd stats pull-source 10058
Bug: 145565211
Change-Id: I2d36cee59e4cb9f78b6a92d5b4b00d81415a2129
parent 871fe0a9
Loading
Loading
Loading
Loading
+0 −42
Original line number Original line Diff line number Diff line
@@ -856,43 +856,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        pulledData.add(e);
        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.
     * Pulls various data.
     */
     */
@@ -928,11 +891,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
                break;
                break;
            }
            }


            case StatsLog.FACE_SETTINGS: {
                pullFaceSettings(tagId, elapsedNanos, wallClockNanos, ret);
                break;
            }

            default:
            default:
                Slog.w(TAG, "No such tagId data as " + tagId);
                Slog.w(TAG, "No such tagId data as " + tagId);
                return null;
                return null;
+0 −4
Original line number Original line Diff line number Diff line
@@ -115,10 +115,6 @@ std::map<PullerKey, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
        {{.atomTag = android::util::GPU_STATS_APP_INFO},
        {{.atomTag = android::util::GPU_STATS_APP_INFO},
         {.puller = new GpuStatsPuller(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
        // VmsClientStats
        {{.atomTag = android::util::VMS_CLIENT_STATS},
        {{.atomTag = android::util::VMS_CLIENT_STATS},
         {.additiveFields = {5, 6, 7, 8, 9, 10},
         {.additiveFields = {5, 6, 7, 8, 9, 10},
+49 −3
Original line number Original line Diff line number Diff line
@@ -2497,11 +2497,57 @@ public class StatsPullAtomService extends SystemService {
    }
    }


    private void registerFaceSettings() {
    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() {
    private int pullFaceSettings(int atomTag, List<StatsEvent> pulledData) {
        // No op.
        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() {
    private void registerAppOps() {