Fix mvno match data is incorrect for APNs

[Cause of Defect]
When user editing an existing apn, ApnPreference won't pass
the subId to ApnEditor.
As a result, if use change the mvno type to 'imsi', ApnEditor
can NOT fetch the correct IMSI due to invalid subId.

[How To Fix]
Pass subId to ApnEditor, which is same as adding new APN.

Bug: 34646368
Test: manual - edited an existing apn
Change-Id: I79fe55ccdeb8dab0ffcc7dfb22ba680beb58b9cd
This commit is contained in:
Wei Huang
2017-01-23 20:26:20 +09:00
committed by daisuke oyamada
parent 4ce19f5c4f
commit ec5109ab6d
2 changed files with 16 additions and 5 deletions

11
src/com/android/settings/ApnPreference.java Normal file → Executable file
View File

@@ -23,6 +23,7 @@ import android.net.Uri;
import android.provider.Telephony;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
import android.telephony.SubscriptionManager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
@@ -35,6 +36,8 @@ public class ApnPreference extends Preference implements
CompoundButton.OnCheckedChangeListener, OnClickListener {
final static String TAG = "ApnPreference";
private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
public ApnPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@@ -116,7 +119,9 @@ public class ApnPreference extends Preference implements
if (context != null) {
int pos = Integer.parseInt(getKey());
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
context.startActivity(new Intent(Intent.ACTION_EDIT, url));
Intent editIntent = new Intent(Intent.ACTION_EDIT, url);
editIntent.putExtra(ApnSettings.SUB_ID, mSubId);
context.startActivity(editIntent);
}
}
}
@@ -128,4 +133,8 @@ public class ApnPreference extends Preference implements
public boolean getSelectable() {
return mSelectable;
}
public void setSubId(int subId) {
mSubId = subId;
}
}