1 package com.android.wallpaper.util.wallpaperconnection 2 3 import android.content.ComponentName 4 import android.content.ServiceConnection 5 import android.os.IBinder 6 import android.service.wallpaper.IWallpaperService 7 8 class WallpaperServiceConnection(val listener: WallpaperServiceConnectionListener) : 9 ServiceConnection { 10 onServiceConnectednull11 override fun onServiceConnected(componentName: ComponentName?, service: IBinder?) { 12 listener.onWallpaperServiceConnected(this, IWallpaperService.Stub.asInterface(service)) 13 } 14 onServiceDisconnectednull15 override fun onServiceDisconnected(componentName: ComponentName?) {} 16 17 interface WallpaperServiceConnectionListener { onWallpaperServiceConnectednull18 fun onWallpaperServiceConnected( 19 serviceConnection: ServiceConnection, 20 wallpaperService: IWallpaperService, 21 ) 22 } 23 } 24