• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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.impl
18 
19 import android.content.Context
20 import com.android.wm.shell.common.DisplayController
21 import com.android.wm.shell.common.SyncTransactionQueue
22 import com.android.wm.shell.compatui.api.CompatUIComponent
23 import com.android.wm.shell.compatui.api.CompatUIComponentFactory
24 import com.android.wm.shell.compatui.api.CompatUIInfo
25 import com.android.wm.shell.compatui.api.CompatUISpec
26 import com.android.wm.shell.compatui.api.CompatUIState
27 
28 /**
29  * Default {@link CompatUIComponentFactory } implementation
30  */
31 class DefaultCompatUIComponentFactory(
32     private val context: Context,
33     private val syncQueue: SyncTransactionQueue,
34     private val displayController: DisplayController
35 ) : CompatUIComponentFactory {
createnull36     override fun create(
37         spec: CompatUISpec,
38         compId: String,
39         state: CompatUIState,
40         compatUIInfo: CompatUIInfo
41     ): CompatUIComponent =
42         CompatUIComponent(
43             spec,
44             compId,
45             context,
46             state,
47             compatUIInfo,
48             syncQueue,
49             displayController.getDisplayLayout(compatUIInfo.taskInfo.displayId)
50         )
51 }
52