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.view.IDisplayChangeWindowCallback;
20 import android.window.DisplayAreaInfo;
21 
22 /**
23  * Singular controller of a "remote" display change. When a display rotation or change is started,
24  * WM freezes the screen. It will then call into this controller and wait for a response via the
25  * callback.
26  *
27  * This needs to provide configuration changes because those changes need to be applied in sync
28  * with the actual display rotation to prevent relayouts with mismatched information.
29  *
30  * The flow is like this:
31  *  1. DisplayContent/Rotation freezes the screen
32  *  2. This controller is notified of a rotation and provided a callback.
33  *  3. This controller is responsible for collecting a set of configuration changes to go along with
34  *     the rotation.
35  *  4. The callback is fired which tells DisplayContent/Rotation to apply the provided configuration
36  *     changes and continue the rotation.
37  *
38  * @hide
39  */
40 oneway interface IDisplayChangeWindowController {
41 
42     /**
43      * Called when WM needs to know how to update tasks in response to a display change.
44      * If this isn't called, a timeout will continue the change in WM.
45      *
46      * @param fromRotation the old rotation
47      * @param newRotation the new rotation
48      * @param newDisplayAreaInfo the new display area info after the change
49      * @param callback A callback to be called when this has calculated updated configs.
50      */
onDisplayChange(int displayId, int fromRotation, int toRotation, in DisplayAreaInfo newDisplayAreaInfo, in IDisplayChangeWindowCallback callback)51     void onDisplayChange(int displayId, int fromRotation, int toRotation,
52             in DisplayAreaInfo newDisplayAreaInfo, in IDisplayChangeWindowCallback callback);
53 
54 }
55