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

Commit cc1e94a9 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Consolidate isTablet logic across Launcher and SysUI" into sc-v2-dev

parents f20bc6a1 c8beebf5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ public class InvariantDeviceProfile {
        }
        new DeviceGridState(this).writeToPrefs(context);

        DisplayController.INSTANCE.get(context).addChangeListener(
        DisplayController.INSTANCE.get(context).setPriorityListener(
                (displayContext, info, flags) -> {
                    if ((flags & (CHANGE_DENSITY | CHANGE_SUPPORTED_BOUNDS)) != 0) {
                        onConfigChanged(displayContext);
+9 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S

    // Null for SDK < S
    private final Context mWindowContext;
    // The callback in this listener updates DeviceProfile, which other listeners might depend on
    private DisplayInfoChangeListener mPriorityListener;
    private final ArrayList<DisplayInfoChangeListener> mListeners = new ArrayList<>();

    private Info mInfo;
@@ -207,6 +209,10 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S
    @Override
    public final void onLowMemory() { }

    public void setPriorityListener(DisplayInfoChangeListener listener) {
        mPriorityListener = listener;
    }

    public void addChangeListener(DisplayInfoChangeListener listener) {
        mListeners.add(listener);
    }
@@ -261,6 +267,9 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S
    }

    private void notifyChange(Context context, int flags) {
        if (mPriorityListener != null) {
            mPriorityListener.onDisplayInfoChanged(context, mInfo, flags);
        }
        for (int i = mListeners.size() - 1; i >= 0; i--) {
            mListeners.get(i).onDisplayInfoChanged(context, mInfo, flags);
        }