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

Commit e4f4eabc authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5519018 from 61c29851 to qt-release

Change-Id: I8e0d784b1c344bc8864ddd1822f8eee3f4f54e51
parents 7d0b188f 61c29851
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -687,6 +687,7 @@ java_defaults {
        "core/java/com/android/server/DropboxLogTags.logtags",
        "core/java/org/chromium/arc/EventLogTags.logtags",

        ":apex-properties",
        ":platform-properties",

        ":framework-statslog-gen",
+1 −2
Original line number Diff line number Diff line
@@ -38820,8 +38820,7 @@ package android.provider {
    field @Deprecated public static final String LOCATION_MODE = "location_mode";
    field @Deprecated public static final int LOCATION_MODE_BATTERY_SAVING = 2; // 0x2
    field @Deprecated public static final int LOCATION_MODE_HIGH_ACCURACY = 3; // 0x3
    field @Deprecated public static final int LOCATION_MODE_OFF = 0; // 0x0
    field @Deprecated public static final int LOCATION_MODE_ON = 3; // 0x3
    field public static final int LOCATION_MODE_OFF = 0; // 0x0
    field @Deprecated public static final int LOCATION_MODE_SENSORS_ONLY = 1; // 0x1
    field @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
    field @Deprecated public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
+1 −0
Original line number Diff line number Diff line
@@ -6046,6 +6046,7 @@ package android.provider {
    field public static final String LAST_SETUP_SHOWN = "last_setup_shown";
    field public static final String LOCATION_ACCESS_CHECK_DELAY_MILLIS = "location_access_check_delay_millis";
    field public static final String LOCATION_ACCESS_CHECK_INTERVAL_MILLIS = "location_access_check_interval_millis";
    field public static final int LOCATION_MODE_ON = 3; // 0x3
    field public static final String LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE = "location_permissions_upgrade_to_q_mode";
    field public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = "lock_screen_allow_private_notifications";
    field public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS = "lock_screen_show_notifications";
+51 −21
Original line number Diff line number Diff line
@@ -1202,9 +1202,10 @@ Status StatsService::unregisterPullerCallback(int32_t atomTag, const String16& p
    return Status::ok();
}

Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& trainName,
                                                    int64_t trainVersionCode, int options,
                                                    int32_t state,
Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& trainNameIn,
                                                    const int64_t trainVersionCodeIn,
                                                    const int options,
                                                    const int32_t state,
                                                    const std::vector<int64_t>& experimentIdsIn) {
    uid_t uid = IPCThreadState::self()->getCallingUid();
    // For testing
@@ -1224,34 +1225,64 @@ Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& tra
    // TODO: add verifier permission

    bool readTrainInfoSuccess = false;
    InstallTrainInfo trainInfo;
    if (trainVersionCode == -1 || experimentIdsIn.empty() || trainName.size() == 0) {
        readTrainInfoSuccess = StorageManager::readTrainInfo(trainInfo);
    InstallTrainInfo trainInfoOnDisk;
    readTrainInfoSuccess = StorageManager::readTrainInfo(trainInfoOnDisk);

    bool resetExperimentIds = false;
    int64_t trainVersionCode = trainVersionCodeIn;
    std::string trainNameUtf8 = std::string(String8(trainNameIn).string());
    if (readTrainInfoSuccess) {
        // Keep the old train version if we received an empty version.
        if (trainVersionCodeIn == -1) {
            trainVersionCode = trainInfoOnDisk.trainVersionCode;
        } else if (trainVersionCodeIn != trainInfoOnDisk.trainVersionCode) {
        // Reset experiment ids if we receive a new non-empty train version.
            resetExperimentIds = true;
        }

        // Keep the old train name if we received an empty train name.
        if (trainNameUtf8.size() == 0) {
            trainNameUtf8 = trainInfoOnDisk.trainName;
        } else if (trainNameUtf8 != trainInfoOnDisk.trainName) {
            // Reset experiment ids if we received a new valid train name.
            resetExperimentIds = true;
        }

    if (trainVersionCode == -1 && readTrainInfoSuccess) {
        trainVersionCode = trainInfo.trainVersionCode;
        // Reset if we received a different experiment id.
        if (!experimentIdsIn.empty() &&
                (trainInfoOnDisk.experimentIds.empty() ||
                 experimentIdsIn[0] != trainInfoOnDisk.experimentIds[0])) {
            resetExperimentIds = true;
        }
    }

    // Find the right experiment IDs
    std::vector<int64_t> experimentIds;
    if (readTrainInfoSuccess && experimentIdsIn.empty()) {
        experimentIds = trainInfo.experimentIds;
    } else {
    if (resetExperimentIds || !readTrainInfoSuccess) {
        experimentIds = experimentIdsIn;
    } else {
        experimentIds = trainInfoOnDisk.experimentIds;
    }

    if (!experimentIds.empty()) {
        int64_t firstId = experimentIds[0];
        switch (state) {
            case android::util::BINARY_PUSH_STATE_CHANGED__STATE__INSTALL_SUCCESS:
                experimentIds.push_back(firstId + 1);
                break;
            case android::util::BINARY_PUSH_STATE_CHANGED__STATE__INSTALLER_ROLLBACK_INITIATED:
                experimentIds.push_back(firstId + 2);
                break;
            case android::util::BINARY_PUSH_STATE_CHANGED__STATE__INSTALLER_ROLLBACK_SUCCESS:
                experimentIds.push_back(firstId + 3);
                break;
        }
    }

    // Flatten the experiment IDs to proto
    vector<uint8_t> experimentIdsProtoBuffer;
    writeExperimentIdsToProto(experimentIds, &experimentIdsProtoBuffer);

    // Find the right train name
    std::string trainNameUtf8;
    if (readTrainInfoSuccess && trainName.size() == 0) {
        trainNameUtf8 = trainInfo.trainName;
    } else {
        trainNameUtf8 = std::string(String8(trainName).string());
    }
    StorageManager::writeTrainInfo(trainVersionCode, trainNameUtf8, state, experimentIds);

    userid_t userId = multiuser_get_user_id(uid);
    bool requiresStaging = options & IStatsManager::FLAG_REQUIRE_STAGING;
@@ -1260,7 +1291,6 @@ Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& tra
    LogEvent event(trainNameUtf8, trainVersionCode, requiresStaging, rollbackEnabled,
                   requiresLowLatencyMonitor, state, experimentIdsProtoBuffer, userId);
    mProcessor->OnLogEvent(&event);
    StorageManager::writeTrainInfo(trainVersionCode, trainNameUtf8, state, experimentIds);
    return Status::ok();
}

+5 −2
Original line number Diff line number Diff line
@@ -189,8 +189,11 @@ public:
     * Binder call to log BinaryPushStateChanged atom.
     */
    virtual Status sendBinaryPushStateChangedAtom(
            const android::String16& trainName, int64_t trainVersionCode, int options,
            int32_t state, const std::vector<int64_t>& experimentIds) override;
            const android::String16& trainNameIn,
            const int64_t trainVersionCodeIn,
            const int options,
            const int32_t state,
            const std::vector<int64_t>& experimentIdsIn) override;

    /**
     * Binder call to get registered experiment IDs.
Loading