From 4d8ae85b5de8a90a597e4b649c6ee7208e446e3b Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Mon, 24 May 2010 17:50:32 -0700 Subject: Add needsOtaServiceProvisioning to Phone. By having needsOtaServiceProvisioning supported on all phones we eliminate the need to use an if statement to discriminate phone type. Types of phones that don't support OTASP will return false in the default implementation in PhoneBase. Change-Id: I8fb15a18553e314c1f8f2a00ec7f8cffd79eeb7f --- .../android/accounts/AccountManagerService.java | 2 +- .../com/android/internal/telephony/ITelephony.aidl | 6 ++-- .../java/com/android/internal/telephony/Phone.java | 5 +++ .../com/android/internal/telephony/PhoneBase.java | 14 ++++++-- .../com/android/internal/telephony/PhoneProxy.java | 4 +++ .../android/internal/telephony/cdma/CDMAPhone.java | 40 +++++++++++----------- 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java index 1d9e0f1..2ead976 100644 --- a/core/java/android/accounts/AccountManagerService.java +++ b/core/java/android/accounts/AccountManagerService.java @@ -1657,7 +1657,7 @@ public class AccountManagerService } boolean needsProvisioning; try { - needsProvisioning = telephony.getCdmaNeedsProvisioning(); + needsProvisioning = telephony.needsOtaServiceProvisioning(); } catch (RemoteException e) { Log.w(TAG, "exception while checking provisioning", e); // default to NOT wiping out the passwords diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 2328717..7a1587b 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -239,9 +239,11 @@ interface ITelephony { String getCdmaEriText(); /** - * Returns true if CDMA provisioning needs to run. + * Returns true if OTA service provisioning needs to run. + * Only relevant on some technologies, others will always + * return false. */ - boolean getCdmaNeedsProvisioning(); + boolean needsOtaServiceProvisioning(); /** * Returns the unread count of voicemails diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index 23325f6..8ff38d9 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -1533,6 +1533,11 @@ public interface Phone { boolean isOtaSpNumber(String dialStr); /** + * Returns true if OTA Service Provisioning needs to be performed. + */ + boolean needsOtaServiceProvisioning(); + + /** * Register for notifications when CDMA call waiting comes * * @param h Handler that receives the notification message. diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index 74601e6..fbb658a 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -824,9 +824,19 @@ public abstract class PhoneBase extends Handler implements Phone { logUnexpectedCdmaMethodCall("unregisterForSubscriptionInfoReady"); } + /** + * Returns true if OTA Service Provisioning needs to be performed. + * If not overridden return false. + */ + public boolean needsOtaServiceProvisioning() { + return false; + } + + /** + * Return true if number is an OTASP number. + * If not overridden return false. + */ public boolean isOtaSpNumber(String dialStr) { - // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. - logUnexpectedCdmaMethodCall("isOtaSpNumber"); return false; } diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java index e1511e6..8c2a661 100644 --- a/telephony/java/com/android/internal/telephony/PhoneProxy.java +++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java @@ -764,6 +764,10 @@ public class PhoneProxy extends Handler implements Phone { mActivePhone.exitEmergencyCallbackMode(); } + public boolean needsOtaServiceProvisioning(){ + return mActivePhone.needsOtaServiceProvisioning(); + } + public boolean isOtaSpNumber(String dialStr){ return mActivePhone.isOtaSpNumber(dialStr); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java index 0c591e4..8934037 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -867,26 +867,6 @@ public class CDMAPhone extends PhoneBase { mRuimRecords.setVoiceMessageWaiting(1, mwi); } - /** - * Returns true if CDMA OTA Service Provisioning needs to be performed. - */ - /* package */ boolean - needsOtaServiceProvisioning() { - String cdmaMin = getCdmaMin(); - boolean needsProvisioning; - if (cdmaMin == null || (cdmaMin.length() < 6)) { - if (DBG) Log.d(LOG_TAG, "needsOtaServiceProvisioning: illegal cdmaMin='" - + cdmaMin + "' assume provisioning needed."); - needsProvisioning = true; - } else { - needsProvisioning = (cdmaMin.equals(UNACTIVATED_MIN_VALUE) - || cdmaMin.substring(0,6).equals(UNACTIVATED_MIN2_VALUE)) - || SystemProperties.getBoolean("test_cdma_setup", false); - } - if (DBG) Log.d(LOG_TAG, "needsOtaServiceProvisioning: ret=" + needsProvisioning); - return needsProvisioning; - } - @Override public void exitEmergencyCallbackMode() { if (mWakeLock.isHeld()) { @@ -1180,6 +1160,26 @@ public class CDMAPhone extends PhoneBase { mSMS.setCellBroadcastConfig(configValuesArray, response); } + /** + * Returns true if OTA Service Provisioning needs to be performed. + */ + @Override + public boolean needsOtaServiceProvisioning() { + String cdmaMin = getCdmaMin(); + boolean needsProvisioning; + if (cdmaMin == null || (cdmaMin.length() < 6)) { + if (DBG) Log.d(LOG_TAG, "needsOtaServiceProvisioning: illegal cdmaMin='" + + cdmaMin + "' assume provisioning needed."); + needsProvisioning = true; + } else { + needsProvisioning = (cdmaMin.equals(UNACTIVATED_MIN_VALUE) + || cdmaMin.substring(0,6).equals(UNACTIVATED_MIN2_VALUE)) + || SystemProperties.getBoolean("test_cdma_setup", false); + } + if (DBG) Log.d(LOG_TAG, "needsOtaServiceProvisioning: ret=" + needsProvisioning); + return needsProvisioning; + } + private static final String IS683A_FEATURE_CODE = "*228"; private static final int IS683A_FEATURE_CODE_NUM_DIGITS = 4; private static final int IS683A_SYS_SEL_CODE_NUM_DIGITS = 2; -- cgit v1.1