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