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

Commit db14b487 authored by Neil Fuller's avatar Neil Fuller
Browse files

Add an atom for TimeZoneDataVersion

The atom records the tzdb version in use on the device
as reported by the public SDK ICU APIs.

Test: build / boot
Bug: 119010737
Change-Id: Ifa2bed2eabf192da7adbc29b064cbb41f85f9ba7
parent 29405ed8
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -302,6 +302,7 @@ message Atom {
        RoleHolder role_holder = 10049;
        DangerousPermissionState dangerous_permission_state = 10050;
        TrainInfo train_info = 10051;
        TimeZoneDataInfo time_zone_data_info = 10052;
    }

    // DO NOT USE field numbers above 100,000 in AOSP.
@@ -5564,3 +5565,11 @@ message AssistGestureProgressReported {
  // [0,100] progress for the assist gesture.
  optional int32 progress = 1;
}

/*
 * Information about the time zone data on a device.
 */
message TimeZoneDataInfo {
    // A version identifier for the data set on device. e.g. "2018i"
    optional string tzdb_version = 1;
}
+3 −0
Original line number Diff line number Diff line
@@ -234,6 +234,9 @@ std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
         {.puller = new StatsCompanionServicePuller(android::util::DANGEROUS_PERMISSION_STATE)}},
        // TrainInfo.
        {android::util::TRAIN_INFO, {.puller = new TrainInfoPuller()}},
        // TimeZoneDataInfo.
        {android::util::TIME_ZONE_DATA_INFO,
         {.puller = new StatsCompanionServicePuller(android::util::TIME_ZONE_DATA_INFO)}},
};

StatsPullerManager::StatsPullerManager() : mNextPullTimeNs(NO_ALARM_UPDATE) {
+18 −0
Original line number Diff line number Diff line
@@ -1942,6 +1942,20 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        }
    }

    private void pullTimeZoneDataInfo(int tagId,
            long elapsedNanos, long wallClockNanos, List<StatsLogEventWrapper> pulledData) {
        String tzDbVersion = "Unknown";
        try {
            tzDbVersion = android.icu.util.TimeZone.getTZDataVersion();
        } catch (Exception e) {
            Log.e(TAG, "Getting tzdb version failed: ", e);
        }

        StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
        e.writeString(tzDbVersion);
        pulledData.add(e);
    }

    /**
     * Pulls various data.
     */
@@ -2130,6 +2144,10 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
                pullDangerousPermissionState(elapsedNanos, wallClockNanos, ret);
                break;
            }
            case StatsLog.TIME_ZONE_DATA_INFO: {
                pullTimeZoneDataInfo(tagId, elapsedNanos, wallClockNanos, ret);
                break;
            }
            default:
                Slog.w(TAG, "No such tagId data as " + tagId);
                return null;