Merge "Migrate recents.splitPrimaryTask to WM Shell library"
This commit is contained in:
committed by
Android (Google) Code Review
commit
e86bb69506
@@ -1319,34 +1319,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
||||
mBackground.getRight(), mBackground.getBottom(), Op.UNION);
|
||||
}
|
||||
|
||||
void onDockedTopTask() {
|
||||
mState.animateAfterRecentsDrawn = true;
|
||||
startDragging(false /* animate */, false /* touching */);
|
||||
updateDockSide();
|
||||
mEntranceAnimationRunning = true;
|
||||
|
||||
resizeStackSurfaces(calculatePositionForInsetBounds(),
|
||||
mSplitLayout.getSnapAlgorithm().getMiddleTarget().position,
|
||||
mSplitLayout.getSnapAlgorithm().getMiddleTarget(),
|
||||
null /* transaction */);
|
||||
}
|
||||
|
||||
void onRecentsDrawn() {
|
||||
updateDockSide();
|
||||
final int position = calculatePositionForInsetBounds();
|
||||
if (mState.animateAfterRecentsDrawn) {
|
||||
mState.animateAfterRecentsDrawn = false;
|
||||
|
||||
mHandler.post(() -> {
|
||||
// Delay switching resizing mode because this might cause jank in recents animation
|
||||
// that's longer than this animation.
|
||||
stopDragging(position, getSnapAlgorithm().getMiddleTarget(),
|
||||
mLongPressEntraceAnimDuration, Interpolators.FAST_OUT_SLOW_IN,
|
||||
200 /* endDelay */);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void onUndockingTask() {
|
||||
int dockSide = mSplitLayout.getPrimarySplitSide();
|
||||
if (inSplitMode()) {
|
||||
|
||||
@@ -48,14 +48,6 @@ public interface SplitScreen {
|
||||
/** Switch to minimized state if appropriate. */
|
||||
void setMinimized(boolean minimized);
|
||||
|
||||
/**
|
||||
* Workaround for b/62528361, at the time recents has drawn, it may happen before a
|
||||
* configuration change to the Divider, and internally, the event will be posted to the
|
||||
* subscriber, or DividerView, which has been removed and prevented from resizing. Instead,
|
||||
* register the event handler here and proxy the event to the current DividerView.
|
||||
*/
|
||||
void onRecentsDrawn();
|
||||
|
||||
/** Called when there's an activity forced resizable. */
|
||||
void onActivityForcedResizable(String packageName, int taskId, int reason);
|
||||
|
||||
@@ -68,9 +60,6 @@ public interface SplitScreen {
|
||||
/** Called when there's a task undocking. */
|
||||
void onUndockingTask();
|
||||
|
||||
/** Called when top task docked. */
|
||||
void onDockedTopTask();
|
||||
|
||||
/** Called when app transition finished. */
|
||||
void onAppTransitionFinished();
|
||||
|
||||
@@ -85,4 +74,13 @@ public interface SplitScreen {
|
||||
|
||||
/** @return the container token for the secondary split root task. */
|
||||
WindowContainerToken getSecondaryRoot();
|
||||
|
||||
/**
|
||||
* Splits the primary task if feasible, this is to preserve legacy way to toggle split screen.
|
||||
* Like triggering split screen through long pressing recents app button or through
|
||||
* {@link android.accessibilityservice.AccessibilityService#GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN}.
|
||||
*
|
||||
* @return {@code true} if it successes to split the primary task.
|
||||
*/
|
||||
boolean splitPrimaryTask();
|
||||
}
|
||||
|
||||
@@ -16,19 +16,25 @@
|
||||
|
||||
package com.android.wm.shell.splitscreen;
|
||||
|
||||
import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
|
||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.util.Slog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
import android.window.TaskOrganizer;
|
||||
import android.window.WindowContainerToken;
|
||||
import android.window.WindowContainerTransaction;
|
||||
@@ -47,6 +53,7 @@ import com.android.wm.shell.common.TransactionPool;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -57,7 +64,7 @@ public class SplitScreenController implements SplitScreen,
|
||||
DisplayController.OnDisplaysChangedListener {
|
||||
static final boolean DEBUG = false;
|
||||
|
||||
private static final String TAG = "Divider";
|
||||
private static final String TAG = "SplitScreenCtrl";
|
||||
private static final int DEFAULT_APP_TRANSITION_DURATION = 336;
|
||||
|
||||
private final Context mContext;
|
||||
@@ -157,12 +164,12 @@ public class SplitScreenController implements SplitScreen,
|
||||
// Don't initialize the divider or anything until we get the default display.
|
||||
}
|
||||
|
||||
/** Returns {@code true} if split screen is supported on the device. */
|
||||
@Override
|
||||
public boolean isSplitScreenSupported() {
|
||||
return mSplits.isSplitScreenSupported();
|
||||
}
|
||||
|
||||
/** Called when keyguard showing state changed. */
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
if (!isSplitActive() || mView == null) {
|
||||
return;
|
||||
@@ -229,21 +236,22 @@ public class SplitScreenController implements SplitScreen,
|
||||
mHandler.post(task);
|
||||
}
|
||||
|
||||
/** Returns {@link DividerView}. */
|
||||
@Override
|
||||
public DividerView getDividerView() {
|
||||
return mView;
|
||||
}
|
||||
|
||||
/** Returns {@code true} if one of the split screen is in minimized mode. */
|
||||
@Override
|
||||
public boolean isMinimized() {
|
||||
return mMinimized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHomeStackResizable() {
|
||||
return mHomeStackResizable;
|
||||
}
|
||||
|
||||
/** Returns {@code true} if the divider is visible. */
|
||||
@Override
|
||||
public boolean isDividerVisible() {
|
||||
return mView != null && mView.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
@@ -328,7 +336,7 @@ public class SplitScreenController implements SplitScreen,
|
||||
}
|
||||
}
|
||||
|
||||
/** Switch to minimized state if appropriate. */
|
||||
@Override
|
||||
public void setMinimized(final boolean minimized) {
|
||||
if (DEBUG) Slog.d(TAG, "posting ext setMinimized " + minimized + " vis:" + mVisible);
|
||||
mHandler.post(() -> {
|
||||
@@ -392,48 +400,29 @@ public class SplitScreenController implements SplitScreen,
|
||||
mWindowManager.setTouchable(!mAdjustedForIme);
|
||||
}
|
||||
|
||||
/**
|
||||
* Workaround for b/62528361, at the time recents has drawn, it may happen before a
|
||||
* configuration change to the Divider, and internally, the event will be posted to the
|
||||
* subscriber, or DividerView, which has been removed and prevented from resizing. Instead,
|
||||
* register the event handler here and proxy the event to the current DividerView.
|
||||
*/
|
||||
public void onRecentsDrawn() {
|
||||
if (mView != null) {
|
||||
mView.onRecentsDrawn();
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when there's an activity forced resizable. */
|
||||
@Override
|
||||
public void onActivityForcedResizable(String packageName, int taskId, int reason) {
|
||||
mForcedResizableController.activityForcedResizable(packageName, taskId, reason);
|
||||
}
|
||||
|
||||
/** Called when there's an activity dismissing split screen. */
|
||||
@Override
|
||||
public void onActivityDismissingSplitScreen() {
|
||||
mForcedResizableController.activityDismissingSplitScreen();
|
||||
}
|
||||
|
||||
/** Called when there's an activity launch on secondary display failed. */
|
||||
@Override
|
||||
public void onActivityLaunchOnSecondaryDisplayFailed() {
|
||||
mForcedResizableController.activityLaunchOnSecondaryDisplayFailed();
|
||||
}
|
||||
|
||||
/** Called when there's a task undocking. */
|
||||
@Override
|
||||
public void onUndockingTask() {
|
||||
if (mView != null) {
|
||||
mView.onUndockingTask();
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when top task docked. */
|
||||
public void onDockedTopTask() {
|
||||
if (mView != null) {
|
||||
mView.onDockedTopTask();
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when app transition finished. */
|
||||
@Override
|
||||
public void onAppTransitionFinished() {
|
||||
if (mView == null) {
|
||||
return;
|
||||
@@ -441,7 +430,7 @@ public class SplitScreenController implements SplitScreen,
|
||||
mForcedResizableController.onAppTransitionFinished();
|
||||
}
|
||||
|
||||
/** Dumps current status of Split Screen. */
|
||||
@Override
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.print(" mVisible="); pw.println(mVisible);
|
||||
pw.print(" mMinimized="); pw.println(mMinimized);
|
||||
@@ -458,7 +447,7 @@ public class SplitScreenController implements SplitScreen,
|
||||
return (long) (transitionDuration * transitionScale);
|
||||
}
|
||||
|
||||
/** Registers listener that gets called whenever the existence of the divider changes. */
|
||||
@Override
|
||||
public void registerInSplitScreenListener(Consumer<Boolean> listener) {
|
||||
listener.accept(isDividerVisible());
|
||||
synchronized (mDockedStackExistsListeners) {
|
||||
@@ -473,6 +462,42 @@ public class SplitScreenController implements SplitScreen,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean splitPrimaryTask() {
|
||||
try {
|
||||
if (ActivityTaskManager.getService().getLockTaskModeState() == LOCK_TASK_MODE_PINNED
|
||||
|| isSplitActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try fetching the top running task.
|
||||
final List<RunningTaskInfo> runningTasks =
|
||||
ActivityTaskManager.getService().getTasks(1 /* maxNum */);
|
||||
if (runningTasks == null || runningTasks.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
// Note: The set of running tasks from the system is ordered by recency.
|
||||
final RunningTaskInfo topRunningTask = runningTasks.get(0);
|
||||
|
||||
final int activityType = topRunningTask.configuration.windowConfiguration
|
||||
.getActivityType();
|
||||
if (activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!topRunningTask.supportsSplitScreenMultiWindow) {
|
||||
Toast.makeText(mContext, R.string.dock_non_resizeble_failed_to_dock_text,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
return ActivityTaskManager.getService().setTaskWindowingModeSplitScreenPrimary(
|
||||
topRunningTask.taskId, true /* onTop */);
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Notifies the bounds of split screen changed. */
|
||||
void notifyBoundsChanged(Rect secondaryWindowBounds, Rect secondaryWindowInsets) {
|
||||
synchronized (mBoundsChangedListeners) {
|
||||
@@ -532,7 +557,7 @@ public class SplitScreenController implements SplitScreen,
|
||||
return mWindowManagerProxy;
|
||||
}
|
||||
|
||||
/** @return the container token for the secondary split root task. */
|
||||
@Override
|
||||
public WindowContainerToken getSecondaryRoot() {
|
||||
if (mSplits == null || mSplits.mSecondary == null) {
|
||||
return null;
|
||||
|
||||
@@ -372,19 +372,6 @@ public class ActivityManagerWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves an already resumed task to the side of the screen to initiate split screen.
|
||||
*/
|
||||
public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode,
|
||||
Rect initialBounds) {
|
||||
try {
|
||||
return ActivityTaskManager.getService().setTaskWindowingModeSplitScreenPrimary(taskId,
|
||||
true /* onTop */);
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a task stack listener with the system.
|
||||
* This should be called on the main thread.
|
||||
|
||||
@@ -16,30 +16,17 @@
|
||||
|
||||
package com.android.systemui.recents;
|
||||
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.trust.TrustManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.shared.recents.IOverviewProxy;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.wm.shell.splitscreen.SplitScreen;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -56,7 +43,6 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
|
||||
private final static String TAG = "OverviewProxyRecentsImpl";
|
||||
@Nullable
|
||||
private final Lazy<StatusBar> mStatusBarLazy;
|
||||
private final Optional<SplitScreen> mSplitScreenOptional;
|
||||
|
||||
private Context mContext;
|
||||
private Handler mHandler;
|
||||
@@ -65,10 +51,8 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
|
||||
|
||||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||
@Inject
|
||||
public OverviewProxyRecentsImpl(Optional<Lazy<StatusBar>> statusBarLazy,
|
||||
Optional<SplitScreen> splitScreenOptional) {
|
||||
public OverviewProxyRecentsImpl(Optional<Lazy<StatusBar>> statusBarLazy) {
|
||||
mStatusBarLazy = statusBarLazy.orElse(null);
|
||||
mSplitScreenOptional = splitScreenOptional;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,42 +124,4 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean splitPrimaryTask(int stackCreateMode, Rect initialBounds,
|
||||
int metricsDockAction) {
|
||||
Point realSize = new Point();
|
||||
if (initialBounds == null) {
|
||||
mContext.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY)
|
||||
.getRealSize(realSize);
|
||||
initialBounds = new Rect(0, 0, realSize.x, realSize.y);
|
||||
}
|
||||
|
||||
ActivityManager.RunningTaskInfo runningTask =
|
||||
ActivityManagerWrapper.getInstance().getRunningTask();
|
||||
final int activityType = runningTask != null
|
||||
? runningTask.configuration.windowConfiguration.getActivityType()
|
||||
: ACTIVITY_TYPE_UNDEFINED;
|
||||
boolean screenPinningActive = ActivityManagerWrapper.getInstance().isScreenPinningActive();
|
||||
boolean isRunningTaskInHomeOrRecentsStack =
|
||||
activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS;
|
||||
if (runningTask != null && !isRunningTaskInHomeOrRecentsStack && !screenPinningActive) {
|
||||
if (runningTask.supportsSplitScreenMultiWindow) {
|
||||
if (ActivityManagerWrapper.getInstance().setTaskWindowingModeSplitScreenPrimary(
|
||||
runningTask.id, stackCreateMode, initialBounds)) {
|
||||
mSplitScreenOptional.ifPresent(splitScreen -> {
|
||||
splitScreen.onDockedTopTask();
|
||||
// The overview service is handling split screen, so just skip the wait
|
||||
// for the first draw and notify the divider to start animating now
|
||||
splitScreen.onRecentsDrawn();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(mContext, R.string.dock_non_resizeble_failed_to_dock_text,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.systemui.recents;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.systemui.SystemUI;
|
||||
@@ -120,17 +119,6 @@ public class Recents extends SystemUI implements CommandQueue.Callbacks {
|
||||
mImpl.cancelPreloadRecentApps();
|
||||
}
|
||||
|
||||
public boolean splitPrimaryTask(int stackCreateMode, Rect initialBounds,
|
||||
int metricsDockAction) {
|
||||
// Ensure the device has been provisioned before allowing the user to interact with
|
||||
// recents
|
||||
if (!isUserSetup()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mImpl.splitPrimaryTask(stackCreateMode, initialBounds, metricsDockAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether this device is provisioned and the current user is set up.
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.android.systemui.recents;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
@@ -35,10 +34,6 @@ public interface RecentsImplementation {
|
||||
default void showRecentApps(boolean triggeredFromAltTab) {}
|
||||
default void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {}
|
||||
default void toggleRecentApps() {}
|
||||
default boolean splitPrimaryTask(int stackCreateMode, Rect initialBounds,
|
||||
int metricsDockAction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
default void dump(PrintWriter pw) {}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package com.android.systemui.shortcut;
|
||||
|
||||
import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT;
|
||||
import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.RemoteException;
|
||||
@@ -29,7 +26,6 @@ import android.view.WindowManagerGlobal;
|
||||
import com.android.internal.policy.DividerSnapAlgorithm;
|
||||
import com.android.systemui.SystemUI;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.wm.shell.splitscreen.DividerView;
|
||||
import com.android.wm.shell.splitscreen.SplitScreen;
|
||||
|
||||
@@ -46,7 +42,6 @@ public class ShortcutKeyDispatcher extends SystemUI
|
||||
|
||||
private static final String TAG = "ShortcutKeyDispatcher";
|
||||
private final Optional<SplitScreen> mSplitScreenOptional;
|
||||
private final Recents mRecents;
|
||||
|
||||
private ShortcutKeyServiceProxy mShortcutKeyServiceProxy = new ShortcutKeyServiceProxy(this);
|
||||
private IWindowManager mWindowManagerService = WindowManagerGlobal.getWindowManagerService();
|
||||
@@ -60,11 +55,9 @@ public class ShortcutKeyDispatcher extends SystemUI
|
||||
protected final long SC_DOCK_RIGHT = META_MASK | KeyEvent.KEYCODE_RIGHT_BRACKET;
|
||||
|
||||
@Inject
|
||||
public ShortcutKeyDispatcher(Context context,
|
||||
Optional<SplitScreen> splitScreenOptional, Recents recents) {
|
||||
public ShortcutKeyDispatcher(Context context, Optional<SplitScreen> splitScreenOptional) {
|
||||
super(context);
|
||||
mSplitScreenOptional = splitScreenOptional;
|
||||
mRecents = recents;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,8 +89,7 @@ public class ShortcutKeyDispatcher extends SystemUI
|
||||
}
|
||||
|
||||
private void handleDockKey(long shortcutCode) {
|
||||
if (mSplitScreenOptional.isPresent()) {
|
||||
SplitScreen splitScreen = mSplitScreenOptional.get();
|
||||
mSplitScreenOptional.ifPresent(splitScreen -> {
|
||||
if (splitScreen.isDividerVisible()) {
|
||||
// If there is already a docked window, we respond by resizing the docking pane.
|
||||
DividerView dividerView = splitScreen.getDividerView();
|
||||
@@ -112,12 +104,9 @@ public class ShortcutKeyDispatcher extends SystemUI
|
||||
dividerView.stopDragging(target.position, 0f, false /* avoidDismissStart */,
|
||||
true /* logMetrics */);
|
||||
return;
|
||||
} else {
|
||||
splitScreen.splitPrimaryTask();
|
||||
}
|
||||
}
|
||||
|
||||
// Split the screen
|
||||
mRecents.splitPrimaryTask((shortcutCode == SC_DOCK_LEFT)
|
||||
? SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT
|
||||
: SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT, null, -1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT;
|
||||
import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
|
||||
import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
|
||||
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
|
||||
import static android.app.StatusBarManager.WindowType;
|
||||
@@ -37,7 +35,6 @@ import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASL
|
||||
import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE;
|
||||
import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_WAKING;
|
||||
import static com.android.systemui.shared.system.WindowManagerWrapper.NAV_BAR_POS_INVALID;
|
||||
import static com.android.systemui.shared.system.WindowManagerWrapper.NAV_BAR_POS_LEFT;
|
||||
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.PERMISSION_SELF;
|
||||
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT;
|
||||
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT_TRANSPARENT;
|
||||
@@ -174,7 +171,6 @@ import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.Snoo
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.qs.QSFragment;
|
||||
import com.android.systemui.qs.QSPanel;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.ScreenPinningRequest;
|
||||
import com.android.systemui.shared.plugins.PluginManager;
|
||||
import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
@@ -718,7 +714,6 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
DozeScrimController dozeScrimController,
|
||||
VolumeComponent volumeComponent,
|
||||
CommandQueue commandQueue,
|
||||
Optional<Recents> recentsOptional,
|
||||
Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
|
||||
PluginManager pluginManager,
|
||||
Optional<SplitScreen> splitScreenOptional,
|
||||
@@ -799,7 +794,6 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
mNotificationShadeDepthControllerLazy = notificationShadeDepthControllerLazy;
|
||||
mVolumeComponent = volumeComponent;
|
||||
mCommandQueue = commandQueue;
|
||||
mRecentsOptional = recentsOptional;
|
||||
mStatusBarComponentBuilder = statusBarComponentBuilder;
|
||||
mPluginManager = pluginManager;
|
||||
mSplitScreenOptional = splitScreenOptional;
|
||||
@@ -1548,35 +1542,37 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
|
||||
public boolean toggleSplitScreenMode(int metricsDockAction, int metricsUndockAction) {
|
||||
if (!mRecentsOptional.isPresent()) {
|
||||
if (!mSplitScreenOptional.isPresent()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mSplitScreenOptional.isPresent()) {
|
||||
SplitScreen splitScreen = mSplitScreenOptional.get();
|
||||
if (splitScreen.isDividerVisible()) {
|
||||
if (splitScreen.isMinimized()
|
||||
&& !splitScreen.isHomeStackResizable()) {
|
||||
// Undocking from the minimized state is not supported
|
||||
return false;
|
||||
} else {
|
||||
splitScreen.onUndockingTask();
|
||||
if (metricsUndockAction != -1) {
|
||||
mMetricsLogger.action(metricsUndockAction);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
final SplitScreen splitScreen = mSplitScreenOptional.get();
|
||||
if (splitScreen.isDividerVisible()) {
|
||||
if (splitScreen.isMinimized() && !splitScreen.isHomeStackResizable()) {
|
||||
// Undocking from the minimized state is not supported
|
||||
return false;
|
||||
}
|
||||
|
||||
splitScreen.onUndockingTask();
|
||||
if (metricsUndockAction != -1) {
|
||||
mMetricsLogger.action(metricsUndockAction);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
final int navbarPos = WindowManagerWrapper.getInstance().getNavBarPosition(mDisplayId);
|
||||
if (navbarPos == NAV_BAR_POS_INVALID) {
|
||||
return false;
|
||||
}
|
||||
int createMode = navbarPos == NAV_BAR_POS_LEFT
|
||||
? SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT
|
||||
: SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
|
||||
return mRecentsOptional.get().splitPrimaryTask(createMode, null, metricsDockAction);
|
||||
|
||||
if (splitScreen.splitPrimaryTask()) {
|
||||
if (metricsDockAction != -1) {
|
||||
mMetricsLogger.action(metricsDockAction);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4121,8 +4117,6 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
protected Display mDisplay;
|
||||
private int mDisplayId;
|
||||
|
||||
private final Optional<Recents> mRecentsOptional;
|
||||
|
||||
protected NotificationShelfController mNotificationShelfController;
|
||||
|
||||
private final Lazy<AssistManager> mAssistManagerLazy;
|
||||
|
||||
@@ -43,7 +43,6 @@ import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||
import com.android.systemui.navigationbar.NavigationBarController;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
import com.android.systemui.plugins.PluginDependencyProvider;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.ScreenPinningRequest;
|
||||
import com.android.systemui.shared.plugins.PluginManager;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
@@ -175,7 +174,6 @@ public interface StatusBarPhoneModule {
|
||||
DozeScrimController dozeScrimController,
|
||||
VolumeComponent volumeComponent,
|
||||
CommandQueue commandQueue,
|
||||
Optional<Recents> recentsOptional,
|
||||
Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
|
||||
PluginManager pluginManager,
|
||||
Optional<SplitScreen> splitScreenOptional,
|
||||
@@ -254,7 +252,6 @@ public interface StatusBarPhoneModule {
|
||||
dozeScrimController,
|
||||
volumeComponent,
|
||||
commandQueue,
|
||||
recentsOptional,
|
||||
statusBarComponentBuilder,
|
||||
pluginManager,
|
||||
splitScreenOptional,
|
||||
|
||||
@@ -93,7 +93,6 @@ import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher;
|
||||
import com.android.systemui.plugins.PluginDependencyProvider;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.ScreenPinningRequest;
|
||||
import com.android.systemui.shared.plugins.PluginManager;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
@@ -232,7 +231,6 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
@Mock private KeyguardLiftController mKeyguardLiftController;
|
||||
@Mock private VolumeComponent mVolumeComponent;
|
||||
@Mock private CommandQueue mCommandQueue;
|
||||
@Mock private Recents mRecents;
|
||||
@Mock private Provider<StatusBarComponent.Builder> mStatusBarComponentBuilderProvider;
|
||||
@Mock private StatusBarComponent.Builder mStatusBarComponentBuilder;
|
||||
@Mock private StatusBarComponent mStatusBarComponent;
|
||||
@@ -392,7 +390,6 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
mDozeScrimController,
|
||||
mVolumeComponent,
|
||||
mCommandQueue,
|
||||
Optional.of(mRecents),
|
||||
mStatusBarComponentBuilderProvider,
|
||||
mPluginManager,
|
||||
Optional.of(mSplitScreen),
|
||||
|
||||
Reference in New Issue
Block a user