diff options
author | Wink Saville <wink@google.com> | 2010-11-24 11:28:58 -0800 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2010-11-24 11:28:58 -0800 |
commit | dd97d83ff74f47034039c34eae5245ee017820fb (patch) | |
tree | bb4c2ec04f196a5e517357a2c46b33070e20979b /telephony | |
parent | ac711639ae055405f9b4347bcdbd09880df4517f (diff) | |
download | frameworks_base-dd97d83ff74f47034039c34eae5245ee017820fb.zip frameworks_base-dd97d83ff74f47034039c34eae5245ee017820fb.tar.gz frameworks_base-dd97d83ff74f47034039c34eae5245ee017820fb.tar.bz2 |
Promote ActiveApn and methods to DataConnectionTracker.
Also, add getActiveApnType.
Change-Id: If44d2c35617a1ad385a7e5b7c1028751ded3ead2
Diffstat (limited to 'telephony')
3 files changed, 37 insertions, 63 deletions
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java index 9c738ec..8f3fa1b 100644 --- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java @@ -16,8 +16,6 @@ package com.android.internal.telephony; -import com.android.internal.telephony.cdma.CDMAPhone; - import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; @@ -231,6 +229,9 @@ public abstract class DataConnectionTracker extends Handler { protected HashMap<Integer, DataConnection> mDataConnections = new HashMap<Integer, DataConnection>(); + /* Currently active APN */ + protected ApnSetting mActiveApn; + protected BroadcastReceiver mIntentReceiver = new BroadcastReceiver () { @Override @@ -343,6 +344,40 @@ public abstract class DataConnectionTracker extends Handler { return new ArrayList<DataConnection>(mDataConnections.values()); } + protected boolean isApnTypeActive(String type) { + // TODO: support simultaneous with List instead + return mActiveApn != null && mActiveApn.canHandleType(type); + } + + public String[] getActiveApnTypes() { + String[] result; + if (mActiveApn != null) { + result = mActiveApn.types; + } else { + result = new String[1]; + result[0] = Phone.APN_TYPE_DEFAULT; + } + return result; + } + + public String getActiveApnType() { + String result; + if (mActiveApn != null) { + result = apnIdToType(mActiveApn.id); + } else { + result = null; + } + return result; + } + + protected String getActiveApnString() { + String result = null; + if (mActiveApn != null) { + result = mActiveApn.apn; + } + return result; + } + /** * The data connection is expected to be setup while device * 1. has Icc card @@ -533,14 +568,8 @@ public abstract class DataConnectionTracker extends Handler { } } - protected abstract boolean isApnTypeActive(String type); - protected abstract boolean isApnTypeAvailable(String type); - protected abstract String[] getActiveApnTypes(); - - protected abstract String getActiveApnString(); - protected abstract void setState(State s); protected LinkProperties getLinkProperties(String apnType) { diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index e003a73..024ef33 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -89,9 +89,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { Phone.APN_TYPE_MMS, Phone.APN_TYPE_HIPRI }; - // if we have no active Apn this is null - protected ApnSetting mActiveApn; - /* Constructor */ CdmaDataConnectionTracker(CDMAPhone p) { @@ -158,11 +155,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } @Override - protected boolean isApnTypeActive(String type) { - return mActiveApn != null && mActiveApn.canHandleType(type); - } - - @Override protected boolean isApnTypeAvailable(String type) { for (String s : mSupportedApnTypes) { if (TextUtils.equals(type, s)) { @@ -172,23 +164,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { return false; } - @Override - protected String[] getActiveApnTypes() { - String[] result; - if (mActiveApn != null) { - result = mActiveApn.types; - } else { - result = new String[1]; - result[0] = Phone.APN_TYPE_DEFAULT; - } - return result; - } - - @Override - protected String getActiveApnString() { - return null; - } - /** * The data connection is expected to be setup while device * 1. has ruim card or non-volatile data store diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 5c229b6..b41402c 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -109,9 +109,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { private int mWaitingApnsPermanentFailureCountDown = 0; private ApnSetting mPreferredApn = null; - /* Currently active APN */ - protected ApnSetting mActiveApn; - /** The DataConnection being setup */ private GsmDataConnection mPendingDataConnection; @@ -212,27 +209,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } } - @Override - public String[] getActiveApnTypes() { - String[] result; - if (mActiveApn != null) { - result = mActiveApn.types; - } else { - result = new String[1]; - result[0] = Phone.APN_TYPE_DEFAULT; - } - return result; - } - - @Override - protected String getActiveApnString() { - String result = null; - if (mActiveApn != null) { - result = mActiveApn.apn; - } - return result; - } - /** * The data connection is expected to be setup while device * 1. has sim card @@ -257,12 +233,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } @Override - protected boolean isApnTypeActive(String type) { - // TODO: support simultaneous with List instead - return mActiveApn != null && mActiveApn.canHandleType(type); - } - - @Override protected boolean isApnTypeAvailable(String type) { if (type.equals(Phone.APN_TYPE_DUN)) { return (fetchDunApn() != null); |