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

Commit d31de9dd authored by Kevin Chyn's avatar Kevin Chyn Committed by android-build-merger
Browse files

Merge "Adding Face Setting Stats." into qt-dev

am: 27a8e5b3

Change-Id: I982426d6633c3ffaa6182c1fab4bf04cf64d0292
parents 80635b44 27a8e5b3
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ message Atom {
    }

    // 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 @@ message Atom {
        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.
@@ -5926,3 +5927,23 @@ message AppsOnExternalStorageInfo {
    // 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;
}
+3 −0
Original line number Diff line number Diff line
@@ -254,6 +254,9 @@ std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
        // 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) {
+39 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ import android.os.UserManager;
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 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        }
    }

    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 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
                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;