Merge "Set overview orientation for all nav modes" into ub-launcher3-rvc-dev

This commit is contained in:
Vinit Nayak 2020-06-07 01:56:19 +00:00 committed by Android (Google) Code Review
commit f6858198b9
10 changed files with 28 additions and 14 deletions

View File

@ -53,14 +53,17 @@ final class AppToOverviewAnimationProvider<T extends StatefulActivity<?>> extend
private final BaseActivityInterface<?, T> mActivityInterface;
// The id of the currently running task that is transitioning to overview.
private final int mTargetTaskId;
private final RecentsAnimationDeviceState mDeviceState;
private T mActivity;
private RecentsView mRecentsView;
AppToOverviewAnimationProvider(
BaseActivityInterface<?, T> activityInterface, int targetTaskId) {
BaseActivityInterface<?, T> activityInterface, int targetTaskId,
RecentsAnimationDeviceState deviceState) {
mActivityInterface = activityInterface;
mTargetTaskId = targetTaskId;
mDeviceState = deviceState;
}
/**
@ -73,6 +76,7 @@ final class AppToOverviewAnimationProvider<T extends StatefulActivity<?>> extend
activity.<RecentsView>getOverviewPanel().showCurrentTask(mTargetTaskId);
AbstractFloatingView.closeAllOpenViews(activity, wasVisible);
BaseActivityInterface.AnimationFactory factory = mActivityInterface.prepareRecentsUI(
mDeviceState,
wasVisible, (controller) -> {
controller.dispatchOnStart();
controller.getAnimationPlayer().end();

View File

@ -300,9 +300,6 @@ public abstract class BaseSwipeUpHandler<T extends StatefulActivity<?>, Q extend
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.PAUSE_NOT_DETECTED, "BaseSwipeUpHandler.2");
}
((RecentsView) createdActivity.getOverviewPanel())
.setLayoutRotation(mDeviceState.getCurrentActiveRotation(),
mDeviceState.getDisplayRotation());
initTransitionEndpoints(InvariantDeviceProfile.INSTANCE.get(mContext)
.getDeviceProfile(mContext));
}

View File

@ -331,7 +331,7 @@ public abstract class BaseSwipeUpHandlerV2<T extends StatefulActivity<?>, Q exte
// as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
if (mGestureState.getEndTarget() != HOME) {
Runnable initAnimFactory = () -> {
mAnimationFactory = mActivityInterface.prepareRecentsUI(
mAnimationFactory = mActivityInterface.prepareRecentsUI(mDeviceState,
mWasLauncherAlreadyVisible, this::onAnimatorPlaybackControllerCreated);
maybeUpdateRecentsAttachedState(false /* animate */);
};

View File

@ -83,7 +83,7 @@ public final class FallbackActivityInterface extends
/** 6 */
@Override
public AnimationFactory prepareRecentsUI(
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
boolean activityVisible, Consumer<AnimatorPlaybackController> callback) {
DefaultAnimationFactory factory = new DefaultAnimationFactory(callback);
factory.initUI();

View File

@ -32,6 +32,7 @@ import android.view.animation.Interpolator;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
@ -118,8 +119,11 @@ public final class LauncherActivityInterface extends
}
@Override
public AnimationFactory prepareRecentsUI(
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
boolean activityVisible, Consumer<AnimatorPlaybackController> callback) {
((RecentsView) getCreatedActivity().getOverviewPanel())
.setLayoutRotation(deviceState.getCurrentActiveRotation(),
deviceState.getDisplayRotation());
DefaultAnimationFactory factory = new DefaultAnimationFactory(callback) {
@Override
public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator,

View File

@ -165,7 +165,7 @@ public class OverviewCommandHelper {
mActivityInterface = mOverviewComponentObserver.getActivityInterface();
mCreateTime = SystemClock.elapsedRealtime();
mAnimationProvider = new AppToOverviewAnimationProvider<>(mActivityInterface,
RecentsModel.getRunningTaskId());
RecentsModel.getRunningTaskId(), mDeviceState);
// Preload the plan
mRecentsModel.getTasks(null);

View File

@ -33,6 +33,7 @@ import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.Surface;
import android.widget.FrameLayout;
import com.android.launcher3.BaseQuickstepLauncher;
@ -225,6 +226,7 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher>
public void reset() {
super.reset();
setLayoutRotation(Surface.ROTATION_0, Surface.ROTATION_0);
// We are moving to home or some other UI with no recents. Switch back to the home client,
// the home predictions should have been updated when the activity was resumed.
PredictionUiStateManager.INSTANCE.get(getContext()).switchClient(Client.HOME);

View File

@ -105,7 +105,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
public abstract void onAssistantVisibilityChanged(float visibility);
public abstract AnimationFactory prepareRecentsUI(
public abstract AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
boolean activityVisible, Consumer<AnimatorPlaybackController> callback);
public abstract ActivityInitListener createActivityInitListener(

View File

@ -237,10 +237,8 @@ public class RecentsAnimationDeviceState implements
@Override
public void onNavigationModeChanged(SysUINavigationMode.Mode newMode) {
mDefaultDisplay.removeChangeListener(this);
if (newMode.hasGestures) {
mDefaultDisplay.addChangeListener(this);
onDisplayInfoChanged(mDefaultDisplay.getInfo(), CHANGE_ALL);
}
mDefaultDisplay.addChangeListener(this);
onDisplayInfoChanged(mDefaultDisplay.getInfo(), CHANGE_ALL);
if (newMode == NO_BUTTON) {
mExclusionListener.register();
@ -268,6 +266,10 @@ public class RecentsAnimationDeviceState implements
}
mDisplayRotation = info.rotation;
if (!mMode.hasGestures) {
return;
}
mNavBarPosition = new NavBarPosition(mMode, info);
updateGestureTouchRegions();
mOrientationTouchTransformer.createOrAddTouchRegion(info);
@ -606,7 +608,11 @@ public class RecentsAnimationDeviceState implements
}
}
public int getCurrentActiveRotation() {
int getCurrentActiveRotation() {
if (!mMode.hasGestures) {
// touch rotation should always match that of display for 3 button
return mDisplayRotation;
}
return mOrientationTouchTransformer.getCurrentActiveRotation();
}

View File

@ -207,6 +207,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
mLauncherRotation = launcherRotation;
mDisplayRotation = displayRotation;
mTouchRotation = touchRotation;
mPreviousRotation = touchRotation;
if (mLauncherRotation == mTouchRotation || canLauncherRotate()) {
mOrientationHandler = PagedOrientationHandler.HOME_ROTATED;