Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b7fae36 authored by kaiyiz's avatar kaiyiz Committed by cretin45
Browse files

Gallery2: Sign SIM card number for Mobile Data to Setting

When choose prefered APN in Streaming Settings, there is no default
SIM card number for mobile data, so the reset function is not available.

In the intent for APN setting, add the SIM card number for default
set.

CRs-Fixed: 731357

Change-Id: I30e9e361af504be851adef0537d7512150338783
parent 565a3338
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.preference.PreferenceCategory;
import android.preference.RingtonePreference;
import android.preference.PreferenceScreen;
import android.provider.ContactsContract;
import android.provider.Settings;
import android.provider.Settings.System;
import android.provider.Telephony;
import android.telephony.TelephonyManager;
@@ -285,11 +286,23 @@ public class SettingsActivity extends PreferenceActivity {
    }
    
    private void setApnListener() {
        final String ACTION_NAME = "android.settings.APN_SETTINGS";
        final String CLASS_NAME    = "com.android.settings.ApnSettings";
        final String SUBSCRIPTION_KEY = "subscription";

        mApn.setSummary(getDefaultApnName());
        mApn.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            public boolean onPreferenceClick(Preference preference) {
                Intent intent = new Intent(ACTION_NAME);
                Intent intent = new Intent();
                intent.setClassName(PACKAGE_NAME, CLASS_NAME);

                int subscription = 0;
                try {
                    subscription = Settings.Global.getInt(SettingsActivity.this.getContentResolver(),
                            Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION);
                    intent.putExtra(SUBSCRIPTION_KEY, subscription);
                } catch (Exception e) {
                    Log.d("SettingActivity", "Can't get subscription for Exception" + e);
                }
                startActivityForResult(intent, SELECT_APN);
                return true;
            }