Merge "Flatten SplitscreenPipMixedHandler into DefaultMixedHandler" into tm-qpr-dev
This commit is contained in:
@@ -82,7 +82,7 @@ import com.android.wm.shell.splitscreen.SplitScreenController;
|
|||||||
import com.android.wm.shell.sysui.ShellCommandHandler;
|
import com.android.wm.shell.sysui.ShellCommandHandler;
|
||||||
import com.android.wm.shell.sysui.ShellController;
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
import com.android.wm.shell.sysui.ShellInit;
|
import com.android.wm.shell.sysui.ShellInit;
|
||||||
import com.android.wm.shell.transition.SplitscreenPipMixedHandler;
|
import com.android.wm.shell.transition.DefaultMixedHandler;
|
||||||
import com.android.wm.shell.transition.Transitions;
|
import com.android.wm.shell.transition.Transitions;
|
||||||
import com.android.wm.shell.unfold.ShellUnfoldProgressProvider;
|
import com.android.wm.shell.unfold.ShellUnfoldProgressProvider;
|
||||||
import com.android.wm.shell.unfold.UnfoldAnimationController;
|
import com.android.wm.shell.unfold.UnfoldAnimationController;
|
||||||
@@ -484,13 +484,13 @@ public abstract class WMShellModule {
|
|||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
@Provides
|
@Provides
|
||||||
static SplitscreenPipMixedHandler provideSplitscreenPipMixedHandler(
|
static DefaultMixedHandler provideDefaultMixedHandler(
|
||||||
ShellInit shellInit,
|
ShellInit shellInit,
|
||||||
Optional<SplitScreenController> splitScreenOptional,
|
Optional<SplitScreenController> splitScreenOptional,
|
||||||
Optional<PipTouchHandler> pipTouchHandlerOptional,
|
Optional<PipTouchHandler> pipTouchHandlerOptional,
|
||||||
Transitions transitions) {
|
Transitions transitions) {
|
||||||
return new SplitscreenPipMixedHandler(shellInit, splitScreenOptional,
|
return new DefaultMixedHandler(shellInit, transitions, splitScreenOptional,
|
||||||
pipTouchHandlerOptional, transitions);
|
pipTouchHandlerOptional);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -619,7 +619,7 @@ public abstract class WMShellModule {
|
|||||||
@ShellCreateTriggerOverride
|
@ShellCreateTriggerOverride
|
||||||
@Provides
|
@Provides
|
||||||
static Object provideIndependentShellComponentsToCreate(
|
static Object provideIndependentShellComponentsToCreate(
|
||||||
SplitscreenPipMixedHandler splitscreenPipMixedHandler,
|
DefaultMixedHandler defaultMixedHandler,
|
||||||
Optional<DesktopModeController> desktopModeController) {
|
Optional<DesktopModeController> desktopModeController) {
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,14 @@ import android.window.WindowContainerTransaction;
|
|||||||
|
|
||||||
import com.android.internal.protolog.common.ProtoLog;
|
import com.android.internal.protolog.common.ProtoLog;
|
||||||
import com.android.wm.shell.pip.PipTransitionController;
|
import com.android.wm.shell.pip.PipTransitionController;
|
||||||
|
import com.android.wm.shell.pip.phone.PipTouchHandler;
|
||||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||||
|
import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||||
import com.android.wm.shell.splitscreen.StageCoordinator;
|
import com.android.wm.shell.splitscreen.StageCoordinator;
|
||||||
|
import com.android.wm.shell.sysui.ShellInit;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A handler for dealing with transitions involving multiple other handlers. For example: an
|
* A handler for dealing with transitions involving multiple other handlers. For example: an
|
||||||
@@ -47,8 +51,8 @@ import java.util.ArrayList;
|
|||||||
public class DefaultMixedHandler implements Transitions.TransitionHandler {
|
public class DefaultMixedHandler implements Transitions.TransitionHandler {
|
||||||
|
|
||||||
private final Transitions mPlayer;
|
private final Transitions mPlayer;
|
||||||
private final PipTransitionController mPipHandler;
|
private PipTransitionController mPipHandler;
|
||||||
private final StageCoordinator mSplitHandler;
|
private StageCoordinator mSplitHandler;
|
||||||
|
|
||||||
private static class MixedTransition {
|
private static class MixedTransition {
|
||||||
static final int TYPE_ENTER_PIP_FROM_SPLIT = 1;
|
static final int TYPE_ENTER_PIP_FROM_SPLIT = 1;
|
||||||
@@ -77,13 +81,22 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
|
|||||||
mTransition = transition;
|
mTransition = transition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ArrayList<MixedTransition> mActiveTransitions = new ArrayList<>();
|
private final ArrayList<MixedTransition> mActiveTransitions = new ArrayList<>();
|
||||||
|
|
||||||
public DefaultMixedHandler(@NonNull Transitions player,
|
public DefaultMixedHandler(@NonNull ShellInit shellInit, @NonNull Transitions player,
|
||||||
@NonNull PipTransitionController pipHandler, @NonNull StageCoordinator splitHandler) {
|
Optional<SplitScreenController> splitScreenControllerOptional,
|
||||||
|
Optional<PipTouchHandler> pipTouchHandlerOptional) {
|
||||||
mPlayer = player;
|
mPlayer = player;
|
||||||
mPipHandler = pipHandler;
|
if (Transitions.ENABLE_SHELL_TRANSITIONS && pipTouchHandlerOptional.isPresent()
|
||||||
mSplitHandler = splitHandler;
|
&& splitScreenControllerOptional.isPresent()) {
|
||||||
|
// Add after dependencies because it is higher priority
|
||||||
|
shellInit.addInitCallback(() -> {
|
||||||
|
mPipHandler = pipTouchHandlerOptional.get().getTransitionHandler();
|
||||||
|
mSplitHandler = splitScreenControllerOptional.get().getTransitionHandler();
|
||||||
|
mPlayer.addHandler(this);
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2022 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.wm.shell.transition;
|
|
||||||
|
|
||||||
import com.android.wm.shell.pip.phone.PipTouchHandler;
|
|
||||||
import com.android.wm.shell.splitscreen.SplitScreenController;
|
|
||||||
import com.android.wm.shell.sysui.ShellInit;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles transitions between the Splitscreen and PIP components.
|
|
||||||
*/
|
|
||||||
public class SplitscreenPipMixedHandler {
|
|
||||||
|
|
||||||
private final Optional<SplitScreenController> mSplitScreenOptional;
|
|
||||||
private final Optional<PipTouchHandler> mPipTouchHandlerOptional;
|
|
||||||
private final Transitions mTransitions;
|
|
||||||
|
|
||||||
public SplitscreenPipMixedHandler(ShellInit shellInit,
|
|
||||||
Optional<SplitScreenController> splitScreenControllerOptional,
|
|
||||||
Optional<PipTouchHandler> pipTouchHandlerOptional,
|
|
||||||
Transitions transitions) {
|
|
||||||
mSplitScreenOptional = splitScreenControllerOptional;
|
|
||||||
mPipTouchHandlerOptional = pipTouchHandlerOptional;
|
|
||||||
mTransitions = transitions;
|
|
||||||
if (Transitions.ENABLE_SHELL_TRANSITIONS
|
|
||||||
&& mSplitScreenOptional.isPresent() && mPipTouchHandlerOptional.isPresent()) {
|
|
||||||
shellInit.addInitCallback(this::onInit, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onInit() {
|
|
||||||
// Special handling for initializing based on multiple components
|
|
||||||
final DefaultMixedHandler mixedHandler = new DefaultMixedHandler(mTransitions,
|
|
||||||
mPipTouchHandlerOptional.get().getTransitionHandler(),
|
|
||||||
mSplitScreenOptional.get().getTransitionHandler());
|
|
||||||
// Added at end so that it has highest priority.
|
|
||||||
mTransitions.addHandler(mixedHandler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user