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.pip;
18 
19 import android.app.PictureInPictureParams;
20 import android.view.SurfaceControl;
21 import android.content.ComponentName;
22 import android.content.pm.ActivityInfo;
23 import android.graphics.Rect;
24 
25 import com.android.wm.shell.pip.IPipAnimationListener;
26 
27 /**
28  * Interface that is exposed to remote callers to manipulate the Pip feature.
29  */
30 interface IPip {
31 
32     /**
33      * Notifies that Activity is about to be swiped to home with entering PiP transition and
34      * queries the destination bounds for PiP depends on Launcher's rotation and shelf height.
35      *
36      * @param componentName ComponentName represents the Activity
37      * @param activityInfo ActivityInfo tied to the Activity
38      * @param pictureInPictureParams PictureInPictureParams tied to the Activity
39      * @param launcherRotation Launcher rotation to calculate the PiP destination bounds
40      * @param shelfHeight Shelf height of launcher to calculate the PiP destination bounds
41      * @return destination bounds the PiP window should land into
42      */
startSwipePipToHome(in ComponentName componentName, in ActivityInfo activityInfo, in PictureInPictureParams pictureInPictureParams, int launcherRotation, int shelfHeight)43     Rect startSwipePipToHome(in ComponentName componentName, in ActivityInfo activityInfo,
44                 in PictureInPictureParams pictureInPictureParams,
45                 int launcherRotation, int shelfHeight) = 1;
46 
47     /**
48      * Notifies the swiping Activity to PiP onto home transition is finished
49      *
50      * @param componentName ComponentName represents the Activity
51      * @param destinationBounds the destination bounds the PiP window lands into
52      * @param overlay an optional overlay to fade out after entering PiP
53      */
stopSwipePipToHome(in ComponentName componentName, in Rect destinationBounds, in SurfaceControl overlay)54     oneway void stopSwipePipToHome(in ComponentName componentName, in Rect destinationBounds,
55             in SurfaceControl overlay) = 2;
56 
57     /**
58      * Sets listener to get pinned stack animation callbacks.
59      */
60     oneway void setPinnedStackAnimationListener(IPipAnimationListener listener) = 3;
61 
62     /**
63      * Sets the shelf height and visibility.
64      */
setShelfHeight(boolean visible, int shelfHeight)65     oneway void setShelfHeight(boolean visible, int shelfHeight) = 4;
66 }
67