Loading init/property_service.cpp +27 −23 Original line number Diff line number Diff line Loading @@ -117,7 +117,6 @@ static bool accept_messages = false; static std::mutex accept_messages_lock; static std::thread property_service_thread; static std::thread property_service_for_system_thread; static std::mutex set_property_lock; static std::unique_ptr<PersistWriteThread> persist_write_thread; Loading Loading @@ -395,7 +394,11 @@ static std::optional<uint32_t> PropertySet(const std::string& name, const std::s return {PROP_ERROR_INVALID_VALUE}; } auto lock = std::lock_guard{set_property_lock}; if (name == "sys.powerctl") { // No action here - NotifyPropertyChange will trigger the appropriate action, and since this // can come to the second thread, we mustn't call out to the __system_property_* functions // which support multiple readers but only one mutator. } else { prop_info* pi = (prop_info*)__system_property_find(name.c_str()); if (pi != nullptr) { // ro.* properties are actually "write-once". Loading @@ -422,6 +425,7 @@ static std::optional<uint32_t> PropertySet(const std::string& name, const std::s } WritePersistentProperty(name, value); } } NotifyPropertyChange(name, value); return {PROP_SUCCESS}; Loading libstats/expresslog/Histogram.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -71,5 +71,10 @@ void Histogram::logSample(float sample) const { stats_write(EXPRESS_HISTOGRAM_SAMPLE_REPORTED, mMetricIdHash, /*count*/ 1, binIndex); } void Histogram::logSampleWithUid(int32_t uid, float sample) const { const int binIndex = mBinOptions->getBinForSample(sample); stats_write(EXPRESS_UID_HISTOGRAM_SAMPLE_REPORTED, mMetricIdHash, /*count*/ 1, binIndex, uid); } } // namespace expresslog } // namespace android libstats/expresslog/include/Histogram.h +5 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,11 @@ public: */ void logSample(float sample) const; /** * Logs increment sample count for automatically calculated bin with uid */ void logSampleWithUid(int32_t uid, float sample) const; private: const int64_t mMetricIdHash; const std::shared_ptr<BinOptions> mBinOptions; Loading Loading
init/property_service.cpp +27 −23 Original line number Diff line number Diff line Loading @@ -117,7 +117,6 @@ static bool accept_messages = false; static std::mutex accept_messages_lock; static std::thread property_service_thread; static std::thread property_service_for_system_thread; static std::mutex set_property_lock; static std::unique_ptr<PersistWriteThread> persist_write_thread; Loading Loading @@ -395,7 +394,11 @@ static std::optional<uint32_t> PropertySet(const std::string& name, const std::s return {PROP_ERROR_INVALID_VALUE}; } auto lock = std::lock_guard{set_property_lock}; if (name == "sys.powerctl") { // No action here - NotifyPropertyChange will trigger the appropriate action, and since this // can come to the second thread, we mustn't call out to the __system_property_* functions // which support multiple readers but only one mutator. } else { prop_info* pi = (prop_info*)__system_property_find(name.c_str()); if (pi != nullptr) { // ro.* properties are actually "write-once". Loading @@ -422,6 +425,7 @@ static std::optional<uint32_t> PropertySet(const std::string& name, const std::s } WritePersistentProperty(name, value); } } NotifyPropertyChange(name, value); return {PROP_SUCCESS}; Loading
libstats/expresslog/Histogram.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -71,5 +71,10 @@ void Histogram::logSample(float sample) const { stats_write(EXPRESS_HISTOGRAM_SAMPLE_REPORTED, mMetricIdHash, /*count*/ 1, binIndex); } void Histogram::logSampleWithUid(int32_t uid, float sample) const { const int binIndex = mBinOptions->getBinForSample(sample); stats_write(EXPRESS_UID_HISTOGRAM_SAMPLE_REPORTED, mMetricIdHash, /*count*/ 1, binIndex, uid); } } // namespace expresslog } // namespace android
libstats/expresslog/include/Histogram.h +5 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,11 @@ public: */ void logSample(float sample) const; /** * Logs increment sample count for automatically calculated bin with uid */ void logSampleWithUid(int32_t uid, float sample) const; private: const int64_t mMetricIdHash; const std::shared_ptr<BinOptions> mBinOptions; Loading