Merge "Add static lock in PowerProfile" into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-08-30 23:35:07 +00:00
committed by Android (Google) Code Review

View File

@@ -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) {