1 /**
2  * Copyright (c) 2016, 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 android.view;
18 
19 import android.content.ComponentName;
20 import android.content.pm.ParceledListSlice;
21 import android.graphics.Rect;
22 import android.view.DisplayInfo;
23 import android.view.IPinnedStackController;
24 
25 /**
26  * Listener for changes to the pinned stack made by the WindowManager.
27  *
28  * @hide
29  */
30 oneway interface IPinnedStackListener {
31 
32     /**
33      * Called when the listener is registered and provides an interface to call back to the pinned
34      * stack controller to update the controller of the pinned stack state.
35      */
onListenerRegistered(IPinnedStackController controller)36     void onListenerRegistered(IPinnedStackController controller);
37 
38     /**
39      * Called when the window manager has detected a change that would cause the movement bounds
40      * to be changed (ie. after configuration change, aspect ratio change, etc).
41      */
onMovementBoundsChanged(boolean fromImeAdjustment)42     void onMovementBoundsChanged(boolean fromImeAdjustment);
43 
44     /**
45      * Called when window manager decides to adjust the pinned stack bounds because of the IME, or
46      * when the listener is first registered to allow the listener to synchronized its state with
47      * the controller.  This call will always be followed by a onMovementBoundsChanged() call
48      * with fromImeAdjustement set to {@code true}.
49      */
onImeVisibilityChanged(boolean imeVisible, int imeHeight)50     void onImeVisibilityChanged(boolean imeVisible, int imeHeight);
51 
52     /**
53      * Called when the set of actions for the current PiP activity changes, or when the listener
54      * is first registered to allow the listener to synchronized its state with the controller.
55      */
onActionsChanged(in ParceledListSlice actions)56     void onActionsChanged(in ParceledListSlice actions);
57 
58     /**
59      * Called by the window manager to notify the listener that Activity (was or is in pinned mode)
60      * is hidden (either stopped or removed). This is generally used as a signal to reset saved
61      * reentry fraction and size.
62      * {@param componentName} represents the application component of PiP window.
63      */
onActivityHidden(in ComponentName componentName)64     void onActivityHidden(in ComponentName componentName);
65 
66     /**
67      * Called when the window manager has detected change on DisplayInfo,  or
68      * when the listener is first registered to allow the listener to synchronized its state with
69      * the controller.
70      */
onDisplayInfoChanged(in DisplayInfo displayInfo)71     void onDisplayInfoChanged(in DisplayInfo displayInfo);
72 
73     /**
74      * Called by the window manager at the beginning of a configuration update cascade
75      * since the metrics from these resources are used for bounds calculations.
76      */
onConfigurationChanged()77     void onConfigurationChanged();
78 
79     /**
80      * Called by the window manager when the aspect ratio is reset.
81      */
onAspectRatioChanged(float aspectRatio)82     void onAspectRatioChanged(float aspectRatio);
83 }
84