Move CarrierConfigLoader registrar call to init

Move the service register call so that the fake version of the
CarrierConfigLoader that is created during testing doesn't replace
the actual CarrierConfigManager during the duration of the test.

Also quit the handlerthread to avoid issues in the future.

Bug: 186558648
Bug: 186700549
Bug: 186701101
Bug: 186515966
Bug: 186515965
Test: atest --rerun-until-failure 10 TeleServiceTests
Change-Id: I21ff7db7e7fb7e5ca3d6e59c6e46b4ea212ebe68
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index d5b697a..577d2c0 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -706,9 +706,6 @@
         mFromSystemUnlocked = new boolean[numPhones];
         mServiceConnectionForNoSimConfig = new CarrierServiceConnection[numPhones];
         mServiceBoundForNoSimConfig = new boolean[numPhones];
-        // Make this service available through ServiceManager.
-        TelephonyFrameworkInitializer
-                .getTelephonyServiceManager().getCarrierConfigServiceRegisterer().register(this);
         logd("CarrierConfigLoader has started");
         mSubscriptionInfoUpdater = subscriptionInfoUpdater;
         mHandler.sendEmptyMessage(EVENT_CHECK_SYSTEM_UPDATE);
@@ -724,6 +721,9 @@
             if (sInstance == null) {
                 sInstance = new CarrierConfigLoader(context,
                         PhoneFactory.getSubscriptionInfoUpdater(), Looper.myLooper());
+                // Make this service available through ServiceManager.
+                TelephonyFrameworkInitializer.getTelephonyServiceManager()
+                        .getCarrierConfigServiceRegisterer().register(sInstance);
             } else {
                 Log.wtf(LOG_TAG, "init() called multiple times!  sInstance = " + sInstance);
             }