diff options
author | Wink Saville <wink@google.com> | 2012-01-17 11:31:54 -0800 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2012-01-17 11:31:54 -0800 |
commit | 1e6329d4545955d5ebb440d09be9eb974ab3a2a6 (patch) | |
tree | b916b04c238020c4713f15e8cb78dccb393c7ca7 /telephony | |
parent | bd9d9d3ae2a758139c7dd722c4836a33b9b059a8 (diff) | |
download | frameworks_base-1e6329d4545955d5ebb440d09be9eb974ab3a2a6.zip frameworks_base-1e6329d4545955d5ebb440d09be9eb974ab3a2a6.tar.gz frameworks_base-1e6329d4545955d5ebb440d09be9eb974ab3a2a6.tar.bz2 |
Use new preferredAPN URI avoiding onApnChanged() call with self-change
Solving the issue that setting preferred APN from GDCT triggers
back APN change event and force unnecessary data call disconnects
and setups.
The new URI is added in Telephony Provider so ContentObserver
callback (results in onApnChanged) will not be triggered.
Bug:5448858
Change-Id: I4c0bcf32cec69cf1d0a0430f7a27495b89e93625
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 7eda04f..9eaf7a0 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -136,7 +136,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { private static final String INTENT_DATA_STALL_ALARM = "com.android.internal.telephony.gprs-data-stall"; - static final Uri PREFERAPN_URI = Uri.parse("content://telephony/carriers/preferapn"); + static final Uri PREFERAPN_NO_UPDATE_URI = + Uri.parse("content://telephony/carriers/preferapn_no_update"); static final String APN_ID = "apn_id"; private boolean canSetPreferApn = false; @@ -2342,26 +2343,30 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { private void setPreferredApn(int pos) { if (!canSetPreferApn) { + log("setPreferredApn: X !canSEtPreferApn"); return; } + log("setPreferredApn: delete"); ContentResolver resolver = mPhone.getContext().getContentResolver(); - resolver.delete(PREFERAPN_URI, null, null); + resolver.delete(PREFERAPN_NO_UPDATE_URI, null, null); if (pos >= 0) { + log("setPreferredApn: insert"); ContentValues values = new ContentValues(); values.put(APN_ID, pos); - resolver.insert(PREFERAPN_URI, values); + resolver.insert(PREFERAPN_NO_UPDATE_URI, values); } } private ApnSetting getPreferredApn() { if (mAllApns.isEmpty()) { + log("getPreferredApn: X not found mAllApns.isEmpty"); return null; } Cursor cursor = mPhone.getContext().getContentResolver().query( - PREFERAPN_URI, new String[] { "_id", "name", "apn" }, + PREFERAPN_NO_UPDATE_URI, new String[] { "_id", "name", "apn" }, null, null, Telephony.Carriers.DEFAULT_SORT_ORDER); if (cursor != null) { @@ -2376,6 +2381,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { pos = cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers._ID)); for(ApnSetting p:mAllApns) { if (p.id == pos && p.canHandleType(mRequestedApnType)) { + log("getPreferredApn: X found apnSetting" + p); cursor.close(); return p; } @@ -2386,6 +2392,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { cursor.close(); } + log("getPreferredApn: X not found"); return null; } |