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

Commit fbd42f6e authored by Omar Elmekkawy's avatar Omar Elmekkawy
Browse files

Migrate uiMode, theme and dpi change updates to ShellController for tiling.

Tiling depends on taskInfo updates to listen to theme and uiMode updates,
this is specially inaccurate if the app overrides the system config.

This CL migrates the uiMode and theme updates listening from
onTaskInfoChange API to shellController.onConfigurationChange API.

also tiling now re-draws when the density dpi changes mid-tiling session
to respect the new resolution.

Flag: com.android.window.flags.enable_tile_resizing
Test: Unit tests and on device testing
Bug: 424780063
Change-Id: Ibcd75c8613bc5acdbb32605d2ea44fad72ed99d5
parent 15503c93
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -990,7 +990,8 @@ public abstract class WMShellModule {
            FocusTransitionObserver focusTransitionObserver,
            @ShellMainThread ShellExecutor mainExecutor,
            DesktopState desktopState,
            ShellInit shellInit) {
            ShellInit shellInit,
            ShellController shellController) {
        return new DesktopTilingDecorViewModel(
                context,
                mainDispatcher,
@@ -1008,7 +1009,8 @@ public abstract class WMShellModule {
                focusTransitionObserver,
                mainExecutor,
                desktopState,
                shellInit
                shellInit,
                shellController
        );
    }

+4 −1
Original line number Diff line number Diff line
@@ -298,7 +298,6 @@ public class ShellController {
            ProtoLog.v(WM_SHELL_SYSUI_EVENTS, "Initial Configuration: %s", newConfig);
            return;
        }

        final int diff = newConfig.diff(mLastConfiguration);
        ProtoLog.v(WM_SHELL_SYSUI_EVENTS, "New configuration change: %s", newConfig);
        ProtoLog.v(WM_SHELL_SYSUI_EVENTS, "\tchanges=%s",
@@ -360,6 +359,10 @@ public class ShellController {
        }
    }

    public Configuration getLastConfiguration() {
        return mLastConfiguration;
    }

    @VisibleForTesting
    void onUserProfilesChanged(@NonNull List<UserInfo> profiles) {
        if (FIX_MISSING_USER_CHANGE_CALLBACKS_FLAG.isTrue() && !updateProfiles(profiles)) {
+0 −1
Original line number Diff line number Diff line
@@ -588,7 +588,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
        } else {
            decoration.relayout(taskInfo, taskInfo.isFocused, decoration.mExclusionRegion);
        }
        mDesktopTilingDecorViewModel.onTaskInfoChange(taskInfo);
        mActivityOrientationChangeHandler.ifPresent(handler ->
                handler.handleActivityOrientationChange(oldTaskInfo, taskInfo));
    }
+3 −5
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE
import com.android.wm.shell.shared.annotations.ShellBackgroundThread
import com.android.wm.shell.shared.annotations.ShellMainThread
import com.android.wm.shell.shared.desktopmode.DesktopState
import com.android.wm.shell.sysui.ShellController
import com.android.wm.shell.sysui.ShellInit
import com.android.wm.shell.transition.FocusTransitionObserver
import com.android.wm.shell.transition.Transitions
@@ -72,6 +73,7 @@ class DesktopTilingDecorViewModel(
    private val mainExecutor: ShellExecutor,
    private val desktopState: DesktopState,
    private val shellInit: ShellInit,
    private val shellController: ShellController,
) : DisplayChangeController.OnDisplayChangingListener {
    @VisibleForTesting
    var tilingHandlerByUserAndDeskId = SparseArray<SparseArray<DesktopTilingWindowDecoration>>()
@@ -120,6 +122,7 @@ class DesktopTilingDecorViewModel(
                            focusTransitionObserver,
                            mainExecutor,
                            desktopState,
                            shellController,
                        )
                        .also { userHandlerList[deskId] = it }
                }
@@ -165,11 +168,6 @@ class DesktopTilingDecorViewModel(
        }
    }

    fun onTaskInfoChange(taskInfo: RunningTaskInfo) {
        val deskId = getCurrentActiveDeskForDisplay(taskInfo.displayId) ?: return
        tilingHandlerByUserAndDeskId[currentUserId]?.get(deskId)?.onTaskInfoChange(taskInfo)
    }

    override fun onDisplayChange(
        displayId: Int,
        fromRotation: Int,
+3 −2
Original line number Diff line number Diff line
@@ -194,8 +194,8 @@ class DesktopTilingDividerWindowManager(
    }

    /** Notifies the divider view of task info change and possible color change. */
    fun onTaskInfoChange() {
        tilingDividerView?.onTaskInfoChange()
    fun onThemeChange() {
        tilingDividerView?.onThemeChanged()
    }

    /** Hides the divider bar. */
@@ -215,6 +215,7 @@ class DesktopTilingDividerWindowManager(
        runningAnimator?.cancel()
        runningAnimator = null
    }

    /** Shows the divider bar. */
    fun showDividerBar(isTilingVisibleAfterRecents: Boolean) {
        if (dividerShown || runningAnimator != null) return
Loading