diff options
author | Christian Morlok <ChristianMorlok@gmail.com> | 2016-01-20 08:31:10 +0100 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2017-01-07 01:41:42 +0200 |
commit | 1c69bf004adee8f15c2171c91d23d395f1ff3065 (patch) | |
tree | 473082ad600d8b45149b944f1d76a157be70c913 | |
parent | ac2ec3753e98f19ee3ccb3d1dd3b5d310d039c7a (diff) | |
download | android_frameworks_opt_telephony-1c69bf004adee8f15c2171c91d23d395f1ff3065.tar.gz android_frameworks_opt_telephony-1c69bf004adee8f15c2171c91d23d395f1ff3065.tar.bz2 android_frameworks_opt_telephony-1c69bf004adee8f15c2171c91d23d395f1ff3065.zip |
telephony: Do not set default subscriptions on shutdown
On some devices the SIM slots are not deactivated at the same time
when the phone is shut down or rebooted. This means that at some point
only one SIM is activated, and all default subscriptions are set to
this SIM (a feature introduced in http://review.cyanogenmod.org/#/c/121239/).
Change-Id: Ief36004619b75530a21b23efc767e1beb1fb0750
-rw-r--r-- | src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java b/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java index 0ff09ad1a..c2d8e1d2f 100644 --- a/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +++ b/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java @@ -115,6 +115,7 @@ public class SubscriptionInfoUpdater extends Handler { // The current foreground user ID. private int mCurrentlyActiveUserId; private CarrierServiceBindHelper mCarrierServiceBindHelper; + private boolean mIsShutdown; public SubscriptionInfoUpdater(Context context, Phone[] phone, CommandsInterface[] ci) { logd("Constructor invoked"); @@ -124,10 +125,12 @@ public class SubscriptionInfoUpdater extends Handler { mSubscriptionManager = SubscriptionManager.from(mContext); mPackageManager = IPackageManager.Stub.asInterface(ServiceManager.getService("package")); mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); + mIsShutdown = false; IntentFilter intentFilter = new IntentFilter(TelephonyIntents.ACTION_SIM_STATE_CHANGED); intentFilter.addAction(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED); intentFilter.addAction(Intent.ACTION_USER_UNLOCKED); + intentFilter.addAction(Intent.ACTION_SHUTDOWN); mContext.registerReceiver(sReceiver, intentFilter); mCarrierServiceBindHelper = new CarrierServiceBindHelper(mContext); @@ -201,6 +204,11 @@ public class SubscriptionInfoUpdater extends Handler { return; } + if (action.equals(Intent.ACTION_SHUTDOWN)) { + mIsShutdown = true; + return; + } + if (!action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED) && !action.equals(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED)) { return; @@ -666,7 +674,7 @@ public class SubscriptionInfoUpdater extends Handler { } } - if (insertedSimCount == 1) { + if (!mIsShutdown && insertedSimCount == 1) { SubscriptionInfo sir = subInfos.get(0); int subId = sir.getSubscriptionId(); mSubscriptionManager.setDefaultDataSubId(subId); |