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

Commit 2998e432 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Listen for cases where touch controllers change, and update them" into ub-launcher3-master

parents a64b41ea a006830f
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -16,12 +16,11 @@


package com.android.launcher3.uioverrides;
package com.android.launcher3.uioverrides;


import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.ALL_APPS;


import android.content.Context;
import android.content.Context;
import android.content.SharedPreferences;


import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile;
@@ -59,6 +58,10 @@ public class UiFactory {
        }
        }
    }
    }


    public static void setOnTouchControllersChangedListener(Context context, Runnable listener) {
        OverviewInteractionState.getInstance(context).setOnSwipeUpSettingChangedListener(listener);
    }

    public static StateHandler[] getStateHandler(Launcher launcher) {
    public static StateHandler[] getStateHandler(Launcher launcher) {
        return new StateHandler[] {
        return new StateHandler[] {
                launcher.getAllAppsController(), launcher.getWorkspace(),
                launcher.getAllAppsController(), launcher.getWorkspace(),
+9 −1
Original line number Original line Diff line number Diff line
@@ -15,7 +15,6 @@
 */
 */
package com.android.quickstep;
package com.android.quickstep;


import static com.android.launcher3.Utilities.getPrefs;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_QUICK_SCRUB;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_QUICK_SCRUB;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON;
@@ -86,6 +85,8 @@ public class OverviewInteractionState {
    private boolean mBackButtonVisible = true;
    private boolean mBackButtonVisible = true;
    private boolean mSwipeUpEnabled = true;
    private boolean mSwipeUpEnabled = true;


    private Runnable mOnSwipeUpSettingChangedListener;

    private OverviewInteractionState(Context context) {
    private OverviewInteractionState(Context context) {
        mUiHandler = new Handler(this::handleUiMessage);
        mUiHandler = new Handler(this::handleUiMessage);
        mBgHandler = new Handler(UiThreadHelper.getBackgroundLooper(), this::handleBgMessage);
        mBgHandler = new Handler(UiThreadHelper.getBackgroundLooper(), this::handleBgMessage);
@@ -124,12 +125,19 @@ public class OverviewInteractionState {
                break;
                break;
            case MSG_SET_SWIPE_UP_ENABLED:
            case MSG_SET_SWIPE_UP_ENABLED:
                mSwipeUpEnabled = msg.arg1 != 0;
                mSwipeUpEnabled = msg.arg1 != 0;
                if (mOnSwipeUpSettingChangedListener != null) {
                    mOnSwipeUpSettingChangedListener.run();
                }
                break;
                break;
        }
        }
        applyFlags();
        applyFlags();
        return true;
        return true;
    }
    }


    public void setOnSwipeUpSettingChangedListener(Runnable listener) {
        mOnSwipeUpSettingChangedListener = listener;
    }

    @WorkerThread
    @WorkerThread
    private void applyFlags() {
    private void applyFlags() {
        if (mISystemUiProxy == null) {
        if (mISystemUiProxy == null) {
+5 −3
Original line number Original line Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.launcher3;


import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;

import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.NORMAL;
@@ -81,7 +80,6 @@ import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.dynamicui.WallpaperColorInfo;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.folder.FolderIconPreviewVerifier;
import com.android.launcher3.folder.FolderIconPreviewVerifier;
import com.android.launcher3.keyboard.CustomActionsPopup;
import com.android.launcher3.keyboard.CustomActionsPopup;
@@ -923,7 +921,9 @@ public class Launcher extends BaseDraggingActivity
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);


        // Setup the drag layer
        // Setup the drag layer
        mDragLayer.setup(mDragController);
        Runnable setupDragLayer = () -> mDragLayer.setup(mDragController);
        UiFactory.setOnTouchControllersChangedListener(this, setupDragLayer);
        setupDragLayer.run();


        mWorkspace.setup(mDragController);
        mWorkspace.setup(mDragController);
        // Until the workspace is bound, ensure that we keep the wallpaper offset locked to the
        // Until the workspace is bound, ensure that we keep the wallpaper offset locked to the
@@ -1327,6 +1327,8 @@ public class Launcher extends BaseDraggingActivity
        unregisterReceiver(mReceiver);
        unregisterReceiver(mReceiver);
        mWorkspace.removeFolderListeners();
        mWorkspace.removeFolderListeners();


        UiFactory.setOnTouchControllersChangedListener(this, null);

        // Stop callbacks from LauncherModel
        // Stop callbacks from LauncherModel
        // It's possible to receive onDestroy after a new Launcher activity has
        // It's possible to receive onDestroy after a new Launcher activity has
        // been created. In this case, don't interfere with the new Launcher.
        // been created. In this case, don't interfere with the new Launcher.
+4 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


package com.android.launcher3.uioverrides;
package com.android.launcher3.uioverrides;


import android.content.Context;

import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.util.TouchController;
@@ -27,6 +29,8 @@ public class UiFactory {
                launcher.getDragController(), new AllAppsSwipeController(launcher)};
                launcher.getDragController(), new AllAppsSwipeController(launcher)};
    }
    }


    public static void setOnTouchControllersChangedListener(Context context, Runnable listener) { }

    public static StateHandler[] getStateHandler(Launcher launcher) {
    public static StateHandler[] getStateHandler(Launcher launcher) {
        return new StateHandler[] {
        return new StateHandler[] {
                launcher.getAllAppsController(), launcher.getWorkspace() };
                launcher.getAllAppsController(), launcher.getWorkspace() };