Merge changes Ie8c5a77b,I96125e9f into tm-qpr-dev
* changes: Remove unused interfaces and controllers Add keyguard callbacks to ShellInterface
This commit is contained in:
@@ -28,6 +28,13 @@ import com.android.wm.shell.common.annotations.ExternalThread;
|
|||||||
@ExternalThread
|
@ExternalThread
|
||||||
public interface BackAnimation {
|
public interface BackAnimation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a binder that can be passed to an external process to update back animations.
|
||||||
|
*/
|
||||||
|
default IBackAnimation createExternalInterface() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a {@link MotionEvent} is generated by a back gesture.
|
* Called when a {@link MotionEvent} is generated by a back gesture.
|
||||||
*
|
*
|
||||||
@@ -46,13 +53,6 @@ public interface BackAnimation {
|
|||||||
*/
|
*/
|
||||||
void setTriggerBack(boolean triggerBack);
|
void setTriggerBack(boolean triggerBack);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a binder that can be passed to an external process to update back animations.
|
|
||||||
*/
|
|
||||||
default IBackAnimation createExternalInterface() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the threshold values that defining edge swipe behavior.
|
* Sets the threshold values that defining edge swipe behavior.
|
||||||
* @param triggerThreshold the min threshold to trigger back.
|
* @param triggerThreshold the min threshold to trigger back.
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021 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.compatui;
|
|
||||||
|
|
||||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface to engage compat UI.
|
|
||||||
*/
|
|
||||||
@ExternalThread
|
|
||||||
public interface CompatUI {
|
|
||||||
/**
|
|
||||||
* Called when the keyguard showing state changes. Removes all compat UIs if the
|
|
||||||
* keyguard is now showing.
|
|
||||||
*
|
|
||||||
* <p>Note that if the keyguard is occluded it will also be considered showing.
|
|
||||||
*
|
|
||||||
* @param showing indicates if the keyguard is now showing.
|
|
||||||
*/
|
|
||||||
void onKeyguardShowingChanged(boolean showing);
|
|
||||||
}
|
|
||||||
@@ -39,9 +39,10 @@ import com.android.wm.shell.common.DisplayInsetsController.OnInsetsChangedListen
|
|||||||
import com.android.wm.shell.common.DisplayLayout;
|
import com.android.wm.shell.common.DisplayLayout;
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
|
||||||
import com.android.wm.shell.compatui.CompatUIWindowManager.CompatUIHintsState;
|
import com.android.wm.shell.compatui.CompatUIWindowManager.CompatUIHintsState;
|
||||||
import com.android.wm.shell.compatui.letterboxedu.LetterboxEduWindowManager;
|
import com.android.wm.shell.compatui.letterboxedu.LetterboxEduWindowManager;
|
||||||
|
import com.android.wm.shell.sysui.KeyguardChangeListener;
|
||||||
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
import com.android.wm.shell.transition.Transitions;
|
import com.android.wm.shell.transition.Transitions;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@@ -58,7 +59,7 @@ import dagger.Lazy;
|
|||||||
* activities are in compatibility mode.
|
* activities are in compatibility mode.
|
||||||
*/
|
*/
|
||||||
public class CompatUIController implements OnDisplaysChangedListener,
|
public class CompatUIController implements OnDisplaysChangedListener,
|
||||||
DisplayImeController.ImePositionProcessor {
|
DisplayImeController.ImePositionProcessor, KeyguardChangeListener {
|
||||||
|
|
||||||
/** Callback for compat UI interaction. */
|
/** Callback for compat UI interaction. */
|
||||||
public interface CompatUICallback {
|
public interface CompatUICallback {
|
||||||
@@ -100,13 +101,13 @@ public class CompatUIController implements OnDisplaysChangedListener,
|
|||||||
private final SparseArray<WeakReference<Context>> mDisplayContextCache = new SparseArray<>(0);
|
private final SparseArray<WeakReference<Context>> mDisplayContextCache = new SparseArray<>(0);
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
private final ShellController mShellController;
|
||||||
private final DisplayController mDisplayController;
|
private final DisplayController mDisplayController;
|
||||||
private final DisplayInsetsController mDisplayInsetsController;
|
private final DisplayInsetsController mDisplayInsetsController;
|
||||||
private final DisplayImeController mImeController;
|
private final DisplayImeController mImeController;
|
||||||
private final SyncTransactionQueue mSyncQueue;
|
private final SyncTransactionQueue mSyncQueue;
|
||||||
private final ShellExecutor mMainExecutor;
|
private final ShellExecutor mMainExecutor;
|
||||||
private final Lazy<Transitions> mTransitionsLazy;
|
private final Lazy<Transitions> mTransitionsLazy;
|
||||||
private final CompatUIImpl mImpl = new CompatUIImpl();
|
|
||||||
|
|
||||||
private CompatUICallback mCallback;
|
private CompatUICallback mCallback;
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ public class CompatUIController implements OnDisplaysChangedListener,
|
|||||||
private boolean mKeyguardShowing;
|
private boolean mKeyguardShowing;
|
||||||
|
|
||||||
public CompatUIController(Context context,
|
public CompatUIController(Context context,
|
||||||
|
ShellController shellController,
|
||||||
DisplayController displayController,
|
DisplayController displayController,
|
||||||
DisplayInsetsController displayInsetsController,
|
DisplayInsetsController displayInsetsController,
|
||||||
DisplayImeController imeController,
|
DisplayImeController imeController,
|
||||||
@@ -125,6 +127,7 @@ public class CompatUIController implements OnDisplaysChangedListener,
|
|||||||
ShellExecutor mainExecutor,
|
ShellExecutor mainExecutor,
|
||||||
Lazy<Transitions> transitionsLazy) {
|
Lazy<Transitions> transitionsLazy) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mShellController = shellController;
|
||||||
mDisplayController = displayController;
|
mDisplayController = displayController;
|
||||||
mDisplayInsetsController = displayInsetsController;
|
mDisplayInsetsController = displayInsetsController;
|
||||||
mImeController = imeController;
|
mImeController = imeController;
|
||||||
@@ -134,11 +137,7 @@ public class CompatUIController implements OnDisplaysChangedListener,
|
|||||||
mDisplayController.addDisplayWindowListener(this);
|
mDisplayController.addDisplayWindowListener(this);
|
||||||
mImeController.addPositionProcessor(this);
|
mImeController.addPositionProcessor(this);
|
||||||
mCompatUIHintsState = new CompatUIHintsState();
|
mCompatUIHintsState = new CompatUIHintsState();
|
||||||
}
|
shellController.addKeyguardChangeListener(this);
|
||||||
|
|
||||||
/** Returns implementation of {@link CompatUI}. */
|
|
||||||
public CompatUI asCompatUI() {
|
|
||||||
return mImpl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the callback for UI interactions. */
|
/** Sets the callback for UI interactions. */
|
||||||
@@ -223,9 +222,10 @@ public class CompatUIController implements OnDisplaysChangedListener,
|
|||||||
layout -> layout.updateVisibility(showOnDisplay(displayId)));
|
layout -> layout.updateVisibility(showOnDisplay(displayId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@Override
|
||||||
void onKeyguardShowingChanged(boolean showing) {
|
public void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
|
||||||
mKeyguardShowing = showing;
|
boolean animatingDismiss) {
|
||||||
|
mKeyguardShowing = visible;
|
||||||
// Hide the compat UIs when keyguard is showing.
|
// Hide the compat UIs when keyguard is showing.
|
||||||
forAllLayouts(layout -> layout.updateVisibility(showOnDisplay(layout.getDisplayId())));
|
forAllLayouts(layout -> layout.updateVisibility(showOnDisplay(layout.getDisplayId())));
|
||||||
}
|
}
|
||||||
@@ -373,19 +373,6 @@ public class CompatUIController implements OnDisplaysChangedListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The interface for calls from outside the Shell, within the host process.
|
|
||||||
*/
|
|
||||||
@ExternalThread
|
|
||||||
private class CompatUIImpl implements CompatUI {
|
|
||||||
@Override
|
|
||||||
public void onKeyguardShowingChanged(boolean showing) {
|
|
||||||
mMainExecutor.execute(() -> {
|
|
||||||
CompatUIController.this.onKeyguardShowingChanged(showing);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** An implementation of {@link OnInsetsChangedListener} for a given display id. */
|
/** An implementation of {@link OnInsetsChangedListener} for a given display id. */
|
||||||
private class PerDisplayOnInsetsChangedListener implements OnInsetsChangedListener {
|
private class PerDisplayOnInsetsChangedListener implements OnInsetsChangedListener {
|
||||||
final int mDisplayId;
|
final int mDisplayId;
|
||||||
|
|||||||
@@ -57,15 +57,12 @@ import com.android.wm.shell.common.annotations.ShellAnimationThread;
|
|||||||
import com.android.wm.shell.common.annotations.ShellBackgroundThread;
|
import com.android.wm.shell.common.annotations.ShellBackgroundThread;
|
||||||
import com.android.wm.shell.common.annotations.ShellMainThread;
|
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||||
import com.android.wm.shell.common.annotations.ShellSplashscreenThread;
|
import com.android.wm.shell.common.annotations.ShellSplashscreenThread;
|
||||||
import com.android.wm.shell.compatui.CompatUI;
|
|
||||||
import com.android.wm.shell.compatui.CompatUIController;
|
import com.android.wm.shell.compatui.CompatUIController;
|
||||||
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
|
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
|
||||||
import com.android.wm.shell.displayareahelper.DisplayAreaHelperController;
|
import com.android.wm.shell.displayareahelper.DisplayAreaHelperController;
|
||||||
import com.android.wm.shell.draganddrop.DragAndDrop;
|
|
||||||
import com.android.wm.shell.draganddrop.DragAndDropController;
|
import com.android.wm.shell.draganddrop.DragAndDropController;
|
||||||
import com.android.wm.shell.freeform.FreeformTaskListener;
|
import com.android.wm.shell.freeform.FreeformTaskListener;
|
||||||
import com.android.wm.shell.fullscreen.FullscreenTaskListener;
|
import com.android.wm.shell.fullscreen.FullscreenTaskListener;
|
||||||
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout;
|
|
||||||
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutoutController;
|
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutoutController;
|
||||||
import com.android.wm.shell.kidsmode.KidsModeTaskOrganizer;
|
import com.android.wm.shell.kidsmode.KidsModeTaskOrganizer;
|
||||||
import com.android.wm.shell.onehanded.OneHanded;
|
import com.android.wm.shell.onehanded.OneHanded;
|
||||||
@@ -85,8 +82,6 @@ import com.android.wm.shell.startingsurface.StartingWindowTypeAlgorithm;
|
|||||||
import com.android.wm.shell.startingsurface.phone.PhoneStartingWindowTypeAlgorithm;
|
import com.android.wm.shell.startingsurface.phone.PhoneStartingWindowTypeAlgorithm;
|
||||||
import com.android.wm.shell.sysui.ShellController;
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
import com.android.wm.shell.sysui.ShellInterface;
|
import com.android.wm.shell.sysui.ShellInterface;
|
||||||
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelper;
|
|
||||||
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelperController;
|
|
||||||
import com.android.wm.shell.transition.ShellTransitions;
|
import com.android.wm.shell.transition.ShellTransitions;
|
||||||
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;
|
||||||
@@ -171,12 +166,6 @@ public abstract class WMShellBaseModule {
|
|||||||
iconProvider, mainExecutor);
|
iconProvider, mainExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static Optional<DragAndDrop> provideDragAndDrop(DragAndDropController dragAndDropController) {
|
|
||||||
return Optional.of(dragAndDropController.asDragAndDrop());
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
@Provides
|
@Provides
|
||||||
static ShellTaskOrganizer provideShellTaskOrganizer(@ShellMainThread ShellExecutor mainExecutor,
|
static ShellTaskOrganizer provideShellTaskOrganizer(@ShellMainThread ShellExecutor mainExecutor,
|
||||||
@@ -206,19 +195,15 @@ public abstract class WMShellBaseModule {
|
|||||||
recentTasksOptional);
|
recentTasksOptional);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides static Optional<CompatUI> provideCompatUI(CompatUIController compatUIController) {
|
|
||||||
return Optional.of(compatUIController.asCompatUI());
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
@Provides
|
@Provides
|
||||||
static CompatUIController provideCompatUIController(Context context,
|
static CompatUIController provideCompatUIController(Context context,
|
||||||
|
ShellController shellController,
|
||||||
DisplayController displayController, DisplayInsetsController displayInsetsController,
|
DisplayController displayController, DisplayInsetsController displayInsetsController,
|
||||||
DisplayImeController imeController, SyncTransactionQueue syncQueue,
|
DisplayImeController imeController, SyncTransactionQueue syncQueue,
|
||||||
@ShellMainThread ShellExecutor mainExecutor, Lazy<Transitions> transitionsLazy) {
|
@ShellMainThread ShellExecutor mainExecutor, Lazy<Transitions> transitionsLazy) {
|
||||||
return new CompatUIController(context, displayController, displayInsetsController,
|
return new CompatUIController(context, shellController, displayController,
|
||||||
imeController, syncQueue, mainExecutor, transitionsLazy);
|
displayInsetsController, imeController, syncQueue, mainExecutor, transitionsLazy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
@@ -373,13 +358,6 @@ public abstract class WMShellBaseModule {
|
|||||||
// Hide display cutout
|
// Hide display cutout
|
||||||
//
|
//
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static Optional<HideDisplayCutout> provideHideDisplayCutout(
|
|
||||||
Optional<HideDisplayCutoutController> hideDisplayCutoutController) {
|
|
||||||
return hideDisplayCutoutController.map((controller) -> controller.asHideDisplayCutout());
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
@Provides
|
@Provides
|
||||||
static Optional<HideDisplayCutoutController> provideHideDisplayCutoutController(Context context,
|
static Optional<HideDisplayCutoutController> provideHideDisplayCutoutController(Context context,
|
||||||
@@ -415,23 +393,6 @@ public abstract class WMShellBaseModule {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Task to Surface communication
|
|
||||||
//
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static Optional<TaskSurfaceHelper> provideTaskSurfaceHelper(
|
|
||||||
Optional<TaskSurfaceHelperController> taskSurfaceController) {
|
|
||||||
return taskSurfaceController.map((controller) -> controller.asTaskSurfaceHelper());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
static Optional<TaskSurfaceHelperController> provideTaskSurfaceHelperController(
|
|
||||||
ShellTaskOrganizer taskOrganizer, @ShellMainThread ShellExecutor mainExecutor) {
|
|
||||||
return Optional.ofNullable(new TaskSurfaceHelperController(taskOrganizer, mainExecutor));
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pip (optional feature)
|
// Pip (optional feature)
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ public abstract class WMShellModule {
|
|||||||
@Provides
|
@Provides
|
||||||
@DynamicOverride
|
@DynamicOverride
|
||||||
static SplitScreenController provideSplitScreenController(
|
static SplitScreenController provideSplitScreenController(
|
||||||
|
ShellController shellController,
|
||||||
ShellTaskOrganizer shellTaskOrganizer,
|
ShellTaskOrganizer shellTaskOrganizer,
|
||||||
SyncTransactionQueue syncQueue, Context context,
|
SyncTransactionQueue syncQueue, Context context,
|
||||||
RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer,
|
RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer,
|
||||||
@@ -234,7 +235,7 @@ public abstract class WMShellModule {
|
|||||||
DisplayInsetsController displayInsetsController, Transitions transitions,
|
DisplayInsetsController displayInsetsController, Transitions transitions,
|
||||||
TransactionPool transactionPool, IconProvider iconProvider,
|
TransactionPool transactionPool, IconProvider iconProvider,
|
||||||
Optional<RecentTasksController> recentTasks) {
|
Optional<RecentTasksController> recentTasks) {
|
||||||
return new SplitScreenController(shellTaskOrganizer, syncQueue, context,
|
return new SplitScreenController(shellController, shellTaskOrganizer, syncQueue, context,
|
||||||
rootTaskDisplayAreaOrganizer, mainExecutor, displayController, displayImeController,
|
rootTaskDisplayAreaOrganizer, mainExecutor, displayController, displayImeController,
|
||||||
displayInsetsController, transitions, transactionPool, iconProvider,
|
displayInsetsController, transitions, transactionPool, iconProvider,
|
||||||
recentTasks);
|
recentTasks);
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.wm.shell.draganddrop;
|
|
||||||
|
|
||||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for telling DragAndDrop stuff.
|
|
||||||
*/
|
|
||||||
@ExternalThread
|
|
||||||
public interface DragAndDrop {
|
|
||||||
}
|
|
||||||
@@ -81,11 +81,9 @@ public class DragAndDropController implements DisplayController.OnDisplaysChange
|
|||||||
private final IconProvider mIconProvider;
|
private final IconProvider mIconProvider;
|
||||||
private SplitScreenController mSplitScreen;
|
private SplitScreenController mSplitScreen;
|
||||||
private ShellExecutor mMainExecutor;
|
private ShellExecutor mMainExecutor;
|
||||||
private DragAndDropImpl mImpl;
|
|
||||||
private ArrayList<DragAndDropListener> mListeners = new ArrayList<>();
|
private ArrayList<DragAndDropListener> mListeners = new ArrayList<>();
|
||||||
|
|
||||||
private final SparseArray<PerDisplay> mDisplayDropTargets = new SparseArray<>();
|
private final SparseArray<PerDisplay> mDisplayDropTargets = new SparseArray<>();
|
||||||
private final SurfaceControl.Transaction mTransaction = new SurfaceControl.Transaction();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener called during drag events, currently just onDragStarted.
|
* Listener called during drag events, currently just onDragStarted.
|
||||||
@@ -107,11 +105,6 @@ public class DragAndDropController implements DisplayController.OnDisplaysChange
|
|||||||
mLogger = new DragAndDropEventLogger(uiEventLogger);
|
mLogger = new DragAndDropEventLogger(uiEventLogger);
|
||||||
mIconProvider = iconProvider;
|
mIconProvider = iconProvider;
|
||||||
mMainExecutor = mainExecutor;
|
mMainExecutor = mainExecutor;
|
||||||
mImpl = new DragAndDropImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DragAndDrop asDragAndDrop() {
|
|
||||||
return mImpl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(Optional<SplitScreenController> splitscreen) {
|
public void initialize(Optional<SplitScreenController> splitscreen) {
|
||||||
@@ -353,8 +346,4 @@ public class DragAndDropController implements DisplayController.OnDisplaysChange
|
|||||||
dragLayout = dl;
|
dragLayout = dl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DragAndDropImpl implements DragAndDrop {
|
|
||||||
// TODO: To be removed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.wm.shell.hidedisplaycutout;
|
|
||||||
|
|
||||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface to engage hide display cutout feature.
|
|
||||||
*/
|
|
||||||
@ExternalThread
|
|
||||||
public interface HideDisplayCutout {
|
|
||||||
}
|
|
||||||
@@ -40,8 +40,6 @@ public class HideDisplayCutoutController implements ConfigurationChangeListener
|
|||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final ShellController mShellController;
|
private final ShellController mShellController;
|
||||||
private final HideDisplayCutoutOrganizer mOrganizer;
|
private final HideDisplayCutoutOrganizer mOrganizer;
|
||||||
private final ShellExecutor mMainExecutor;
|
|
||||||
private final HideDisplayCutoutImpl mImpl = new HideDisplayCutoutImpl();
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean mEnabled;
|
boolean mEnabled;
|
||||||
|
|
||||||
@@ -62,23 +60,18 @@ public class HideDisplayCutoutController implements ConfigurationChangeListener
|
|||||||
|
|
||||||
HideDisplayCutoutOrganizer organizer =
|
HideDisplayCutoutOrganizer organizer =
|
||||||
new HideDisplayCutoutOrganizer(context, displayController, mainExecutor);
|
new HideDisplayCutoutOrganizer(context, displayController, mainExecutor);
|
||||||
return new HideDisplayCutoutController(context, shellController, organizer, mainExecutor);
|
return new HideDisplayCutoutController(context, shellController, organizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HideDisplayCutoutController(Context context, ShellController shellController,
|
HideDisplayCutoutController(Context context, ShellController shellController,
|
||||||
HideDisplayCutoutOrganizer organizer, ShellExecutor mainExecutor) {
|
HideDisplayCutoutOrganizer organizer) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mShellController = shellController;
|
mShellController = shellController;
|
||||||
mOrganizer = organizer;
|
mOrganizer = organizer;
|
||||||
mMainExecutor = mainExecutor;
|
|
||||||
updateStatus();
|
updateStatus();
|
||||||
mShellController.addConfigurationChangeListener(this);
|
mShellController.addConfigurationChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HideDisplayCutout asHideDisplayCutout() {
|
|
||||||
return mImpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void updateStatus() {
|
void updateStatus() {
|
||||||
// The config value is used for controlling enabling/disabling status of the feature and is
|
// The config value is used for controlling enabling/disabling status of the feature and is
|
||||||
@@ -112,8 +105,4 @@ public class HideDisplayCutoutController implements ConfigurationChangeListener
|
|||||||
pw.println(mEnabled);
|
pw.println(mEnabled);
|
||||||
mOrganizer.dump(pw);
|
mOrganizer.dump(pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HideDisplayCutoutImpl implements HideDisplayCutout {
|
|
||||||
// TODO: To be removed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,9 +85,4 @@ public interface OneHanded {
|
|||||||
* Notifies when user switch complete
|
* Notifies when user switch complete
|
||||||
*/
|
*/
|
||||||
void onUserSwitch(int userId);
|
void onUserSwitch(int userId);
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies when keyguard visibility changed
|
|
||||||
*/
|
|
||||||
void onKeyguardVisibilityChanged(boolean showing);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import com.android.wm.shell.common.TaskStackListenerCallback;
|
|||||||
import com.android.wm.shell.common.TaskStackListenerImpl;
|
import com.android.wm.shell.common.TaskStackListenerImpl;
|
||||||
import com.android.wm.shell.common.annotations.ExternalThread;
|
import com.android.wm.shell.common.annotations.ExternalThread;
|
||||||
import com.android.wm.shell.sysui.ConfigurationChangeListener;
|
import com.android.wm.shell.sysui.ConfigurationChangeListener;
|
||||||
|
import com.android.wm.shell.sysui.KeyguardChangeListener;
|
||||||
import com.android.wm.shell.sysui.ShellController;
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -63,7 +64,8 @@ import java.io.PrintWriter;
|
|||||||
* Manages and manipulates the one handed states, transitions, and gesture for phones.
|
* Manages and manipulates the one handed states, transitions, and gesture for phones.
|
||||||
*/
|
*/
|
||||||
public class OneHandedController implements RemoteCallable<OneHandedController>,
|
public class OneHandedController implements RemoteCallable<OneHandedController>,
|
||||||
DisplayChangeController.OnDisplayChangingListener, ConfigurationChangeListener {
|
DisplayChangeController.OnDisplayChangingListener, ConfigurationChangeListener,
|
||||||
|
KeyguardChangeListener {
|
||||||
private static final String TAG = "OneHandedController";
|
private static final String TAG = "OneHandedController";
|
||||||
|
|
||||||
private static final String ONE_HANDED_MODE_OFFSET_PERCENTAGE =
|
private static final String ONE_HANDED_MODE_OFFSET_PERCENTAGE =
|
||||||
@@ -279,6 +281,7 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
|||||||
|
|
||||||
mState.addSListeners(mTutorialHandler);
|
mState.addSListeners(mTutorialHandler);
|
||||||
mShellController.addConfigurationChangeListener(this);
|
mShellController.addConfigurationChangeListener(this);
|
||||||
|
mShellController.addKeyguardChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OneHanded asOneHanded() {
|
public OneHanded asOneHanded() {
|
||||||
@@ -605,8 +608,11 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
|||||||
mTutorialHandler.onConfigurationChanged();
|
mTutorialHandler.onConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onKeyguardVisibilityChanged(boolean showing) {
|
@Override
|
||||||
mKeyguardShowing = showing;
|
public void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
|
||||||
|
boolean animatingDismiss) {
|
||||||
|
mKeyguardShowing = visible;
|
||||||
|
stopOneHanded();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onUserSwitch(int newUserId) {
|
private void onUserSwitch(int newUserId) {
|
||||||
@@ -756,13 +762,6 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
|||||||
OneHandedController.this.onUserSwitch(userId);
|
OneHandedController.this.onUserSwitch(userId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
|
||||||
mMainExecutor.execute(() -> {
|
|
||||||
OneHandedController.this.onKeyguardVisibilityChanged(showing);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -100,23 +100,6 @@ public interface Pip {
|
|||||||
*/
|
*/
|
||||||
default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { }
|
default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { }
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the visibility of keyguard is changed.
|
|
||||||
* @param showing {@code true} if keyguard is now showing, {@code false} otherwise.
|
|
||||||
* @param animating {@code true} if system is animating between keyguard and surface behind,
|
|
||||||
* this only makes sense when showing is {@code false}.
|
|
||||||
*/
|
|
||||||
default void onKeyguardVisibilityChanged(boolean showing, boolean animating) { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the dismissing animation keyguard and surfaces behind is finished.
|
|
||||||
* See also {@link #onKeyguardVisibilityChanged(boolean, boolean)}.
|
|
||||||
*
|
|
||||||
* TODO(b/206741900) deprecate this path once we're able to animate the PiP window as part of
|
|
||||||
* keyguard dismiss animation.
|
|
||||||
*/
|
|
||||||
default void onKeyguardDismissAnimationFinished() { }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dump the current state and information if need.
|
* Dump the current state and information if need.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ import com.android.wm.shell.pip.PipTransitionState;
|
|||||||
import com.android.wm.shell.pip.PipUtils;
|
import com.android.wm.shell.pip.PipUtils;
|
||||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||||
import com.android.wm.shell.sysui.ConfigurationChangeListener;
|
import com.android.wm.shell.sysui.ConfigurationChangeListener;
|
||||||
|
import com.android.wm.shell.sysui.KeyguardChangeListener;
|
||||||
import com.android.wm.shell.sysui.ShellController;
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
import com.android.wm.shell.transition.Transitions;
|
import com.android.wm.shell.transition.Transitions;
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ import java.util.function.Consumer;
|
|||||||
* Manages the picture-in-picture (PIP) UI and states for Phones.
|
* Manages the picture-in-picture (PIP) UI and states for Phones.
|
||||||
*/
|
*/
|
||||||
public class PipController implements PipTransitionController.PipTransitionCallback,
|
public class PipController implements PipTransitionController.PipTransitionCallback,
|
||||||
RemoteCallable<PipController>, ConfigurationChangeListener {
|
RemoteCallable<PipController>, ConfigurationChangeListener, KeyguardChangeListener {
|
||||||
private static final String TAG = "PipController";
|
private static final String TAG = "PipController";
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@@ -527,6 +528,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
});
|
});
|
||||||
|
|
||||||
mShellController.addConfigurationChangeListener(this);
|
mShellController.addConfigurationChangeListener(this);
|
||||||
|
mShellController.addKeyguardChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -661,21 +663,24 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
* finished first to reset the visibility of PiP window.
|
* finished first to reset the visibility of PiP window.
|
||||||
* See also {@link #onKeyguardDismissAnimationFinished()}
|
* See also {@link #onKeyguardDismissAnimationFinished()}
|
||||||
*/
|
*/
|
||||||
private void onKeyguardVisibilityChanged(boolean keyguardShowing, boolean animating) {
|
@Override
|
||||||
|
public void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
|
||||||
|
boolean animatingDismiss) {
|
||||||
if (!mPipTaskOrganizer.isInPip()) {
|
if (!mPipTaskOrganizer.isInPip()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keyguardShowing) {
|
if (visible) {
|
||||||
mIsKeyguardShowingOrAnimating = true;
|
mIsKeyguardShowingOrAnimating = true;
|
||||||
hidePipMenu(null /* onStartCallback */, null /* onEndCallback */);
|
hidePipMenu(null /* onStartCallback */, null /* onEndCallback */);
|
||||||
mPipTaskOrganizer.setPipVisibility(false);
|
mPipTaskOrganizer.setPipVisibility(false);
|
||||||
} else if (!animating) {
|
} else if (!animatingDismiss) {
|
||||||
mIsKeyguardShowingOrAnimating = false;
|
mIsKeyguardShowingOrAnimating = false;
|
||||||
mPipTaskOrganizer.setPipVisibility(true);
|
mPipTaskOrganizer.setPipVisibility(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onKeyguardDismissAnimationFinished() {
|
@Override
|
||||||
|
public void onKeyguardDismissAnimationFinished() {
|
||||||
if (mPipTaskOrganizer.isInPip()) {
|
if (mPipTaskOrganizer.isInPip()) {
|
||||||
mIsKeyguardShowingOrAnimating = false;
|
mIsKeyguardShowingOrAnimating = false;
|
||||||
mPipTaskOrganizer.setPipVisibility(true);
|
mPipTaskOrganizer.setPipVisibility(true);
|
||||||
@@ -995,18 +1000,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKeyguardVisibilityChanged(boolean showing, boolean animating) {
|
|
||||||
mMainExecutor.execute(() -> {
|
|
||||||
PipController.this.onKeyguardVisibilityChanged(showing, animating);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKeyguardDismissAnimationFinished() {
|
|
||||||
mMainExecutor.execute(PipController.this::onKeyguardDismissAnimationFinished);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dump(PrintWriter pw) {
|
public void dump(PrintWriter pw) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -77,12 +77,6 @@ public interface SplitScreen {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the visibility of the keyguard changes.
|
|
||||||
* @param showing Indicates if the keyguard is now visible.
|
|
||||||
*/
|
|
||||||
void onKeyguardVisibilityChanged(boolean showing);
|
|
||||||
|
|
||||||
/** Called when device waking up finished. */
|
/** Called when device waking up finished. */
|
||||||
void onFinishedWakingUp();
|
void onFinishedWakingUp();
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ import com.android.wm.shell.draganddrop.DragAndDropPolicy;
|
|||||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||||
import com.android.wm.shell.recents.RecentTasksController;
|
import com.android.wm.shell.recents.RecentTasksController;
|
||||||
import com.android.wm.shell.splitscreen.SplitScreen.StageType;
|
import com.android.wm.shell.splitscreen.SplitScreen.StageType;
|
||||||
|
import com.android.wm.shell.sysui.KeyguardChangeListener;
|
||||||
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
import com.android.wm.shell.transition.LegacyTransitions;
|
import com.android.wm.shell.transition.LegacyTransitions;
|
||||||
import com.android.wm.shell.transition.Transitions;
|
import com.android.wm.shell.transition.Transitions;
|
||||||
|
|
||||||
@@ -99,7 +101,7 @@ import java.util.concurrent.Executor;
|
|||||||
*/
|
*/
|
||||||
// TODO(b/198577848): Implement split screen flicker test to consolidate CUJ of split screen.
|
// TODO(b/198577848): Implement split screen flicker test to consolidate CUJ of split screen.
|
||||||
public class SplitScreenController implements DragAndDropPolicy.Starter,
|
public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||||
RemoteCallable<SplitScreenController> {
|
RemoteCallable<SplitScreenController>, KeyguardChangeListener {
|
||||||
private static final String TAG = SplitScreenController.class.getSimpleName();
|
private static final String TAG = SplitScreenController.class.getSimpleName();
|
||||||
|
|
||||||
public static final int EXIT_REASON_UNKNOWN = 0;
|
public static final int EXIT_REASON_UNKNOWN = 0;
|
||||||
@@ -127,6 +129,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@interface ExitReason{}
|
@interface ExitReason{}
|
||||||
|
|
||||||
|
private final ShellController mShellController;
|
||||||
private final ShellTaskOrganizer mTaskOrganizer;
|
private final ShellTaskOrganizer mTaskOrganizer;
|
||||||
private final SyncTransactionQueue mSyncQueue;
|
private final SyncTransactionQueue mSyncQueue;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@@ -147,7 +150,8 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
// outside the bounds of the roots by being reparented into a higher level fullscreen container
|
// outside the bounds of the roots by being reparented into a higher level fullscreen container
|
||||||
private SurfaceControl mSplitTasksContainerLayer;
|
private SurfaceControl mSplitTasksContainerLayer;
|
||||||
|
|
||||||
public SplitScreenController(ShellTaskOrganizer shellTaskOrganizer,
|
public SplitScreenController(ShellController shellController,
|
||||||
|
ShellTaskOrganizer shellTaskOrganizer,
|
||||||
SyncTransactionQueue syncQueue, Context context,
|
SyncTransactionQueue syncQueue, Context context,
|
||||||
RootTaskDisplayAreaOrganizer rootTDAOrganizer,
|
RootTaskDisplayAreaOrganizer rootTDAOrganizer,
|
||||||
ShellExecutor mainExecutor, DisplayController displayController,
|
ShellExecutor mainExecutor, DisplayController displayController,
|
||||||
@@ -155,6 +159,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
DisplayInsetsController displayInsetsController,
|
DisplayInsetsController displayInsetsController,
|
||||||
Transitions transitions, TransactionPool transactionPool, IconProvider iconProvider,
|
Transitions transitions, TransactionPool transactionPool, IconProvider iconProvider,
|
||||||
Optional<RecentTasksController> recentTasks) {
|
Optional<RecentTasksController> recentTasks) {
|
||||||
|
mShellController = shellController;
|
||||||
mTaskOrganizer = shellTaskOrganizer;
|
mTaskOrganizer = shellTaskOrganizer;
|
||||||
mSyncQueue = syncQueue;
|
mSyncQueue = syncQueue;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -185,6 +190,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onOrganizerRegistered() {
|
public void onOrganizerRegistered() {
|
||||||
|
mShellController.addKeyguardChangeListener(this);
|
||||||
if (mStageCoordinator == null) {
|
if (mStageCoordinator == null) {
|
||||||
// TODO: Multi-display
|
// TODO: Multi-display
|
||||||
mStageCoordinator = new StageCoordinator(mContext, DEFAULT_DISPLAY, mSyncQueue,
|
mStageCoordinator = new StageCoordinator(mContext, DEFAULT_DISPLAY, mSyncQueue,
|
||||||
@@ -283,8 +289,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
mStageCoordinator.exitSplitScreen(toTopTaskId, exitReason);
|
mStageCoordinator.exitSplitScreen(toTopTaskId, exitReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
@Override
|
||||||
mStageCoordinator.onKeyguardVisibilityChanged(showing);
|
public void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
|
||||||
|
boolean animatingDismiss) {
|
||||||
|
mStageCoordinator.onKeyguardVisibilityChanged(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFinishedWakingUp() {
|
public void onFinishedWakingUp() {
|
||||||
@@ -657,13 +665,6 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
|
||||||
mMainExecutor.execute(() -> {
|
|
||||||
SplitScreenController.this.onKeyguardVisibilityChanged(showing);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinishedWakingUp() {
|
public void onFinishedWakingUp() {
|
||||||
mMainExecutor.execute(() -> {
|
mMainExecutor.execute(() -> {
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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.sysui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callbacks for when the keyguard changes.
|
||||||
|
*/
|
||||||
|
public interface KeyguardChangeListener {
|
||||||
|
/**
|
||||||
|
* Notifies the Shell that the keyguard is showing (and if so, whether it is occluded).
|
||||||
|
*/
|
||||||
|
default void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
|
||||||
|
boolean animatingDismiss) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the Shell when the keyguard dismiss animation has finished.
|
||||||
|
*
|
||||||
|
* TODO(b/206741900) deprecate this path once we're able to animate the PiP window as part of
|
||||||
|
* keyguard dismiss animation.
|
||||||
|
*/
|
||||||
|
default void onKeyguardDismissAnimationFinished() {}
|
||||||
|
}
|
||||||
@@ -47,7 +47,9 @@ public class ShellController {
|
|||||||
private final ShellExecutor mMainExecutor;
|
private final ShellExecutor mMainExecutor;
|
||||||
private final ShellInterfaceImpl mImpl = new ShellInterfaceImpl();
|
private final ShellInterfaceImpl mImpl = new ShellInterfaceImpl();
|
||||||
|
|
||||||
private final CopyOnWriteArrayList<ConfigurationChangeListener> mListeners =
|
private final CopyOnWriteArrayList<ConfigurationChangeListener> mConfigChangeListeners =
|
||||||
|
new CopyOnWriteArrayList<>();
|
||||||
|
private final CopyOnWriteArrayList<KeyguardChangeListener> mKeyguardChangeListeners =
|
||||||
new CopyOnWriteArrayList<>();
|
new CopyOnWriteArrayList<>();
|
||||||
private Configuration mLastConfiguration;
|
private Configuration mLastConfiguration;
|
||||||
|
|
||||||
@@ -68,15 +70,31 @@ public class ShellController {
|
|||||||
* particular order.
|
* particular order.
|
||||||
*/
|
*/
|
||||||
public void addConfigurationChangeListener(ConfigurationChangeListener listener) {
|
public void addConfigurationChangeListener(ConfigurationChangeListener listener) {
|
||||||
mListeners.remove(listener);
|
mConfigChangeListeners.remove(listener);
|
||||||
mListeners.add(listener);
|
mConfigChangeListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an existing configuration listener.
|
* Removes an existing configuration listener.
|
||||||
*/
|
*/
|
||||||
public void removeConfigurationChangeListener(ConfigurationChangeListener listener) {
|
public void removeConfigurationChangeListener(ConfigurationChangeListener listener) {
|
||||||
mListeners.remove(listener);
|
mConfigChangeListeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new Keyguard listener. The Keyguard change callbacks are not made in any
|
||||||
|
* particular order.
|
||||||
|
*/
|
||||||
|
public void addKeyguardChangeListener(KeyguardChangeListener listener) {
|
||||||
|
mKeyguardChangeListeners.remove(listener);
|
||||||
|
mKeyguardChangeListeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an existing Keyguard listener.
|
||||||
|
*/
|
||||||
|
public void removeKeyguardChangeListener(KeyguardChangeListener listener) {
|
||||||
|
mKeyguardChangeListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -102,7 +120,7 @@ public class ShellController {
|
|||||||
|
|
||||||
// Update the last configuration and call listeners
|
// Update the last configuration and call listeners
|
||||||
mLastConfiguration.updateFrom(newConfig);
|
mLastConfiguration.updateFrom(newConfig);
|
||||||
for (ConfigurationChangeListener listener : mListeners) {
|
for (ConfigurationChangeListener listener : mConfigChangeListeners) {
|
||||||
listener.onConfigurationChanged(newConfig);
|
listener.onConfigurationChanged(newConfig);
|
||||||
if (densityFontScaleChanged) {
|
if (densityFontScaleChanged) {
|
||||||
listener.onDensityOrFontScaleChanged();
|
listener.onDensityOrFontScaleChanged();
|
||||||
@@ -119,11 +137,26 @@ public class ShellController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void onKeyguardVisibilityChanged(boolean visible, boolean occluded, boolean animatingDismiss) {
|
||||||
|
for (KeyguardChangeListener listener : mKeyguardChangeListeners) {
|
||||||
|
listener.onKeyguardVisibilityChanged(visible, occluded, animatingDismiss);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void onKeyguardDismissAnimationFinished() {
|
||||||
|
for (KeyguardChangeListener listener : mKeyguardChangeListeners) {
|
||||||
|
listener.onKeyguardDismissAnimationFinished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void dump(@NonNull PrintWriter pw, String prefix) {
|
public void dump(@NonNull PrintWriter pw, String prefix) {
|
||||||
final String innerPrefix = prefix + " ";
|
final String innerPrefix = prefix + " ";
|
||||||
pw.println(prefix + TAG);
|
pw.println(prefix + TAG);
|
||||||
pw.println(innerPrefix + "mListeners=" + mListeners.size());
|
pw.println(innerPrefix + "mConfigChangeListeners=" + mConfigChangeListeners.size());
|
||||||
pw.println(innerPrefix + "mLastConfiguration=" + mLastConfiguration);
|
pw.println(innerPrefix + "mLastConfiguration=" + mLastConfiguration);
|
||||||
|
pw.println(innerPrefix + "mKeyguardChangeListeners=" + mKeyguardChangeListeners.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,5 +169,19 @@ public class ShellController {
|
|||||||
mMainExecutor.execute(() ->
|
mMainExecutor.execute(() ->
|
||||||
ShellController.this.onConfigurationChanged(newConfiguration));
|
ShellController.this.onConfigurationChanged(newConfiguration));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
|
||||||
|
boolean animatingDismiss) {
|
||||||
|
mMainExecutor.execute(() ->
|
||||||
|
ShellController.this.onKeyguardVisibilityChanged(visible, occluded,
|
||||||
|
animatingDismiss));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyguardDismissAnimationFinished() {
|
||||||
|
mMainExecutor.execute(() ->
|
||||||
|
ShellController.this.onKeyguardDismissAnimationFinished());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,16 @@ public interface ShellInterface {
|
|||||||
* Notifies the Shell that the configuration has changed.
|
* Notifies the Shell that the configuration has changed.
|
||||||
*/
|
*/
|
||||||
default void onConfigurationChanged(Configuration newConfiguration) {}
|
default void onConfigurationChanged(Configuration newConfiguration) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the Shell that the keyguard is showing (and if so, whether it is occluded) or not
|
||||||
|
* showing, and whether it is animating a dismiss.
|
||||||
|
*/
|
||||||
|
default void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
|
||||||
|
boolean animatingDismiss) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the Shell when the keyguard dismiss animation has finished.
|
||||||
|
*/
|
||||||
|
default void onKeyguardDismissAnimationFinished() {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021 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.tasksurfacehelper;
|
|
||||||
|
|
||||||
import android.app.ActivityManager.RunningTaskInfo;
|
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.view.SurfaceControl;
|
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface to communicate with a Task's SurfaceControl.
|
|
||||||
*/
|
|
||||||
public interface TaskSurfaceHelper {
|
|
||||||
|
|
||||||
/** Sets the METADATA_GAME_MODE for the layer corresponding to the task **/
|
|
||||||
default void setGameModeForTask(int taskId, int gameMode) {}
|
|
||||||
|
|
||||||
/** Takes a screenshot for a task **/
|
|
||||||
default void screenshotTask(RunningTaskInfo taskInfo, Rect crop, Executor executor,
|
|
||||||
Consumer<SurfaceControl.ScreenshotHardwareBuffer> consumer) {}
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021 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.tasksurfacehelper;
|
|
||||||
|
|
||||||
import android.app.ActivityManager.RunningTaskInfo;
|
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.view.SurfaceControl;
|
|
||||||
|
|
||||||
import com.android.wm.shell.ShellTaskOrganizer;
|
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Intermediary controller that communicates with {@link ShellTaskOrganizer} to send commands
|
|
||||||
* to SurfaceControl.
|
|
||||||
*/
|
|
||||||
public class TaskSurfaceHelperController {
|
|
||||||
|
|
||||||
private final ShellTaskOrganizer mTaskOrganizer;
|
|
||||||
private final ShellExecutor mMainExecutor;
|
|
||||||
private final TaskSurfaceHelperImpl mImpl = new TaskSurfaceHelperImpl();
|
|
||||||
|
|
||||||
public TaskSurfaceHelperController(ShellTaskOrganizer taskOrganizer,
|
|
||||||
ShellExecutor mainExecutor) {
|
|
||||||
mTaskOrganizer = taskOrganizer;
|
|
||||||
mMainExecutor = mainExecutor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TaskSurfaceHelper asTaskSurfaceHelper() {
|
|
||||||
return mImpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends a Transaction to set the game mode metadata on the
|
|
||||||
* corresponding SurfaceControl
|
|
||||||
*/
|
|
||||||
public void setGameModeForTask(int taskId, int gameMode) {
|
|
||||||
mTaskOrganizer.setSurfaceMetadata(taskId, SurfaceControl.METADATA_GAME_MODE, gameMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Take screenshot of the specified task.
|
|
||||||
*/
|
|
||||||
public void screenshotTask(RunningTaskInfo taskInfo, Rect crop,
|
|
||||||
Consumer<SurfaceControl.ScreenshotHardwareBuffer> consumer) {
|
|
||||||
mTaskOrganizer.screenshotTask(taskInfo, crop, consumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TaskSurfaceHelperImpl implements TaskSurfaceHelper {
|
|
||||||
@Override
|
|
||||||
public void setGameModeForTask(int taskId, int gameMode) {
|
|
||||||
mMainExecutor.execute(() -> {
|
|
||||||
TaskSurfaceHelperController.this.setGameModeForTask(taskId, gameMode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenshotTask(RunningTaskInfo taskInfo, Rect crop, Executor executor,
|
|
||||||
Consumer<SurfaceControl.ScreenshotHardwareBuffer> consumer) {
|
|
||||||
mMainExecutor.execute(() -> {
|
|
||||||
TaskSurfaceHelperController.this.screenshotTask(taskInfo, crop,
|
|
||||||
(t) -> executor.execute(() -> consumer.accept(t)));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -53,6 +53,7 @@ import com.android.wm.shell.common.DisplayLayout;
|
|||||||
import com.android.wm.shell.common.ShellExecutor;
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||||
import com.android.wm.shell.compatui.letterboxedu.LetterboxEduWindowManager;
|
import com.android.wm.shell.compatui.letterboxedu.LetterboxEduWindowManager;
|
||||||
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
import com.android.wm.shell.transition.Transitions;
|
import com.android.wm.shell.transition.Transitions;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -78,6 +79,7 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
private static final int TASK_ID = 12;
|
private static final int TASK_ID = 12;
|
||||||
|
|
||||||
private CompatUIController mController;
|
private CompatUIController mController;
|
||||||
|
private @Mock ShellController mMockShellController;
|
||||||
private @Mock DisplayController mMockDisplayController;
|
private @Mock DisplayController mMockDisplayController;
|
||||||
private @Mock DisplayInsetsController mMockDisplayInsetsController;
|
private @Mock DisplayInsetsController mMockDisplayInsetsController;
|
||||||
private @Mock DisplayLayout mMockDisplayLayout;
|
private @Mock DisplayLayout mMockDisplayLayout;
|
||||||
@@ -105,7 +107,7 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
doReturn(TASK_ID).when(mMockLetterboxEduLayout).getTaskId();
|
doReturn(TASK_ID).when(mMockLetterboxEduLayout).getTaskId();
|
||||||
doReturn(true).when(mMockLetterboxEduLayout).createLayout(anyBoolean());
|
doReturn(true).when(mMockLetterboxEduLayout).createLayout(anyBoolean());
|
||||||
doReturn(true).when(mMockLetterboxEduLayout).updateCompatInfo(any(), any(), anyBoolean());
|
doReturn(true).when(mMockLetterboxEduLayout).updateCompatInfo(any(), any(), anyBoolean());
|
||||||
mController = new CompatUIController(mContext, mMockDisplayController,
|
mController = new CompatUIController(mContext, mMockShellController, mMockDisplayController,
|
||||||
mMockDisplayInsetsController, mMockImeController, mMockSyncQueue, mMockExecutor,
|
mMockDisplayInsetsController, mMockImeController, mMockSyncQueue, mMockExecutor,
|
||||||
mMockTransitionsLazy) {
|
mMockTransitionsLazy) {
|
||||||
@Override
|
@Override
|
||||||
@@ -123,6 +125,11 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
spyOn(mController);
|
spyOn(mController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void instantiateController_registerKeyguardChangeListener() {
|
||||||
|
verify(mMockShellController, times(1)).addKeyguardChangeListener(any());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListenerRegistered() {
|
public void testListenerRegistered() {
|
||||||
verify(mMockDisplayController).addDisplayWindowListener(mController);
|
verify(mMockDisplayController).addDisplayWindowListener(mController);
|
||||||
@@ -324,7 +331,7 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
/* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN), mMockTaskListener);
|
/* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN), mMockTaskListener);
|
||||||
|
|
||||||
// Verify that the restart button is hidden after keyguard becomes showing.
|
// Verify that the restart button is hidden after keyguard becomes showing.
|
||||||
mController.onKeyguardShowingChanged(true);
|
mController.onKeyguardVisibilityChanged(true, false, false);
|
||||||
|
|
||||||
verify(mMockCompatLayout).updateVisibility(false);
|
verify(mMockCompatLayout).updateVisibility(false);
|
||||||
verify(mMockLetterboxEduLayout).updateVisibility(false);
|
verify(mMockLetterboxEduLayout).updateVisibility(false);
|
||||||
@@ -340,7 +347,7 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
false);
|
false);
|
||||||
|
|
||||||
// Verify button is shown after keyguard becomes not showing.
|
// Verify button is shown after keyguard becomes not showing.
|
||||||
mController.onKeyguardShowingChanged(false);
|
mController.onKeyguardVisibilityChanged(false, false, false);
|
||||||
|
|
||||||
verify(mMockCompatLayout).updateVisibility(true);
|
verify(mMockCompatLayout).updateVisibility(true);
|
||||||
verify(mMockLetterboxEduLayout).updateVisibility(true);
|
verify(mMockLetterboxEduLayout).updateVisibility(true);
|
||||||
@@ -352,7 +359,7 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
/* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN), mMockTaskListener);
|
/* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN), mMockTaskListener);
|
||||||
|
|
||||||
mController.onImeVisibilityChanged(DISPLAY_ID, /* isShowing= */ true);
|
mController.onImeVisibilityChanged(DISPLAY_ID, /* isShowing= */ true);
|
||||||
mController.onKeyguardShowingChanged(true);
|
mController.onKeyguardVisibilityChanged(true, false, false);
|
||||||
|
|
||||||
verify(mMockCompatLayout, times(2)).updateVisibility(false);
|
verify(mMockCompatLayout, times(2)).updateVisibility(false);
|
||||||
verify(mMockLetterboxEduLayout, times(2)).updateVisibility(false);
|
verify(mMockLetterboxEduLayout, times(2)).updateVisibility(false);
|
||||||
@@ -360,7 +367,7 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
clearInvocations(mMockCompatLayout, mMockLetterboxEduLayout);
|
clearInvocations(mMockCompatLayout, mMockLetterboxEduLayout);
|
||||||
|
|
||||||
// Verify button remains hidden after keyguard becomes not showing since IME is showing.
|
// Verify button remains hidden after keyguard becomes not showing since IME is showing.
|
||||||
mController.onKeyguardShowingChanged(false);
|
mController.onKeyguardVisibilityChanged(false, false, false);
|
||||||
|
|
||||||
verify(mMockCompatLayout).updateVisibility(false);
|
verify(mMockCompatLayout).updateVisibility(false);
|
||||||
verify(mMockLetterboxEduLayout).updateVisibility(false);
|
verify(mMockLetterboxEduLayout).updateVisibility(false);
|
||||||
@@ -378,7 +385,7 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
/* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN), mMockTaskListener);
|
/* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN), mMockTaskListener);
|
||||||
|
|
||||||
mController.onImeVisibilityChanged(DISPLAY_ID, /* isShowing= */ true);
|
mController.onImeVisibilityChanged(DISPLAY_ID, /* isShowing= */ true);
|
||||||
mController.onKeyguardShowingChanged(true);
|
mController.onKeyguardVisibilityChanged(true, false, false);
|
||||||
|
|
||||||
verify(mMockCompatLayout, times(2)).updateVisibility(false);
|
verify(mMockCompatLayout, times(2)).updateVisibility(false);
|
||||||
verify(mMockLetterboxEduLayout, times(2)).updateVisibility(false);
|
verify(mMockLetterboxEduLayout, times(2)).updateVisibility(false);
|
||||||
@@ -392,7 +399,7 @@ public class CompatUIControllerTest extends ShellTestCase {
|
|||||||
verify(mMockLetterboxEduLayout).updateVisibility(false);
|
verify(mMockLetterboxEduLayout).updateVisibility(false);
|
||||||
|
|
||||||
// Verify button is shown after keyguard becomes not showing.
|
// Verify button is shown after keyguard becomes not showing.
|
||||||
mController.onKeyguardShowingChanged(false);
|
mController.onKeyguardVisibilityChanged(false, false, false);
|
||||||
|
|
||||||
verify(mMockCompatLayout).updateVisibility(true);
|
verify(mMockCompatLayout).updateVisibility(true);
|
||||||
verify(mMockLetterboxEduLayout).updateVisibility(true);
|
verify(mMockLetterboxEduLayout).updateVisibility(true);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import androidx.test.filters.SmallTest;
|
|||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
|
||||||
import com.android.wm.shell.ShellTestCase;
|
import com.android.wm.shell.ShellTestCase;
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
|
||||||
import com.android.wm.shell.sysui.ShellController;
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -49,8 +48,6 @@ public class HideDisplayCutoutControllerTest extends ShellTestCase {
|
|||||||
private ShellController mShellController;
|
private ShellController mShellController;
|
||||||
@Mock
|
@Mock
|
||||||
private HideDisplayCutoutOrganizer mMockDisplayAreaOrganizer;
|
private HideDisplayCutoutOrganizer mMockDisplayAreaOrganizer;
|
||||||
@Mock
|
|
||||||
private ShellExecutor mMockMainExecutor;
|
|
||||||
|
|
||||||
private HideDisplayCutoutController mHideDisplayCutoutController;
|
private HideDisplayCutoutController mHideDisplayCutoutController;
|
||||||
|
|
||||||
@@ -58,7 +55,7 @@ public class HideDisplayCutoutControllerTest extends ShellTestCase {
|
|||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mHideDisplayCutoutController = new HideDisplayCutoutController(
|
mHideDisplayCutoutController = new HideDisplayCutoutController(
|
||||||
mContext, mShellController, mMockDisplayAreaOrganizer, mMockMainExecutor);
|
mContext, mShellController, mMockDisplayAreaOrganizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -148,6 +148,11 @@ public class OneHandedControllerTest extends OneHandedTestCase {
|
|||||||
verify(mMockShellController, times(1)).addConfigurationChangeListener(any());
|
verify(mMockShellController, times(1)).addConfigurationChangeListener(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testControllerRegistersKeyguardChangeListener() {
|
||||||
|
verify(mMockShellController, times(1)).addKeyguardChangeListener(any());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultShouldNotInOneHanded() {
|
public void testDefaultShouldNotInOneHanded() {
|
||||||
// Assert default transition state is STATE_NONE
|
// Assert default transition state is STATE_NONE
|
||||||
|
|||||||
@@ -122,6 +122,11 @@ public class PipControllerTest extends ShellTestCase {
|
|||||||
verify(mMockShellController, times(1)).addConfigurationChangeListener(any());
|
verify(mMockShellController, times(1)).addConfigurationChangeListener(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void instantiatePipController_registerKeyguardChangeListener() {
|
||||||
|
verify(mMockShellController, times(1)).addKeyguardChangeListener(any());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void instantiatePipController_registersPipTransitionCallback() {
|
public void instantiatePipController_registersPipTransitionCallback() {
|
||||||
verify(mMockPipTransitionController).registerPipTransitionCallback(any());
|
verify(mMockPipTransitionController).registerPipTransitionCallback(any());
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ import static org.mockito.ArgumentMatchers.any;
|
|||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
|
import static org.mockito.Mockito.times;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
@@ -44,10 +47,12 @@ import com.android.wm.shell.ShellTestCase;
|
|||||||
import com.android.wm.shell.common.DisplayController;
|
import com.android.wm.shell.common.DisplayController;
|
||||||
import com.android.wm.shell.common.DisplayImeController;
|
import com.android.wm.shell.common.DisplayImeController;
|
||||||
import com.android.wm.shell.common.DisplayInsetsController;
|
import com.android.wm.shell.common.DisplayInsetsController;
|
||||||
|
import com.android.wm.shell.common.DisplayLayout;
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||||
import com.android.wm.shell.common.TransactionPool;
|
import com.android.wm.shell.common.TransactionPool;
|
||||||
import com.android.wm.shell.recents.RecentTasksController;
|
import com.android.wm.shell.recents.RecentTasksController;
|
||||||
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
import com.android.wm.shell.transition.Transitions;
|
import com.android.wm.shell.transition.Transitions;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -65,6 +70,7 @@ import java.util.Optional;
|
|||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class SplitScreenControllerTests extends ShellTestCase {
|
public class SplitScreenControllerTests extends ShellTestCase {
|
||||||
|
|
||||||
|
@Mock ShellController mShellController;
|
||||||
@Mock ShellTaskOrganizer mTaskOrganizer;
|
@Mock ShellTaskOrganizer mTaskOrganizer;
|
||||||
@Mock SyncTransactionQueue mSyncQueue;
|
@Mock SyncTransactionQueue mSyncQueue;
|
||||||
@Mock RootTaskDisplayAreaOrganizer mRootTDAOrganizer;
|
@Mock RootTaskDisplayAreaOrganizer mRootTDAOrganizer;
|
||||||
@@ -82,10 +88,17 @@ public class SplitScreenControllerTests extends ShellTestCase {
|
|||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mSplitScreenController = spy(new SplitScreenController(mTaskOrganizer, mSyncQueue, mContext,
|
mSplitScreenController = spy(new SplitScreenController(mShellController, mTaskOrganizer,
|
||||||
mRootTDAOrganizer, mMainExecutor, mDisplayController, mDisplayImeController,
|
mSyncQueue, mContext, mRootTDAOrganizer, mMainExecutor, mDisplayController,
|
||||||
mDisplayInsetsController, mTransitions, mTransactionPool, mIconProvider,
|
mDisplayImeController, mDisplayInsetsController, mTransitions, mTransactionPool,
|
||||||
mRecentTasks));
|
mIconProvider, mRecentTasks));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testControllerRegistersKeyguardChangeListener() {
|
||||||
|
when(mDisplayController.getDisplayLayout(anyInt())).thenReturn(new DisplayLayout());
|
||||||
|
mSplitScreenController.onOrganizerRegistered();
|
||||||
|
verify(mShellController, times(1)).addKeyguardChangeListener(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -46,12 +46,14 @@ public class ShellControllerTest extends ShellTestCase {
|
|||||||
private ShellExecutor mExecutor;
|
private ShellExecutor mExecutor;
|
||||||
|
|
||||||
private ShellController mController;
|
private ShellController mController;
|
||||||
private TestConfigurationChangeListener mListener;
|
private TestConfigurationChangeListener mConfigChangeListener;
|
||||||
|
private TestKeyguardChangeListener mKeyguardChangeListener;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mListener = new TestConfigurationChangeListener();
|
mKeyguardChangeListener = new TestKeyguardChangeListener();
|
||||||
|
mConfigChangeListener = new TestConfigurationChangeListener();
|
||||||
mController = new ShellController(mExecutor);
|
mController = new ShellController(mExecutor);
|
||||||
mController.onConfigurationChanged(getConfigurationCopy());
|
mController.onConfigurationChanged(getConfigurationCopy());
|
||||||
}
|
}
|
||||||
@@ -61,48 +63,98 @@ public class ShellControllerTest extends ShellTestCase {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddKeyguardChangeListener_ensureCallback() {
|
||||||
|
mController.addKeyguardChangeListener(mKeyguardChangeListener);
|
||||||
|
|
||||||
|
mController.onKeyguardVisibilityChanged(true, false, false);
|
||||||
|
assertTrue(mKeyguardChangeListener.visibilityChanged == 1);
|
||||||
|
assertTrue(mKeyguardChangeListener.dismissAnimationFinished == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDoubleAddKeyguardChangeListener_ensureSingleCallback() {
|
||||||
|
mController.addKeyguardChangeListener(mKeyguardChangeListener);
|
||||||
|
mController.addKeyguardChangeListener(mKeyguardChangeListener);
|
||||||
|
|
||||||
|
mController.onKeyguardVisibilityChanged(true, false, false);
|
||||||
|
assertTrue(mKeyguardChangeListener.visibilityChanged == 1);
|
||||||
|
assertTrue(mKeyguardChangeListener.dismissAnimationFinished == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddRemoveKeyguardChangeListener_ensureNoCallback() {
|
||||||
|
mController.addKeyguardChangeListener(mKeyguardChangeListener);
|
||||||
|
mController.removeKeyguardChangeListener(mKeyguardChangeListener);
|
||||||
|
|
||||||
|
mController.onKeyguardVisibilityChanged(true, false, false);
|
||||||
|
assertTrue(mKeyguardChangeListener.visibilityChanged == 0);
|
||||||
|
assertTrue(mKeyguardChangeListener.dismissAnimationFinished == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testKeyguardVisibilityChanged() {
|
||||||
|
mController.addKeyguardChangeListener(mKeyguardChangeListener);
|
||||||
|
|
||||||
|
mController.onKeyguardVisibilityChanged(true, true, true);
|
||||||
|
assertTrue(mKeyguardChangeListener.visibilityChanged == 1);
|
||||||
|
assertTrue(mKeyguardChangeListener.lastAnimatingDismiss);
|
||||||
|
assertTrue(mKeyguardChangeListener.lastOccluded);
|
||||||
|
assertTrue(mKeyguardChangeListener.lastAnimatingDismiss);
|
||||||
|
assertTrue(mKeyguardChangeListener.dismissAnimationFinished == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testKeyguardDismissAnimationFinished() {
|
||||||
|
mController.addKeyguardChangeListener(mKeyguardChangeListener);
|
||||||
|
|
||||||
|
mController.onKeyguardDismissAnimationFinished();
|
||||||
|
assertTrue(mKeyguardChangeListener.visibilityChanged == 0);
|
||||||
|
assertTrue(mKeyguardChangeListener.dismissAnimationFinished == 1);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddConfigurationChangeListener_ensureCallback() {
|
public void testAddConfigurationChangeListener_ensureCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.densityDpi = 200;
|
newConfig.densityDpi = 200;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoubleAddConfigurationChangeListener_ensureSingleCallback() {
|
public void testDoubleAddConfigurationChangeListener_ensureSingleCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.densityDpi = 200;
|
newConfig.densityDpi = 200;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddRemoveConfigurationChangeListener_ensureNoCallback() {
|
public void testAddRemoveConfigurationChangeListener_ensureNoCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
mController.removeConfigurationChangeListener(mListener);
|
mController.removeConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.densityDpi = 200;
|
newConfig.densityDpi = 200;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 0);
|
assertTrue(mConfigChangeListener.configChanges == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultipleConfigurationChangeListeners() {
|
public void testMultipleConfigurationChangeListeners() {
|
||||||
TestConfigurationChangeListener listener2 = new TestConfigurationChangeListener();
|
TestConfigurationChangeListener listener2 = new TestConfigurationChangeListener();
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
mController.addConfigurationChangeListener(listener2);
|
mController.addConfigurationChangeListener(listener2);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.densityDpi = 200;
|
newConfig.densityDpi = 200;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
assertTrue(listener2.configChanges == 1);
|
assertTrue(listener2.configChanges == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +167,7 @@ public class ShellControllerTest extends ShellTestCase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
mController.addConfigurationChangeListener(badListener);
|
mController.addConfigurationChangeListener(badListener);
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
// Ensure we don't fail just because a listener was removed mid-callback
|
// Ensure we don't fail just because a listener was removed mid-callback
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
@@ -125,77 +177,77 @@ public class ShellControllerTest extends ShellTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDensityChangeCallback() {
|
public void testDensityChangeCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.densityDpi = 200;
|
newConfig.densityDpi = 200;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
assertTrue(mListener.densityChanges == 1);
|
assertTrue(mConfigChangeListener.densityChanges == 1);
|
||||||
assertTrue(mListener.smallestWidthChanges == 0);
|
assertTrue(mConfigChangeListener.smallestWidthChanges == 0);
|
||||||
assertTrue(mListener.themeChanges == 0);
|
assertTrue(mConfigChangeListener.themeChanges == 0);
|
||||||
assertTrue(mListener.localeChanges == 0);
|
assertTrue(mConfigChangeListener.localeChanges == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFontScaleChangeCallback() {
|
public void testFontScaleChangeCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.fontScale = 2;
|
newConfig.fontScale = 2;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
assertTrue(mListener.densityChanges == 1);
|
assertTrue(mConfigChangeListener.densityChanges == 1);
|
||||||
assertTrue(mListener.smallestWidthChanges == 0);
|
assertTrue(mConfigChangeListener.smallestWidthChanges == 0);
|
||||||
assertTrue(mListener.themeChanges == 0);
|
assertTrue(mConfigChangeListener.themeChanges == 0);
|
||||||
assertTrue(mListener.localeChanges == 0);
|
assertTrue(mConfigChangeListener.localeChanges == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSmallestWidthChangeCallback() {
|
public void testSmallestWidthChangeCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.smallestScreenWidthDp = 100;
|
newConfig.smallestScreenWidthDp = 100;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
assertTrue(mListener.densityChanges == 0);
|
assertTrue(mConfigChangeListener.densityChanges == 0);
|
||||||
assertTrue(mListener.smallestWidthChanges == 1);
|
assertTrue(mConfigChangeListener.smallestWidthChanges == 1);
|
||||||
assertTrue(mListener.themeChanges == 0);
|
assertTrue(mConfigChangeListener.themeChanges == 0);
|
||||||
assertTrue(mListener.localeChanges == 0);
|
assertTrue(mConfigChangeListener.localeChanges == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThemeChangeCallback() {
|
public void testThemeChangeCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.assetsSeq++;
|
newConfig.assetsSeq++;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
assertTrue(mListener.densityChanges == 0);
|
assertTrue(mConfigChangeListener.densityChanges == 0);
|
||||||
assertTrue(mListener.smallestWidthChanges == 0);
|
assertTrue(mConfigChangeListener.smallestWidthChanges == 0);
|
||||||
assertTrue(mListener.themeChanges == 1);
|
assertTrue(mConfigChangeListener.themeChanges == 1);
|
||||||
assertTrue(mListener.localeChanges == 0);
|
assertTrue(mConfigChangeListener.localeChanges == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNightModeChangeCallback() {
|
public void testNightModeChangeCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
newConfig.uiMode = Configuration.UI_MODE_NIGHT_YES;
|
newConfig.uiMode = Configuration.UI_MODE_NIGHT_YES;
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
assertTrue(mListener.densityChanges == 0);
|
assertTrue(mConfigChangeListener.densityChanges == 0);
|
||||||
assertTrue(mListener.smallestWidthChanges == 0);
|
assertTrue(mConfigChangeListener.smallestWidthChanges == 0);
|
||||||
assertTrue(mListener.themeChanges == 1);
|
assertTrue(mConfigChangeListener.themeChanges == 1);
|
||||||
assertTrue(mListener.localeChanges == 0);
|
assertTrue(mConfigChangeListener.localeChanges == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLocaleChangeCallback() {
|
public void testLocaleChangeCallback() {
|
||||||
mController.addConfigurationChangeListener(mListener);
|
mController.addConfigurationChangeListener(mConfigChangeListener);
|
||||||
|
|
||||||
Configuration newConfig = getConfigurationCopy();
|
Configuration newConfig = getConfigurationCopy();
|
||||||
// Just change the locales to be different
|
// Just change the locales to be different
|
||||||
@@ -205,11 +257,11 @@ public class ShellControllerTest extends ShellTestCase {
|
|||||||
newConfig.locale = Locale.CANADA;
|
newConfig.locale = Locale.CANADA;
|
||||||
}
|
}
|
||||||
mController.onConfigurationChanged(newConfig);
|
mController.onConfigurationChanged(newConfig);
|
||||||
assertTrue(mListener.configChanges == 1);
|
assertTrue(mConfigChangeListener.configChanges == 1);
|
||||||
assertTrue(mListener.densityChanges == 0);
|
assertTrue(mConfigChangeListener.densityChanges == 0);
|
||||||
assertTrue(mListener.smallestWidthChanges == 0);
|
assertTrue(mConfigChangeListener.smallestWidthChanges == 0);
|
||||||
assertTrue(mListener.themeChanges == 0);
|
assertTrue(mConfigChangeListener.themeChanges == 0);
|
||||||
assertTrue(mListener.localeChanges == 1);
|
assertTrue(mConfigChangeListener.localeChanges == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Configuration getConfigurationCopy() {
|
private Configuration getConfigurationCopy() {
|
||||||
@@ -253,4 +305,27 @@ public class ShellControllerTest extends ShellTestCase {
|
|||||||
localeChanges++;
|
localeChanges++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestKeyguardChangeListener implements KeyguardChangeListener {
|
||||||
|
// Counts of number of times each of the callbacks are called
|
||||||
|
public int visibilityChanged;
|
||||||
|
public boolean lastVisibility;
|
||||||
|
public boolean lastOccluded;
|
||||||
|
public boolean lastAnimatingDismiss;
|
||||||
|
public int dismissAnimationFinished;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyguardVisibilityChanged(boolean visible, boolean occluded,
|
||||||
|
boolean animatingDismiss) {
|
||||||
|
lastVisibility = visible;
|
||||||
|
lastOccluded = occluded;
|
||||||
|
lastAnimatingDismiss = animatingDismiss;
|
||||||
|
visibilityChanged++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyguardDismissAnimationFinished() {
|
||||||
|
dismissAnimationFinished++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021 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.tasksurfacehelper;
|
|
||||||
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
import android.testing.AndroidTestingRunner;
|
|
||||||
import android.view.SurfaceControl;
|
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
|
||||||
|
|
||||||
import com.android.wm.shell.ShellTaskOrganizer;
|
|
||||||
import com.android.wm.shell.ShellTestCase;
|
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.MockitoAnnotations;
|
|
||||||
|
|
||||||
@RunWith(AndroidTestingRunner.class)
|
|
||||||
@SmallTest
|
|
||||||
public class TaskSurfaceHelperControllerTest extends ShellTestCase {
|
|
||||||
private TaskSurfaceHelperController mTaskSurfaceHelperController;
|
|
||||||
@Mock
|
|
||||||
private ShellTaskOrganizer mMockTaskOrganizer;
|
|
||||||
@Mock
|
|
||||||
private ShellExecutor mMockShellExecutor;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
MockitoAnnotations.initMocks(this);
|
|
||||||
mTaskSurfaceHelperController = new TaskSurfaceHelperController(
|
|
||||||
mMockTaskOrganizer, mMockShellExecutor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSetGameModeForTask() {
|
|
||||||
mTaskSurfaceHelperController.setGameModeForTask(/*taskId*/1, /*gameMode*/3);
|
|
||||||
verify(mMockTaskOrganizer).setSurfaceMetadata(1, SurfaceControl.METADATA_GAME_MODE, 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -96,16 +96,12 @@ public abstract class SystemUIInitializer {
|
|||||||
.setSplitScreen(mWMComponent.getSplitScreen())
|
.setSplitScreen(mWMComponent.getSplitScreen())
|
||||||
.setOneHanded(mWMComponent.getOneHanded())
|
.setOneHanded(mWMComponent.getOneHanded())
|
||||||
.setBubbles(mWMComponent.getBubbles())
|
.setBubbles(mWMComponent.getBubbles())
|
||||||
.setHideDisplayCutout(mWMComponent.getHideDisplayCutout())
|
|
||||||
.setShellCommandHandler(mWMComponent.getShellCommandHandler())
|
.setShellCommandHandler(mWMComponent.getShellCommandHandler())
|
||||||
.setTaskViewFactory(mWMComponent.getTaskViewFactory())
|
.setTaskViewFactory(mWMComponent.getTaskViewFactory())
|
||||||
.setTransitions(mWMComponent.getTransitions())
|
.setTransitions(mWMComponent.getTransitions())
|
||||||
.setStartingSurface(mWMComponent.getStartingSurface())
|
.setStartingSurface(mWMComponent.getStartingSurface())
|
||||||
.setDisplayAreaHelper(mWMComponent.getDisplayAreaHelper())
|
.setDisplayAreaHelper(mWMComponent.getDisplayAreaHelper())
|
||||||
.setTaskSurfaceHelper(mWMComponent.getTaskSurfaceHelper())
|
|
||||||
.setRecentTasks(mWMComponent.getRecentTasks())
|
.setRecentTasks(mWMComponent.getRecentTasks())
|
||||||
.setCompatUI(mWMComponent.getCompatUI())
|
|
||||||
.setDragAndDrop(mWMComponent.getDragAndDrop())
|
|
||||||
.setBackAnimation(mWMComponent.getBackAnimation());
|
.setBackAnimation(mWMComponent.getBackAnimation());
|
||||||
} else {
|
} else {
|
||||||
// TODO: Call on prepareSysUIComponentBuilder but not with real components. Other option
|
// TODO: Call on prepareSysUIComponentBuilder but not with real components. Other option
|
||||||
@@ -116,16 +112,12 @@ public abstract class SystemUIInitializer {
|
|||||||
.setSplitScreen(Optional.ofNullable(null))
|
.setSplitScreen(Optional.ofNullable(null))
|
||||||
.setOneHanded(Optional.ofNullable(null))
|
.setOneHanded(Optional.ofNullable(null))
|
||||||
.setBubbles(Optional.ofNullable(null))
|
.setBubbles(Optional.ofNullable(null))
|
||||||
.setHideDisplayCutout(Optional.ofNullable(null))
|
|
||||||
.setShellCommandHandler(Optional.ofNullable(null))
|
.setShellCommandHandler(Optional.ofNullable(null))
|
||||||
.setTaskViewFactory(Optional.ofNullable(null))
|
.setTaskViewFactory(Optional.ofNullable(null))
|
||||||
.setTransitions(new ShellTransitions() {})
|
.setTransitions(new ShellTransitions() {})
|
||||||
.setDisplayAreaHelper(Optional.ofNullable(null))
|
.setDisplayAreaHelper(Optional.ofNullable(null))
|
||||||
.setStartingSurface(Optional.ofNullable(null))
|
.setStartingSurface(Optional.ofNullable(null))
|
||||||
.setTaskSurfaceHelper(Optional.ofNullable(null))
|
|
||||||
.setRecentTasks(Optional.ofNullable(null))
|
.setRecentTasks(Optional.ofNullable(null))
|
||||||
.setCompatUI(Optional.ofNullable(null))
|
|
||||||
.setDragAndDrop(Optional.ofNullable(null))
|
|
||||||
.setBackAnimation(Optional.ofNullable(null));
|
.setBackAnimation(Optional.ofNullable(null));
|
||||||
}
|
}
|
||||||
mSysUIComponent = builder.build();
|
mSysUIComponent = builder.build();
|
||||||
|
|||||||
@@ -41,17 +41,13 @@ import com.android.wm.shell.ShellCommandHandler;
|
|||||||
import com.android.wm.shell.TaskViewFactory;
|
import com.android.wm.shell.TaskViewFactory;
|
||||||
import com.android.wm.shell.back.BackAnimation;
|
import com.android.wm.shell.back.BackAnimation;
|
||||||
import com.android.wm.shell.bubbles.Bubbles;
|
import com.android.wm.shell.bubbles.Bubbles;
|
||||||
import com.android.wm.shell.compatui.CompatUI;
|
|
||||||
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
|
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
|
||||||
import com.android.wm.shell.draganddrop.DragAndDrop;
|
|
||||||
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout;
|
|
||||||
import com.android.wm.shell.onehanded.OneHanded;
|
import com.android.wm.shell.onehanded.OneHanded;
|
||||||
import com.android.wm.shell.pip.Pip;
|
import com.android.wm.shell.pip.Pip;
|
||||||
import com.android.wm.shell.recents.RecentTasks;
|
import com.android.wm.shell.recents.RecentTasks;
|
||||||
import com.android.wm.shell.splitscreen.SplitScreen;
|
import com.android.wm.shell.splitscreen.SplitScreen;
|
||||||
import com.android.wm.shell.startingsurface.StartingSurface;
|
import com.android.wm.shell.startingsurface.StartingSurface;
|
||||||
import com.android.wm.shell.sysui.ShellInterface;
|
import com.android.wm.shell.sysui.ShellInterface;
|
||||||
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelper;
|
|
||||||
import com.android.wm.shell.transition.ShellTransitions;
|
import com.android.wm.shell.transition.ShellTransitions;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -99,9 +95,6 @@ public interface SysUIComponent {
|
|||||||
@BindsInstance
|
@BindsInstance
|
||||||
Builder setTaskViewFactory(Optional<TaskViewFactory> t);
|
Builder setTaskViewFactory(Optional<TaskViewFactory> t);
|
||||||
|
|
||||||
@BindsInstance
|
|
||||||
Builder setHideDisplayCutout(Optional<HideDisplayCutout> h);
|
|
||||||
|
|
||||||
@BindsInstance
|
@BindsInstance
|
||||||
Builder setShellCommandHandler(Optional<ShellCommandHandler> shellDump);
|
Builder setShellCommandHandler(Optional<ShellCommandHandler> shellDump);
|
||||||
|
|
||||||
@@ -114,18 +107,9 @@ public interface SysUIComponent {
|
|||||||
@BindsInstance
|
@BindsInstance
|
||||||
Builder setDisplayAreaHelper(Optional<DisplayAreaHelper> h);
|
Builder setDisplayAreaHelper(Optional<DisplayAreaHelper> h);
|
||||||
|
|
||||||
@BindsInstance
|
|
||||||
Builder setTaskSurfaceHelper(Optional<TaskSurfaceHelper> t);
|
|
||||||
|
|
||||||
@BindsInstance
|
@BindsInstance
|
||||||
Builder setRecentTasks(Optional<RecentTasks> r);
|
Builder setRecentTasks(Optional<RecentTasks> r);
|
||||||
|
|
||||||
@BindsInstance
|
|
||||||
Builder setCompatUI(Optional<CompatUI> s);
|
|
||||||
|
|
||||||
@BindsInstance
|
|
||||||
Builder setDragAndDrop(Optional<DragAndDrop> d);
|
|
||||||
|
|
||||||
@BindsInstance
|
@BindsInstance
|
||||||
Builder setBackAnimation(Optional<BackAnimation> b);
|
Builder setBackAnimation(Optional<BackAnimation> b);
|
||||||
|
|
||||||
|
|||||||
@@ -29,20 +29,16 @@ import com.android.wm.shell.TaskViewFactory;
|
|||||||
import com.android.wm.shell.back.BackAnimation;
|
import com.android.wm.shell.back.BackAnimation;
|
||||||
import com.android.wm.shell.bubbles.Bubbles;
|
import com.android.wm.shell.bubbles.Bubbles;
|
||||||
import com.android.wm.shell.common.annotations.ShellMainThread;
|
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||||
import com.android.wm.shell.compatui.CompatUI;
|
|
||||||
import com.android.wm.shell.dagger.TvWMShellModule;
|
import com.android.wm.shell.dagger.TvWMShellModule;
|
||||||
import com.android.wm.shell.dagger.WMShellModule;
|
import com.android.wm.shell.dagger.WMShellModule;
|
||||||
import com.android.wm.shell.dagger.WMSingleton;
|
import com.android.wm.shell.dagger.WMSingleton;
|
||||||
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
|
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
|
||||||
import com.android.wm.shell.draganddrop.DragAndDrop;
|
|
||||||
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout;
|
|
||||||
import com.android.wm.shell.onehanded.OneHanded;
|
import com.android.wm.shell.onehanded.OneHanded;
|
||||||
import com.android.wm.shell.pip.Pip;
|
import com.android.wm.shell.pip.Pip;
|
||||||
import com.android.wm.shell.recents.RecentTasks;
|
import com.android.wm.shell.recents.RecentTasks;
|
||||||
import com.android.wm.shell.splitscreen.SplitScreen;
|
import com.android.wm.shell.splitscreen.SplitScreen;
|
||||||
import com.android.wm.shell.startingsurface.StartingSurface;
|
import com.android.wm.shell.startingsurface.StartingSurface;
|
||||||
import com.android.wm.shell.sysui.ShellInterface;
|
import com.android.wm.shell.sysui.ShellInterface;
|
||||||
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelper;
|
|
||||||
import com.android.wm.shell.transition.ShellTransitions;
|
import com.android.wm.shell.transition.ShellTransitions;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -103,9 +99,6 @@ public interface WMComponent {
|
|||||||
@WMSingleton
|
@WMSingleton
|
||||||
Optional<Bubbles> getBubbles();
|
Optional<Bubbles> getBubbles();
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
Optional<HideDisplayCutout> getHideDisplayCutout();
|
|
||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
Optional<TaskViewFactory> getTaskViewFactory();
|
Optional<TaskViewFactory> getTaskViewFactory();
|
||||||
|
|
||||||
@@ -118,18 +111,9 @@ public interface WMComponent {
|
|||||||
@WMSingleton
|
@WMSingleton
|
||||||
Optional<DisplayAreaHelper> getDisplayAreaHelper();
|
Optional<DisplayAreaHelper> getDisplayAreaHelper();
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
Optional<TaskSurfaceHelper> getTaskSurfaceHelper();
|
|
||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
Optional<RecentTasks> getRecentTasks();
|
Optional<RecentTasks> getRecentTasks();
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
Optional<CompatUI> getCompatUI();
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
Optional<DragAndDrop> getDragAndDrop();
|
|
||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
Optional<BackAnimation> getBackAnimation();
|
Optional<BackAnimation> getBackAnimation();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import android.app.NotificationChannel;
|
|||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
|||||||
@@ -55,9 +55,6 @@ import com.android.systemui.statusbar.policy.UserInfoController;
|
|||||||
import com.android.systemui.tracing.ProtoTracer;
|
import com.android.systemui.tracing.ProtoTracer;
|
||||||
import com.android.systemui.tracing.nano.SystemUiTraceProto;
|
import com.android.systemui.tracing.nano.SystemUiTraceProto;
|
||||||
import com.android.wm.shell.ShellCommandHandler;
|
import com.android.wm.shell.ShellCommandHandler;
|
||||||
import com.android.wm.shell.compatui.CompatUI;
|
|
||||||
import com.android.wm.shell.draganddrop.DragAndDrop;
|
|
||||||
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout;
|
|
||||||
import com.android.wm.shell.nano.WmShellTraceProto;
|
import com.android.wm.shell.nano.WmShellTraceProto;
|
||||||
import com.android.wm.shell.onehanded.OneHanded;
|
import com.android.wm.shell.onehanded.OneHanded;
|
||||||
import com.android.wm.shell.onehanded.OneHandedEventCallback;
|
import com.android.wm.shell.onehanded.OneHandedEventCallback;
|
||||||
@@ -110,10 +107,7 @@ public final class WMShell extends CoreStartable
|
|||||||
private final Optional<Pip> mPipOptional;
|
private final Optional<Pip> mPipOptional;
|
||||||
private final Optional<SplitScreen> mSplitScreenOptional;
|
private final Optional<SplitScreen> mSplitScreenOptional;
|
||||||
private final Optional<OneHanded> mOneHandedOptional;
|
private final Optional<OneHanded> mOneHandedOptional;
|
||||||
private final Optional<HideDisplayCutout> mHideDisplayCutoutOptional;
|
|
||||||
private final Optional<ShellCommandHandler> mShellCommandHandler;
|
private final Optional<ShellCommandHandler> mShellCommandHandler;
|
||||||
private final Optional<CompatUI> mCompatUIOptional;
|
|
||||||
private final Optional<DragAndDrop> mDragAndDropOptional;
|
|
||||||
|
|
||||||
private final CommandQueue mCommandQueue;
|
private final CommandQueue mCommandQueue;
|
||||||
private final ConfigurationController mConfigurationController;
|
private final ConfigurationController mConfigurationController;
|
||||||
@@ -127,10 +121,7 @@ public final class WMShell extends CoreStartable
|
|||||||
private final Executor mSysUiMainExecutor;
|
private final Executor mSysUiMainExecutor;
|
||||||
|
|
||||||
private boolean mIsSysUiStateValid;
|
private boolean mIsSysUiStateValid;
|
||||||
private KeyguardUpdateMonitorCallback mSplitScreenKeyguardCallback;
|
|
||||||
private KeyguardUpdateMonitorCallback mPipKeyguardCallback;
|
|
||||||
private KeyguardUpdateMonitorCallback mOneHandedKeyguardCallback;
|
private KeyguardUpdateMonitorCallback mOneHandedKeyguardCallback;
|
||||||
private KeyguardStateController.Callback mCompatUIKeyguardCallback;
|
|
||||||
private WakefulnessLifecycle.Observer mWakefulnessObserver;
|
private WakefulnessLifecycle.Observer mWakefulnessObserver;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -139,10 +130,7 @@ public final class WMShell extends CoreStartable
|
|||||||
Optional<Pip> pipOptional,
|
Optional<Pip> pipOptional,
|
||||||
Optional<SplitScreen> splitScreenOptional,
|
Optional<SplitScreen> splitScreenOptional,
|
||||||
Optional<OneHanded> oneHandedOptional,
|
Optional<OneHanded> oneHandedOptional,
|
||||||
Optional<HideDisplayCutout> hideDisplayCutoutOptional,
|
|
||||||
Optional<ShellCommandHandler> shellCommandHandler,
|
Optional<ShellCommandHandler> shellCommandHandler,
|
||||||
Optional<CompatUI> sizeCompatUIOptional,
|
|
||||||
Optional<DragAndDrop> dragAndDropOptional,
|
|
||||||
CommandQueue commandQueue,
|
CommandQueue commandQueue,
|
||||||
ConfigurationController configurationController,
|
ConfigurationController configurationController,
|
||||||
KeyguardStateController keyguardStateController,
|
KeyguardStateController keyguardStateController,
|
||||||
@@ -164,12 +152,9 @@ public final class WMShell extends CoreStartable
|
|||||||
mPipOptional = pipOptional;
|
mPipOptional = pipOptional;
|
||||||
mSplitScreenOptional = splitScreenOptional;
|
mSplitScreenOptional = splitScreenOptional;
|
||||||
mOneHandedOptional = oneHandedOptional;
|
mOneHandedOptional = oneHandedOptional;
|
||||||
mHideDisplayCutoutOptional = hideDisplayCutoutOptional;
|
|
||||||
mWakefulnessLifecycle = wakefulnessLifecycle;
|
mWakefulnessLifecycle = wakefulnessLifecycle;
|
||||||
mProtoTracer = protoTracer;
|
mProtoTracer = protoTracer;
|
||||||
mShellCommandHandler = shellCommandHandler;
|
mShellCommandHandler = shellCommandHandler;
|
||||||
mCompatUIOptional = sizeCompatUIOptional;
|
|
||||||
mDragAndDropOptional = dragAndDropOptional;
|
|
||||||
mUserInfoController = userInfoController;
|
mUserInfoController = userInfoController;
|
||||||
mSysUiMainExecutor = sysUiMainExecutor;
|
mSysUiMainExecutor = sysUiMainExecutor;
|
||||||
}
|
}
|
||||||
@@ -185,6 +170,22 @@ public final class WMShell extends CoreStartable
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Subscribe to keyguard changes
|
||||||
|
mKeyguardStateController.addCallback(new KeyguardStateController.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onKeyguardShowingChanged() {
|
||||||
|
mShell.onKeyguardVisibilityChanged(mKeyguardStateController.isShowing(),
|
||||||
|
mKeyguardStateController.isOccluded(),
|
||||||
|
mKeyguardStateController.isAnimatingBetweenKeyguardAndSurfaceBehind());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mKeyguardUpdateMonitor.registerCallback(new KeyguardUpdateMonitorCallback() {
|
||||||
|
@Override
|
||||||
|
public void onKeyguardDismissAnimationFinished() {
|
||||||
|
mShell.onKeyguardDismissAnimationFinished();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// TODO: Consider piping config change and other common calls to a shell component to
|
// TODO: Consider piping config change and other common calls to a shell component to
|
||||||
// delegate internally
|
// delegate internally
|
||||||
mProtoTracer.add(this);
|
mProtoTracer.add(this);
|
||||||
@@ -192,7 +193,6 @@ public final class WMShell extends CoreStartable
|
|||||||
mPipOptional.ifPresent(this::initPip);
|
mPipOptional.ifPresent(this::initPip);
|
||||||
mSplitScreenOptional.ifPresent(this::initSplitScreen);
|
mSplitScreenOptional.ifPresent(this::initSplitScreen);
|
||||||
mOneHandedOptional.ifPresent(this::initOneHanded);
|
mOneHandedOptional.ifPresent(this::initOneHanded);
|
||||||
mCompatUIOptional.ifPresent(this::initCompatUi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -204,20 +204,6 @@ public final class WMShell extends CoreStartable
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mPipKeyguardCallback = new KeyguardUpdateMonitorCallback() {
|
|
||||||
@Override
|
|
||||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
|
||||||
pip.onKeyguardVisibilityChanged(showing,
|
|
||||||
mKeyguardStateController.isAnimatingBetweenKeyguardAndSurfaceBehind());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKeyguardDismissAnimationFinished() {
|
|
||||||
pip.onKeyguardDismissAnimationFinished();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mKeyguardUpdateMonitor.registerCallback(mPipKeyguardCallback);
|
|
||||||
|
|
||||||
mSysUiState.addCallback(sysUiStateFlag -> {
|
mSysUiState.addCallback(sysUiStateFlag -> {
|
||||||
mIsSysUiStateValid = (sysUiStateFlag & INVALID_SYSUI_STATE_MASK) == 0;
|
mIsSysUiStateValid = (sysUiStateFlag & INVALID_SYSUI_STATE_MASK) == 0;
|
||||||
pip.onSystemUiStateChanged(mIsSysUiStateValid, sysUiStateFlag);
|
pip.onSystemUiStateChanged(mIsSysUiStateValid, sysUiStateFlag);
|
||||||
@@ -230,14 +216,6 @@ public final class WMShell extends CoreStartable
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void initSplitScreen(SplitScreen splitScreen) {
|
void initSplitScreen(SplitScreen splitScreen) {
|
||||||
mSplitScreenKeyguardCallback = new KeyguardUpdateMonitorCallback() {
|
|
||||||
@Override
|
|
||||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
|
||||||
splitScreen.onKeyguardVisibilityChanged(showing);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mKeyguardUpdateMonitor.registerCallback(mSplitScreenKeyguardCallback);
|
|
||||||
|
|
||||||
mWakefulnessLifecycle.addObserver(new WakefulnessLifecycle.Observer() {
|
mWakefulnessLifecycle.addObserver(new WakefulnessLifecycle.Observer() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinishedWakingUp() {
|
public void onFinishedWakingUp() {
|
||||||
@@ -283,13 +261,8 @@ public final class WMShell extends CoreStartable
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: Either move into ShellInterface or register a receiver on the Shell side directly
|
||||||
mOneHandedKeyguardCallback = new KeyguardUpdateMonitorCallback() {
|
mOneHandedKeyguardCallback = new KeyguardUpdateMonitorCallback() {
|
||||||
@Override
|
|
||||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
|
||||||
oneHanded.onKeyguardVisibilityChanged(showing);
|
|
||||||
oneHanded.stopOneHanded();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUserSwitchComplete(int userId) {
|
public void onUserSwitchComplete(int userId) {
|
||||||
oneHanded.onUserSwitch(userId);
|
oneHanded.onUserSwitch(userId);
|
||||||
@@ -340,17 +313,6 @@ public final class WMShell extends CoreStartable
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
void initCompatUi(CompatUI sizeCompatUI) {
|
|
||||||
mCompatUIKeyguardCallback = new KeyguardStateController.Callback() {
|
|
||||||
@Override
|
|
||||||
public void onKeyguardShowingChanged() {
|
|
||||||
sizeCompatUI.onKeyguardShowingChanged(mKeyguardStateController.isShowing());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mKeyguardStateController.addCallback(mCompatUIKeyguardCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToProto(SystemUiTraceProto proto) {
|
public void writeToProto(SystemUiTraceProto proto) {
|
||||||
if (proto.wmShell == null) {
|
if (proto.wmShell == null) {
|
||||||
|
|||||||
@@ -24,12 +24,10 @@ import android.test.suitebuilder.annotation.SmallTest;
|
|||||||
import androidx.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||||
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.keyguard.ScreenLifecycle;
|
import com.android.systemui.keyguard.ScreenLifecycle;
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||||
import com.android.systemui.model.SysUiState;
|
import com.android.systemui.model.SysUiState;
|
||||||
import com.android.systemui.navigationbar.NavigationModeController;
|
|
||||||
import com.android.systemui.statusbar.CommandQueue;
|
import com.android.systemui.statusbar.CommandQueue;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
@@ -37,9 +35,6 @@ import com.android.systemui.statusbar.policy.UserInfoController;
|
|||||||
import com.android.systemui.tracing.ProtoTracer;
|
import com.android.systemui.tracing.ProtoTracer;
|
||||||
import com.android.wm.shell.ShellCommandHandler;
|
import com.android.wm.shell.ShellCommandHandler;
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
import com.android.wm.shell.compatui.CompatUI;
|
|
||||||
import com.android.wm.shell.draganddrop.DragAndDrop;
|
|
||||||
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout;
|
|
||||||
import com.android.wm.shell.onehanded.OneHanded;
|
import com.android.wm.shell.onehanded.OneHanded;
|
||||||
import com.android.wm.shell.onehanded.OneHandedEventCallback;
|
import com.android.wm.shell.onehanded.OneHandedEventCallback;
|
||||||
import com.android.wm.shell.onehanded.OneHandedTransitionCallback;
|
import com.android.wm.shell.onehanded.OneHandedTransitionCallback;
|
||||||
@@ -71,31 +66,25 @@ public class WMShellTest extends SysuiTestCase {
|
|||||||
@Mock ConfigurationController mConfigurationController;
|
@Mock ConfigurationController mConfigurationController;
|
||||||
@Mock KeyguardStateController mKeyguardStateController;
|
@Mock KeyguardStateController mKeyguardStateController;
|
||||||
@Mock KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
@Mock KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||||
@Mock NavigationModeController mNavigationModeController;
|
|
||||||
@Mock ScreenLifecycle mScreenLifecycle;
|
@Mock ScreenLifecycle mScreenLifecycle;
|
||||||
@Mock SysUiState mSysUiState;
|
@Mock SysUiState mSysUiState;
|
||||||
@Mock Pip mPip;
|
@Mock Pip mPip;
|
||||||
@Mock SplitScreen mSplitScreen;
|
@Mock SplitScreen mSplitScreen;
|
||||||
@Mock OneHanded mOneHanded;
|
@Mock OneHanded mOneHanded;
|
||||||
@Mock HideDisplayCutout mHideDisplayCutout;
|
|
||||||
@Mock WakefulnessLifecycle mWakefulnessLifecycle;
|
@Mock WakefulnessLifecycle mWakefulnessLifecycle;
|
||||||
@Mock ProtoTracer mProtoTracer;
|
@Mock ProtoTracer mProtoTracer;
|
||||||
@Mock ShellCommandHandler mShellCommandHandler;
|
@Mock ShellCommandHandler mShellCommandHandler;
|
||||||
@Mock CompatUI mCompatUI;
|
|
||||||
@Mock UserInfoController mUserInfoController;
|
@Mock UserInfoController mUserInfoController;
|
||||||
@Mock ShellExecutor mSysUiMainExecutor;
|
@Mock ShellExecutor mSysUiMainExecutor;
|
||||||
@Mock DragAndDrop mDragAndDrop;
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
|
|
||||||
mWMShell = new WMShell(mContext, mShellInterface, Optional.of(mPip),
|
mWMShell = new WMShell(mContext, mShellInterface, Optional.of(mPip),
|
||||||
Optional.of(mSplitScreen), Optional.of(mOneHanded), Optional.of(mHideDisplayCutout),
|
Optional.of(mSplitScreen), Optional.of(mOneHanded),
|
||||||
Optional.of(mShellCommandHandler), Optional.of(mCompatUI),
|
Optional.of(mShellCommandHandler), mCommandQueue, mConfigurationController,
|
||||||
Optional.of(mDragAndDrop),
|
mKeyguardStateController, mKeyguardUpdateMonitor, mScreenLifecycle, mSysUiState,
|
||||||
mCommandQueue, mConfigurationController, mKeyguardStateController,
|
|
||||||
mKeyguardUpdateMonitor, mScreenLifecycle, mSysUiState,
|
|
||||||
mProtoTracer, mWakefulnessLifecycle, mUserInfoController, mSysUiMainExecutor);
|
mProtoTracer, mWakefulnessLifecycle, mUserInfoController, mSysUiMainExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,28 +95,13 @@ public class WMShellTest extends SysuiTestCase {
|
|||||||
verify(mCommandQueue).addCallback(any(CommandQueue.Callbacks.class));
|
verify(mCommandQueue).addCallback(any(CommandQueue.Callbacks.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initSplitScreen_registersCallbacks() {
|
|
||||||
mWMShell.initSplitScreen(mSplitScreen);
|
|
||||||
|
|
||||||
verify(mKeyguardUpdateMonitor).registerCallback(any(KeyguardUpdateMonitorCallback.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void initOneHanded_registersCallbacks() {
|
public void initOneHanded_registersCallbacks() {
|
||||||
mWMShell.initOneHanded(mOneHanded);
|
mWMShell.initOneHanded(mOneHanded);
|
||||||
|
|
||||||
verify(mKeyguardUpdateMonitor).registerCallback(any(KeyguardUpdateMonitorCallback.class));
|
|
||||||
verify(mCommandQueue).addCallback(any(CommandQueue.Callbacks.class));
|
verify(mCommandQueue).addCallback(any(CommandQueue.Callbacks.class));
|
||||||
verify(mScreenLifecycle).addObserver(any(ScreenLifecycle.Observer.class));
|
verify(mScreenLifecycle).addObserver(any(ScreenLifecycle.Observer.class));
|
||||||
verify(mOneHanded).registerTransitionCallback(any(OneHandedTransitionCallback.class));
|
verify(mOneHanded).registerTransitionCallback(any(OneHandedTransitionCallback.class));
|
||||||
verify(mOneHanded).registerEventCallback(any(OneHandedEventCallback.class));
|
verify(mOneHanded).registerEventCallback(any(OneHandedEventCallback.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initCompatUI_registersCallbacks() {
|
|
||||||
mWMShell.initCompatUi(mCompatUI);
|
|
||||||
|
|
||||||
verify(mKeyguardStateController).addCallback(any(KeyguardStateController.Callback.class));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user