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

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

Snap for 6502793 from a39608ef to mainline-release

Change-Id: I7d20aca9fea014cc910f10ea49fb91cb33e01fe1
parents ea487ad3 a39608ef
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -447,7 +447,7 @@ message Atom {
    }

    // Pulled events will start at field 10000.
    // Next: 10080
    // Next: 10082
    oneof pulled {
        WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
@@ -538,6 +538,7 @@ message Atom {
        SimSlotState sim_slot_state = 10078 [(module) = "telephony"];
        SupportedRadioAccessFamily supported_radio_access_family = 10079 [(module) = "telephony"];
        SettingSnapshot setting_snapshot = 10080 [(module) = "framework"];
        DisplayWakeReason display_wake_reason = 10081 [(module) = "framework"];
    }

    // DO NOT USE field numbers above 100,000 in AOSP.
@@ -9632,6 +9633,17 @@ message AccessibilityServiceReported {
    optional android.stats.accessibility.ServiceStatus service_status = 2;
}

message DisplayWakeReason {
    // Wake_up_reason code
    // If LOWORD(wake_up_reason) = 0
    //     reference to HIWORD(wake_up_reason) PowerManager.WAKE_REASON_XXX
    //     else reference wake_up_reason to
    //     frameworks/base/services/core/java/com/android/server/power/Notifier.java#DispWakeupReason
    optional int32 wake_up_reason = 1;
    // Count of wake up by reason
    optional int32 wake_times = 2;
}

/**
 * Logs app usage events.
 */
+1 −1
Original line number Diff line number Diff line
@@ -442,7 +442,7 @@ protected:
    bool mIsActive;

    // The slice_by_state atom ids defined in statsd_config.
    std::vector<int32_t> mSlicedStateAtoms;
    const std::vector<int32_t> mSlicedStateAtoms;

    // Maps atom ids and state values to group_ids (<atom_id, <value, group_id>>).
    const std::unordered_map<int32_t, std::unordered_map<int, int64_t>> mStateGroupMap;
+7 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ MetricsManager::MetricsManager(const ConfigKey& key, const StatsdConfig& config,
      mLastReportTimeNs(currentTimeNs),
      mLastReportWallClockNs(getWallClockNs()),
      mPullerManager(pullerManager),
      mWhitelistedAtomIds(config.whitelisted_atom_ids().begin(),
                          config.whitelisted_atom_ids().end()),
      mShouldPersistHistory(config.persist_locally()) {
    // Init the ttl end timestamp.
    refreshTtl(timeBaseNs);
@@ -366,11 +368,16 @@ void MetricsManager::onDumpReport(const int64_t dumpTimeStampNs,


bool MetricsManager::checkLogCredentials(const LogEvent& event) {
    // TODO(b/154856835): Remove this check once we get whitelist from the config.
    if (android::util::AtomsInfo::kWhitelistedAtoms.find(event.GetTagId()) !=
      android::util::AtomsInfo::kWhitelistedAtoms.end())
    {
        return true;
    }

    if (mWhitelistedAtomIds.find(event.GetTagId()) != mWhitelistedAtomIds.end()) {
        return true;
    }
    std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex);
    if (mAllowedLogSources.find(event.GetUid()) == mAllowedLogSources.end()) {
        VLOG("log source %d not on the whitelist", event.GetUid());
+2 −0
Original line number Diff line number Diff line
@@ -189,6 +189,8 @@ private:
    // To guard access to mAllowedLogSources
    mutable std::mutex mAllowedLogSourcesMutex;

    const std::set<int32_t> mWhitelistedAtomIds;

    // We can pull any atom from these uids.
    std::set<int32_t> mDefaultPullUids;

+10 −1
Original line number Diff line number Diff line
@@ -791,10 +791,19 @@ bool initMetrics(const ConfigKey& key, const StatsdConfig& config, const int64_t
        }
        noReportMetricIds.insert(no_report_metric);
    }

    const set<int> whitelistedAtomIds(config.whitelisted_atom_ids().begin(),
                                      config.whitelisted_atom_ids().end());
    for (const auto& it : allMetricProducers) {
        // Register metrics to StateTrackers
        for (int atomId : it->getSlicedStateAtoms()) {
            // Register listener for non-whitelisted atoms only. Using whitelisted atom as a sliced
            // state atom is not allowed.
            if (whitelistedAtomIds.find(atomId) == whitelistedAtomIds.end()) {
                StateManager::getInstance().registerListener(atomId, it);
            } else {
                return false;
            }
        }
    }
    return true;
Loading