1 /* 2 * Copyright 2025 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 androidx.appfunctions.internal 18 19 import android.os.Build 20 import android.util.Log 21 import androidx.annotation.RequiresApi 22 import androidx.appfunctions.internal.Constants.APP_FUNCTIONS_TAG 23 24 /** Provides manual dependency injection for AppFunction runtime infrastructure. */ 25 @RequiresApi(Build.VERSION_CODES.S) 26 internal object Dependencies { 27 28 /** The instance of [AggregatedAppFunctionInventory]. */ <lambda>null29 internal val aggregatedAppFunctionInventory: AggregatedAppFunctionInventory by lazy { 30 AggregatedAppFunctionInventory::class 31 .java 32 .findImpl( 33 prefix = "$", 34 suffix = "_Impl", 35 ) 36 } 37 38 /** The instance of [AggregatedAppFunctionInvoker]. */ <lambda>null39 internal val aggregatedAppFunctionInvoker: AggregatedAppFunctionInvoker by lazy { 40 AggregatedAppFunctionInvoker::class 41 .java 42 .findImpl( 43 prefix = "$", 44 suffix = "_Impl", 45 ) 46 } 47 <lambda>null48 internal val translatorSelector: TranslatorSelector by lazy { 49 try { 50 TranslatorSelector::class 51 .java 52 .findImpl( 53 prefix = "", 54 suffix = "Impl", 55 ) 56 } catch (ex: Exception) { 57 Log.d(APP_FUNCTIONS_TAG, "Cannot find TranslatorSelectorImpl") 58 NullTranslatorSelector() 59 } 60 } 61 } 62