Preventing unnecessary setLayout calls in workspace

Separating getSystemProperty in a separate method

Change-Id: I88716e796e29ac27ef25afa41077a8f29eb65f25
This commit is contained in:
Sunny Goyal
2016-08-30 12:05:48 -07:00
parent 0a6dde7265
commit dfc8b6685b
2 changed files with 10 additions and 5 deletions
+9 -4
View File
@@ -776,16 +776,21 @@ public final class Utilities {
}
public static boolean isBootCompleted() {
return "1".equals(getSystemProperty("sys.boot_completed", "1"));
}
public static String getSystemProperty(String property, String defaultValue) {
try {
Class clazz = Class.forName("android.os.SystemProperties");
Method getter = clazz.getDeclaredMethod("get", String.class);
String value = (String) getter.invoke(null, "sys.boot_completed");
return "1".equals(value);
String value = (String) getter.invoke(null, property);
if (!TextUtils.isEmpty(value)) {
return value;
}
} catch (Exception e) {
Log.d(TAG, "Unable to read system properties");
// Assume that boot has completed
return true;
}
return defaultValue;
}
/**
+1 -1
View File
@@ -624,8 +624,8 @@ public class Workspace extends PagedView
ViewGroup.LayoutParams lp = qsbContainer.getLayoutParams();
if (cellHeight > 0 && lp.height != cellHeight) {
lp.height = cellHeight;
qsbContainer.setLayoutParams(lp);
}
qsbContainer.setLayoutParams(lp);
}
}