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

Commit 67e349f0 authored by Tony Huang's avatar Tony Huang
Browse files

Migrate OneHanded to WM shell (2/n)

Remove OneHandedModule for refactoring and further migration works

Bug: 161980408
Bug: 164962096
Test: atest com.android.systemui.onehanded
Change-Id: I0f30163e099626b7fa0f2fa6142cb617b288b22c
parent d498c4d5
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import com.android.systemui.dagger.SysUIComponent;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.SystemServicesModule;
import com.android.systemui.dagger.SystemUIModule;
import com.android.systemui.onehanded.dagger.OneHandedModule;
import com.android.systemui.pip.phone.dagger.PipModule;

import dagger.Subcomponent;
@@ -36,7 +35,6 @@ import dagger.Subcomponent;
        DependencyProvider.class,
        DependencyBinder.class,
        PipModule.class,
        OneHandedModule.class,
        SystemServicesModule.class,
        SystemUIModule.class,
        CarSystemUIModule.class,
+0 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import com.android.systemui.InitController;
import com.android.systemui.SystemUIAppComponentFactory;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardSliceProvider;
import com.android.systemui.onehanded.dagger.OneHandedModule;
import com.android.systemui.pip.phone.dagger.PipModule;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.util.InjectionInflationController;
@@ -37,7 +36,6 @@ import dagger.Subcomponent;
        DefaultComponentBinder.class,
        DependencyProvider.class,
        DependencyBinder.class,
        OneHandedModule.class,
        PipModule.class,
        SystemServicesModule.class,
        SystemUIBinder.class,
+3 −5
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ import javax.inject.Inject;
 * Manages and manipulates the one handed states, transitions, and gesture for phones.
 */
@SysUISingleton
public class OneHandedManagerImpl implements OneHandedManager, Dumpable {
public class OneHandedController implements Dumpable {
    private static final String TAG = "OneHandedManager";
    private static final String ONE_HANDED_MODE_OFFSET_PERCENTAGE =
            "persist.debug.one_handed_offset_percentage";
@@ -106,7 +106,7 @@ public class OneHandedManagerImpl implements OneHandedManager, Dumpable {
     * Constructor of OneHandedManager
     */
    @Inject
    public OneHandedManagerImpl(Context context,
    public OneHandedController(Context context,
            CommandQueue commandQueue,
            DisplayController displayController,
            NavigationModeController navigationModeController,
@@ -137,7 +137,7 @@ public class OneHandedManagerImpl implements OneHandedManager, Dumpable {
     */
    // TODO(b/161980408): Should remove extra constructor.
    @VisibleForTesting
    OneHandedManagerImpl(Context context,
    OneHandedController(Context context,
            CommandQueue commandQueue,
            DisplayController displayController,
            OneHandedDisplayAreaOrganizer displayAreaOrganizer,
@@ -194,7 +194,6 @@ public class OneHandedManagerImpl implements OneHandedManager, Dumpable {
    /**
     * Enters one handed mode.
     */
    @Override
    public void startOneHanded() {
        if (!mDisplayAreaOrganizer.isInOneHanded()) {
            final int yOffSet = Math.round(getDisplaySize().y * mOffSetFraction);
@@ -206,7 +205,6 @@ public class OneHandedManagerImpl implements OneHandedManager, Dumpable {
    /**
     * Exits one handed mode.
     */
    @Override
    public void stopOneHanded() {
        if (mDisplayAreaOrganizer.isInOneHanded()) {
            mDisplayAreaOrganizer.scheduleOffset(0, 0);
+2 −2
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ public class OneHandedGestureHandler implements OneHandedTransitionCallback,
    }

    /**
     * Notified by {@link OneHandedManager}, when user update settings of Enabled or Disabled
     * Notified by {@link OneHandedController}, when user update settings of Enabled or Disabled
     *
     * @param isEnabled is one handed settings enabled or not
     */
@@ -264,7 +264,7 @@ public class OneHandedGestureHandler implements OneHandedTransitionCallback,
    }

    /**
     * The touch(gesture) events to notify {@link OneHandedManager} start or stop one handed
     * The touch(gesture) events to notify {@link OneHandedController} start or stop one handed
     */
    public interface OneHandedGestureEventCallback {
        /**
+0 −44
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.onehanded;

/**
 * The base class of OneHandedManager
 */
public interface OneHandedManager {

    /**
     * Set one handed enabled or disabled
     */
    default void setOneHandedEnabled(boolean enabled) {}

    /**
     * Set task stack changed to exit
     */
    default void setTaskChangeToExit(boolean enabled) {}

    /**
     * Exit one handed mode
     */
    default void stopOneHanded() {}

    /**
     * Trigger one handed mode
     */
    default void startOneHanded() {}

}
Loading