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 package com.android.wm.shell.windowdecor.common.viewhost 17 18 import android.content.res.Configuration 19 import android.graphics.Region 20 import android.view.SurfaceControl 21 import android.view.View 22 import android.view.WindowManager 23 import com.android.wm.shell.windowdecor.WindowDecoration 24 25 /** 26 * An interface for a utility that hosts a [WindowDecoration]'s [View] hierarchy under a 27 * [SurfaceControl]. 28 */ 29 interface WindowDecorViewHost { 30 /** The surface where the underlying [View] hierarchy is being rendered. */ 31 val surfaceControl: SurfaceControl 32 33 /** Synchronously update the view hierarchy of this view host. */ updateViewnull34 fun updateView( 35 view: View, 36 attrs: WindowManager.LayoutParams, 37 configuration: Configuration, 38 touchableRegion: Region? = null, 39 onDrawTransaction: SurfaceControl.Transaction? = null, 40 ) 41 42 /** Asynchronously update the view hierarchy of this view host. */ 43 fun updateViewAsync( 44 view: View, 45 attrs: WindowManager.LayoutParams, 46 configuration: Configuration, 47 touchableRegion: Region? = null, 48 ) 49 50 /** Releases the underlying [View] hierarchy and removes the backing [SurfaceControl]. */ 51 fun release(t: SurfaceControl.Transaction) 52 } 53