| /* |
| * Copyright (C) 2014 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package com.android.server.telecom; |
| |
| import android.Manifest; |
| import android.app.ActivityManager; |
| import android.bluetooth.BluetoothManager; |
| import android.content.BroadcastReceiver; |
| import android.content.Context; |
| import android.content.Intent; |
| import android.content.IntentFilter; |
| import android.content.ServiceConnection; |
| import android.content.pm.ResolveInfo; |
| import android.net.Uri; |
| import android.os.BugreportManager; |
| import android.os.DropBoxManager; |
| import android.os.Looper; |
| import android.os.UserHandle; |
| import android.telecom.Log; |
| import android.telecom.PhoneAccountHandle; |
| |
| import android.telecom.TelecomManager; |
| import android.telephony.TelephonyManager; |
| import android.widget.Toast; |
| |
| import androidx.annotation.NonNull; |
| |
| import com.android.internal.annotations.VisibleForTesting; |
| import com.android.internal.telephony.flags.Flags; |
| import com.android.server.telecom.DefaultDialerCache.DefaultDialerManagerAdapter; |
| import com.android.server.telecom.bluetooth.BluetoothDeviceManager; |
| import com.android.server.telecom.bluetooth.BluetoothRouteManager; |
| import com.android.server.telecom.bluetooth.BluetoothStateReceiver; |
| import com.android.server.telecom.callfiltering.BlockedNumbersAdapter; |
| import com.android.server.telecom.callfiltering.IncomingCallFilterGraph; |
| import com.android.server.telecom.components.TelecomBroadcastReceiver; |
| import com.android.server.telecom.components.UserCallIntentProcessor; |
| import com.android.server.telecom.components.UserCallIntentProcessorFactory; |
| import com.android.server.telecom.flags.FeatureFlags; |
| import com.android.server.telecom.metrics.TelecomMetricsController; |
| import com.android.server.telecom.ui.AudioProcessingNotification; |
| import com.android.server.telecom.ui.CallStreamingNotification; |
| import com.android.server.telecom.ui.DisconnectedCallNotifier; |
| import com.android.server.telecom.ui.IncomingCallNotifier; |
| import com.android.server.telecom.ui.MissedCallNotifierImpl.MissedCallNotifierImplFactory; |
| import com.android.server.telecom.ui.ToastFactory; |
| import com.android.server.telecom.callsequencing.TransactionManager; |
| |
| import java.io.FileNotFoundException; |
| import java.io.InputStream; |
| import java.util.List; |
| import java.util.concurrent.Executor; |
| import java.util.concurrent.Executors; |
| import java.util.concurrent.ScheduledExecutorService; |
| |
| /** |
| * Top-level Application class for Telecom. |
| */ |
| public class TelecomSystem { |
| |
| /** |
| * Tagging interface for the object used for synchronizing multi-threaded operations in |
| * the Telecom system. |
| */ |
| public interface SyncRoot { |
| } |
| |
| /** |
| * Broadcast sent when the user is starting. |
| */ |
| private static final String ACTION_USER_STARTING = "android.intent.action.USER_STARTING"; |
| |
| private static final IntentFilter USER_SWITCHED_FILTER = |
| new IntentFilter(Intent.ACTION_USER_SWITCHED); |
| |
| private static final IntentFilter USER_STARTING_FILTER = |
| new IntentFilter(ACTION_USER_STARTING); |
| |
| private static final IntentFilter BOOT_COMPLETE_FILTER = |
| new IntentFilter(Intent.ACTION_BOOT_COMPLETED); |
| |
| /** Intent filter for dialer secret codes. */ |
| private static final IntentFilter DIALER_SECRET_CODE_FILTER; |
| |
| /* |
| * Initializes the dialer secret code intent filter. Setup to handle the various secret codes |
| * which can be dialed (e.g. in format *#*#code#*#*) to trigger various behavior in Telecom. |
| */ |
| static { |
| DIALER_SECRET_CODE_FILTER = new IntentFilter( |
| "android.provider.Telephony.SECRET_CODE"); |
| DIALER_SECRET_CODE_FILTER.addDataScheme("android_secret_code"); |
| DIALER_SECRET_CODE_FILTER |
| .addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_DEBUG_ON, null); |
| DIALER_SECRET_CODE_FILTER |
| .addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_DEBUG_OFF, null); |
| DIALER_SECRET_CODE_FILTER |
| .addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_MARK, null); |
| |
| USER_SWITCHED_FILTER.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); |
| USER_STARTING_FILTER.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); |
| BOOT_COMPLETE_FILTER.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); |
| DIALER_SECRET_CODE_FILTER.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); |
| } |
| |
| private static TelecomSystem INSTANCE = null; |
| |
| private final SyncRoot mLock = new SyncRoot() { }; |
| private final MissedCallNotifier mMissedCallNotifier; |
| private final IncomingCallNotifier mIncomingCallNotifier; |
| private final PhoneAccountRegistrar mPhoneAccountRegistrar; |
| private final CallsManager mCallsManager; |
| private final RespondViaSmsManager mRespondViaSmsManager; |
| private final Context mContext; |
| // Note: We need to retain this or the receivers won't get fired. |
| private Context mAllUsersContext; |
| private final CallIntentProcessor mCallIntentProcessor; |
| private final TelecomBroadcastIntentProcessor mTelecomBroadcastIntentProcessor; |
| private final TelecomServiceImpl mTelecomServiceImpl; |
| private final ContactsAsyncHelper mContactsAsyncHelper; |
| private final DialerCodeReceiver mDialerCodeReceiver; |
| private final FeatureFlags mFeatureFlags; |
| |
| private boolean mIsBootComplete = false; |
| |
| private TelecomMetricsController mMetricsController; |
| |
| private final BroadcastReceiver mUserSwitchedReceiver = new BroadcastReceiver() { |
| @Override |
| public void onReceive(Context context, Intent intent) { |
| Log.startSession("TSSwR.oR"); |
| try { |
| synchronized (mLock) { |
| int userHandleId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); |
| UserHandle currentUserHandle; |
| currentUserHandle = UserHandle.of(userHandleId); |
| Log.i(TelecomSystem.this, "ACTION_USER_SWITCHED: userHandle=%s", |
| currentUserHandle); |
| mPhoneAccountRegistrar.setCurrentUserHandle(currentUserHandle); |
| mCallsManager.onUserSwitch(currentUserHandle); |
| } |
| } finally { |
| Log.endSession(); |
| } |
| } |
| }; |
| |
| private final BroadcastReceiver mUserStartingReceiver = new BroadcastReceiver() { |
| @Override |
| public void onReceive(Context context, Intent intent) { |
| Log.startSession("TSStR.oR"); |
| try { |
| synchronized (mLock) { |
| int userHandleId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); |
| UserHandle addingUserHandle; |
| addingUserHandle = UserHandle.of(userHandleId); |
| Log.i(TelecomSystem.this, "ACTION_USER_STARTING: userHandle=%s", |
| addingUserHandle); |
| mCallsManager.onUserStarting(addingUserHandle); |
| } |
| } finally { |
| Log.endSession(); |
| } |
| } |
| }; |
| |
| private final BroadcastReceiver mBootCompletedReceiver = new BroadcastReceiver() { |
| @Override |
| public void onReceive(Context context, Intent intent) { |
| Log.startSession("TSBCR.oR"); |
| try { |
| synchronized (mLock) { |
| Log.i(TelecomSystem.this, "ACTION_BOOT_COMPLETE"); |
| mIsBootComplete = true; |
| mCallsManager.onBootCompleted(); |
| } |
| } finally { |
| Log.endSession(); |
| } |
| } |
| }; |
| |
| public static TelecomSystem getInstance() { |
| return INSTANCE; |
| } |
| |
| public static void setInstance(TelecomSystem instance) { |
| if (INSTANCE != null) { |
| Log.w("TelecomSystem", "Attempt to set TelecomSystem.INSTANCE twice"); |
| } |
| Log.i(TelecomSystem.class, "TelecomSystem.INSTANCE being set"); |
| INSTANCE = instance; |
| } |
| |
| public TelecomSystem( |
| Context context, |
| MissedCallNotifierImplFactory missedCallNotifierImplFactory, |
| CallerInfoAsyncQueryFactory callerInfoAsyncQueryFactory, |
| HeadsetMediaButtonFactory headsetMediaButtonFactory, |
| ProximitySensorManagerFactory proximitySensorManagerFactory, |
| InCallWakeLockControllerFactory inCallWakeLockControllerFactory, |
| ConnectionServiceFocusManager.ConnectionServiceFocusManagerFactory |
| connectionServiceFocusManagerFactory, |
| Timeouts.Adapter timeoutsAdapter, |
| AsyncRingtonePlayer asyncRingtonePlayer, |
| PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, |
| IncomingCallNotifier incomingCallNotifier, |
| InCallTonePlayer.ToneGeneratorFactory toneGeneratorFactory, |
| CallAudioRouteController.Factory callAudioRouteControllerFactory, |
| CallAudioModeStateMachine.Factory callAudioModeStateMachineFactory, |
| ClockProxy clockProxy, |
| RoleManagerAdapter roleManagerAdapter, |
| ContactsAsyncHelper.Factory contactsAsyncHelperFactory, |
| String sysUiPackageName, |
| String telecomUiPackageName, |
| Ringer.AccessibilityManagerAdapter accessibilityManagerAdapter, |
| Executor asyncTaskExecutor, |
| Executor asyncCallAudioTaskExecutor, |
| BlockedNumbersAdapter blockedNumbersAdapter, |
| FeatureFlags featureFlags, |
| android.telecom.flags.FeatureFlags moduleFeatureFlags, |
| com.android.internal.telephony.flags.FeatureFlags telephonyFlags, |
| Looper looper, |
| Ringer.VibratorAdapter vibratorAdapter) { |
| mContext = context.getApplicationContext(); |
| mFeatureFlags = featureFlags; |
| LogUtils.initLogging(mContext); |
| android.telecom.Log.setLock(mLock); |
| AnomalyReporterAdapterImpl.initialize(mContext); |
| DefaultDialerManagerAdapter defaultDialerAdapter = |
| new DefaultDialerCache.DefaultDialerManagerAdapterImpl(); |
| |
| DefaultDialerCache defaultDialerCache = new DefaultDialerCache(mContext, |
| defaultDialerAdapter, roleManagerAdapter, mLock, mFeatureFlags); |
| |
| Log.startSession("TS.init"); |
| // Wrap this in a try block to ensure session cleanup occurs in the case of error. |
| try { |
| mPhoneAccountRegistrar = new PhoneAccountRegistrar(mContext, mLock, defaultDialerCache, |
| (packageName, userHandle) -> AppLabelProxy.Util.getAppLabel(mContext, |
| userHandle, packageName, mFeatureFlags), null, mFeatureFlags, |
| new AnomalyReporterAdapterImpl(mContext)); |
| |
| mContactsAsyncHelper = contactsAsyncHelperFactory.create( |
| new ContactsAsyncHelper.ContentResolverAdapter() { |
| @Override |
| public InputStream openInputStream(Context context, Uri uri) |
| throws FileNotFoundException { |
| return context.getContentResolver().openInputStream(uri); |
| } |
| }); |
| BluetoothDeviceManager bluetoothDeviceManager = new BluetoothDeviceManager(mContext, |
| mContext.getSystemService(BluetoothManager.class).getAdapter(), |
| featureFlags); |
| BluetoothRouteManager bluetoothRouteManager = new BluetoothRouteManager( |
| bluetoothDeviceManager); |
| BluetoothStateReceiver bluetoothStateReceiver = new BluetoothStateReceiver(mContext, |
| bluetoothDeviceManager); |
| |
| WiredHeadsetManager wiredHeadsetManager = new WiredHeadsetManager(mContext); |
| SystemStateHelper systemStateHelper = new SystemStateHelper(mContext, mLock); |
| |
| mMissedCallNotifier = missedCallNotifierImplFactory |
| .makeMissedCallNotifierImpl(mContext, mPhoneAccountRegistrar, |
| defaultDialerCache, |
| featureFlags); |
| DisconnectedCallNotifier.Factory disconnectedCallNotifierFactory = |
| new DisconnectedCallNotifier.Default(); |
| |
| CallerInfoLookupHelper callerInfoLookupHelper = |
| new CallerInfoLookupHelper(context, callerInfoAsyncQueryFactory, |
| mContactsAsyncHelper, mLock); |
| |
| InCallControllerFactory inCallControllerFactory = new InCallControllerFactory() { |
| @Override |
| public InCallController create(Context context, SyncRoot lock, |
| CallsManager callsManager, SystemStateHelper systemStateProvider, |
| DefaultDialerCache defaultDialerCache, Timeouts.Adapter timeoutsAdapter, |
| EmergencyCallHelper emergencyCallHelper) { |
| return new InCallController(context, lock, callsManager, systemStateProvider, |
| defaultDialerCache, timeoutsAdapter, emergencyCallHelper, |
| new CarModeTracker(), clockProxy, telecomUiPackageName, featureFlags); |
| } |
| }; |
| |
| EmergencyCallHelper emergencyCallHelper = new EmergencyCallHelper(mContext, |
| defaultDialerCache, timeoutsAdapter, mFeatureFlags); |
| |
| CallEndpointControllerFactory callEndpointControllerFactory = |
| new CallEndpointControllerFactory() { |
| @Override |
| public CallEndpointController create(Context context, SyncRoot lock, |
| CallsManager callsManager) { |
| return new CallEndpointController(context, callsManager, featureFlags); |
| } |
| }; |
| |
| CallDiagnosticServiceController callDiagnosticServiceController = |
| new CallDiagnosticServiceController( |
| new CallDiagnosticServiceController.ContextProxy() { |
| @Override |
| public List<ResolveInfo> queryIntentServicesAsUser( |
| @NonNull Intent intent, int flags, int userId) { |
| return UserUtil.getPackageManagerFromUserHandler(mContext, |
| UserHandle.of(userId)).queryIntentServices(intent, |
| flags); |
| } |
| |
| @Override |
| public boolean bindServiceAsUser(@NonNull Intent service, |
| @NonNull ServiceConnection conn, int flags, |
| @NonNull UserHandle user) { |
| return mContext.bindServiceAsUser(service, conn, flags, user); |
| } |
| |
| @Override |
| public void unbindService(@NonNull ServiceConnection conn) { |
| mContext.unbindService(conn); |
| } |
| |
| @Override |
| public UserHandle getCurrentUserHandle() { |
| return mCallsManager.getCurrentUserHandle(); |
| } |
| }, |
| TelecomResourceId.getString(mContext, |
| "call_diagnostic_service_package_name"), |
| mLock |
| ); |
| |
| AudioProcessingNotification audioProcessingNotification = |
| new AudioProcessingNotification(mContext, mFeatureFlags); |
| |
| ToastFactory toastFactory = new ToastFactory() { |
| @Override |
| public void makeText(Context context, int resId, int duration) { |
| context.getMainExecutor().execute(() -> |
| Toast.makeText(context, resId, duration).show()); |
| } |
| |
| @Override |
| public void makeText(Context context, CharSequence text, int duration) { |
| context.getMainExecutor().execute(() -> |
| Toast.makeText(context, text, duration).show()); |
| } |
| }; |
| |
| EmergencyCallDiagnosticLogger emergencyCallDiagnosticLogger = |
| new EmergencyCallDiagnosticLogger(mContext.getSystemService( |
| TelephonyManager.class), mContext.getSystemService( |
| BugreportManager.class), timeoutsAdapter, mContext.getSystemService( |
| DropBoxManager.class), asyncTaskExecutor, clockProxy); |
| |
| mMetricsController = TelecomMetricsController.make(mContext); |
| |
| ScheduledExecutorService scheduledExecutorService = |
| Executors.newSingleThreadScheduledExecutor(); |
| CallAnomalyWatchdog callAnomalyWatchdog = new CallAnomalyWatchdog( |
| scheduledExecutorService, |
| mLock, mFeatureFlags, timeoutsAdapter, clockProxy, |
| emergencyCallDiagnosticLogger, mMetricsController); |
| |
| TransactionManager transactionManager = TransactionManager.getInstance(); |
| |
| CallStreamingNotification callStreamingNotification = |
| new CallStreamingNotification(mContext, |
| (packageName, userHandle) -> AppLabelProxy.Util.getAppLabel(mContext, |
| userHandle, packageName, mFeatureFlags), asyncTaskExecutor, |
| mFeatureFlags); |
| |
| LowBatteryAlertListener lowBatteryAlertListener = |
| Flags.supportLowBatteryAlert() ? new LowBatteryAlertListener(mContext, |
| scheduledExecutorService) : null; |
| |
| mCallsManager = new CallsManager( |
| mContext, |
| mLock, |
| callerInfoLookupHelper, |
| mMissedCallNotifier, |
| disconnectedCallNotifierFactory, |
| mPhoneAccountRegistrar, |
| headsetMediaButtonFactory, |
| proximitySensorManagerFactory, |
| inCallWakeLockControllerFactory, |
| connectionServiceFocusManagerFactory, |
| bluetoothRouteManager, |
| wiredHeadsetManager, |
| systemStateHelper, |
| defaultDialerCache, |
| timeoutsAdapter, |
| asyncRingtonePlayer, |
| phoneNumberUtilsAdapter, |
| emergencyCallHelper, |
| toneGeneratorFactory, |
| clockProxy, |
| audioProcessingNotification, |
| bluetoothStateReceiver, |
| callAudioRouteControllerFactory, |
| callAudioModeStateMachineFactory, |
| inCallControllerFactory, |
| callDiagnosticServiceController, |
| roleManagerAdapter, |
| toastFactory, |
| callEndpointControllerFactory, |
| callAnomalyWatchdog, |
| accessibilityManagerAdapter, |
| asyncTaskExecutor, |
| asyncCallAudioTaskExecutor, |
| blockedNumbersAdapter, |
| transactionManager, |
| emergencyCallDiagnosticLogger, |
| callStreamingNotification, |
| bluetoothDeviceManager, |
| featureFlags, |
| telephonyFlags, |
| IncomingCallFilterGraph::new, |
| mMetricsController, |
| vibratorAdapter, |
| scheduledExecutorService, |
| lowBatteryAlertListener, |
| telecomUiPackageName); |
| bluetoothDeviceManager.setCallsManager(mCallsManager); |
| mIncomingCallNotifier = incomingCallNotifier; |
| incomingCallNotifier.setCallsManagerProxy(new IncomingCallNotifier.CallsManagerProxy() { |
| @Override |
| public boolean hasUnholdableCallsForOtherConnectionService( |
| PhoneAccountHandle phoneAccountHandle) { |
| return mCallsManager.hasUnholdableCallsForOtherConnectionService( |
| phoneAccountHandle); |
| } |
| |
| @Override |
| public int getNumUnholdableCallsForOtherConnectionService( |
| PhoneAccountHandle phoneAccountHandle) { |
| return mCallsManager.getNumUnholdableCallsForOtherConnectionService( |
| phoneAccountHandle); |
| } |
| |
| @Override |
| public Call getActiveCall() { |
| return mCallsManager.getActiveCall(); |
| } |
| }); |
| mCallsManager.setIncomingCallNotifier(mIncomingCallNotifier); |
| |
| mRespondViaSmsManager = new RespondViaSmsManager(mCallsManager, mLock, |
| asyncTaskExecutor); |
| mCallsManager.setRespondViaSmsManager(mRespondViaSmsManager); |
| |
| // IMPORTANT: This context must be retained or the receivers we register here will never |
| // fire once the context is garbage collected. |
| mAllUsersContext = mContext.createContextAsUser(UserHandle.ALL, 0); |
| mAllUsersContext.registerReceiver(mUserSwitchedReceiver, USER_SWITCHED_FILTER, |
| Context.RECEIVER_NOT_EXPORTED); |
| mAllUsersContext.registerReceiver(mUserStartingReceiver, USER_STARTING_FILTER, |
| Context.RECEIVER_NOT_EXPORTED); |
| mAllUsersContext.registerReceiver(mBootCompletedReceiver, BOOT_COMPLETE_FILTER, |
| Context.RECEIVER_NOT_EXPORTED); |
| if (com.android.internal.telecom.flags.Flags.registerBluetoothReceiverForAllUsers()) { |
| mAllUsersContext.registerReceiver(bluetoothStateReceiver, |
| BluetoothStateReceiver.INTENT_FILTER, |
| Context.RECEIVER_EXPORTED); |
| } else { |
| mContext.registerReceiver(bluetoothStateReceiver, |
| BluetoothStateReceiver.INTENT_FILTER); |
| } |
| |
| // Set current user explicitly since USER_SWITCHED_FILTER intent can be missed at |
| // startup |
| synchronized (mLock) { |
| UserHandle currentUserHandle = UserHandle.of(ActivityManager.getCurrentUser()); |
| mPhoneAccountRegistrar.setCurrentUserHandle(currentUserHandle); |
| mCallsManager.onUserSwitch(currentUserHandle); |
| } |
| |
| mCallIntentProcessor = new CallIntentProcessor(mContext, mCallsManager, |
| defaultDialerCache, telecomUiPackageName, featureFlags); |
| mTelecomBroadcastIntentProcessor = new TelecomBroadcastIntentProcessor( |
| mContext, mCallsManager, mFeatureFlags); |
| |
| IntentFilter telecomBroadcastFilter = new IntentFilter(); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_CLEAR_MISSED_CALLS); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_CALL_BACK_FROM_NOTIFICATION); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_SEND_SMS_FROM_NOTIFICATION); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_ANSWER_FROM_NOTIFICATION); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_REJECT_FROM_NOTIFICATION); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_PROCEED_WITH_CALL); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_CANCEL_CALL); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_PLACE_REDIRECTED_CALL); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_PLACE_UNREDIRECTED_CALL); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_CANCEL_REDIRECTED_CALL); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_HANGUP_CALL); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_STOP_STREAMING); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_DISCONNECTED_SEND_SMS_FROM_NOTIFICATION); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_DISCONNECTED_CALL_BACK_FROM_NOTIFICATION); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_SEND_CALL_TO_LOCAL_VOICEMAIL); |
| telecomBroadcastFilter.addAction(TelecomBroadcastIntentProcessor |
| .ACTION_PICKUP_LOCAL_VOICEMAIL); |
| mAllUsersContext.registerReceiver(new TelecomBroadcastReceiver(), |
| telecomBroadcastFilter, TelecomManager.PERMISSION_TELECOM_UI_ACCESS, null, |
| Context.RECEIVER_EXPORTED); |
| |
| // Register the receiver for the dialer secret codes, used to enable extended logging. |
| mDialerCodeReceiver = new DialerCodeReceiver(mCallsManager); |
| mContext.registerReceiver(mDialerCodeReceiver, DIALER_SECRET_CODE_FILTER, |
| Manifest.permission.CONTROL_INCALL_EXPERIENCE, null); |
| |
| // There is no USER_SWITCHED broadcast for user 0, handle it here explicitly. |
| mTelecomServiceImpl = new TelecomServiceImpl( |
| mContext, mCallsManager, mPhoneAccountRegistrar, |
| new CallIntentProcessor.AdapterImpl(defaultDialerCache, telecomUiPackageName), |
| new UserCallIntentProcessorFactory() { |
| @Override |
| public UserCallIntentProcessor create(Context context, |
| UserHandle userHandle) { |
| return new UserCallIntentProcessor(context, userHandle, |
| telecomUiPackageName); |
| } |
| }, |
| defaultDialerCache, |
| new TelecomServiceImpl.SubscriptionManagerAdapterImpl(), |
| featureFlags, |
| moduleFeatureFlags, |
| null, |
| new com.android.internal.telecom.flags.Flags(), |
| mLock, |
| mMetricsController, |
| sysUiPackageName, |
| telecomUiPackageName); |
| } finally { |
| Log.endSession(); |
| } |
| } |
| |
| @VisibleForTesting |
| public PhoneAccountRegistrar getPhoneAccountRegistrar() { |
| return mPhoneAccountRegistrar; |
| } |
| |
| @VisibleForTesting |
| public CallsManager getCallsManager() { |
| return mCallsManager; |
| } |
| |
| public CallIntentProcessor getCallIntentProcessor() { |
| return mCallIntentProcessor; |
| } |
| |
| public TelecomBroadcastIntentProcessor getTelecomBroadcastIntentProcessor() { |
| return mTelecomBroadcastIntentProcessor; |
| } |
| |
| public TelecomServiceImpl getTelecomServiceImpl() { |
| return mTelecomServiceImpl; |
| } |
| |
| public Object getLock() { |
| return mLock; |
| } |
| |
| public boolean isBootComplete() { |
| return mIsBootComplete; |
| } |
| |
| public FeatureFlags getFeatureFlags() { |
| return mFeatureFlags; |
| } |
| |
| public TelecomMetricsController getMetricsController() { |
| return mMetricsController; |
| } |
| } |