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.systemui.communal.widgets
18 
19 import android.appwidget.AppWidgetHostView
20 import android.appwidget.AppWidgetProviderInfo
21 import android.content.Context
22 import com.android.systemui.animation.LaunchableView
23 import com.android.systemui.animation.LaunchableViewDelegate
24 
25 /** AppWidgetHostView that displays in communal hub to show smartspace content. */
26 class SmartspaceAppWidgetHostView(context: Context) : AppWidgetHostView(context), LaunchableView {
27     private val launchableViewDelegate =
28         LaunchableViewDelegate(
29             this,
<lambda>null30             superSetVisibility = { super.setVisibility(it) },
31         )
32 
setAppWidgetnull33     override fun setAppWidget(appWidgetId: Int, info: AppWidgetProviderInfo?) {
34         super.setAppWidget(appWidgetId, info)
35         setPadding(0, 0, 0, 0)
36     }
37 
getRemoteContextEnsuringCorrectCachedApkPathnull38     override fun getRemoteContextEnsuringCorrectCachedApkPath(): Context? {
39         // Silence errors
40         return null
41     }
42 
setShouldBlockVisibilityChangesnull43     override fun setShouldBlockVisibilityChanges(block: Boolean) =
44         launchableViewDelegate.setShouldBlockVisibilityChanges(block)
45 
46     override fun setVisibility(visibility: Int) = launchableViewDelegate.setVisibility(visibility)
47 }
48