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