1 /*
2  * Copyright (C) 2019 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.graphics.Rect;
20 import android.content.res.Configuration;
21 
22 import java.util.List;
23 
24 /**
25  * Interface to listen for changes to display window-containers.
26  *
27  * This differs from DisplayManager's DisplayListener in a couple ways:
28  *  - onDisplayAdded is always called after the display is actually added to the WM hierarchy.
29  *    This corresponds to the DisplayContent and not the raw Dislay from DisplayManager.
30  *  - onDisplayConfigurationChanged is called for all configuration changes, not just changes
31  *    to displayinfo (eg. windowing-mode).
32  *
33  * @hide
34  */
35 oneway interface IDisplayWindowListener {
36 
37     /**
38      * Called when a new display is added to the WM hierarchy. The existing display ids are returned
39      * when this listener is registered with WM via {@link #registerDisplayWindowListener}.
40      */
onDisplayAdded(int displayId)41     void onDisplayAdded(int displayId);
42 
43     /**
44      * Called when a display's window-container configuration has changed.
45      */
onDisplayConfigurationChanged(int displayId, in Configuration newConfig)46     void onDisplayConfigurationChanged(int displayId, in Configuration newConfig);
47 
48     /**
49      * Called when a display is removed from the hierarchy.
50      */
onDisplayRemoved(int displayId)51     void onDisplayRemoved(int displayId);
52 
53     /**
54      * Called when fixed rotation is started on a display.
55      */
onFixedRotationStarted(int displayId, int newRotation)56     void onFixedRotationStarted(int displayId, int newRotation);
57 
58     /**
59      * Called when the previous fixed rotation on a display is finished.
60      */
onFixedRotationFinished(int displayId)61     void onFixedRotationFinished(int displayId);
62 
63     /**
64      * Called when the keep clear ares on a display have changed.
65      */
onKeepClearAreasChanged(int displayId, in List<Rect> restricted, in List<Rect> unrestricted)66     void onKeepClearAreasChanged(int displayId, in List<Rect> restricted, in List<Rect> unrestricted);
67 }
68