• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2024 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 com.android.wm.shell.compatui.letterbox
18 
19 import android.graphics.Rect
20 import android.view.SurfaceControl
21 import android.view.SurfaceControl.Transaction
22 
23 /**
24  * Abstracts the component responsible to handle a single or multiple letterbox surfaces for a
25  * specific [Change].
26  */
27 interface LetterboxController {
28 
29     /**
30      * Creates a Letterbox Surface for a given displayId/taskId if it doesn't exist.
31      */
createLetterboxSurfacenull32     fun createLetterboxSurface(
33         key: LetterboxKey,
34         transaction: Transaction,
35         parentLeash: SurfaceControl
36     )
37 
38     /**
39      * Invoked to destroy the surfaces for a letterbox session for given displayId/taskId.
40      */
41     fun destroyLetterboxSurface(
42         key: LetterboxKey,
43         transaction: Transaction
44     )
45 
46     /**
47      * Invoked to show/hide the letterbox surfaces for given displayId/taskId.
48      */
49     fun updateLetterboxSurfaceVisibility(
50         key: LetterboxKey,
51         transaction: Transaction,
52         visible: Boolean
53     )
54 
55     /**
56      * Updates the bounds for the letterbox surfaces for given displayId/taskId.
57      */
58     fun updateLetterboxSurfaceBounds(
59         key: LetterboxKey,
60         transaction: Transaction,
61         taskBounds: Rect,
62         activityBounds: Rect
63     )
64 
65     /**
66      * Utility method to dump the current state.
67      */
68     fun dump()
69 }
70