1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.wm.shell.desktopmode; 18 19 import android.app.ActivityManager.RunningTaskInfo; 20 import android.content.Intent; 21 import android.os.Bundle; 22 import android.window.RemoteTransition; 23 import com.android.wm.shell.desktopmode.IDesktopTaskListener; 24 import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource; 25 import com.android.wm.shell.shared.desktopmode.DesktopTaskToFrontReason; 26 import com.android.wm.shell.desktopmode.IMoveToDesktopCallback; 27 28 /** 29 * Interface that is exposed to remote callers to manipulate desktop mode features. 30 */ 31 interface IDesktopMode { 32 /** If possible, creates a new desk on the display whose ID is `displayId`. */ createDesk(int displayId)33 oneway void createDesk(int displayId); 34 35 /** Activates the desk whose ID is `deskId` on whatever display it currently exists on. */ activateDesk(int deskId, in RemoteTransition remoteTransition)36 oneway void activateDesk(int deskId, in RemoteTransition remoteTransition); 37 38 /** Removes the desk with the given `deskId`. */ removeDesk(int deskId)39 oneway void removeDesk(int deskId); 40 41 /** Removes all the available desks on all displays. */ removeAllDesks()42 oneway void removeAllDesks(); 43 44 /** Show apps on the desktop on the given display */ showDesktopApps(int displayId, in RemoteTransition remoteTransition)45 void showDesktopApps(int displayId, in RemoteTransition remoteTransition); 46 47 /** @deprecated use {@link #showDesktopApps} instead. */ stashDesktopApps(int displayId)48 void stashDesktopApps(int displayId); 49 50 /** @deprecated this is no longer supported. */ hideStashedDesktopApps(int displayId)51 void hideStashedDesktopApps(int displayId); 52 53 /** 54 * Bring task with the given id to front, using the given remote transition. 55 * 56 * <p> Note: beyond moving a task to the front, this method will minimize a task if we reach the 57 * Desktop task limit, so {@code remoteTransition} should also handle any such minimize change. 58 */ showDesktopApp(int taskId, in @nullable RemoteTransition remoteTransition, in DesktopTaskToFrontReason toFrontReason)59 oneway void showDesktopApp(int taskId, in @nullable RemoteTransition remoteTransition, 60 in DesktopTaskToFrontReason toFrontReason); 61 62 /** Perform cleanup transactions after the animation to split select is complete */ onDesktopSplitSelectAnimComplete(in RunningTaskInfo taskInfo)63 oneway void onDesktopSplitSelectAnimComplete(in RunningTaskInfo taskInfo); 64 65 /** Set listener that will receive callbacks about updates to desktop tasks */ setTaskListener(IDesktopTaskListener listener)66 oneway void setTaskListener(IDesktopTaskListener listener); 67 68 /** Move a task with given `taskId` to desktop */ moveToDesktop(int taskId, in DesktopModeTransitionSource transitionSource, in @nullable RemoteTransition remoteTransition, in @nullable IMoveToDesktopCallback callback)69 void moveToDesktop(int taskId, in DesktopModeTransitionSource transitionSource, 70 in @nullable RemoteTransition remoteTransition, 71 in @nullable IMoveToDesktopCallback callback); 72 73 /** 74 * Removes the default desktop on the given display. 75 * @deprecated with multi-desks, we should use `removeDesk()`. 76 */ removeDefaultDeskInDisplay(int displayId)77 oneway void removeDefaultDeskInDisplay(int displayId); 78 79 /** Move a task with given `taskId` to external display */ moveToExternalDisplay(int taskId)80 void moveToExternalDisplay(int taskId); 81 82 /** Start a transition when launching an intent in desktop mode */ startLaunchIntentTransition(in Intent intent, in Bundle options, in int displayId)83 void startLaunchIntentTransition(in Intent intent, in Bundle options, in int displayId); 84 } 85