Merge "Removing unnecessary event dispatching via touch-controller. Instead using a poll method similar to other touch controllers" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
579ddc7aff
+6
-10
@@ -26,6 +26,7 @@ import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
|
||||
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
||||
import static com.android.quickstep.util.VibratorWrapper.OVERVIEW_HAPTIC;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ONE_HANDED_ACTIVE;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
@@ -86,6 +87,11 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
|
||||
@Override
|
||||
protected boolean canInterceptTouch(MotionEvent ev) {
|
||||
mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0;
|
||||
boolean isOneHandedModeActive = (SystemUiProxy.INSTANCE.get(mLauncher)
|
||||
.getLastSystemUiStateFlags() & SYSUI_STATE_ONE_HANDED_ACTIVE) != 0;
|
||||
// Reset touch slop multiplier to default 1.0f if one-handed-mode is not active
|
||||
mDetector.setTouchSlopMultiplier(
|
||||
isOneHandedModeActive ? ONE_HANDED_ACTIVATED_SLOP_MULTIPLIER : 1f /* default */);
|
||||
return super.canInterceptTouch(ev) && !mLauncher.isInState(HINT_STATE);
|
||||
}
|
||||
|
||||
@@ -277,14 +283,4 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
|
||||
private float dpiFromPx(float pixels) {
|
||||
return Utilities.dpiFromPx(pixels, mLauncher.getResources().getDisplayMetrics().densityDpi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOneHandedModeStateChanged(boolean activated) {
|
||||
if (activated) {
|
||||
mDetector.setTouchSlopMultiplier(ONE_HANDED_ACTIVATED_SLOP_MULTIPLIER);
|
||||
} else {
|
||||
// Reset touch slop multiplier to default 1.0f
|
||||
mDetector.setTouchSlopMultiplier(1f /* default */);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,9 +121,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
|
||||
public abstract void onAssistantVisibilityChanged(float visibility);
|
||||
|
||||
/** Called when one handed mode activated or deactivated. */
|
||||
public abstract void onOneHandedModeStateChanged(boolean activated);
|
||||
|
||||
public abstract AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
|
||||
boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback);
|
||||
|
||||
|
||||
@@ -77,11 +77,6 @@ public final class FallbackActivityInterface extends
|
||||
// set to zero prior to this class becoming active.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOneHandedModeStateChanged(boolean activated) {
|
||||
// Do nothing for FallbackActivityInterface
|
||||
}
|
||||
|
||||
/** 6 */
|
||||
@Override
|
||||
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
|
||||
|
||||
@@ -108,15 +108,6 @@ public final class LauncherActivityInterface extends
|
||||
launcher.onAssistantVisibilityChanged(visibility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOneHandedModeStateChanged(boolean activated) {
|
||||
Launcher launcher = getCreatedActivity();
|
||||
if (launcher == null) {
|
||||
return;
|
||||
}
|
||||
launcher.onOneHandedStateChanged(activated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
|
||||
boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
|
||||
|
||||
@@ -115,11 +115,6 @@ public final class OverviewComponentObserver {
|
||||
if (mDeviceState.isHomeDisabled() != mIsHomeDisabled) {
|
||||
updateOverviewTargets();
|
||||
}
|
||||
|
||||
// Notify ALL_APPS touch controller when one handed mode state activated or deactivated
|
||||
if (mDeviceState.isOneHandedModeEnabled()) {
|
||||
mActivityInterface.onOneHandedModeStateChanged(mDeviceState.isOneHandedModeActive());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOverviewTargets(Intent unused) {
|
||||
|
||||
@@ -647,14 +647,6 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
mHotseat.getQsb().setAlpha(1f - visibility);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when one handed mode activated and deactivated.
|
||||
* @param activated true if one handed mode activated, false otherwise.
|
||||
*/
|
||||
public void onOneHandedStateChanged(boolean activated) {
|
||||
mDragLayer.onOneHandedModeStateChanged(activated);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if a new DeviceProfile is initialized, and {@code false} otherwise.
|
||||
*/
|
||||
|
||||
@@ -56,7 +56,6 @@ import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.graphics.Scrim;
|
||||
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
import com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlayCallbacks;
|
||||
|
||||
@@ -474,16 +473,6 @@ public class DragLayer extends BaseDragLayer<Launcher> implements LauncherOverla
|
||||
return mWorkspaceDragScrim;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when one handed mode state changed.
|
||||
* @param activated true if one handed mode activated, false otherwise.
|
||||
*/
|
||||
public void onOneHandedModeStateChanged(boolean activated) {
|
||||
for (TouchController controller : mControllers) {
|
||||
controller.onOneHandedModeStateChanged(activated);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOverlayScrollChanged(float progress) {
|
||||
float alpha = 1 - Interpolators.DEACCEL_3.getInterpolation(progress);
|
||||
|
||||
@@ -32,10 +32,5 @@ public interface TouchController {
|
||||
*/
|
||||
boolean onControllerInterceptTouchEvent(MotionEvent ev);
|
||||
|
||||
/**
|
||||
* Called when one handed mode state changed
|
||||
*/
|
||||
default void onOneHandedModeStateChanged(boolean activated) { }
|
||||
|
||||
default void dump(String prefix, PrintWriter writer) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user