diff --git a/core/java/com/android/internal/os/PowerProfile.java b/core/java/com/android/internal/os/PowerProfile.java index 51cf2eae851f9..872b465a9ca58 100644 --- a/core/java/com/android/internal/os/PowerProfile.java +++ b/core/java/com/android/internal/os/PowerProfile.java @@ -205,13 +205,17 @@ public class PowerProfile { private static final String TAG_ARRAYITEM = "value"; private static final String ATTR_NAME = "name"; + private static final Object sLock = new Object(); + public PowerProfile(Context context) { // Read the XML file for the given profile (normally only one per // device) - if (sPowerMap.size() == 0) { - readPowerValuesFromXml(context); + synchronized (sLock) { + if (sPowerMap.size() == 0) { + readPowerValuesFromXml(context); + } + initCpuClusters(); } - initCpuClusters(); } private void readPowerValuesFromXml(Context context) {