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

Commit 4ba3b12e authored by Xin Li's avatar Xin Li Committed by Gerrit Code Review
Browse files

Merge changes from topic "PPRL.190205.001"

* changes:
  Fix merge problems with cherry-picking "Add notification settings to backup&restore" change into pi-dev
  DO NOT MERGE - Merge PPRL.190205.001 into master
parents 619ed85e 31a61f63
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ const int FIELD_ID_STRINGS = 9;

#define STATS_DATA_DIR "/data/misc/stats-data"

// Cool down period for writing data to disk to avoid overwriting files.
#define WRITE_DATA_COOL_DOWN_SEC 5

StatsLogProcessor::StatsLogProcessor(const sp<UidMap>& uidMap,
                                     const sp<AlarmMonitor>& anomalyAlarmMonitor,
                                     const sp<AlarmMonitor>& periodicAlarmMonitor,
@@ -526,6 +529,16 @@ void StatsLogProcessor::WriteDataToDiskLocked(const ConfigKey& key,

void StatsLogProcessor::WriteDataToDiskLocked(const DumpReportReason dumpReportReason) {
    const int64_t timeNs = getElapsedRealtimeNs();
    // Do not write to disk if we already have in the last few seconds.
    // This is to avoid overwriting files that would have the same name if we
    //   write twice in the same second.
    if (static_cast<unsigned long long> (timeNs) <
            mLastWriteTimeNs + WRITE_DATA_COOL_DOWN_SEC * NS_PER_SEC) {
        ALOGI("Statsd skipping writing data to disk. Already wrote data in last %d seconds",
                WRITE_DATA_COOL_DOWN_SEC);
        return;
    }
    mLastWriteTimeNs = timeNs;
    for (auto& pair : mMetricsManagers) {
        WriteDataToDiskLocked(pair.first, timeNs, dumpReportReason);
    }
+5 −1
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@ enum DumpReportReason {
    GET_DATA_CALLED = 4,
    ADB_DUMP = 5,
    CONFIG_RESET = 6,
    STATSCOMPANION_DIED = 7
    STATSCOMPANION_DIED = 7,
    TERMINATION_SIGNAL_RECEIVED = 8
};

class StatsLogProcessor : public ConfigListener {
@@ -183,6 +184,9 @@ private:

    long mLastPullerCacheClearTimeSec = 0;

    // Last time we wrote data to disk.
    int64_t mLastWriteTimeNs = 0;

#ifdef VERY_VERBOSE_PRINTING
    bool mPrintAllLogs = false;
#endif
+7 −0
Original line number Diff line number Diff line
@@ -881,6 +881,13 @@ void StatsService::Startup() {
    mConfigManager->Startup();
}

void StatsService::Terminate() {
    ALOGI("StatsService::Terminating");
    if (mProcessor != nullptr) {
        mProcessor->WriteDataToDisk(TERMINATION_SIGNAL_RECEIVED);
    }
}

void StatsService::OnLogEvent(LogEvent* event, bool reconnectionStarts) {
    mProcessor->OnLogEvent(event, reconnectionStarts);
}
+5 −0
Original line number Diff line number Diff line
@@ -73,6 +73,11 @@ public:
     */
    void Startup();

    /**
     * Called when terminiation signal received.
     */
    void Terminate();

    /**
     * Called by LogReader when there's a log event to process.
     */
+21 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ message Atom {
        PhoneServiceStateChanged phone_service_state_changed = 94;
        PhoneStateChanged phone_state_changed = 95;
        LowMemReported low_mem_reported = 81;
        ThermalThrottlingStateChanged thermal_throttling = 86;
        NetworkDnsEventReported network_dns_event_reported = 116;
        DataStallEvent data_stall_event = 121;
        BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event = 125;
@@ -238,6 +239,26 @@ message AttributionNode {
 * *****************************************************************************
 */

/**
 * Logs when the Thermal service HAL notifies the throttling start/stop events.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
 */
message ThermalThrottlingStateChanged {
    optional android.os.TemperatureTypeEnum sensor_type = 1;

    enum State {
        UNKNOWN = 0;
        START = 1;
        STOP = 2;
    }

    optional State state = 2;

    optional float temperature = 3;
}

/**
 * Logs when the screen state changes.
 *
Loading