From 4e87969a1c43d5e83db63771acdad95b42272656 Mon Sep 17 00:00:00 2001 From: Linus Tufvesson Date: Tue, 19 Nov 2019 12:59:38 +0000 Subject: [PATCH] Only apply flag when it has been changed The properies object provided in onPropertiesChanged only contains flag(s) that have been added/deleted/updated, changing an unrelated flag in the same namespace will trigger onPropertiesChanged to be executed and the properties object won't have your flag, even though it mighet be set in deviceconfig. Test: It builds Bug: 144693310 Change-Id: Iae1692456266efb860f875f3df33fee5831f60cd --- .../com/android/server/am/ActivityManagerService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index f1cee0348832c..16096069631ef 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -957,10 +957,12 @@ public class ActivityManagerService extends IActivityManager.Stub new DeviceConfig.OnPropertiesChangedListener() { @Override public void onPropertiesChanged(Properties properties) { - mPssDeferralTime = properties.getLong(ACTIVITY_START_PSS_DEFER_CONFIG, 0); - if (DEBUG_PSS) { - Slog.d(TAG_PSS, "Activity-start PSS delay now " - + mPssDeferralTime + " ms"); + if (properties.getKeyset().contains(ACTIVITY_START_PSS_DEFER_CONFIG)) { + mPssDeferralTime = properties.getLong(ACTIVITY_START_PSS_DEFER_CONFIG, 0); + if (DEBUG_PSS) { + Slog.d(TAG_PSS, "Activity-start PSS delay now " + + mPssDeferralTime + " ms"); + } } } };