1 /* 2 * Copyright (C) 2021 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.splitscreen; 18 19 import android.app.PendingIntent; 20 import android.content.Intent; 21 import android.content.pm.ShortcutInfo; 22 import android.os.Bundle; 23 import android.os.UserHandle; 24 import com.android.internal.logging.InstanceId; 25 import android.view.RemoteAnimationAdapter; 26 import android.view.RemoteAnimationTarget; 27 import android.window.RemoteTransition; 28 29 import com.android.wm.shell.splitscreen.ISplitScreenListener; 30 import com.android.wm.shell.splitscreen.ISplitSelectListener; 31 32 /** 33 * Interface that is exposed to remote callers to manipulate the splitscreen feature. 34 */ 35 interface ISplitScreen { 36 37 /** 38 * Registers a split screen listener. 39 */ 40 oneway void registerSplitScreenListener(in ISplitScreenListener listener) = 1; 41 42 /** 43 * Unregisters a split screen listener. 44 */ 45 oneway void unregisterSplitScreenListener(in ISplitScreenListener listener) = 2; 46 47 /** 48 * Registers a split select listener. 49 */ 50 oneway void registerSplitSelectListener(in ISplitSelectListener listener) = 20; 51 52 /** 53 * Unregisters a split select listener. 54 */ 55 oneway void unregisterSplitSelectListener(in ISplitSelectListener listener) = 21; 56 57 /** 58 * Removes a task from the side stage. 59 */ removeFromSideStage(int taskId)60 oneway void removeFromSideStage(int taskId) = 4; 61 62 /** 63 * Removes the split-screen stages and leaving indicated task to top. Passing INVALID_TASK_ID 64 * to indicate leaving no top task after leaving split-screen. 65 */ exitSplitScreen(int toTopTaskId)66 oneway void exitSplitScreen(int toTopTaskId) = 5; 67 68 /** 69 * @param exitSplitScreenOnHide if to exit split-screen if both stages are not visible. 70 */ exitSplitScreenOnHide(boolean exitSplitScreenOnHide)71 oneway void exitSplitScreenOnHide(boolean exitSplitScreenOnHide) = 6; 72 73 /** 74 * Starts a task in a stage. 75 */ startTask(int taskId, int position, in Bundle options)76 oneway void startTask(int taskId, int position, in Bundle options) = 7; 77 78 /** 79 * Starts a shortcut in a stage. 80 */ startShortcut(String packageName, String shortcutId, int position, in Bundle options, in UserHandle user, in InstanceId instanceId)81 oneway void startShortcut(String packageName, String shortcutId, int position, 82 in Bundle options, in UserHandle user, in InstanceId instanceId) = 8; 83 84 /** 85 * Starts an activity in a stage. 86 */ startIntent(in PendingIntent intent, int userId, in Intent fillInIntent, int position, in Bundle options, in InstanceId instanceId)87 oneway void startIntent(in PendingIntent intent, int userId, in Intent fillInIntent, 88 int position, in Bundle options, in InstanceId instanceId) = 9; 89 90 /** 91 * Starts tasks simultaneously in one transition. 92 */ startTasks(int taskId1, in Bundle options1, int taskId2, in Bundle options2, int splitPosition, int snapPosition, in RemoteTransition remoteTransition, in InstanceId instanceId)93 oneway void startTasks(int taskId1, in Bundle options1, int taskId2, in Bundle options2, 94 int splitPosition, int snapPosition, in RemoteTransition remoteTransition, 95 in InstanceId instanceId) = 10; 96 97 /** 98 * Starts a pair of intent and task in one transition. 99 */ startIntentAndTask(in PendingIntent pendingIntent, int userId1, in Bundle options1, int taskId, in Bundle options2, int sidePosition, int snapPosition, in RemoteTransition remoteTransition, in InstanceId instanceId)100 oneway void startIntentAndTask(in PendingIntent pendingIntent, int userId1, in Bundle options1, 101 int taskId, in Bundle options2, int sidePosition, int snapPosition, 102 in RemoteTransition remoteTransition, in InstanceId instanceId) = 16; 103 104 /** 105 * Starts a pair of shortcut and task in one transition. 106 */ startShortcutAndTask(in ShortcutInfo shortcutInfo, in Bundle options1, int taskId, in Bundle options2, int splitPosition, int snapPosition, in RemoteTransition remoteTransition, in InstanceId instanceId)107 oneway void startShortcutAndTask(in ShortcutInfo shortcutInfo, in Bundle options1, int taskId, 108 in Bundle options2, int splitPosition, int snapPosition, 109 in RemoteTransition remoteTransition, in InstanceId instanceId) = 17; 110 111 /** 112 * Version of startTasks using legacy transition system. 113 */ startTasksWithLegacyTransition(int taskId1, in Bundle options1, int taskId2, in Bundle options2, int splitPosition, int snapPosition, in RemoteAnimationAdapter adapter, in InstanceId instanceId)114 oneway void startTasksWithLegacyTransition(int taskId1, in Bundle options1, int taskId2, 115 in Bundle options2, int splitPosition, int snapPosition, 116 in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 11; 117 118 /** 119 * Starts a pair of intent and task using legacy transition system. 120 */ startIntentAndTaskWithLegacyTransition(in PendingIntent pendingIntent, int userId1, in Bundle options1, int taskId, in Bundle options2, int splitPosition, int snapPosition, in RemoteAnimationAdapter adapter, in InstanceId instanceId)121 oneway void startIntentAndTaskWithLegacyTransition(in PendingIntent pendingIntent, int userId1, 122 in Bundle options1, int taskId, in Bundle options2, int splitPosition, int snapPosition, 123 in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 12; 124 125 /** 126 * Starts a pair of shortcut and task using legacy transition system. 127 */ startShortcutAndTaskWithLegacyTransition(in ShortcutInfo shortcutInfo, in Bundle options1, int taskId, in Bundle options2, int splitPosition, int snapPosition, in RemoteAnimationAdapter adapter, in InstanceId instanceId)128 oneway void startShortcutAndTaskWithLegacyTransition(in ShortcutInfo shortcutInfo, 129 in Bundle options1, int taskId, in Bundle options2, int splitPosition, int snapPosition, 130 in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 15; 131 132 /** 133 * Start a pair of intents using legacy transition system. 134 */ startIntentsWithLegacyTransition(in PendingIntent pendingIntent1, int userId1, in ShortcutInfo shortcutInfo1, in Bundle options1, in PendingIntent pendingIntent2, int userId2, in ShortcutInfo shortcutInfo2, in Bundle options2, int splitPosition, int snapPosition, in RemoteAnimationAdapter adapter, in InstanceId instanceId)135 oneway void startIntentsWithLegacyTransition(in PendingIntent pendingIntent1, int userId1, 136 in ShortcutInfo shortcutInfo1, in Bundle options1, in PendingIntent pendingIntent2, 137 int userId2, in ShortcutInfo shortcutInfo2, in Bundle options2, int splitPosition, 138 int snapPosition, in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 18; 139 140 /** 141 * Start a pair of intents in one transition. 142 */ startIntents(in PendingIntent pendingIntent1, int userId1, in ShortcutInfo shortcutInfo1, in Bundle options1, in PendingIntent pendingIntent2, int userId2, in ShortcutInfo shortcutInfo2, in Bundle options2, int splitPosition, int snapPosition, in RemoteTransition remoteTransition, in InstanceId instanceId)143 oneway void startIntents(in PendingIntent pendingIntent1, int userId1, 144 in ShortcutInfo shortcutInfo1, in Bundle options1, in PendingIntent pendingIntent2, 145 int userId2, in ShortcutInfo shortcutInfo2, in Bundle options2, int splitPosition, 146 int snapPosition, in RemoteTransition remoteTransition, in InstanceId instanceId) = 19; 147 148 /** 149 * Blocking call that notifies and gets additional split-screen targets when entering 150 * recents (for example: the dividerBar). 151 * @param appTargets apps that will be re-parented to display area 152 */ 153 RemoteAnimationTarget[] onGoingToRecentsLegacy(in RemoteAnimationTarget[] appTargets) = 13; 154 155 /** 156 * Blocking call that notifies and gets additional split-screen targets when entering 157 * recents (for example: the dividerBar). Different than the method above in that this one 158 * does not expect split to currently be running. 159 */ 160 RemoteAnimationTarget[] onStartingSplitLegacy(in RemoteAnimationTarget[] appTargets) = 14; 161 162 /** 163 * Reverse the split. 164 */ switchSplitPosition()165 oneway void switchSplitPosition() = 22; 166 } 167 // Last id = 22