• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.common.pip;
18 
19 import android.app.ActivityManager.RunningTaskInfo;
20 import android.app.PictureInPictureParams;
21 import android.view.SurfaceControl;
22 import android.content.ComponentName;
23 import android.content.pm.ActivityInfo;
24 import android.graphics.Rect;
25 
26 import com.android.wm.shell.common.pip.IPipAnimationListener;
27 
28 /**
29  * Interface that is exposed to remote callers to manipulate the Pip feature.
30  */
31 interface IPip {
32 
33     /**
34      * Notifies that Activity is about to be swiped to home with entering PiP transition and
35      * queries the destination bounds for PiP depends on Launcher's rotation and shelf height.
36      *
37      * @param componentName ComponentName represents the Activity
38      * @param activityInfo ActivityInfo tied to the Activity
39      * @param pictureInPictureParams PictureInPictureParams tied to the Activity
40      * @param launcherRotation Launcher rotation to calculate the PiP destination bounds
41      * @param hotseatKeepClearArea Bounds of Hotseat to avoid used to calculate PiP destination
42               bounds
43      * @return destination bounds the PiP window should land into
44      */
startSwipePipToHome(in RunningTaskInfo taskInfo, int launcherRotation, in Rect hotseatKeepClearArea)45     Rect startSwipePipToHome(in RunningTaskInfo taskInfo, int launcherRotation,
46             in Rect hotseatKeepClearArea) = 1;
47 
48     /**
49      * Notifies the swiping Activity to PiP onto home transition is finished
50      *
51      * @param taskId the Task id that the Activity and overlay are currently in.
52      * @param componentName ComponentName represents the Activity
53      * @param destinationBounds the destination bounds the PiP window lands into
54      * @param overlay an optional overlay to fade out after entering PiP
55      * @param appBounds the bounds used to set the buffer size of the optional content overlay
56      * @param sourceRectHint the bounds to show in the transition to PiP
57      */
stopSwipePipToHome(int taskId, in ComponentName componentName, in Rect destinationBounds, in SurfaceControl overlay, in Rect appBounds, in Rect sourceRectHint)58     oneway void stopSwipePipToHome(int taskId, in ComponentName componentName,
59             in Rect destinationBounds, in SurfaceControl overlay, in Rect appBounds,
60             in Rect sourceRectHint) = 2;
61 
62     /**
63      * Notifies the swiping Activity to PiP onto home transition is aborted
64      *
65      * @param taskId the Task id that the Activity and overlay are currently in.
66      * @param componentName ComponentName represents the Activity
67      */
abortSwipePipToHome(int taskId, in ComponentName componentName)68     oneway void abortSwipePipToHome(int taskId, in ComponentName componentName) = 3;
69 
70     /**
71      * Sets listener to get pinned stack animation callbacks.
72      */
73     oneway void setPipAnimationListener(IPipAnimationListener listener) = 4;
74 
75     /**
76      * Sets the shelf height and visibility.
77      */
setShelfHeight(boolean visible, int shelfHeight)78     oneway void setShelfHeight(boolean visible, int shelfHeight) = 5;
79 
80     /**
81      * Sets the next pip animation type to be the alpha animation.
82      */
setPipAnimationTypeToAlpha()83     oneway void setPipAnimationTypeToAlpha() = 6;
84 
85     /**
86      * Sets the height and visibility of the Launcher keep clear area.
87      */
setLauncherKeepClearAreaHeight(boolean visible, int height)88     oneway void setLauncherKeepClearAreaHeight(boolean visible, int height) = 7;
89 
90     /**
91      * Sets the app icon size in pixel used by Launcher
92      */
setLauncherAppIconSize(int iconSizePx)93     oneway void setLauncherAppIconSize(int iconSizePx) = 8;
94 }
95