summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard/setup
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2015-04-18 11:40:43 +0700
committercretin45 <cretin45@gmail.com>2015-04-20 15:53:19 -0700
commitdd500a1f42e65043595840c173cd5a4763f6099d (patch)
treed678833c1dbfece1740c3eb6301da37abd1a3482 /src/com/cyanogenmod/setupwizard/setup
parent317a6cb89108e97b2e61f912f23928d58c6ca874 (diff)
downloadpackages_apps_SetupWizard-dd500a1f42e65043595840c173cd5a4763f6099d.zip
packages_apps_SetupWizard-dd500a1f42e65043595840c173cd5a4763f6099d.tar.gz
packages_apps_SetupWizard-dd500a1f42e65043595840c173cd5a4763f6099d.tar.bz2
SetupWizard: don't access SubscriptionController directly
SubscriptionController exists in the telephony process and cannot be accessed by SetupWizard. getInstance() will always return null. Change-Id: I017682d3aad539e1954348664b1c1fec7f76009d
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
index c5aedc4..e9e71ec 100644
--- a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java
@@ -38,8 +38,6 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
-import com.android.internal.telephony.SubscriptionController;
-
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.SetupWizardApp;
import com.cyanogenmod.setupwizard.cmstats.SetupStats;
@@ -52,11 +50,8 @@ public class ChooseDataSimPage extends SetupPage {
public static final String TAG = "ChooseDataSimPage";
- private SubscriptionManager mSubscriptionManager;
-
public ChooseDataSimPage(Context context, SetupDataCallbacks callbacks) {
super(context, callbacks);
- mSubscriptionManager = SubscriptionManager.from(context);
}
@Override
@@ -100,6 +95,7 @@ public class ChooseDataSimPage extends SetupPage {
private boolean mIsAttached = false;
private Context mContext;
+ private SubscriptionManager mSubscriptionManager;
private final Handler mHandler = new Handler();
@@ -115,8 +111,7 @@ public class ChooseDataSimPage extends SetupPage {
public void onClick(View view) {
SubscriptionInfo subInfoRecord = (SubscriptionInfo)view.getTag();
if (subInfoRecord != null) {
- SubscriptionController.getInstance()
- .setDefaultDataSubId(subInfoRecord.getSubscriptionId());
+ mSubscriptionManager.setDefaultDataSubId(subInfoRecord.getSubscriptionId());
setDataSubChecked(subInfoRecord);
}
}
@@ -126,8 +121,7 @@ public class ChooseDataSimPage extends SetupPage {
protected void initializePage() {
mPageView = (ViewGroup)mRootView.findViewById(R.id.page_view);
mProgressBar = (ProgressBar) mRootView.findViewById(R.id.progress);
- List<SubscriptionInfo> subInfoRecords = SubscriptionController
- .getInstance().getActiveSubscriptionInfoList();
+ List<SubscriptionInfo> subInfoRecords = mSubscriptionManager.getActiveSubscriptionInfoList();
int simCount = subInfoRecords.size();
mSubInfoRecords = new SparseArray<SubscriptionInfo>(simCount);
for (int i = 0; i < simCount; i++) {
@@ -163,10 +157,16 @@ public class ChooseDataSimPage extends SetupPage {
}
@Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mContext = getActivity().getApplicationContext();
+ mSubscriptionManager = SubscriptionManager.from(mContext);
+ }
+
+ @Override
public void onResume() {
super.onResume();
mIsAttached = true;
- mContext = getActivity().getApplicationContext();
mPhone = (TelephonyManager)getActivity().getSystemService(Context.TELEPHONY_SERVICE);
for (int i = 0; i < mPhoneStateListeners.size(); i++) {
mPhone.listen(mPhoneStateListeners.get(i),
@@ -253,9 +253,8 @@ public class ChooseDataSimPage extends SetupPage {
if (mIsAttached) {
for (int i = 0; i < mSubInfoRecords.size(); i++) {
SubscriptionInfo subInfoRecord = mSubInfoRecords.get(i);
- mCheckBoxes.get(i).setChecked(SubscriptionManager.getDefaultDataSubId()
+ mCheckBoxes.get(i).setChecked(mSubscriptionManager.getDefaultDataPhoneId()
== subInfoRecord.getSimSlotIndex());
-
}
}
}