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

Commit e99f07cd authored by kaiyiz's avatar kaiyiz Committed by Gerrit - the friendly Code Review server
Browse files

Settings: Make APN of CT can be edited in default mode

The APN of CT can't be edited, because that the read_only property
is true.

In order to make APN of CT can be edited, the rules of editing APN
is changed.

CRs-Fixed: 773544

Change-Id: I7fbab82957b3de83f8516436152184b5fba79583
parent e266c3c9
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1430,5 +1430,9 @@
        <item>46003</item>
        <item>46003</item>
        <item>46007</item>
        <item>46007</item>
    </string-array>
    </string-array>
    <string-array name="plmn_list_for_apn_disable">
        <item>46001</item>
        <item>46009</item>
    </string-array>


</resources>
</resources>
+0 −3
Original line number Original line Diff line number Diff line
@@ -78,9 +78,6 @@
    <!-- Whether to switch dm for autoboot -->
    <!-- Whether to switch dm for autoboot -->
    <bool name="dm_autoboot_setting_visible">false</bool>
    <bool name="dm_autoboot_setting_visible">false</bool>


    <!-- Whether to edit APN name-->
    <bool name="config_name_apn">true</bool>

    <!-- Whether to show hotspot settings -->
    <!-- Whether to show hotspot settings -->
    <bool name="show_wifi_hotspot_settings">false</bool>
    <bool name="show_wifi_hotspot_settings">false</bool>


+20 −11
Original line number Original line Diff line number Diff line
@@ -100,6 +100,7 @@ public class ApnEditor extends PreferenceActivity
    private Cursor mCursor;
    private Cursor mCursor;
    private boolean mNewApn;
    private boolean mNewApn;
    private boolean mFirstTime;
    private boolean mFirstTime;
    private boolean mApnDisable = false;
    private Resources mRes;
    private Resources mRes;
    private TelephonyManager mTelephonyManager;
    private TelephonyManager mTelephonyManager;


@@ -207,15 +208,6 @@ public class ApnEditor extends PreferenceActivity
                SubscriptionManager.getDefaultSubId());
                SubscriptionManager.getDefaultSubId());
        Log.d(TAG,"ApnEditor onCreate received sub: " + mSubId);
        Log.d(TAG,"ApnEditor onCreate received sub: " + mSubId);
        mDisableEditor = intent.getBooleanExtra("DISABLE_EDITOR",false);
        mDisableEditor = intent.getBooleanExtra("DISABLE_EDITOR",false);
        if (mDisableEditor) {
            if (getResources().getBoolean(R.bool.config_name_apn)) {
                getPreferenceScreen().setEnabled(false);
                Log.d(TAG, "ApnEditor form is disabled.");
            } else {
                mApn.setEnabled(false);
                Log.d(TAG, "Apn Name can't be edited.");
            }
        }


        mFirstTime = icicle == null;
        mFirstTime = icicle == null;


@@ -382,6 +374,23 @@ public class ApnEditor extends PreferenceActivity
        } else {
        } else {
            mCarrierEnabled.setEnabled(false);
            mCarrierEnabled.setEnabled(false);
        }
        }
        String mccMnc = mMcc.getText() + mMnc.getText();
        for (String plmn : getResources().getStringArray(R.array.plmn_list_for_apn_disable)) {
            if (plmn.equals(mccMnc)) {
                mApnDisable  = true;
                Log.d(TAG, "APN is China Unicom's.");
                break;
            }
        }
        if (mDisableEditor) {
            if (mApnDisable ) {
                getPreferenceScreen().setEnabled(false);
                Log.d(TAG, "ApnEditor form is disabled.");
            } else {
                mApn.setEnabled(false);
                Log.d(TAG, "Apn Name can't be edited.");
            }
        }
    }
    }


    /**
    /**
@@ -497,7 +506,7 @@ public class ApnEditor extends PreferenceActivity
    @Override
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        super.onCreateOptionsMenu(menu);
        if (mDisableEditor && getResources().getBoolean(R.bool.config_name_apn)) {
        if (mDisableEditor && mApnDisable ) {
            Log.d(TAG, "Form is disabled. Do not create the options menu.");
            Log.d(TAG, "Form is disabled. Do not create the options menu.");
            return true;
            return true;
        }
        }
@@ -569,7 +578,7 @@ public class ApnEditor extends PreferenceActivity
        String mnc = checkNotSet(mMnc.getText());
        String mnc = checkNotSet(mMnc.getText());


        // If the form is not editable, do nothing and return.
        // If the form is not editable, do nothing and return.
        if(mDisableEditor && getResources().getBoolean(R.bool.config_name_apn)){
        if (mDisableEditor && mApnDisable ) {
            Log.d(TAG, "Form is disabled. Nothing to save.");
            Log.d(TAG, "Form is disabled. Nothing to save.");
            return true;
            return true;
        }
        }