1 /* 2 * Copyright 2023 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.bouncer.domain.interactor 18 19 import android.content.Context 20 import android.content.Intent 21 import android.telecom.TelecomManager 22 import android.telephony.euicc.EuiccManager 23 import com.android.internal.util.EmergencyAffordanceManager 24 import com.android.systemui.dagger.SysUISingleton 25 import com.android.systemui.dagger.qualifiers.Application 26 import dagger.Module 27 import dagger.Provides 28 29 /** Module for providing interactor-related objects for the bouncer. */ 30 @Module 31 object BouncerInteractorModule { 32 33 @Provides emergencyDialerIntentFactorynull34 fun emergencyDialerIntentFactory( 35 telecomManager: TelecomManager? 36 ): EmergencyDialerIntentFactory { 37 return object : EmergencyDialerIntentFactory { 38 override fun invoke(): Intent? { 39 return telecomManager?.createLaunchEmergencyDialerIntent(/* number = */ null) 40 } 41 } 42 } 43 44 @Provides 45 @SysUISingleton emergencyAffordanceManagernull46 fun emergencyAffordanceManager( 47 @Application applicationContext: Context, 48 ): EmergencyAffordanceManager { 49 return EmergencyAffordanceManager(applicationContext) 50 } 51 52 @Provides provideEuiccManagernull53 fun provideEuiccManager(@Application applicationContext: Context): EuiccManager? { 54 return applicationContext.getSystemService(Context.EUICC_SERVICE) as EuiccManager? 55 } 56 } 57