Merge "Use main looper for PhoneStateListener"
diff --git a/src/com/android/settings/network/telephony/CarrierPreferenceController.java b/src/com/android/settings/network/telephony/CarrierPreferenceController.java
index 957eaaa..406ef7b 100644
--- a/src/com/android/settings/network/telephony/CarrierPreferenceController.java
+++ b/src/com/android/settings/network/telephony/CarrierPreferenceController.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
+import android.telephony.SubscriptionManager;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -37,6 +38,7 @@
public CarrierPreferenceController(Context context, String key) {
super(context, key);
mCarrierConfigManager = new CarrierConfigManager(context);
+ mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
public void init(int subId) {
diff --git a/src/com/android/settings/network/telephony/DataUsagePreferenceController.java b/src/com/android/settings/network/telephony/DataUsagePreferenceController.java
index 07c58c1..b94f7e5 100644
--- a/src/com/android/settings/network/telephony/DataUsagePreferenceController.java
+++ b/src/com/android/settings/network/telephony/DataUsagePreferenceController.java
@@ -43,6 +43,7 @@
public DataUsagePreferenceController(Context context, String key) {
super(context, key);
+ mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
@Override
diff --git a/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java b/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
index d6773ed..0a258ec 100644
--- a/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
+++ b/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
@@ -17,6 +17,7 @@
package com.android.settings.network.telephony;
import android.content.Context;
+import android.os.Looper;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
@@ -53,7 +54,7 @@
public Enhanced4gLtePreferenceController(Context context, String key) {
super(context, key);
mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
- mPhoneStateListener = new PhoneCallStateListener();
+ mPhoneStateListener = new PhoneCallStateListener(Looper.getMainLooper());
mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
@@ -131,6 +132,11 @@
}
private class PhoneCallStateListener extends PhoneStateListener {
+
+ public PhoneCallStateListener(Looper looper) {
+ super(looper);
+ }
+
@Override
public void onCallStateChanged(int state, String incomingNumber) {
updateState(mPreference);
diff --git a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
index 6958a11..065f182 100644
--- a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
+++ b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
@@ -61,6 +61,7 @@
super(context, key);
mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
mDataContentObserver = new DataContentObserver(new Handler(Looper.getMainLooper()));
+ mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
@Override
diff --git a/src/com/android/settings/network/telephony/RoamingPreferenceController.java b/src/com/android/settings/network/telephony/RoamingPreferenceController.java
index 3c1741b..b2eba08 100644
--- a/src/com/android/settings/network/telephony/RoamingPreferenceController.java
+++ b/src/com/android/settings/network/telephony/RoamingPreferenceController.java
@@ -61,6 +61,7 @@
super(context, key);
mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
mDataContentObserver = new DataContentObserver(new Handler(Looper.getMainLooper()));
+ mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
@Override