Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dfc8b668 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Preventing unnecessary setLayout calls in workspace

Separating getSystemProperty in a separate method

Change-Id: I88716e796e29ac27ef25afa41077a8f29eb65f25
parent 0a6dde72
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -624,10 +624,10 @@ public class Workspace extends PagedView
            ViewGroup.LayoutParams lp = qsbContainer.getLayoutParams();
            if (cellHeight > 0 && lp.height != cellHeight) {
                lp.height = cellHeight;
            }
                qsbContainer.setLayoutParams(lp);
            }
        }
    }

    public void removeAllWorkspaceScreens() {
        // Disable all layout transitions before removing all pages to ensure that we don't get the