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

Commit 5213f715 authored by yifan.bai's avatar yifan.bai Committed by android-build-merger
Browse files

Merge "Fix APN cannot save after ApnEditor is paused."

am: 052768a8

* commit '052768a8':
  Fix APN cannot save after ApnEditor is paused.

Change-Id: I2f7ac81f9955ca02ab8b37084bed68934a11f9e9
parents d0d0af81 052768a8
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -249,6 +249,21 @@ public class ApnEditor extends InstrumentedPreferenceActivity
    @Override
    public void onResume() {
        super.onResume();

        if (mUri == null && mNewApn) {
            // The URI could have been deleted when activity is paused,
            // therefore, it needs to be restored.
            mUri = getContentResolver().insert(getIntent().getData(), new ContentValues());
            if (mUri == null) {
                Log.w(TAG, "Failed to insert new telephony provider into "
                        + getIntent().getData());
                finish();
                return;
            }
            mCursor = managedQuery(mUri, sProjection, null, null);
            mCursor.moveToFirst();
        }

        getPreferenceScreen().getSharedPreferences()
                .registerOnSharedPreferenceChangeListener(this);
    }
@@ -596,6 +611,7 @@ public class ApnEditor extends InstrumentedPreferenceActivity
        // If it's a new APN and a name or apn haven't been entered, then erase the entry
        if (force && mNewApn && name.length() < 1 && apn.length() < 1) {
            getContentResolver().delete(mUri, null, null);
            mUri = null;
            return false;
        }