Preventing unnecessary setLayout calls in workspace
Separating getSystemProperty in a separate method

Change-Id: I88716e796e29ac27ef25afa41077a8f29eb65f25
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 2988fb9..9079837 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -776,16 +776,21 @@
     }
 
     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;
     }
 
     /**
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 4c2d4bb..88eeac6 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -624,8 +624,8 @@
             ViewGroup.LayoutParams lp = qsbContainer.getLayoutParams();
             if (cellHeight > 0 && lp.height != cellHeight) {
                 lp.height = cellHeight;
+                qsbContainer.setLayoutParams(lp);
             }
-            qsbContainer.setLayoutParams(lp);
         }
     }