VRR: Use appId to replace uid mapping
Uid is combination of user id and app id. Because the allowlist
is recored by pkg for each users. We could ignore the user id part
and it also could solve the issue we didn't update the mapping
when user added case.
Bug: 298722189
Test: atest SmallAreaDetectionAllowMappingsTest
Test: atest SmallAreaDetectionControllerTest
Test: Add new user and open Youtube short to check refresh rate
Change-Id: Ic80be38ebc19938bc061bf6121c68efc4ff9ac4c
diff --git a/services/surfaceflinger/Scheduler/SmallAreaDetectionAllowMappings.cpp b/services/surfaceflinger/Scheduler/SmallAreaDetectionAllowMappings.cpp
index 95cd5d1..38c6da4 100644
--- a/services/surfaceflinger/Scheduler/SmallAreaDetectionAllowMappings.cpp
+++ b/services/surfaceflinger/Scheduler/SmallAreaDetectionAllowMappings.cpp
@@ -19,26 +19,26 @@
namespace android::scheduler {
void SmallAreaDetectionAllowMappings::update(
- std::vector<std::pair<uid_t, float>>& uidThresholdMappings) {
+ std::vector<std::pair<int32_t, float>>& appIdThresholdMappings) {
std::lock_guard lock(mLock);
mMap.clear();
- for (std::pair<uid_t, float> row : uidThresholdMappings) {
+ for (std::pair<int32_t, float> row : appIdThresholdMappings) {
if (!isValidThreshold(row.second)) continue;
mMap.emplace(row.first, row.second);
}
}
-void SmallAreaDetectionAllowMappings::setThesholdForUid(uid_t uid, float threshold) {
+void SmallAreaDetectionAllowMappings::setThesholdForAppId(int32_t appId, float threshold) {
if (!isValidThreshold(threshold)) return;
std::lock_guard lock(mLock);
- mMap.emplace(uid, threshold);
+ mMap.emplace(appId, threshold);
}
-std::optional<float> SmallAreaDetectionAllowMappings::getThresholdForUid(uid_t uid) {
+std::optional<float> SmallAreaDetectionAllowMappings::getThresholdForAppId(int32_t appId) {
std::lock_guard lock(mLock);
- const auto iter = mMap.find(uid);
+ const auto iter = mMap.find(appId);
if (iter != mMap.end()) {
return iter->second;
}