summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java3
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java47
-rw-r--r--telephony/java/com/android/internal/telephony/BaseCommands.java3
-rw-r--r--telephony/java/com/android/internal/telephony/CallManager.java20
-rw-r--r--telephony/java/com/android/internal/telephony/CallerInfo.java95
-rw-r--r--telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java40
-rw-r--r--telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java2
-rw-r--r--telephony/java/com/android/internal/telephony/RIL.java9
-rw-r--r--telephony/java/com/android/internal/telephony/SMSDispatcher.java17
-rwxr-xr-xtelephony/java/com/android/internal/telephony/WapPushOverSms.java27
-rw-r--r--telephony/java/com/android/internal/telephony/cat/CatService.java3
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/CdmaConnection.java5
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java5
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/RuimRecords.java7
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/SmsMessage.java11
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmConnection.java3
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java7
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java3
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/SmsMessage.java13
19 files changed, 236 insertions, 84 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
index ffabb7b..dea67f3 100644
--- a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
+++ b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java
@@ -94,6 +94,9 @@ public class PhoneNumberFormattingTextWatcher implements TextWatcher {
*/
public PhoneNumberFormattingTextWatcher(String countryCode) {
if (countryCode == null) throw new IllegalArgumentException();
+ // TODO: remove this once CountryDetector.detectCountry().getCountryIso() is fixed to always
+ // return uppercase. Tracked at b/4941319.
+ countryCode = countryCode.toUpperCase(Locale.ENGLISH);
mFormatter = PhoneNumberUtil.getInstance().getAsYouTypeFormatter(countryCode);
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index acbf08b..66120a1 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -469,6 +469,46 @@ public class TelephonyManager {
}
}
+ /** Unknown network class. {@hide} */
+ public static final int NETWORK_CLASS_UNKNOWN = 0;
+ /** Class of broadly defined "2G" networks. {@hide} */
+ public static final int NETWORK_CLASS_2_G = 1;
+ /** Class of broadly defined "3G" networks. {@hide} */
+ public static final int NETWORK_CLASS_3_G = 2;
+ /** Class of broadly defined "4G" networks. {@hide} */
+ public static final int NETWORK_CLASS_4_G = 3;
+
+ /**
+ * Return general class of network type, such as "3G" or "4G". In cases
+ * where classification is contentious, this method is conservative.
+ *
+ * @hide
+ */
+ public static int getNetworkClass(int networkType) {
+ switch (networkType) {
+ case NETWORK_TYPE_GPRS:
+ case NETWORK_TYPE_EDGE:
+ case NETWORK_TYPE_CDMA:
+ case NETWORK_TYPE_1xRTT:
+ case NETWORK_TYPE_IDEN:
+ return NETWORK_CLASS_2_G;
+ case NETWORK_TYPE_UMTS:
+ case NETWORK_TYPE_EVDO_0:
+ case NETWORK_TYPE_EVDO_A:
+ case NETWORK_TYPE_HSDPA:
+ case NETWORK_TYPE_HSUPA:
+ case NETWORK_TYPE_HSPA:
+ case NETWORK_TYPE_EVDO_B:
+ case NETWORK_TYPE_EHRPD:
+ case NETWORK_TYPE_HSPAP:
+ return NETWORK_CLASS_3_G;
+ case NETWORK_TYPE_LTE:
+ return NETWORK_CLASS_4_G;
+ default:
+ return NETWORK_CLASS_UNKNOWN;
+ }
+ }
+
/**
* Returns a string representation of the radio technology (network type)
* currently in use on the device.
@@ -477,7 +517,12 @@ public class TelephonyManager {
* @hide pending API council review
*/
public String getNetworkTypeName() {
- switch (getNetworkType()) {
+ return getNetworkTypeName(getNetworkType());
+ }
+
+ /** {@hide} */
+ public static String getNetworkTypeName(int type) {
+ switch (type) {
case NETWORK_TYPE_GPRS:
return "GPRS";
case NETWORK_TYPE_EDGE:
diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java
index 13afbb7..8427d14 100644
--- a/telephony/java/com/android/internal/telephony/BaseCommands.java
+++ b/telephony/java/com/android/internal/telephony/BaseCommands.java
@@ -23,7 +23,6 @@ import android.os.Registrant;
import android.os.Handler;
import android.os.AsyncResult;
import android.os.SystemProperties;
-import android.util.Config;
import android.util.Log;
import java.io.FileInputStream;
@@ -691,7 +690,7 @@ public abstract class BaseCommands implements CommandsInterface {
RadioState oldState;
synchronized (mStateMonitor) {
- if (Config.LOGV) {
+ if (false) {
Log.v(LOG_TAG, "setRadioState old: " + mState
+ " new " + newState);
}
diff --git a/telephony/java/com/android/internal/telephony/CallManager.java b/telephony/java/com/android/internal/telephony/CallManager.java
index 7abae09..171b371 100644
--- a/telephony/java/com/android/internal/telephony/CallManager.java
+++ b/telephony/java/com/android/internal/telephony/CallManager.java
@@ -1803,33 +1803,33 @@ public final class CallManager {
Call call;
StringBuilder b = new StringBuilder();
- b.append("########### Dump CallManager ############");
- b.append("\nCallManager state = " + getState());
+ b.append("CallManager {");
+ b.append("\nstate = " + getState());
call = getActiveFgCall();
- b.append("\n - Foreground: " + getActiveFgCallState());
+ b.append("\n- Foreground: " + getActiveFgCallState());
b.append(" from " + call.getPhone());
- b.append("\n Conn: ").append(getFgCallConnections());
+ b.append("\n Conn: ").append(getFgCallConnections());
call = getFirstActiveBgCall();
- b.append("\n - Background: " + call.getState());
+ b.append("\n- Background: " + call.getState());
b.append(" from " + call.getPhone());
- b.append("\n Conn: ").append(getBgCallConnections());
+ b.append("\n Conn: ").append(getBgCallConnections());
call = getFirstActiveRingingCall();
- b.append("\n - Ringing: " +call.getState());
+ b.append("\n- Ringing: " +call.getState());
b.append(" from " + call.getPhone());
for (Phone phone : getAllPhones()) {
if (phone != null) {
- b.append("\n Phone: " + phone + ", name = " + phone.getPhoneName()
+ b.append("\nPhone: " + phone + ", name = " + phone.getPhoneName()
+ ", state = " + phone.getState());
call = phone.getForegroundCall();
- b.append("\n - Foreground: ").append(call);
+ b.append("\n- Foreground: ").append(call);
call = phone.getBackgroundCall();
b.append(" Background: ").append(call);
call = phone.getRingingCall();
b.append(" Ringing: ").append(call);
}
}
- b.append("\n########## End Dump CallManager ##########");
+ b.append("\n}");
return b.toString();
}
}
diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java
index 014901d..ab93e2a 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfo.java
+++ b/telephony/java/com/android/internal/telephony/CallerInfo.java
@@ -19,6 +19,7 @@ package com.android.internal.telephony;
import android.content.Context;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
+import android.location.CountryDetector;
import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Data;
@@ -29,6 +30,13 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
+import com.google.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder;
+import com.google.i18n.phonenumbers.NumberParseException;
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+
+import java.util.Locale;
+
/**
* Looks up caller information for the given phone number.
@@ -72,7 +80,8 @@ public class CallerInfo {
*/
public String name;
public String phoneNumber;
- public String nomalizedNumber;
+ public String normalizedNumber;
+ public String geoDescription;
public String cnapName;
public int numberPresentation;
@@ -131,7 +140,7 @@ public class CallerInfo {
info.isCachedPhotoCurrent = false;
info.contactExists = false;
- if (VDBG) Log.v(TAG, "construct callerInfo from cursor");
+ if (VDBG) Log.v(TAG, "getCallerInfo() based on cursor...");
if (cursor != null) {
if (cursor.moveToFirst()) {
@@ -156,7 +165,7 @@ public class CallerInfo {
// Look for the normalized number
columnIndex = cursor.getColumnIndex(PhoneLookup.NORMALIZED_NUMBER);
if (columnIndex != -1) {
- info.nomalizedNumber = cursor.getString(columnIndex);
+ info.normalizedNumber = cursor.getString(columnIndex);
}
// Look for the label/type combo
@@ -236,6 +245,8 @@ public class CallerInfo {
* with all relevant fields empty or null.
*/
public static CallerInfo getCallerInfo(Context context, String number) {
+ if (VDBG) Log.v(TAG, "getCallerInfo() based on number...");
+
if (TextUtils.isEmpty(number)) {
return null;
}
@@ -473,6 +484,78 @@ public class CallerInfo {
}
/**
+ * Updates this CallerInfo's geoDescription field, based on the raw
+ * phone number in the phoneNumber field.
+ *
+ * (Note that the various getCallerInfo() methods do *not* set the
+ * geoDescription automatically; you need to call this method
+ * explicitly to get it.)
+ *
+ * @param context the context used to look up the current locale / country
+ * @param fallbackNumber if this CallerInfo's phoneNumber field is empty,
+ * this specifies a fallback number to use instead.
+ */
+ public void updateGeoDescription(Context context, String fallbackNumber) {
+ String number = TextUtils.isEmpty(phoneNumber) ? fallbackNumber : phoneNumber;
+ geoDescription = getGeoDescription(context, number);
+ }
+
+ /**
+ * @return a geographical description string for the specified number.
+ * @see com.google.i18n.phonenumbers.PhoneNumberOfflineGeocoder
+ */
+ private static String getGeoDescription(Context context, String number) {
+ if (VDBG) Log.v(TAG, "getGeoDescription('" + number + "')...");
+
+ if (TextUtils.isEmpty(number)) {
+ return null;
+ }
+
+ PhoneNumberUtil util = PhoneNumberUtil.getInstance();
+ PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance();
+
+ String countryIso;
+ Locale locale = context.getResources().getConfiguration().locale;
+ CountryDetector detector = (CountryDetector) context.getSystemService(
+ Context.COUNTRY_DETECTOR);
+ if (detector != null) {
+ countryIso = detector.detectCountry().getCountryIso();
+ } else {
+ countryIso = locale.getCountry();
+ Log.w(TAG, "No CountryDetector; falling back to countryIso based on locale: "
+ + countryIso);
+ }
+
+ // Temp workaround: The current libphonenumber library requires
+ // the countryIso to be uppercase (e.g. "US") but the
+ // detector.detectCountry().getCountryIso() call currently returns
+ // "us". Passing "us" to util.parse() will just result in a
+ // NumberParseException.
+ // So force the countryIso to uppercase for now.
+ // TODO: remove this once getCountryIso() is fixed to always
+ // return uppercase.
+ countryIso = countryIso.toUpperCase();
+
+ PhoneNumber pn = null;
+ try {
+ if (VDBG) Log.v(TAG, "parsing '" + number
+ + "' for countryIso '" + countryIso + "'...");
+ pn = util.parse(number, countryIso);
+ if (VDBG) Log.v(TAG, "- parsed number: " + pn);
+ } catch (NumberParseException e) {
+ Log.w(TAG, "getGeoDescription: NumberParseException for incoming number '" + number + "'");
+ }
+
+ if (pn != null) {
+ String description = geocoder.getDescriptionForNumber(pn, locale);
+ if (VDBG) Log.v(TAG, "- got description: '" + description + "'");
+ return description;
+ } else {
+ return null;
+ }
+ }
+
+ /**
* @return a string debug representation of this instance.
*/
public String toString() {
@@ -482,8 +565,11 @@ public class CallerInfo {
if (VERBOSE_DEBUG) {
return new StringBuilder(384)
+ .append(super.toString() + " { ")
.append("\nname: " + name)
.append("\nphoneNumber: " + phoneNumber)
+ .append("\nnormalizedNumber: " + normalizedNumber)
+ .append("\ngeoDescription: " + geoDescription)
.append("\ncnapName: " + cnapName)
.append("\nnumberPresentation: " + numberPresentation)
.append("\nnamePresentation: " + namePresentation)
@@ -502,10 +588,11 @@ public class CallerInfo {
.append("\nemergency: " + mIsEmergency)
.append("\nvoicemail " + mIsVoiceMail)
.append("\ncontactExists " + contactExists)
+ .append(" }")
.toString();
} else {
return new StringBuilder(128)
- .append("CallerInfo { ")
+ .append(super.toString() + " { ")
.append("name " + ((name == null) ? "null" : "non-null"))
.append(", phoneNumber " + ((phoneNumber == null) ? "null" : "non-null"))
.append(" }")
diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
index c47e076..2e8a742 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
+++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
@@ -34,9 +34,11 @@ import android.text.TextUtils;
import android.util.Log;
/**
- * ASYNCHRONOUS QUERY API
+ * Helper class to make it easier to run asynchronous caller-id lookup queries.
+ * @see CallerInfo
+ *
+ * {@hide}
*/
-
public class CallerInfoAsyncQuery {
private static final boolean DBG = false;
private static final String LOG_TAG = "CallerInfoAsyncQuery";
@@ -49,6 +51,12 @@ public class CallerInfoAsyncQuery {
private CallerInfoAsyncQueryHandler mHandler;
+ // If the CallerInfo query finds no contacts, should we use the
+ // PhoneNumberOfflineGeocoder to look up a "geo description"?
+ // (TODO: This could become a flag in config.xml if it ever needs to be
+ // configured on a per-product basis.)
+ private static final boolean ENABLE_UNKNOWN_NUMBER_GEO_DESCRIPTION = true;
+
/**
* Interface for a CallerInfoAsyncQueryHandler result return.
*/
@@ -239,12 +247,34 @@ public class CallerInfoAsyncQuery {
+ mCallerInfo);
}
+ // Final step: look up the geocoded description.
+ if (ENABLE_UNKNOWN_NUMBER_GEO_DESCRIPTION) {
+ // Note we do this only if we *don't* have a valid name (i.e. if
+ // no contacts matched the phone number of the incoming call),
+ // since that's the only case where the incoming-call UI cares
+ // about this field.
+ //
+ // (TODO: But if we ever want the UI to show the geoDescription
+ // even when we *do* match a contact, we'll need to either call
+ // updateGeoDescription() unconditionally here, or possibly add a
+ // new parameter to CallerInfoAsyncQuery.startQuery() to force
+ // the geoDescription field to be populated.)
+
+ if (TextUtils.isEmpty(mCallerInfo.name)) {
+ // Actually when no contacts match the incoming phone number,
+ // the CallerInfo object is totally blank here (i.e. no name
+ // *or* phoneNumber). So we need to pass in cw.number as
+ // a fallback number.
+ mCallerInfo.updateGeoDescription(mQueryContext, cw.number);
+ }
+ }
+
// Use the number entered by the user for display.
if (!TextUtils.isEmpty(cw.number)) {
CountryDetector detector = (CountryDetector) mQueryContext.getSystemService(
Context.COUNTRY_DETECTOR);
mCallerInfo.phoneNumber = PhoneNumberUtils.formatNumber(cw.number,
- mCallerInfo.nomalizedNumber,
+ mCallerInfo.normalizedNumber,
detector.detectCountry().getCountryIso());
}
}
@@ -412,7 +442,7 @@ public class CallerInfoAsyncQuery {
* Method to create a new CallerInfoAsyncQueryHandler object, ensuring correct
* state of context and uri.
*/
- private void allocate (Context context, Uri contactRef) {
+ private void allocate(Context context, Uri contactRef) {
if ((context == null) || (contactRef == null)){
throw new QueryPoolException("Bad context or query uri.");
}
@@ -424,7 +454,7 @@ public class CallerInfoAsyncQuery {
/**
* Releases the relevant data.
*/
- private void release () {
+ private void release() {
mHandler.mQueryContext = null;
mHandler.mQueryUri = null;
mHandler.mCallerInfo = null;
diff --git a/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index 5fef6de..9763265 100644
--- a/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -112,7 +112,7 @@ public abstract class IccSmsInterfaceManager extends ISms.Stub {
*/
public void sendText(String destAddr, String scAddr,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
- mPhone.getContext().enforceCallingPermission(
+ mPhone.getContext().enforceCallingOrSelfPermission(
"android.permission.SEND_SMS",
"Sending SMS message");
if (Log.isLoggable("SMS", Log.VERBOSE)) {
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index 07780ed..c6ed405 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -45,7 +45,6 @@ import android.telephony.PhoneNumberUtils;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.text.TextUtils;
-import android.util.Config;
import android.util.Log;
import com.android.internal.telephony.CallForwardInfo;
@@ -1238,7 +1237,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
rr.mp.writeInt(1);
rr.mp.writeInt(index);
- if (Config.LOGD) {
+ if (false) {
if (RILJ_LOGD) riljLog(rr.serialString() + "> "
+ requestToString(rr.mRequest)
+ " " + index);
@@ -1254,7 +1253,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
rr.mp.writeInt(1);
rr.mp.writeInt(index);
- if (Config.LOGD) {
+ if (false) {
if (RILJ_LOGD) riljLog(rr.serialString() + "> "
+ requestToString(rr.mRequest)
+ " " + index);
@@ -1273,7 +1272,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
rr.mp.writeString(pdu);
rr.mp.writeString(smsc);
- if (Config.LOGD) {
+ if (false) {
if (RILJ_LOGD) riljLog(rr.serialString() + "> "
+ requestToString(rr.mRequest)
+ " " + status);
@@ -1291,7 +1290,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
rr.mp.writeInt(status);
rr.mp.writeString(pdu);
- if (Config.LOGD) {
+ if (false) {
if (RILJ_LOGD) riljLog(rr.serialString() + "> "
+ requestToString(rr.mRequest)
+ " " + status);
diff --git a/telephony/java/com/android/internal/telephony/SMSDispatcher.java b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
index fc2b0a4..76e719c 100644
--- a/telephony/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
@@ -41,7 +41,6 @@ import android.provider.Telephony.Sms.Intents;
import android.provider.Settings;
import android.telephony.SmsMessage;
import android.telephony.ServiceState;
-import android.util.Config;
import android.util.Log;
import android.view.WindowManager;
@@ -301,7 +300,7 @@ public abstract class SMSDispatcher extends Handler {
switch (msg.what) {
case EVENT_NEW_SMS:
// A new SMS has been received by the device
- if (Config.LOGD) {
+ if (false) {
Log.d(TAG, "New SMS Message Received");
}
@@ -362,7 +361,7 @@ public abstract class SMSDispatcher extends Handler {
Log.e(TAG, "failed to send back RESULT_ERROR_LIMIT_EXCEEDED");
}
}
- if (Config.LOGD) {
+ if (false) {
Log.d(TAG, "EVENT_ALERT_TIMEOUT, message stop sending");
}
break;
@@ -474,7 +473,7 @@ public abstract class SMSDispatcher extends Handler {
PendingIntent sentIntent = tracker.mSentIntent;
if (ar.exception == null) {
- if (Config.LOGD) {
+ if (false) {
Log.d(TAG, "SMS send complete. Broadcasting "
+ "intent: " + sentIntent);
}
@@ -502,7 +501,7 @@ public abstract class SMSDispatcher extends Handler {
} catch (CanceledException ex) {}
}
} else {
- if (Config.LOGD) {
+ if (false) {
Log.d(TAG, "SMS send failed");
}
@@ -1037,16 +1036,12 @@ public abstract class SMSDispatcher extends Handler {
if (isEmergencyMessage) {
Intent intent = new Intent(Intents.SMS_EMERGENCY_CB_RECEIVED_ACTION);
intent.putExtra("pdus", pdus);
- if (Config.LOGD)
- Log.d(TAG, "Dispatching " + pdus.length + " emergency SMS CB pdus");
-
+ Log.d(TAG, "Dispatching " + pdus.length + " emergency SMS CB pdus");
dispatch(intent, "android.permission.RECEIVE_EMERGENCY_BROADCAST");
} else {
Intent intent = new Intent(Intents.SMS_CB_RECEIVED_ACTION);
intent.putExtra("pdus", pdus);
- if (Config.LOGD)
- Log.d(TAG, "Dispatching " + pdus.length + " SMS CB pdus");
-
+ Log.d(TAG, "Dispatching " + pdus.length + " SMS CB pdus");
dispatch(intent, "android.permission.RECEIVE_SMS");
}
}
diff --git a/telephony/java/com/android/internal/telephony/WapPushOverSms.java b/telephony/java/com/android/internal/telephony/WapPushOverSms.java
index 7704667..e2779dc 100755
--- a/telephony/java/com/android/internal/telephony/WapPushOverSms.java
+++ b/telephony/java/com/android/internal/telephony/WapPushOverSms.java
@@ -24,7 +24,6 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.provider.Telephony;
import android.provider.Telephony.Sms.Intents;
-import android.util.Config;
import android.util.Log;
import android.os.IBinder;
import android.os.RemoteException;
@@ -62,13 +61,13 @@ public class WapPushOverSms {
public void onServiceConnected(ComponentName name, IBinder service) {
mWapPushMan = IWapPushManager.Stub.asInterface(service);
- if (Config.DEBUG) Log.v(LOG_TAG, "wappush manager connected to " +
+ if (false) Log.v(LOG_TAG, "wappush manager connected to " +
mOwner.hashCode());
}
public void onServiceDisconnected(ComponentName name) {
mWapPushMan = null;
- if (Config.DEBUG) Log.v(LOG_TAG, "wappush manager disconnected.");
+ if (false) Log.v(LOG_TAG, "wappush manager disconnected.");
// WapPushManager must be always attached.
rebindWapPushManager();
}
@@ -101,7 +100,7 @@ public class WapPushOverSms {
try {
Thread.sleep(BIND_RETRY_INTERVAL);
} catch (InterruptedException e) {
- if (Config.DEBUG) Log.v(LOG_TAG, "sleep interrupted.");
+ if (false) Log.v(LOG_TAG, "sleep interrupted.");
}
}
}
@@ -135,7 +134,7 @@ public class WapPushOverSms {
*/
public int dispatchWapPdu(byte[] pdu) {
- if (Config.DEBUG) Log.d(LOG_TAG, "Rx: " + IccUtils.bytesToHexString(pdu));
+ if (false) Log.d(LOG_TAG, "Rx: " + IccUtils.bytesToHexString(pdu));
int index = 0;
int transactionId = pdu[index++] & 0xFF;
@@ -144,7 +143,7 @@ public class WapPushOverSms {
if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) &&
(pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) {
- if (Config.DEBUG) Log.w(LOG_TAG, "Received non-PUSH WAP PDU. Type = " + pduType);
+ if (false) Log.w(LOG_TAG, "Received non-PUSH WAP PDU. Type = " + pduType);
return Intents.RESULT_SMS_HANDLED;
}
@@ -157,7 +156,7 @@ public class WapPushOverSms {
* So it will be encoded in no more than 5 octets.
*/
if (pduDecoder.decodeUintvarInteger(index) == false) {
- if (Config.DEBUG) Log.w(LOG_TAG, "Received PDU. Header Length error.");
+ if (false) Log.w(LOG_TAG, "Received PDU. Header Length error.");
return Intents.RESULT_SMS_GENERIC_ERROR;
}
headerLength = (int)pduDecoder.getValue32();
@@ -178,7 +177,7 @@ public class WapPushOverSms {
* Length = Uintvar-integer
*/
if (pduDecoder.decodeContentType(index) == false) {
- if (Config.DEBUG) Log.w(LOG_TAG, "Received PDU. Header Content-Type error.");
+ if (false) Log.w(LOG_TAG, "Received PDU. Header Content-Type error.");
return Intents.RESULT_SMS_GENERIC_ERROR;
}
@@ -215,14 +214,14 @@ public class WapPushOverSms {
String contentType = ((mimeType == null) ?
Long.toString(binaryContentType) : mimeType);
- if (Config.DEBUG) Log.v(LOG_TAG, "appid found: " + wapAppId + ":" + contentType);
+ if (false) Log.v(LOG_TAG, "appid found: " + wapAppId + ":" + contentType);
try {
boolean processFurther = true;
IWapPushManager wapPushMan = mWapConn.getWapPushManager();
if (wapPushMan == null) {
- if (Config.DEBUG) Log.w(LOG_TAG, "wap push manager not found!");
+ if (false) Log.w(LOG_TAG, "wap push manager not found!");
} else {
Intent intent = new Intent();
intent.putExtra("transactionId", transactionId);
@@ -233,7 +232,7 @@ public class WapPushOverSms {
pduDecoder.getContentParameters());
int procRet = wapPushMan.processMessage(wapAppId, contentType, intent);
- if (Config.DEBUG) Log.v(LOG_TAG, "procRet:" + procRet);
+ if (false) Log.v(LOG_TAG, "procRet:" + procRet);
if ((procRet & WapPushManagerParams.MESSAGE_HANDLED) > 0
&& (procRet & WapPushManagerParams.FURTHER_PROCESSING) == 0) {
processFurther = false;
@@ -243,13 +242,13 @@ public class WapPushOverSms {
return Intents.RESULT_SMS_HANDLED;
}
} catch (RemoteException e) {
- if (Config.DEBUG) Log.w(LOG_TAG, "remote func failed...");
+ if (false) Log.w(LOG_TAG, "remote func failed...");
}
}
- if (Config.DEBUG) Log.v(LOG_TAG, "fall back to existing handler");
+ if (false) Log.v(LOG_TAG, "fall back to existing handler");
if (mimeType == null) {
- if (Config.DEBUG) Log.w(LOG_TAG, "Header Content-Type error.");
+ if (false) Log.w(LOG_TAG, "Header Content-Type error.");
return Intents.RESULT_SMS_GENERIC_ERROR;
}
diff --git a/telephony/java/com/android/internal/telephony/cat/CatService.java b/telephony/java/com/android/internal/telephony/cat/CatService.java
index df47350..fb53686 100644
--- a/telephony/java/com/android/internal/telephony/cat/CatService.java
+++ b/telephony/java/com/android/internal/telephony/cat/CatService.java
@@ -30,7 +30,6 @@ import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccFileHandler;
import com.android.internal.telephony.IccRecords;
-import android.util.Config;
import java.io.ByteArrayOutputStream;
import java.util.Locale;
@@ -382,7 +381,7 @@ public class CatService extends Handler implements AppInterface {
byte[] rawData = buf.toByteArray();
String hexString = IccUtils.bytesToHexString(rawData);
- if (Config.LOGD) {
+ if (false) {
CatLog.d(this, "TERMINAL RESPONSE: " + hexString);
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java b/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java
index 1a15393..8fb136e 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java
@@ -26,7 +26,6 @@ import android.os.PowerManager;
import android.os.Registrant;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.util.Config;
import android.util.Log;
import android.text.TextUtils;
@@ -453,7 +452,7 @@ public class CdmaConnection extends Connection {
if (!disconnected) {
doDisconnect();
- if (Config.LOGD) Log.d(LOG_TAG,
+ if (false) Log.d(LOG_TAG,
"[CDMAConn] onDisconnect: cause=" + cause);
owner.phone.notifyDisconnect(this);
@@ -470,7 +469,7 @@ public class CdmaConnection extends Connection {
onLocalDisconnect() {
if (!disconnected) {
doDisconnect();
- if (Config.LOGD) Log.d(LOG_TAG,
+ if (false) Log.d(LOG_TAG,
"[CDMAConn] onLoalDisconnect" );
if (parent != null) {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
index f24f32b..07b0f4f 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
@@ -33,7 +33,6 @@ import android.provider.Telephony;
import android.provider.Telephony.Sms.Intents;
import android.telephony.SmsManager;
import android.telephony.SmsMessage.MessageClass;
-import android.util.Config;
import android.util.Log;
import com.android.internal.telephony.CommandsInterface;
@@ -151,7 +150,7 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
handleCdmaStatusReport(sms);
handled = true;
} else if ((sms.getUserData() == null)) {
- if (Config.LOGD) {
+ if (false) {
Log.d(TAG, "Received SMS without user data");
}
handled = true;
@@ -448,7 +447,7 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
sentIntent.send(SmsManager.RESULT_ERROR_NO_SERVICE);
} catch (CanceledException ex) {}
}
- if (Config.LOGD) {
+ if (false) {
Log.d(TAG, "Block SMS in Emergency Callback mode");
}
return;
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
index ee63ede..9af2d26 100755
--- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
@@ -119,8 +119,11 @@ public final class RuimRecords extends IccRecords {
adnCache.reset();
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, null);
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null);
+ // Don't clean up PROPERTY_ICC_OPERATOR_ISO_COUNTRY and
+ // PROPERTY_ICC_OPERATOR_NUMERIC here. Since not all CDMA
+ // devices have RUIM, these properties should keep the original
+ // values, e.g. build time settings, when there is no RUIM but
+ // set new values when RUIM is available and loaded.
// recordsRequested is set to false indicating that the SIM
// read requests made so far are not valid. This is set to
diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
index fdd0c9f..be5c616 100644
--- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -19,7 +19,6 @@ package com.android.internal.telephony.cdma;
import android.os.Parcel;
import android.os.SystemProperties;
import android.telephony.PhoneNumberUtils;
-import android.util.Config;
import android.util.Log;
import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.SmsHeader;
@@ -695,7 +694,7 @@ public class SmsMessage extends SmsMessageBase {
if (mEnvelope.bearerData != null) {
mBearerData.numberOfMessages = 0x000000FF & mEnvelope.bearerData[0];
}
- if (Config.DEBUG) {
+ if (false) {
Log.d(LOG_TAG, "parseSms: get MWI " +
Integer.toString(mBearerData.numberOfMessages));
}
@@ -716,7 +715,7 @@ public class SmsMessage extends SmsMessageBase {
if (originatingAddress != null) {
originatingAddress.address = new String(originatingAddress.origBytes);
- if (Config.LOGV) Log.v(LOG_TAG, "SMS originating address: "
+ if (false) Log.v(LOG_TAG, "SMS originating address: "
+ originatingAddress.address);
}
@@ -724,7 +723,7 @@ public class SmsMessage extends SmsMessageBase {
scTimeMillis = mBearerData.msgCenterTimeStamp.toMillis(true);
}
- if (Config.LOGD) Log.d(LOG_TAG, "SMS SC timestamp: " + scTimeMillis);
+ if (false) Log.d(LOG_TAG, "SMS SC timestamp: " + scTimeMillis);
// Message Type (See 3GPP2 C.S0015-B, v2, 4.5.1)
if (mBearerData.messageType == BearerData.MESSAGE_TYPE_DELIVERY_ACK) {
@@ -749,9 +748,9 @@ public class SmsMessage extends SmsMessageBase {
}
if (messageBody != null) {
- if (Config.LOGV) Log.v(LOG_TAG, "SMS message body: '" + messageBody + "'");
+ if (false) Log.v(LOG_TAG, "SMS message body: '" + messageBody + "'");
parseMessageBody();
- } else if ((userData != null) && (Config.LOGV)) {
+ } else if ((userData != null) && (false)) {
Log.v(LOG_TAG, "SMS payload: '" + IccUtils.bytesToHexString(userData) + "'");
}
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmConnection.java b/telephony/java/com/android/internal/telephony/gsm/GsmConnection.java
index 0870d5b..c1ad7b3 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmConnection.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmConnection.java
@@ -23,7 +23,6 @@ import android.os.Message;
import android.os.PowerManager;
import android.os.Registrant;
import android.os.SystemClock;
-import android.util.Config;
import android.util.Log;
import android.telephony.PhoneNumberUtils;
import android.telephony.ServiceState;
@@ -410,7 +409,7 @@ public class GsmConnection extends Connection {
duration = SystemClock.elapsedRealtime() - connectTimeReal;
disconnected = true;
- if (Config.LOGD) Log.d(LOG_TAG,
+ if (false) Log.d(LOG_TAG,
"[GSMConn] onDisconnect: cause=" + cause);
owner.phone.notifyDisconnect(this);
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java b/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
index ca980d9..52ca453 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
@@ -28,7 +28,6 @@ import android.provider.Telephony.Sms.Intents;
import android.telephony.ServiceState;
import android.telephony.SmsCbMessage;
import android.telephony.gsm.GsmCellLocation;
-import android.util.Config;
import android.util.Log;
import com.android.internal.telephony.BaseCommands;
@@ -125,13 +124,13 @@ final class GsmSMSDispatcher extends SMSDispatcher {
if (sms.isMWISetMessage()) {
mGsmPhone.updateMessageWaitingIndicator(true);
handled = sms.isMwiDontStore();
- if (Config.LOGD) {
+ if (false) {
Log.d(TAG, "Received voice mail indicator set SMS shouldStore=" + !handled);
}
} else if (sms.isMWIClearMessage()) {
mGsmPhone.updateMessageWaitingIndicator(false);
handled = sms.isMwiDontStore();
- if (Config.LOGD) {
+ if (false) {
Log.d(TAG, "Received voice mail indicator clear SMS shouldStore=" + !handled);
}
}
@@ -492,7 +491,7 @@ final class GsmSMSDispatcher extends SMSDispatcher {
byte[][] pdus = null;
byte[] receivedPdu = (byte[])ar.result;
- if (Config.LOGD) {
+ if (false) {
for (int i = 0; i < receivedPdu.length; i += 8) {
StringBuilder sb = new StringBuilder("SMS CB pdu data: ");
for (int j = i; j < i + 8 && j < receivedPdu.length; j++) {
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index a7631cd..93f4b4e 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -55,7 +55,6 @@ import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
-import android.util.Config;
import android.util.EventLog;
import android.util.Log;
import android.util.TimeUtils;
@@ -1441,7 +1440,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
}
SystemProperties.set("gsm.nitz.time", String.valueOf(c.getTimeInMillis()));
saveNitzTime(c.getTimeInMillis());
- if (DBG) {
+ if (false) {
long end = SystemClock.elapsedRealtime();
log("NITZ: end=" + end + " dur=" + (end - start));
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
index ac184f4..3784e7c 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
@@ -19,7 +19,6 @@ package com.android.internal.telephony.gsm;
import android.os.Parcel;
import android.telephony.PhoneNumberUtils;
import android.text.format.Time;
-import android.util.Config;
import android.util.Log;
import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.EncodeException;
@@ -459,7 +458,7 @@ public class SmsMessage extends SmsMessageBase {
if (statusReportRequested) {
// Set TP-Status-Report-Request bit.
mtiByte |= 0x20;
- if (Config.LOGD) Log.d(LOG_TAG, "SMS status report requested");
+ if (false) Log.d(LOG_TAG, "SMS status report requested");
}
bo.write(mtiByte);
@@ -880,7 +879,7 @@ public class SmsMessage extends SmsMessageBase {
scAddress = p.getSCAddress();
if (scAddress != null) {
- if (Config.LOGD) Log.d(LOG_TAG, "SMS SC address: " + scAddress);
+ if (false) Log.d(LOG_TAG, "SMS SC address: " + scAddress);
}
// TODO(mkf) support reply path, user data header indicator
@@ -962,7 +961,7 @@ public class SmsMessage extends SmsMessageBase {
originatingAddress = p.getAddress();
if (originatingAddress != null) {
- if (Config.LOGV) Log.v(LOG_TAG, "SMS originating address: "
+ if (false) Log.v(LOG_TAG, "SMS originating address: "
+ originatingAddress.address);
}
@@ -974,14 +973,14 @@ public class SmsMessage extends SmsMessageBase {
// see TS 23.038
dataCodingScheme = p.getByte();
- if (Config.LOGV) {
+ if (false) {
Log.v(LOG_TAG, "SMS TP-PID:" + protocolIdentifier
+ " data coding scheme: " + dataCodingScheme);
}
scTimeMillis = p.getSCTimestampMillis();
- if (Config.LOGD) Log.d(LOG_TAG, "SMS SC timestamp: " + scTimeMillis);
+ if (false) Log.d(LOG_TAG, "SMS SC timestamp: " + scTimeMillis);
boolean hasUserDataHeader = (firstByte & 0x40) == 0x40;
@@ -1113,7 +1112,7 @@ public class SmsMessage extends SmsMessageBase {
break;
}
- if (Config.LOGV) Log.v(LOG_TAG, "SMS message body (raw): '" + messageBody + "'");
+ if (false) Log.v(LOG_TAG, "SMS message body (raw): '" + messageBody + "'");
if (messageBody != null) {
parseMessageBody();