• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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.server.telecom;
18 
19 import android.Manifest;
20 import android.app.ActivityManager;
21 import android.bluetooth.BluetoothManager;
22 import android.content.BroadcastReceiver;
23 import android.content.Context;
24 import android.content.Intent;
25 import android.content.IntentFilter;
26 import android.content.ServiceConnection;
27 import android.content.pm.ResolveInfo;
28 import android.net.Uri;
29 import android.os.BugreportManager;
30 import android.os.DropBoxManager;
31 import android.os.Looper;
32 import android.os.UserHandle;
33 import android.telecom.Log;
34 import android.telecom.PhoneAccountHandle;
35 import android.telephony.AnomalyReporter;
36 import android.telephony.TelephonyManager;
37 import android.widget.Toast;
38 
39 import androidx.annotation.NonNull;
40 
41 import com.android.internal.annotations.VisibleForTesting;
42 import com.android.server.telecom.CallAudioManager.AudioServiceFactory;
43 import com.android.server.telecom.DefaultDialerCache.DefaultDialerManagerAdapter;
44 import com.android.server.telecom.bluetooth.BluetoothDeviceManager;
45 import com.android.server.telecom.bluetooth.BluetoothRouteManager;
46 import com.android.server.telecom.bluetooth.BluetoothStateReceiver;
47 import com.android.server.telecom.callfiltering.BlockedNumbersAdapter;
48 import com.android.server.telecom.callfiltering.IncomingCallFilterGraph;
49 import com.android.server.telecom.components.UserCallIntentProcessor;
50 import com.android.server.telecom.components.UserCallIntentProcessorFactory;
51 import com.android.server.telecom.flags.FeatureFlags;
52 import com.android.server.telecom.metrics.EventStats;
53 import com.android.server.telecom.metrics.TelecomMetricsController;
54 import com.android.server.telecom.ui.AudioProcessingNotification;
55 import com.android.server.telecom.ui.CallStreamingNotification;
56 import com.android.server.telecom.ui.DisconnectedCallNotifier;
57 import com.android.server.telecom.ui.IncomingCallNotifier;
58 import com.android.server.telecom.ui.MissedCallNotifierImpl.MissedCallNotifierImplFactory;
59 import com.android.server.telecom.ui.ToastFactory;
60 import com.android.server.telecom.callsequencing.TransactionManager;
61 
62 import java.io.FileNotFoundException;
63 import java.io.InputStream;
64 import java.util.List;
65 import java.util.concurrent.Executor;
66 import java.util.concurrent.Executors;
67 
68 /**
69  * Top-level Application class for Telecom.
70  */
71 public class TelecomSystem {
72 
73     /**
74      * This interface is implemented by system-instantiated components (e.g., Services and
75      * Activity-s) that wish to use the TelecomSystem but would like to be testable. Such a
76      * component should implement the getTelecomSystem() method to return the global singleton,
77      * and use its own method. Tests can subclass the component to return a non-singleton.
78      *
79      * A refactoring goal for Telecom is to limit use of the TelecomSystem singleton to those
80      * system-instantiated components, and have all other parts of the system just take all their
81      * dependencies as explicit arguments to their constructor or other methods.
82      */
83     public interface Component {
getTelecomSystem()84         TelecomSystem getTelecomSystem();
85     }
86 
87 
88     /**
89      * Tagging interface for the object used for synchronizing multi-threaded operations in
90      * the Telecom system.
91      */
92     public interface SyncRoot {
93     }
94 
95     private static final IntentFilter USER_SWITCHED_FILTER =
96             new IntentFilter(Intent.ACTION_USER_SWITCHED);
97 
98     private static final IntentFilter USER_STARTING_FILTER =
99             new IntentFilter(Intent.ACTION_USER_STARTING);
100 
101     private static final IntentFilter BOOT_COMPLETE_FILTER =
102             new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
103 
104     /** Intent filter for dialer secret codes. */
105     private static final IntentFilter DIALER_SECRET_CODE_FILTER;
106 
107     /**
108      * Initializes the dialer secret code intent filter.  Setup to handle the various secret codes
109      * which can be dialed (e.g. in format *#*#code#*#*) to trigger various behavior in Telecom.
110      */
111     static {
112         DIALER_SECRET_CODE_FILTER = new IntentFilter(
113                 "android.provider.Telephony.SECRET_CODE");
114         DIALER_SECRET_CODE_FILTER.addDataScheme("android_secret_code");
115         DIALER_SECRET_CODE_FILTER
addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_DEBUG_ON, null)116                 .addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_DEBUG_ON, null);
117         DIALER_SECRET_CODE_FILTER
addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_DEBUG_OFF, null)118                 .addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_DEBUG_OFF, null);
119         DIALER_SECRET_CODE_FILTER
addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_MARK, null)120                 .addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_MARK, null);
121         DIALER_SECRET_CODE_FILTER
addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_MENU, null)122                 .addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_MENU, null);
123 
124         USER_SWITCHED_FILTER.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
125         USER_STARTING_FILTER.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
126         BOOT_COMPLETE_FILTER.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
127         DIALER_SECRET_CODE_FILTER.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
128     }
129 
130     private static TelecomSystem INSTANCE = null;
131 
132     private final SyncRoot mLock = new SyncRoot() { };
133     private final MissedCallNotifier mMissedCallNotifier;
134     private final IncomingCallNotifier mIncomingCallNotifier;
135     private final PhoneAccountRegistrar mPhoneAccountRegistrar;
136     private final CallsManager mCallsManager;
137     private final RespondViaSmsManager mRespondViaSmsManager;
138     private final Context mContext;
139     private final CallIntentProcessor mCallIntentProcessor;
140     private final TelecomBroadcastIntentProcessor mTelecomBroadcastIntentProcessor;
141     private final TelecomServiceImpl mTelecomServiceImpl;
142     private final ContactsAsyncHelper mContactsAsyncHelper;
143     private final DialerCodeReceiver mDialerCodeReceiver;
144     private final FeatureFlags mFeatureFlags;
145 
146     private boolean mIsBootComplete = false;
147 
148     private final BroadcastReceiver mUserSwitchedReceiver = new BroadcastReceiver() {
149         @Override
150         public void onReceive(Context context, Intent intent) {
151             Log.startSession("TSSwR.oR");
152             try {
153                 synchronized (mLock) {
154                     int userHandleId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
155                     UserHandle currentUserHandle = new UserHandle(userHandleId);
156                     mPhoneAccountRegistrar.setCurrentUserHandle(currentUserHandle);
157                     mCallsManager.onUserSwitch(currentUserHandle);
158                 }
159             } finally {
160                 Log.endSession();
161             }
162         }
163     };
164 
165     private final BroadcastReceiver mUserStartingReceiver = new BroadcastReceiver() {
166         @Override
167         public void onReceive(Context context, Intent intent) {
168             Log.startSession("TSStR.oR");
169             try {
170                 synchronized (mLock) {
171                     int userHandleId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
172                     UserHandle addingUserHandle = new UserHandle(userHandleId);
173                     mCallsManager.onUserStarting(addingUserHandle);
174                 }
175             } finally {
176                 Log.endSession();
177             }
178         }
179     };
180 
181     private final BroadcastReceiver mBootCompletedReceiver = new BroadcastReceiver() {
182         @Override
183         public void onReceive(Context context, Intent intent) {
184             Log.startSession("TSBCR.oR");
185             try {
186                 synchronized (mLock) {
187                     mIsBootComplete = true;
188                     mCallsManager.onBootCompleted();
189                 }
190             } finally {
191                 Log.endSession();
192             }
193         }
194     };
195 
getInstance()196     public static TelecomSystem getInstance() {
197         return INSTANCE;
198     }
199 
setInstance(TelecomSystem instance)200     public static void setInstance(TelecomSystem instance) {
201         if (INSTANCE != null) {
202             Log.w("TelecomSystem", "Attempt to set TelecomSystem.INSTANCE twice");
203         }
204         Log.i(TelecomSystem.class, "TelecomSystem.INSTANCE being set");
205         INSTANCE = instance;
206     }
207 
TelecomSystem( Context context, MissedCallNotifierImplFactory missedCallNotifierImplFactory, CallerInfoAsyncQueryFactory callerInfoAsyncQueryFactory, HeadsetMediaButtonFactory headsetMediaButtonFactory, ProximitySensorManagerFactory proximitySensorManagerFactory, InCallWakeLockControllerFactory inCallWakeLockControllerFactory, AudioServiceFactory audioServiceFactory, ConnectionServiceFocusManager.ConnectionServiceFocusManagerFactory connectionServiceFocusManagerFactory, Timeouts.Adapter timeoutsAdapter, AsyncRingtonePlayer asyncRingtonePlayer, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, IncomingCallNotifier incomingCallNotifier, InCallTonePlayer.ToneGeneratorFactory toneGeneratorFactory, CallAudioRouteStateMachine.Factory callAudioRouteStateMachineFactory, CallAudioModeStateMachine.Factory callAudioModeStateMachineFactory, ClockProxy clockProxy, RoleManagerAdapter roleManagerAdapter, ContactsAsyncHelper.Factory contactsAsyncHelperFactory, DeviceIdleControllerAdapter deviceIdleControllerAdapter, String sysUiPackageName, Ringer.AccessibilityManagerAdapter accessibilityManagerAdapter, Executor asyncTaskExecutor, Executor asyncCallAudioTaskExecutor, BlockedNumbersAdapter blockedNumbersAdapter, FeatureFlags featureFlags, com.android.internal.telephony.flags.FeatureFlags telephonyFlags, Looper looper)208     public TelecomSystem(
209             Context context,
210             MissedCallNotifierImplFactory missedCallNotifierImplFactory,
211             CallerInfoAsyncQueryFactory callerInfoAsyncQueryFactory,
212             HeadsetMediaButtonFactory headsetMediaButtonFactory,
213             ProximitySensorManagerFactory proximitySensorManagerFactory,
214             InCallWakeLockControllerFactory inCallWakeLockControllerFactory,
215             AudioServiceFactory audioServiceFactory,
216             ConnectionServiceFocusManager.ConnectionServiceFocusManagerFactory
217                     connectionServiceFocusManagerFactory,
218             Timeouts.Adapter timeoutsAdapter,
219             AsyncRingtonePlayer asyncRingtonePlayer,
220             PhoneNumberUtilsAdapter phoneNumberUtilsAdapter,
221             IncomingCallNotifier incomingCallNotifier,
222             InCallTonePlayer.ToneGeneratorFactory toneGeneratorFactory,
223             CallAudioRouteStateMachine.Factory callAudioRouteStateMachineFactory,
224             CallAudioModeStateMachine.Factory callAudioModeStateMachineFactory,
225             ClockProxy clockProxy,
226             RoleManagerAdapter roleManagerAdapter,
227             ContactsAsyncHelper.Factory contactsAsyncHelperFactory,
228             DeviceIdleControllerAdapter deviceIdleControllerAdapter,
229             String sysUiPackageName,
230             Ringer.AccessibilityManagerAdapter accessibilityManagerAdapter,
231             Executor asyncTaskExecutor,
232             Executor asyncCallAudioTaskExecutor,
233             BlockedNumbersAdapter blockedNumbersAdapter,
234             FeatureFlags featureFlags,
235             com.android.internal.telephony.flags.FeatureFlags telephonyFlags,
236             Looper looper) {
237         mContext = context.getApplicationContext();
238         mFeatureFlags = featureFlags;
239         LogUtils.initLogging(mContext);
240         android.telecom.Log.setLock(mLock);
241         AnomalyReporter.initialize(mContext);
242         DefaultDialerManagerAdapter defaultDialerAdapter =
243                 new DefaultDialerCache.DefaultDialerManagerAdapterImpl();
244 
245         DefaultDialerCache defaultDialerCache = new DefaultDialerCache(mContext,
246                 defaultDialerAdapter, roleManagerAdapter, mLock);
247 
248         Log.startSession("TS.init");
249         // Wrap this in a try block to ensure session cleanup occurs in the case of error.
250         try {
251             mPhoneAccountRegistrar = new PhoneAccountRegistrar(mContext, mLock, defaultDialerCache,
252                     (packageName, userHandle) -> AppLabelProxy.Util.getAppLabel(mContext,
253                             userHandle, packageName, mFeatureFlags), null, mFeatureFlags);
254 
255             mContactsAsyncHelper = contactsAsyncHelperFactory.create(
256                     new ContactsAsyncHelper.ContentResolverAdapter() {
257                         @Override
258                         public InputStream openInputStream(Context context, Uri uri)
259                                 throws FileNotFoundException {
260                             return context.getContentResolver().openInputStream(uri);
261                         }
262                     });
263             CallAudioCommunicationDeviceTracker communicationDeviceTracker = new
264                     CallAudioCommunicationDeviceTracker(mContext);
265             BluetoothDeviceManager bluetoothDeviceManager = new BluetoothDeviceManager(mContext,
266                     mContext.getSystemService(BluetoothManager.class).getAdapter(),
267                     communicationDeviceTracker, featureFlags);
268             BluetoothRouteManager bluetoothRouteManager = new BluetoothRouteManager(mContext, mLock,
269                     bluetoothDeviceManager, new Timeouts.Adapter(),
270                     communicationDeviceTracker, featureFlags, looper);
271             BluetoothStateReceiver bluetoothStateReceiver = new BluetoothStateReceiver(
272                     bluetoothDeviceManager, bluetoothRouteManager,
273                     communicationDeviceTracker, featureFlags);
274             mContext.registerReceiver(bluetoothStateReceiver, BluetoothStateReceiver.INTENT_FILTER);
275             communicationDeviceTracker.setBluetoothRouteManager(bluetoothRouteManager);
276 
277             WiredHeadsetManager wiredHeadsetManager = new WiredHeadsetManager(mContext);
278             SystemStateHelper systemStateHelper = new SystemStateHelper(mContext, mLock);
279 
280             mMissedCallNotifier = missedCallNotifierImplFactory
281                     .makeMissedCallNotifierImpl(mContext, mPhoneAccountRegistrar,
282                             defaultDialerCache,
283                             deviceIdleControllerAdapter,
284                             featureFlags);
285             DisconnectedCallNotifier.Factory disconnectedCallNotifierFactory =
286                     new DisconnectedCallNotifier.Default();
287 
288             CallerInfoLookupHelper callerInfoLookupHelper =
289                     new CallerInfoLookupHelper(context, callerInfoAsyncQueryFactory,
290                             mContactsAsyncHelper, mLock);
291 
292             EmergencyCallHelper emergencyCallHelper = new EmergencyCallHelper(mContext,
293                     defaultDialerCache, timeoutsAdapter, mFeatureFlags);
294 
295             InCallControllerFactory inCallControllerFactory = new InCallControllerFactory() {
296                 @Override
297                 public InCallController create(Context context, SyncRoot lock,
298                         CallsManager callsManager, SystemStateHelper systemStateProvider,
299                         DefaultDialerCache defaultDialerCache, Timeouts.Adapter timeoutsAdapter,
300                         EmergencyCallHelper emergencyCallHelper) {
301                     return new InCallController(context, lock, callsManager, systemStateProvider,
302                             defaultDialerCache, timeoutsAdapter, emergencyCallHelper,
303                             new CarModeTracker(), clockProxy, featureFlags);
304                 }
305             };
306 
307             CallEndpointControllerFactory callEndpointControllerFactory =
308                     new CallEndpointControllerFactory() {
309                 @Override
310                 public CallEndpointController create(Context context, SyncRoot lock,
311                         CallsManager callsManager) {
312                     return new CallEndpointController(context, callsManager, featureFlags);
313                 }
314             };
315 
316             CallDiagnosticServiceController callDiagnosticServiceController =
317                     new CallDiagnosticServiceController(
318                             new CallDiagnosticServiceController.ContextProxy() {
319                                 @Override
320                                 public List<ResolveInfo> queryIntentServicesAsUser(
321                                         @NonNull Intent intent, int flags, int userId) {
322                                     return mContext.getPackageManager().queryIntentServicesAsUser(
323                                             intent, flags, userId);
324                                 }
325 
326                                 @Override
327                                 public boolean bindServiceAsUser(@NonNull Intent service,
328                                         @NonNull ServiceConnection conn, int flags,
329                                         @NonNull UserHandle user) {
330                                     return mContext.bindServiceAsUser(service, conn, flags, user);
331                                 }
332 
333                                 @Override
334                                 public void unbindService(@NonNull ServiceConnection conn) {
335                                     mContext.unbindService(conn);
336                                 }
337 
338                                 @Override
339                                 public UserHandle getCurrentUserHandle() {
340                                     return mCallsManager.getCurrentUserHandle();
341                                 }
342                             },
343                             mContext.getResources().getString(
344                                     com.android.server.telecom.R.string
345                                             .call_diagnostic_service_package_name),
346                             mLock
347                     );
348 
349             AudioProcessingNotification audioProcessingNotification =
350                     new AudioProcessingNotification(mContext);
351 
352             ToastFactory toastFactory = new ToastFactory() {
353                 @Override
354                 public void makeText(Context context, int resId, int duration) {
355                     if (mFeatureFlags.telecomResolveHiddenDependencies()) {
356                         context.getMainExecutor().execute(() ->
357                                 Toast.makeText(context, resId, duration).show());
358                     } else {
359                         Toast.makeText(context, context.getMainLooper(),
360                                 context.getString(resId), duration).show();
361                     }
362                 }
363 
364                 @Override
365                 public void makeText(Context context, CharSequence text, int duration) {
366                     if (mFeatureFlags.telecomResolveHiddenDependencies()) {
367                         context.getMainExecutor().execute(() ->
368                                 Toast.makeText(context, text, duration).show());
369                     } else {
370                         Toast.makeText(context, context.getMainLooper(), text, duration).show();
371                     }
372                 }
373             };
374 
375             EmergencyCallDiagnosticLogger emergencyCallDiagnosticLogger =
376                     new EmergencyCallDiagnosticLogger(mContext.getSystemService(
377                             TelephonyManager.class), mContext.getSystemService(
378                             BugreportManager.class), timeoutsAdapter, mContext.getSystemService(
379                             DropBoxManager.class), asyncTaskExecutor, clockProxy);
380 
381             TelecomMetricsController metricsController = featureFlags.telecomMetricsSupport()
382                     ? TelecomMetricsController.make(mContext) : null;
383 
384             CallAnomalyWatchdog callAnomalyWatchdog = new CallAnomalyWatchdog(
385                     Executors.newSingleThreadScheduledExecutor(),
386                     mLock, mFeatureFlags, timeoutsAdapter, clockProxy,
387                     emergencyCallDiagnosticLogger, metricsController);
388 
389             TransactionManager transactionManager = TransactionManager.getInstance();
390 
391             CallStreamingNotification callStreamingNotification =
392                     new CallStreamingNotification(mContext,
393                             (packageName, userHandle) -> AppLabelProxy.Util.getAppLabel(mContext,
394                                     userHandle, packageName, mFeatureFlags), asyncTaskExecutor);
395 
396             mCallsManager = new CallsManager(
397                     mContext,
398                     mLock,
399                     callerInfoLookupHelper,
400                     mMissedCallNotifier,
401                     disconnectedCallNotifierFactory,
402                     mPhoneAccountRegistrar,
403                     headsetMediaButtonFactory,
404                     proximitySensorManagerFactory,
405                     inCallWakeLockControllerFactory,
406                     connectionServiceFocusManagerFactory,
407                     audioServiceFactory,
408                     bluetoothRouteManager,
409                     wiredHeadsetManager,
410                     systemStateHelper,
411                     defaultDialerCache,
412                     timeoutsAdapter,
413                     asyncRingtonePlayer,
414                     phoneNumberUtilsAdapter,
415                     emergencyCallHelper,
416                     toneGeneratorFactory,
417                     clockProxy,
418                     audioProcessingNotification,
419                     bluetoothStateReceiver,
420                     callAudioRouteStateMachineFactory,
421                     callAudioModeStateMachineFactory,
422                     inCallControllerFactory,
423                     callDiagnosticServiceController,
424                     roleManagerAdapter,
425                     toastFactory,
426                     callEndpointControllerFactory,
427                     callAnomalyWatchdog,
428                     accessibilityManagerAdapter,
429                     asyncTaskExecutor,
430                     asyncCallAudioTaskExecutor,
431                     blockedNumbersAdapter,
432                     transactionManager,
433                     emergencyCallDiagnosticLogger,
434                     communicationDeviceTracker,
435                     callStreamingNotification,
436                     bluetoothDeviceManager,
437                     featureFlags,
438                     telephonyFlags,
439                     IncomingCallFilterGraph::new,
440                     metricsController);
441 
442             mIncomingCallNotifier = incomingCallNotifier;
443             incomingCallNotifier.setCallsManagerProxy(new IncomingCallNotifier.CallsManagerProxy() {
444                 @Override
445                 public boolean hasUnholdableCallsForOtherConnectionService(
446                         PhoneAccountHandle phoneAccountHandle) {
447                     return mCallsManager.hasUnholdableCallsForOtherConnectionService(
448                             phoneAccountHandle);
449                 }
450 
451                 @Override
452                 public int getNumUnholdableCallsForOtherConnectionService(
453                         PhoneAccountHandle phoneAccountHandle) {
454                     return mCallsManager.getNumUnholdableCallsForOtherConnectionService(
455                             phoneAccountHandle);
456                 }
457 
458                 @Override
459                 public Call getActiveCall() {
460                     return mCallsManager.getActiveCall();
461                 }
462             });
463             mCallsManager.setIncomingCallNotifier(mIncomingCallNotifier);
464 
465             mRespondViaSmsManager = new RespondViaSmsManager(mCallsManager, mLock,
466                 asyncTaskExecutor, featureFlags);
467             mCallsManager.setRespondViaSmsManager(mRespondViaSmsManager);
468 
469             mContext.registerReceiverAsUser(mUserSwitchedReceiver, UserHandle.ALL,
470                     USER_SWITCHED_FILTER, null, null);
471             mContext.registerReceiverAsUser(mUserStartingReceiver, UserHandle.ALL,
472                     USER_STARTING_FILTER, null, null);
473             mContext.registerReceiverAsUser(mBootCompletedReceiver, UserHandle.ALL,
474                     BOOT_COMPLETE_FILTER, null, null);
475 
476             // Set current user explicitly since USER_SWITCHED_FILTER intent can be missed at
477             // startup
478             synchronized (mLock) {
479                 UserHandle currentUserHandle = UserHandle.of(ActivityManager.getCurrentUser());
480                 mPhoneAccountRegistrar.setCurrentUserHandle(currentUserHandle);
481                 mCallsManager.onUserSwitch(currentUserHandle);
482             }
483 
484             mCallIntentProcessor = new CallIntentProcessor(mContext, mCallsManager,
485                     defaultDialerCache, featureFlags);
486             mTelecomBroadcastIntentProcessor = new TelecomBroadcastIntentProcessor(
487                     mContext, mCallsManager);
488 
489             // Register the receiver for the dialer secret codes, used to enable extended logging.
490             mDialerCodeReceiver = new DialerCodeReceiver(mCallsManager);
491             mContext.registerReceiver(mDialerCodeReceiver, DIALER_SECRET_CODE_FILTER,
492                     Manifest.permission.CONTROL_INCALL_EXPERIENCE, null);
493 
494             // There is no USER_SWITCHED broadcast for user 0, handle it here explicitly.
495             mTelecomServiceImpl = new TelecomServiceImpl(
496                     mContext, mCallsManager, mPhoneAccountRegistrar,
497                     new CallIntentProcessor.AdapterImpl(defaultDialerCache),
498                     new UserCallIntentProcessorFactory() {
499                         @Override
500                         public UserCallIntentProcessor create(Context context,
501                                 UserHandle userHandle) {
502                             return new UserCallIntentProcessor(context, userHandle, featureFlags);
503                         }
504                     },
505                     defaultDialerCache,
506                     new TelecomServiceImpl.SubscriptionManagerAdapterImpl(),
507                     new TelecomServiceImpl.SettingsSecureAdapterImpl(),
508                     featureFlags,
509                     null,
510                     mLock,
511                     metricsController,
512                     sysUiPackageName);
513         } finally {
514             Log.endSession();
515         }
516     }
517 
518     @VisibleForTesting
getPhoneAccountRegistrar()519     public PhoneAccountRegistrar getPhoneAccountRegistrar() {
520         return mPhoneAccountRegistrar;
521     }
522 
523     @VisibleForTesting
getCallsManager()524     public CallsManager getCallsManager() {
525         return mCallsManager;
526     }
527 
getCallIntentProcessor()528     public CallIntentProcessor getCallIntentProcessor() {
529         return mCallIntentProcessor;
530     }
531 
getTelecomBroadcastIntentProcessor()532     public TelecomBroadcastIntentProcessor getTelecomBroadcastIntentProcessor() {
533         return mTelecomBroadcastIntentProcessor;
534     }
535 
getTelecomServiceImpl()536     public TelecomServiceImpl getTelecomServiceImpl() {
537         return mTelecomServiceImpl;
538     }
539 
getLock()540     public Object getLock() {
541         return mLock;
542     }
543 
isBootComplete()544     public boolean isBootComplete() {
545         return mIsBootComplete;
546     }
547 
getFeatureFlags()548     public FeatureFlags getFeatureFlags() {
549         return mFeatureFlags;
550     }
551 }
552