Cleanup whitespace.
This commit is contained in:
@@ -21,11 +21,11 @@ import android.text.Editable;
|
||||
/*
|
||||
* Japanese Phone number formatting rule is a bit complicated.
|
||||
* Here are some valid examples:
|
||||
*
|
||||
*
|
||||
* 022-229-1234 0223-23-1234 022-301-9876 015-482-7849 0154-91-3478
|
||||
* 01547-5-4534 090-1234-1234 080-0123-6789
|
||||
* 0800-000-9999 0570-000-000 0276-00-0000
|
||||
*
|
||||
*
|
||||
* As you can see, there is no straight-forward rule here.
|
||||
* In order to handle this, a big array is prepared.
|
||||
*/
|
||||
@@ -151,14 +151,14 @@ import android.text.Editable;
|
||||
-100, -100, -45, -45, -100, -100, -100, -100, -100, -100,
|
||||
-25, -35, -35, -35, -35, -35, -35, -25, -25, -35,
|
||||
-35, -35, -35, -35, -35, -35, -35, -35, -35, -45};
|
||||
|
||||
|
||||
public static void format(Editable text) {
|
||||
// Here, "root" means the position of "'":
|
||||
// 0'3, 0'90, and +81'-90
|
||||
// (dash will be deleted soon, so it is actually +81'90).
|
||||
int rootIndex = 1;
|
||||
int length = text.length();
|
||||
if (length > 3
|
||||
if (length > 3
|
||||
&& text.subSequence(0, 3).toString().equals("+81")) {
|
||||
rootIndex = 3;
|
||||
} else if (length < 1 || text.charAt(0) != '0') {
|
||||
@@ -176,10 +176,10 @@ import android.text.Editable;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
length = text.length();
|
||||
int dashposition;
|
||||
|
||||
|
||||
i = rootIndex;
|
||||
int base = 0;
|
||||
while (i < length) {
|
||||
@@ -208,7 +208,7 @@ import android.text.Editable;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (length > 3 && rootIndex == 3) {
|
||||
text.insert(rootIndex, "-");
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
**
|
||||
** Copyright 2007, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Represents the neighboring cell information, including
|
||||
* Represents the neighboring cell information, including
|
||||
* Received Signal Strength and Cell ID location.
|
||||
*/
|
||||
public class NeighboringCellInfo implements Parcelable
|
||||
@@ -52,7 +52,7 @@ public class NeighboringCellInfo implements Parcelable
|
||||
mRssi = rssi;
|
||||
mCid = cid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the object from a parcel.
|
||||
*/
|
||||
@@ -60,12 +60,12 @@ public class NeighboringCellInfo implements Parcelable
|
||||
mRssi = in.readInt();
|
||||
mCid = in.readInt();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return received signal strength in "asu", ranging from 0 - 31,
|
||||
* @return received signal strength in "asu", ranging from 0 - 31,
|
||||
* or UNKNOWN_RSSI if unknown
|
||||
*
|
||||
* For GSM, dBm = -113 + 2*asu,
|
||||
* For GSM, dBm = -113 + 2*asu,
|
||||
* 0 means "-113 dBm or less" and 31 means "-51 dBm or greater"
|
||||
*/
|
||||
public int getRssi() {
|
||||
@@ -95,7 +95,7 @@ public class NeighboringCellInfo implements Parcelable
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "["+ ((mCid == UNKNOWN_CID) ? "/" : Integer.toHexString(mCid))
|
||||
return "["+ ((mCid == UNKNOWN_CID) ? "/" : Integer.toHexString(mCid))
|
||||
+ " at " + ((mRssi == UNKNOWN_RSSI)? "/" : mRssi) + "]";
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class NeighboringCellInfo implements Parcelable
|
||||
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(mRssi);
|
||||
dest.writeInt(mCid);
|
||||
dest.writeInt(mCid);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<NeighboringCellInfo> CREATOR
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<HTML>
|
||||
<BODY>
|
||||
Provides APIs for monitoring the basic phone information, such as
|
||||
Provides APIs for monitoring the basic phone information, such as
|
||||
the network type and connection state, plus utilities
|
||||
for manipulating phone number strings.
|
||||
</BODY>
|
||||
|
||||
@@ -505,10 +505,10 @@ public abstract class BaseCommands implements CommandsInterface {
|
||||
public void unregisterForSignalInfo(Handler h) {
|
||||
mSignalInfoRegistrants.remove(h);
|
||||
}
|
||||
|
||||
|
||||
public void registerForCdmaOtaProvision(Handler h,int what, Object obj){
|
||||
Registrant r = new Registrant (h, what, obj);
|
||||
mOtaProvisionRegistrants.add(r);
|
||||
mOtaProvisionRegistrants.add(r);
|
||||
}
|
||||
|
||||
public void unregisterForCdmaOtaProvision(Handler h){
|
||||
|
||||
@@ -80,13 +80,13 @@ public class CallerInfo {
|
||||
/* Split up the phoneLabel into number type and label name */
|
||||
public int numberType;
|
||||
public String numberLabel;
|
||||
|
||||
|
||||
public int photoResource;
|
||||
public long person_id;
|
||||
public boolean needUpdate;
|
||||
public Uri contactRefUri;
|
||||
|
||||
// fields to hold individual contact preference data,
|
||||
|
||||
// fields to hold individual contact preference data,
|
||||
// including the send to voicemail flag and the ringtone
|
||||
// uri reference.
|
||||
public Uri contactRingtoneUri;
|
||||
@@ -116,7 +116,7 @@ public class CallerInfo {
|
||||
* number. The returned CallerInfo is null if no number is supplied.
|
||||
*/
|
||||
public static CallerInfo getCallerInfo(Context context, Uri contactRef, Cursor cursor) {
|
||||
|
||||
|
||||
CallerInfo info = new CallerInfo();
|
||||
info.photoResource = 0;
|
||||
info.phoneLabel = null;
|
||||
@@ -125,9 +125,9 @@ public class CallerInfo {
|
||||
info.cachedPhoto = null;
|
||||
info.isCachedPhotoCurrent = false;
|
||||
info.contactExists = false;
|
||||
|
||||
|
||||
if (Config.LOGV) Log.v(TAG, "construct callerInfo from cursor");
|
||||
|
||||
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
|
||||
@@ -144,7 +144,7 @@ public class CallerInfo {
|
||||
if (columnIndex != -1) {
|
||||
info.phoneNumber = cursor.getString(columnIndex);
|
||||
}
|
||||
|
||||
|
||||
// Look for the label/type combo
|
||||
columnIndex = cursor.getColumnIndex(Phones.LABEL);
|
||||
if (columnIndex != -1) {
|
||||
@@ -168,7 +168,7 @@ public class CallerInfo {
|
||||
info.person_id = cursor.getLong(columnIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// look for the custom ringtone, create from the string stored
|
||||
// in the database.
|
||||
columnIndex = cursor.getColumnIndex(People.CUSTOM_RINGTONE);
|
||||
@@ -181,7 +181,7 @@ public class CallerInfo {
|
||||
// look for the send to voicemail flag, set it to true only
|
||||
// under certain circumstances.
|
||||
columnIndex = cursor.getColumnIndex(People.SEND_TO_VOICEMAIL);
|
||||
info.shouldSendToVoicemail = (columnIndex != -1) &&
|
||||
info.shouldSendToVoicemail = (columnIndex != -1) &&
|
||||
((cursor.getInt(columnIndex)) == 1);
|
||||
info.contactExists = true;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class CallerInfo {
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getCallerInfo given a URI, look up in the call-log database
|
||||
* for the uri unique key.
|
||||
@@ -204,11 +204,11 @@ public class CallerInfo {
|
||||
* number. The returned CallerInfo is null if no number is supplied.
|
||||
*/
|
||||
public static CallerInfo getCallerInfo(Context context, Uri contactRef) {
|
||||
|
||||
return getCallerInfo(context, contactRef,
|
||||
|
||||
return getCallerInfo(context, contactRef,
|
||||
context.getContentResolver().query(contactRef, null, null, null, null));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getCallerInfo given a phone number, look up in the call-log database
|
||||
* for the matching caller id info.
|
||||
@@ -224,13 +224,13 @@ public class CallerInfo {
|
||||
return null;
|
||||
} else {
|
||||
// Change the callerInfo number ONLY if it is an emergency number
|
||||
// or if it is the voicemail number. If it is either, take a
|
||||
// or if it is the voicemail number. If it is either, take a
|
||||
// shortcut and skip the query.
|
||||
if (PhoneNumberUtils.isEmergencyNumber(number)) {
|
||||
CallerInfo ci = new CallerInfo();
|
||||
|
||||
// Note we're setting the phone number here (refer to javadoc
|
||||
// comments at the top of CallerInfo class).
|
||||
// comments at the top of CallerInfo class).
|
||||
ci.phoneNumber = context.getString(
|
||||
com.android.internal.R.string.emergency_call_dialog_number_for_display);
|
||||
return ci;
|
||||
@@ -241,14 +241,14 @@ public class CallerInfo {
|
||||
CallerInfo ci = new CallerInfo();
|
||||
|
||||
// Note we're setting the phone number here (refer to javadoc
|
||||
// comments at the top of CallerInfo class).
|
||||
// comments at the top of CallerInfo class).
|
||||
ci.phoneNumber = TelephonyManager.getDefault().getVoiceMailAlphaTag();
|
||||
// TODO: FIND ANOTHER ICON
|
||||
//info.photoResource = android.R.drawable.badge_voicemail;
|
||||
return ci;
|
||||
}
|
||||
} catch (SecurityException ex) {
|
||||
// Don't crash if this process doesn't have permission to
|
||||
// Don't crash if this process doesn't have permission to
|
||||
// retrieve VM number. It's still allowed to look up caller info.
|
||||
// But don't try it again.
|
||||
sSkipVmCheck = true;
|
||||
@@ -257,16 +257,16 @@ public class CallerInfo {
|
||||
}
|
||||
|
||||
Uri contactUri = Uri.withAppendedPath(Contacts.Phones.CONTENT_FILTER_URL,
|
||||
Uri.encode(number));
|
||||
|
||||
Uri.encode(number));
|
||||
|
||||
CallerInfo info = getCallerInfo(context, contactUri);
|
||||
|
||||
// if no query results were returned with a viable number,
|
||||
// fill in the original number value we used to query with.
|
||||
// if no query results were returned with a viable number,
|
||||
// fill in the original number value we used to query with.
|
||||
if (TextUtils.isEmpty(info.phoneNumber)) {
|
||||
info.phoneNumber = number;
|
||||
}
|
||||
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -278,9 +278,9 @@ public class CallerInfo {
|
||||
* @param number a phone number.
|
||||
* @return if the number belongs to a contact, the contact's name is
|
||||
* returned; otherwise, the number itself is returned.
|
||||
*
|
||||
* TODO NOTE: This MAY need to refer to the Asynchronous Query API
|
||||
* [startQuery()], instead of getCallerInfo, but since it looks like
|
||||
*
|
||||
* TODO NOTE: This MAY need to refer to the Asynchronous Query API
|
||||
* [startQuery()], instead of getCallerInfo, but since it looks like
|
||||
* it is only being used by the provider calls in the messaging app:
|
||||
* 1. android.provider.Telephony.Mms.getDisplayAddress()
|
||||
* 2. android.provider.Telephony.Sms.getDisplayAddress()
|
||||
@@ -310,4 +310,4 @@ public class CallerInfo {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ import android.util.Log;
|
||||
*/
|
||||
|
||||
public class CallerInfoAsyncQuery {
|
||||
|
||||
|
||||
private static final boolean DBG = false;
|
||||
private static final String LOG_TAG = "PHONE";
|
||||
|
||||
|
||||
private static final int EVENT_NEW_QUERY = 1;
|
||||
private static final int EVENT_ADD_LISTENER = 2;
|
||||
private static final int EVENT_END_OF_QUEUE = 3;
|
||||
@@ -55,24 +55,24 @@ public class CallerInfoAsyncQuery {
|
||||
*/
|
||||
public interface OnQueryCompleteListener {
|
||||
/**
|
||||
* Called when the query is complete.
|
||||
*/
|
||||
* Called when the query is complete.
|
||||
*/
|
||||
public void onQueryComplete(int token, Object cookie, CallerInfo ci);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Wrap the cookie from the WorkerArgs with additional information needed by our
|
||||
* classes.
|
||||
* classes.
|
||||
*/
|
||||
private static final class CookieWrapper {
|
||||
public OnQueryCompleteListener listener;
|
||||
public Object cookie;
|
||||
public int event;
|
||||
public String number;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple exception used to communicate problems with the query pool.
|
||||
*/
|
||||
@@ -81,12 +81,12 @@ public class CallerInfoAsyncQuery {
|
||||
super(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Our own implementation of the AsyncQueryHandler.
|
||||
*/
|
||||
private class CallerInfoAsyncQueryHandler extends AsyncQueryHandler {
|
||||
|
||||
|
||||
/**
|
||||
* The information relevant to each CallerInfo query. Each query may have multiple
|
||||
* listeners, so each AsyncCursorInfo is associated with 2 or more CookieWrapper
|
||||
@@ -96,20 +96,20 @@ public class CallerInfoAsyncQuery {
|
||||
private Context mQueryContext;
|
||||
private Uri mQueryUri;
|
||||
private CallerInfo mCallerInfo;
|
||||
|
||||
|
||||
/**
|
||||
* Our own query worker thread.
|
||||
*
|
||||
*
|
||||
* This thread handles the messages enqueued in the looper. The normal sequence
|
||||
* of events is that a new query shows up in the looper queue, followed by 0 or
|
||||
* more add listener requests, and then an end request. Of course, these requests
|
||||
* can be interlaced with requests from other tokens, but is irrelevant to this
|
||||
* handler since the handler has no state.
|
||||
*
|
||||
*
|
||||
* Note that we depend on the queue to keep things in order; in other words, the
|
||||
* looper queue must be FIFO with respect to input from the synchronous startQuery
|
||||
* looper queue must be FIFO with respect to input from the synchronous startQuery
|
||||
* calls and output to this handleMessage call.
|
||||
*
|
||||
*
|
||||
* This use of the queue is required because CallerInfo objects may be accessed
|
||||
* multiple times before the query is complete. All accesses (listeners) must be
|
||||
* queued up and informed in order when the query is complete.
|
||||
@@ -123,22 +123,22 @@ public class CallerInfoAsyncQuery {
|
||||
public void handleMessage(Message msg) {
|
||||
WorkerArgs args = (WorkerArgs) msg.obj;
|
||||
CookieWrapper cw = (CookieWrapper) args.cookie;
|
||||
|
||||
|
||||
if (cw == null) {
|
||||
// Normally, this should never be the case for calls originating
|
||||
// from within this code.
|
||||
// However, if there is any code that this Handler calls (such as in
|
||||
// However, if there is any code that this Handler calls (such as in
|
||||
// super.handleMessage) that DOES place unexpected messages on the
|
||||
// queue, then we need pass these messages on.
|
||||
if (DBG) log("Unexpected command (CookieWrapper is null): " + msg.what +
|
||||
if (DBG) log("Unexpected command (CookieWrapper is null): " + msg.what +
|
||||
" ignored by CallerInfoWorkerHandler, passing onto parent.");
|
||||
|
||||
|
||||
super.handleMessage(msg);
|
||||
} else {
|
||||
|
||||
if (DBG) log("Processing event: " + cw.event + " token (arg1): " + msg.arg1 +
|
||||
|
||||
if (DBG) log("Processing event: " + cw.event + " token (arg1): " + msg.arg1 +
|
||||
" command: " + msg.what + " query URI: " + args.uri);
|
||||
|
||||
|
||||
switch (cw.event) {
|
||||
case EVENT_NEW_QUERY:
|
||||
//start the sql command.
|
||||
@@ -148,7 +148,7 @@ public class CallerInfoAsyncQuery {
|
||||
// shortcuts to avoid query for recognized numbers.
|
||||
case EVENT_EMERGENCY_NUMBER:
|
||||
case EVENT_VOICEMAIL_NUMBER:
|
||||
|
||||
|
||||
case EVENT_ADD_LISTENER:
|
||||
case EVENT_END_OF_QUEUE:
|
||||
// query was already completed, so just send the reply.
|
||||
@@ -157,17 +157,17 @@ public class CallerInfoAsyncQuery {
|
||||
Message reply = args.handler.obtainMessage(msg.what);
|
||||
reply.obj = args;
|
||||
reply.arg1 = msg.arg1;
|
||||
|
||||
|
||||
reply.sendToTarget();
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Asynchronous query handler class for the contact / callerinfo object.
|
||||
*/
|
||||
@@ -182,29 +182,29 @@ public class CallerInfoAsyncQuery {
|
||||
|
||||
/**
|
||||
* Overrides onQueryComplete from AsyncQueryHandler.
|
||||
*
|
||||
*
|
||||
* This method takes into account the state of this class; we construct the CallerInfo
|
||||
* object only once for each set of listeners. When the query thread has done its work
|
||||
* and calls this method, we inform the remaining listeners in the queue, until we're
|
||||
* out of listeners. Once we get the message indicating that we should expect no new
|
||||
* listeners for this CallerInfo object, we release the AsyncCursorInfo back into the
|
||||
* and calls this method, we inform the remaining listeners in the queue, until we're
|
||||
* out of listeners. Once we get the message indicating that we should expect no new
|
||||
* listeners for this CallerInfo object, we release the AsyncCursorInfo back into the
|
||||
* pool.
|
||||
*/
|
||||
@Override
|
||||
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
|
||||
if (DBG) log("query complete for token: " + token);
|
||||
|
||||
|
||||
//get the cookie and notify the listener.
|
||||
CookieWrapper cw = (CookieWrapper) cookie;
|
||||
if (cw == null) {
|
||||
// Normally, this should never be the case for calls originating
|
||||
// from within this code.
|
||||
// However, if there is any code that calls this method, we should
|
||||
// However, if there is any code that calls this method, we should
|
||||
// check the parameters to make sure they're viable.
|
||||
if (DBG) log("Cookie is null, ignoring onQueryComplete() request.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (cw.event == EVENT_END_OF_QUEUE) {
|
||||
release();
|
||||
return;
|
||||
@@ -216,16 +216,16 @@ public class CallerInfoAsyncQuery {
|
||||
throw new QueryPoolException
|
||||
("Bad context or query uri, or CallerInfoAsyncQuery already released.");
|
||||
}
|
||||
|
||||
|
||||
// adjust the callerInfo data as needed, and only if it was set from the
|
||||
// initial query request.
|
||||
// Change the callerInfo number ONLY if it is an emergency number or the
|
||||
// voicemail number, and adjust other data (including photoResource)
|
||||
// voicemail number, and adjust other data (including photoResource)
|
||||
// accordingly.
|
||||
if (cw.event == EVENT_EMERGENCY_NUMBER) {
|
||||
mCallerInfo = new CallerInfo();
|
||||
// Note we're setting the phone number here (refer to javadoc
|
||||
// comments at the top of CallerInfo class).
|
||||
// comments at the top of CallerInfo class).
|
||||
mCallerInfo.phoneNumber = mQueryContext.getString(com.android.internal
|
||||
.R.string.emergency_call_dialog_number_for_display);
|
||||
mCallerInfo.photoResource = com.android.internal.R.drawable.picture_emergency;
|
||||
@@ -234,8 +234,8 @@ public class CallerInfoAsyncQuery {
|
||||
mCallerInfo = new CallerInfo();
|
||||
try {
|
||||
// Note we're setting the phone number here (refer to javadoc
|
||||
// comments at the top of CallerInfo class).
|
||||
mCallerInfo.phoneNumber =
|
||||
// comments at the top of CallerInfo class).
|
||||
mCallerInfo.phoneNumber =
|
||||
TelephonyManager.getDefault().getVoiceMailAlphaTag();
|
||||
} catch (SecurityException ex) {
|
||||
// Should never happen: if this process does not have
|
||||
@@ -243,80 +243,80 @@ public class CallerInfoAsyncQuery {
|
||||
// permission to retrieve VM number and would not generate
|
||||
// an EVENT_VOICEMAIL_NUMBER. But if it happens, don't crash.
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
mCallerInfo = CallerInfo.getCallerInfo(mQueryContext, mQueryUri, cursor);
|
||||
// Use the number entered by the user for display.
|
||||
if (!TextUtils.isEmpty(cw.number)) {
|
||||
mCallerInfo.phoneNumber = PhoneNumberUtils.formatNumber(cw.number);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (DBG) log("constructing CallerInfo object for token: " + token);
|
||||
|
||||
|
||||
//notify that we can clean up the queue after this.
|
||||
CookieWrapper endMarker = new CookieWrapper();
|
||||
endMarker.event = EVENT_END_OF_QUEUE;
|
||||
startQuery (token, endMarker, null, null, null, null, null);
|
||||
}
|
||||
|
||||
|
||||
//notify the listener that the query is complete.
|
||||
if (cw.listener != null) {
|
||||
if (DBG) log("notifying listener: " + cw.listener.getClass().toString() +
|
||||
if (DBG) log("notifying listener: " + cw.listener.getClass().toString() +
|
||||
" for token: " + token);
|
||||
cw.listener.onQueryComplete(token, cw.cookie, mCallerInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Private constructor for factory methods.
|
||||
*/
|
||||
private CallerInfoAsyncQuery() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Factory method to start query with a Uri query spec
|
||||
*/
|
||||
public static CallerInfoAsyncQuery startQuery(int token, Context context, Uri contactRef,
|
||||
public static CallerInfoAsyncQuery startQuery(int token, Context context, Uri contactRef,
|
||||
OnQueryCompleteListener listener, Object cookie) {
|
||||
|
||||
|
||||
CallerInfoAsyncQuery c = new CallerInfoAsyncQuery();
|
||||
c.allocate(context, contactRef);
|
||||
|
||||
if (DBG) log("starting query for URI: " + contactRef + " handler: " + c.toString());
|
||||
|
||||
|
||||
//create cookieWrapper, start query
|
||||
CookieWrapper cw = new CookieWrapper();
|
||||
cw.listener = listener;
|
||||
cw.cookie = cookie;
|
||||
cw.event = EVENT_NEW_QUERY;
|
||||
|
||||
|
||||
c.mHandler.startQuery (token, cw, contactRef, null, null, null, null);
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Factory method to start query with a number
|
||||
*/
|
||||
public static CallerInfoAsyncQuery startQuery(int token, Context context, String number,
|
||||
public static CallerInfoAsyncQuery startQuery(int token, Context context, String number,
|
||||
OnQueryCompleteListener listener, Object cookie) {
|
||||
//contruct the URI object and start Query.
|
||||
Uri contactRef = Uri.withAppendedPath(Contacts.Phones.CONTENT_FILTER_URL, number);
|
||||
|
||||
|
||||
CallerInfoAsyncQuery c = new CallerInfoAsyncQuery();
|
||||
c.allocate(context, contactRef);
|
||||
|
||||
if (DBG) log("starting query for number: " + number + " handler: " + c.toString());
|
||||
|
||||
|
||||
//create cookieWrapper, start query
|
||||
CookieWrapper cw = new CookieWrapper();
|
||||
cw.listener = listener;
|
||||
cw.cookie = cookie;
|
||||
cw.number = number;
|
||||
|
||||
// check to see if these are recognized numbers, and use shortcuts if we can.
|
||||
// check to see if these are recognized numbers, and use shortcuts if we can.
|
||||
if (PhoneNumberUtils.isEmergencyNumber(number)) {
|
||||
cw.event = EVENT_EMERGENCY_NUMBER;
|
||||
} else {
|
||||
@@ -325,13 +325,13 @@ public class CallerInfoAsyncQuery {
|
||||
try {
|
||||
vmNumber = TelephonyManager.getDefault().getVoiceMailNumber();
|
||||
} catch (SecurityException ex) {
|
||||
// Don't crash if this process doesn't have permission to
|
||||
// Don't crash if this process doesn't have permission to
|
||||
// retrieve VM number. It's still allowed to look up caller info.
|
||||
// But don't try it again.
|
||||
sSkipVmCheck = true;
|
||||
}
|
||||
}
|
||||
if (PhoneNumberUtils.compare(number, vmNumber)) {
|
||||
if (PhoneNumberUtils.compare(number, vmNumber)) {
|
||||
cw.event = EVENT_VOICEMAIL_NUMBER;
|
||||
} else {
|
||||
cw.event = EVENT_NEW_QUERY;
|
||||
@@ -339,24 +339,24 @@ public class CallerInfoAsyncQuery {
|
||||
}
|
||||
|
||||
c.mHandler.startQuery (token, cw, contactRef, null, null, null, null);
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to add listeners to a currently running query
|
||||
*/
|
||||
public void addQueryListener(int token, OnQueryCompleteListener listener, Object cookie) {
|
||||
|
||||
if (DBG) log("adding listener to query: " + mHandler.mQueryUri + " handler: " +
|
||||
if (DBG) log("adding listener to query: " + mHandler.mQueryUri + " handler: " +
|
||||
mHandler.toString());
|
||||
|
||||
|
||||
//create cookieWrapper, add query request to end of queue.
|
||||
CookieWrapper cw = new CookieWrapper();
|
||||
cw.listener = listener;
|
||||
cw.cookie = cookie;
|
||||
cw.event = EVENT_ADD_LISTENER;
|
||||
|
||||
|
||||
mHandler.startQuery (token, cw, null, null, null, null, null);
|
||||
}
|
||||
|
||||
@@ -382,12 +382,12 @@ public class CallerInfoAsyncQuery {
|
||||
mHandler.mCallerInfo = null;
|
||||
mHandler = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* static logging method
|
||||
*/
|
||||
private static void log(String msg) {
|
||||
Log.d(LOG_TAG, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class Connection {
|
||||
public static int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network
|
||||
public static int PRESENTATION_PAYPHONE = 4; // show pay phone info
|
||||
|
||||
|
||||
|
||||
public enum DisconnectCause {
|
||||
NOT_DISCONNECTED, /* has not yet disconnected */
|
||||
INCOMING_MISSED, /* an incoming call that was missed and never answered */
|
||||
@@ -231,7 +231,7 @@ public abstract class Connection {
|
||||
COMPLETE, /* The post dial string playback is complete */
|
||||
CANCELLED, /* The post dial string playback was cancelled
|
||||
with cancelPostDial() */
|
||||
PAUSE /* The post dial string playback is pausing for a
|
||||
PAUSE /* The post dial string playback is pausing for a
|
||||
call to processNextPostDialChar*/
|
||||
}
|
||||
|
||||
@@ -260,8 +260,8 @@ public abstract class Connection {
|
||||
/**
|
||||
* Cancel any post
|
||||
*/
|
||||
public abstract void cancelPostDial();
|
||||
|
||||
public abstract void cancelPostDial();
|
||||
|
||||
/**
|
||||
* Returns the caller id presentation type for incoming and waiting calls
|
||||
* @return one of PRESENTATION_*
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.android.internal.telephony;
|
||||
|
||||
/**
|
||||
* Interface used to interact with extended MMI/USSD network service.
|
||||
* Interface used to interact with extended MMI/USSD network service.
|
||||
*/
|
||||
interface IExtendedNetworkService {
|
||||
/**
|
||||
* Set a MMI/USSD command to ExtendedNetworkService for further process.
|
||||
* Set a MMI/USSD command to ExtendedNetworkService for further process.
|
||||
* This should be called when a MMI command is placed from panel.
|
||||
* @param number the dialed MMI/USSD number.
|
||||
*/
|
||||
|
||||
@@ -28,5 +28,5 @@ public final class IccVmFixedException extends IccException {
|
||||
public IccVmFixedException(String s)
|
||||
{
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,5 +28,5 @@ public final class IccVmNotSupportedException extends IccException {
|
||||
public IccVmNotSupportedException(String s)
|
||||
{
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public abstract class SMSDispatcher extends Handler {
|
||||
/** Maximum number of times to retry sending a failed SMS. */
|
||||
private static final int MAX_SEND_RETRIES = 3;
|
||||
/** Delay before next send attempt on a failed SMS, in milliseconds. */
|
||||
private static final int SEND_RETRY_DELAY = 2000;
|
||||
private static final int SEND_RETRY_DELAY = 2000;
|
||||
/** single part SMS */
|
||||
private static final int SINGLE_PART_SMS = 1;
|
||||
|
||||
@@ -173,11 +173,11 @@ public abstract class SMSDispatcher extends Handler {
|
||||
|
||||
/**
|
||||
* Check to see if an application allow to send new SMS messages
|
||||
*
|
||||
*
|
||||
* @param appName is the application sending sms
|
||||
* @param smsWaiting is the number of new sms wants to be sent
|
||||
* @return true if application is allowed to send the requested number
|
||||
* of new sms messages
|
||||
* @return true if application is allowed to send the requested number
|
||||
* of new sms messages
|
||||
*/
|
||||
boolean check(String appName, int smsWaiting) {
|
||||
if (!mSmsStamp.containsKey(appName)) {
|
||||
@@ -196,7 +196,7 @@ public abstract class SMSDispatcher extends Handler {
|
||||
sent.remove(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( (sent.size() + smsWaiting) <= mMaxAllowed) {
|
||||
for (int i = 0; i < smsWaiting; i++ ) {
|
||||
sent.add(ct);
|
||||
@@ -332,7 +332,7 @@ public abstract class SMSDispatcher extends Handler {
|
||||
sendMultipartSms(mSTracker);
|
||||
} else {
|
||||
sendSms(mSTracker);
|
||||
}
|
||||
}
|
||||
mSTracker = null;
|
||||
}
|
||||
break;
|
||||
@@ -712,7 +712,7 @@ public abstract class SMSDispatcher extends Handler {
|
||||
|
||||
/**
|
||||
* Send the multi-part SMS based on multipart Sms tracker
|
||||
*
|
||||
*
|
||||
* @param tracker holds the multipart Sms tracker ready to be sent
|
||||
*/
|
||||
protected abstract void sendMultipartSms (SmsTracker tracker);
|
||||
@@ -759,7 +759,7 @@ public abstract class SMSDispatcher extends Handler {
|
||||
|
||||
/**
|
||||
* Check if a SmsTracker holds multi-part Sms
|
||||
*
|
||||
*
|
||||
* @param tracker a SmsTracker could hold a multi-part Sms
|
||||
* @return true for tracker holds Multi-parts Sms
|
||||
*/
|
||||
@@ -790,7 +790,7 @@ public abstract class SMSDispatcher extends Handler {
|
||||
mRetryCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected SmsTracker SmsTrackerFactory(HashMap data, PendingIntent sentIntent,
|
||||
PendingIntent deliveryIntent) {
|
||||
return new SmsTracker(data, sentIntent, deliveryIntent);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TelephonyIntents {
|
||||
* <p class="note">
|
||||
* Requires no permission.
|
||||
*/
|
||||
public static final String ACTION_RADIO_TECHNOLOGY_CHANGED
|
||||
public static final String ACTION_RADIO_TECHNOLOGY_CHANGED
|
||||
= "android.intent.action.RADIO_TECHNOLOGY";
|
||||
/**
|
||||
* <p>Broadcast Action: The emergency callback mode is changed.
|
||||
|
||||
@@ -36,7 +36,7 @@ public class WapPushOverSms {
|
||||
private SMSDispatcher mSmsDispatcher;
|
||||
|
||||
/**
|
||||
* Hold the wake lock for 5 seconds, which should be enough time for
|
||||
* Hold the wake lock for 5 seconds, which should be enough time for
|
||||
* any receiver(s) to grab its own wake lock.
|
||||
*/
|
||||
private final int WAKE_LOCK_TIMEOUT = 5000;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class CDMAPhone extends PhoneBase {
|
||||
private Registrant mECMExitRespRegistrant;
|
||||
private String mEsn;
|
||||
private String mMeid;
|
||||
|
||||
|
||||
// A runnable which is used to automatically exit from ECM after a period of time.
|
||||
private Runnable mExitEcmRunnable = new Runnable() {
|
||||
public void run() {
|
||||
@@ -854,7 +854,7 @@ public class CDMAPhone extends PhoneBase {
|
||||
// notify change
|
||||
sendEmergencyCallbackModeChange();
|
||||
setSystemProperty(TelephonyProperties.PROPERTY_INECM_MODE, "true");
|
||||
|
||||
|
||||
// Post this runnable so we will automatically exit
|
||||
// if no one invokes exitEmergencyCallbackMode() directly.
|
||||
long delayInMillis = SystemProperties.getLong(
|
||||
|
||||
@@ -802,7 +802,7 @@ public class CdmaConnection extends Connection {
|
||||
// This function is to find the next PAUSE character index if
|
||||
// multiple pauses in a row. Otherwise it finds the next non PAUSE or
|
||||
// non WAIT character index.
|
||||
private static int
|
||||
private static int
|
||||
findNextPCharOrNonPOrNonWCharIndex(String phoneNumber, int currIndex) {
|
||||
boolean wMatched = false;
|
||||
int index = currIndex + 1;
|
||||
@@ -833,7 +833,7 @@ public class CdmaConnection extends Connection {
|
||||
// This function returns either PAUSE or WAIT character to append.
|
||||
// It is based on the next non PAUSE/WAIT character in the phoneNumber and the
|
||||
// index for the current PAUSE/WAIT character
|
||||
private static char
|
||||
private static char
|
||||
findPOrWCharToAppend(String phoneNumber, int currPwIndex, int nextNonPwCharIndex) {
|
||||
char c = phoneNumber.charAt(currPwIndex);
|
||||
char ret;
|
||||
|
||||
@@ -254,7 +254,7 @@ public final class EriManager {
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText0).toString());
|
||||
break;
|
||||
|
||||
|
||||
case EriInfo.ROAMING_INDICATOR_OFF:
|
||||
ret = new EriDisplayInformation(
|
||||
EriInfo.ROAMING_INDICATOR_OFF,
|
||||
@@ -284,56 +284,56 @@ public final class EriManager {
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText4).toString());
|
||||
break;
|
||||
|
||||
|
||||
case 5:
|
||||
ret = new EriDisplayInformation(
|
||||
roamInd,
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText5).toString());
|
||||
break;
|
||||
|
||||
|
||||
case 6:
|
||||
ret = new EriDisplayInformation(
|
||||
roamInd,
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText6).toString());
|
||||
break;
|
||||
|
||||
|
||||
case 7:
|
||||
ret = new EriDisplayInformation(
|
||||
roamInd,
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText7).toString());
|
||||
break;
|
||||
|
||||
|
||||
case 8:
|
||||
ret = new EriDisplayInformation(
|
||||
roamInd,
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText8).toString());
|
||||
break;
|
||||
|
||||
|
||||
case 9:
|
||||
ret = new EriDisplayInformation(
|
||||
roamInd,
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText9).toString());
|
||||
break;
|
||||
|
||||
|
||||
case 10:
|
||||
ret = new EriDisplayInformation(
|
||||
roamInd,
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText10).toString());
|
||||
break;
|
||||
|
||||
|
||||
case 11:
|
||||
ret = new EriDisplayInformation(
|
||||
roamInd,
|
||||
EriInfo.ROAMING_ICON_MODE_NORMAL,
|
||||
mContext.getText(com.android.internal.R.string.roamingText11).toString());
|
||||
break;
|
||||
|
||||
|
||||
case 12:
|
||||
ret = new EriDisplayInformation(
|
||||
roamInd,
|
||||
@@ -363,7 +363,7 @@ public final class EriManager {
|
||||
mContext.getText(com.android.internal
|
||||
.R.string.roamingText0).toString());
|
||||
break;
|
||||
|
||||
|
||||
case EriInfo.ROAMING_INDICATOR_OFF:
|
||||
ret = new EriDisplayInformation(
|
||||
EriInfo.ROAMING_INDICATOR_OFF,
|
||||
@@ -371,7 +371,7 @@ public final class EriManager {
|
||||
mContext.getText(com.android.internal
|
||||
.R.string.roamingText1).toString());
|
||||
break;
|
||||
|
||||
|
||||
case EriInfo.ROAMING_INDICATOR_FLASH:
|
||||
ret = new EriDisplayInformation(
|
||||
EriInfo.ROAMING_INDICATOR_FLASH,
|
||||
@@ -379,7 +379,7 @@ public final class EriManager {
|
||||
mContext.getText(com.android.internal
|
||||
.R.string.roamingText2).toString());
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ret = new EriDisplayInformation(-1, -1, "ERI text");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<HTML>
|
||||
<BODY>
|
||||
Provides classes to control or read data from CDMA phones.
|
||||
Provides classes to control or read data from CDMA phones.
|
||||
@hide
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<HTML>
|
||||
<BODY>
|
||||
Provides CDMA-specific features for text/data/PDU SMS messages
|
||||
Provides CDMA-specific features for text/data/PDU SMS messages
|
||||
@hide
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -83,7 +83,7 @@ public class GsmConnection extends Connection {
|
||||
static final int EVENT_PAUSE_DONE = 2;
|
||||
static final int EVENT_NEXT_POST_DIAL = 3;
|
||||
static final int EVENT_WAKE_LOCK_TIMEOUT = 4;
|
||||
|
||||
|
||||
//***** Constants
|
||||
static final int PAUSE_DELAY_FIRST_MILLIS = 100;
|
||||
static final int PAUSE_DELAY_MILLIS = 3 * 1000;
|
||||
@@ -117,7 +117,7 @@ public class GsmConnection extends Connection {
|
||||
GsmConnection (Context context, DriverCall dc, GsmCallTracker ct, int index) {
|
||||
createWakeLock(context);
|
||||
acquireWakeLock();
|
||||
|
||||
|
||||
owner = ct;
|
||||
h = new MyHandler(owner.getLooper());
|
||||
|
||||
@@ -138,7 +138,7 @@ public class GsmConnection extends Connection {
|
||||
GsmConnection (Context context, String dialString, GsmCallTracker ct, GsmCall parent) {
|
||||
createWakeLock(context);
|
||||
acquireWakeLock();
|
||||
|
||||
|
||||
owner = ct;
|
||||
h = new MyHandler(owner.getLooper());
|
||||
|
||||
@@ -375,7 +375,7 @@ public class GsmConnection extends Connection {
|
||||
return DisconnectCause.ICC_ERROR;
|
||||
} else if (causeCode == CallFailCause.ERROR_UNSPECIFIED) {
|
||||
if (phone.mSST.rs.isCsRestricted()) {
|
||||
return DisconnectCause.CS_RESTRICTED;
|
||||
return DisconnectCause.CS_RESTRICTED;
|
||||
} else if (phone.mSST.rs.isCsEmergencyRestricted()) {
|
||||
return DisconnectCause.CS_RESTRICTED_EMERGENCY;
|
||||
} else if (phone.mSST.rs.isCsNormalRestricted()) {
|
||||
@@ -575,7 +575,7 @@ public class GsmConnection extends Connection {
|
||||
|
||||
return postDialString.substring(nextPostDialChar);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize()
|
||||
{
|
||||
@@ -609,7 +609,7 @@ public class GsmConnection extends Connection {
|
||||
c = 0;
|
||||
} else {
|
||||
boolean isValid;
|
||||
|
||||
|
||||
setPostDialState(PostDialState.STARTED);
|
||||
|
||||
c = postDialString.charAt(nextPostDialChar++);
|
||||
@@ -680,31 +680,31 @@ public class GsmConnection extends Connection {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set post dial state and acquire wake lock while switching to "started"
|
||||
* state, the wake lock will be released if state switches out of "started"
|
||||
* state or after WAKE_LOCK_TIMEOUT_MILLIS.
|
||||
* Set post dial state and acquire wake lock while switching to "started"
|
||||
* state, the wake lock will be released if state switches out of "started"
|
||||
* state or after WAKE_LOCK_TIMEOUT_MILLIS.
|
||||
* @param s new PostDialState
|
||||
*/
|
||||
private void setPostDialState(PostDialState s) {
|
||||
if (postDialState != PostDialState.STARTED
|
||||
if (postDialState != PostDialState.STARTED
|
||||
&& s == PostDialState.STARTED) {
|
||||
acquireWakeLock();
|
||||
Message msg = h.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
|
||||
h.sendMessageDelayed(msg, WAKE_LOCK_TIMEOUT_MILLIS);
|
||||
} else if (postDialState == PostDialState.STARTED
|
||||
} else if (postDialState == PostDialState.STARTED
|
||||
&& s != PostDialState.STARTED) {
|
||||
h.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
|
||||
releaseWakeLock();
|
||||
}
|
||||
postDialState = s;
|
||||
}
|
||||
|
||||
|
||||
private void
|
||||
createWakeLock(Context context) {
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
|
||||
}
|
||||
|
||||
|
||||
private void
|
||||
acquireWakeLock() {
|
||||
log("acquireWakeLock");
|
||||
@@ -720,7 +720,7 @@ public class GsmConnection extends Connection {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void log(String msg) {
|
||||
Log.d(LOG_TAG, "[GSMConn] " + msg);
|
||||
}
|
||||
|
||||
@@ -621,7 +621,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
|
||||
if (isInterrogate()) {
|
||||
phone.mCM.queryFacilityLock(facility, password,
|
||||
serviceClass, obtainMessage(EVENT_QUERY_COMPLETE, this));
|
||||
} else if (isActivate() || isDeactivate()) {
|
||||
} else if (isActivate() || isDeactivate()) {
|
||||
phone.mCM.setFacilityLock(facility, isActivate(), password,
|
||||
serviceClass, obtainMessage(EVENT_SET_COMPLETE, this));
|
||||
} else {
|
||||
@@ -1186,9 +1186,9 @@ public final class GsmMmiCode extends Handler implements MmiCode {
|
||||
sb.append(createQueryCallWaitingResultMessage(ints[1]));
|
||||
} else if (isServiceCodeCallBarring(sc)) {
|
||||
// ints[0] for Call Barring is a bit vector of services
|
||||
sb.append(createQueryCallBarringResultMessage(ints[0]));
|
||||
sb.append(createQueryCallBarringResultMessage(ints[0]));
|
||||
} else if (ints[0] == 1) {
|
||||
// for all other services, treat it as a boolean
|
||||
// for all other services, treat it as a boolean
|
||||
sb.append(context.getText(com.android.internal.R.string.serviceEnabled));
|
||||
} else {
|
||||
sb.append(context.getText(com.android.internal.R.string.mmiError));
|
||||
@@ -1224,9 +1224,9 @@ public final class GsmMmiCode extends Handler implements MmiCode {
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(context.getText(com.android.internal.R.string.serviceEnabledFor));
|
||||
|
||||
for (int classMask = 1
|
||||
for (int classMask = 1
|
||||
; classMask <= SERVICE_CLASS_MAX
|
||||
; classMask <<= 1
|
||||
; classMask <<= 1
|
||||
) {
|
||||
if ((classMask & serviceClass) != 0) {
|
||||
sb.append("\n");
|
||||
@@ -1235,7 +1235,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* TODO: It would be nice to have a method here that can take in a dialstring and
|
||||
* figure out if there is an MMI code embedded within it. This code would replace
|
||||
|
||||
@@ -183,7 +183,7 @@ final class GsmSMSDispatcher extends SMSDispatcher {
|
||||
* Send a multi-part text based SMS which already passed SMS control check.
|
||||
*
|
||||
* It is the working function for sendMultipartText().
|
||||
*
|
||||
*
|
||||
* @param destinationAddress the address to send the message to
|
||||
* @param scAddress is the service center address or null to use
|
||||
* the current default SMSC
|
||||
@@ -269,24 +269,24 @@ final class GsmSMSDispatcher extends SMSDispatcher {
|
||||
|
||||
/**
|
||||
* Send the multi-part SMS based on multipart Sms tracker
|
||||
*
|
||||
*
|
||||
* @param tracker holds the multipart Sms tracker ready to be sent
|
||||
*/
|
||||
protected void sendMultipartSms (SmsTracker tracker) {
|
||||
ArrayList<String> parts;
|
||||
ArrayList<PendingIntent> sentIntents;
|
||||
ArrayList<PendingIntent> deliveryIntents;
|
||||
|
||||
|
||||
HashMap map = tracker.mData;
|
||||
|
||||
|
||||
String destinationAddress = (String) map.get("destination");
|
||||
String scAddress = (String) map.get("scaddress");
|
||||
|
||||
|
||||
parts = (ArrayList<String>) map.get("parts");
|
||||
sentIntents = (ArrayList<PendingIntent>) map.get("sentIntents");
|
||||
deliveryIntents = (ArrayList<PendingIntent>) map.get("deliveryIntents");
|
||||
|
||||
sendMultipartTextWithPermit(destinationAddress,
|
||||
|
||||
sendMultipartTextWithPermit(destinationAddress,
|
||||
scAddress, parts, sentIntents, deliveryIntents);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.android.internal.telephony.gsm;
|
||||
import android.telephony.ServiceState;
|
||||
|
||||
public class RestrictedState {
|
||||
|
||||
|
||||
/**
|
||||
* Set true to block packet data access due to restriction
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ public class RestrictedState {
|
||||
* Set true to block emergency call due to restriction
|
||||
*/
|
||||
private boolean mCsEmergencyRestricted;
|
||||
|
||||
|
||||
public RestrictedState() {
|
||||
setPsRestricted(false);
|
||||
setCsNormalRestricted(false);
|
||||
@@ -80,11 +80,11 @@ public class RestrictedState {
|
||||
public boolean isPsRestricted() {
|
||||
return mPsRestricted;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCsRestricted() {
|
||||
return mCsNormalRestricted && mCsEmergencyRestricted;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals (Object o) {
|
||||
RestrictedState s;
|
||||
@@ -107,7 +107,7 @@ public class RestrictedState {
|
||||
@Override
|
||||
public String toString() {
|
||||
String csString = "none";
|
||||
|
||||
|
||||
if (mCsEmergencyRestricted && mCsNormalRestricted) {
|
||||
csString = "all";
|
||||
} else if (mCsEmergencyRestricted && !mCsNormalRestricted) {
|
||||
@@ -115,7 +115,7 @@ public class RestrictedState {
|
||||
} else if (!mCsEmergencyRestricted && mCsNormalRestricted) {
|
||||
csString = "normal call";
|
||||
}
|
||||
|
||||
|
||||
return "Restricted State CS: " + csString + " PS:" + mPsRestricted;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class SIMRecords extends IccRecords {
|
||||
|
||||
|
||||
SpnOverride mSpnOverride;
|
||||
|
||||
|
||||
//***** Cached SIM State; cleared on channel close
|
||||
|
||||
String imsi;
|
||||
@@ -204,7 +204,7 @@ public final class SIMRecords extends IccRecords {
|
||||
// -1 means no EF_SPN found; treat accordingly.
|
||||
spnDisplayCondition = -1;
|
||||
efMWIS = null;
|
||||
efCPHS_MWI = null;
|
||||
efCPHS_MWI = null;
|
||||
spdiNetworks = null;
|
||||
pnnHomeName = null;
|
||||
|
||||
@@ -483,7 +483,7 @@ public final class SIMRecords extends IccRecords {
|
||||
|
||||
return imsi.substring(0, 3 + MccTable.smallestDigitsMccForMnc(mcc));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If the timezone is not already set, set it based on the MCC of the SIM.
|
||||
* @param mcc Mobile Country Code of the SIM
|
||||
@@ -492,7 +492,7 @@ public final class SIMRecords extends IccRecords {
|
||||
String timezone = SystemProperties.get(TIMEZONE_PROPERTY);
|
||||
if (timezone == null || timezone.length() == 0) {
|
||||
String zoneId = MccTable.defaultTimeZoneForMcc(mcc);
|
||||
|
||||
|
||||
if (zoneId != null && zoneId.length() > 0) {
|
||||
// Set time zone based on MCC
|
||||
AlarmManager alarm =
|
||||
@@ -1011,7 +1011,7 @@ public final class SIMRecords extends IccRecords {
|
||||
IccUtils.bytesToHexString(data));
|
||||
|
||||
mEfCfis = data;
|
||||
|
||||
|
||||
// Refer TS 51.011 Section 10.3.46 for the content description
|
||||
callForwardingEnabled = ((data[1] & 0x01) != 0);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SuppServiceNotification {
|
||||
public int type;
|
||||
/** TS 27.007 7.17 "number" (MT only) */
|
||||
public String number;
|
||||
|
||||
|
||||
static public final int MO_CODE_UNCONDITIONAL_CF_ACTIVE = 0;
|
||||
static public final int MO_CODE_SOME_CF_ACTIVE = 1;
|
||||
static public final int MO_CODE_CALL_FORWARDED = 2;
|
||||
@@ -44,7 +44,7 @@ public class SuppServiceNotification {
|
||||
static public final int MO_CODE_INCOMING_CALLS_BARRED = 6;
|
||||
static public final int MO_CODE_CLIR_SUPPRESSION_REJECTED = 7;
|
||||
static public final int MO_CODE_CALL_DEFLECTED = 8;
|
||||
|
||||
|
||||
static public final int MT_CODE_FORWARDED_CALL = 0;
|
||||
static public final int MT_CODE_CUG_CALL = 1;
|
||||
static public final int MT_CODE_CALL_ON_HOLD = 2;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<HTML>
|
||||
<BODY>
|
||||
Provides classes to control or read data from GSM phones.
|
||||
Provides classes to control or read data from GSM phones.
|
||||
@hide
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -24,15 +24,15 @@ package com.android.internal.telephony.gsm.stk;
|
||||
public interface AppInterface {
|
||||
|
||||
/*
|
||||
* Intent's actions which are broadcasted by the Telephony once a new STK
|
||||
* Intent's actions which are broadcasted by the Telephony once a new STK
|
||||
* proactive command, session end arrive.
|
||||
*/
|
||||
public static final String STK_CMD_ACTION =
|
||||
public static final String STK_CMD_ACTION =
|
||||
"android.intent.action.stk.command";
|
||||
public static final String STK_SESSION_END_ACTION =
|
||||
public static final String STK_SESSION_END_ACTION =
|
||||
"android.intent.action.stk.session_end";
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Callback function from app to telephony to pass a result code and user's
|
||||
* input back to the SIM.
|
||||
*/
|
||||
@@ -44,20 +44,20 @@ public interface AppInterface {
|
||||
* implementation should support those.
|
||||
*/
|
||||
public static enum CommandType {
|
||||
DISPLAY_TEXT(0x21),
|
||||
GET_INKEY(0x22),
|
||||
GET_INPUT(0x23),
|
||||
LAUNCH_BROWSER(0x15),
|
||||
PLAY_TONE(0x20),
|
||||
REFRESH(0x01),
|
||||
SELECT_ITEM(0x24),
|
||||
SEND_SS(0x11),
|
||||
SEND_USSD(0x12),
|
||||
SEND_SMS(0x13),
|
||||
SEND_DTMF(0x14),
|
||||
SET_UP_EVENT_LIST(0x05),
|
||||
SET_UP_IDLE_MODE_TEXT(0x28),
|
||||
SET_UP_MENU(0x25),
|
||||
DISPLAY_TEXT(0x21),
|
||||
GET_INKEY(0x22),
|
||||
GET_INPUT(0x23),
|
||||
LAUNCH_BROWSER(0x15),
|
||||
PLAY_TONE(0x20),
|
||||
REFRESH(0x01),
|
||||
SELECT_ITEM(0x24),
|
||||
SEND_SS(0x11),
|
||||
SEND_USSD(0x12),
|
||||
SEND_SMS(0x13),
|
||||
SEND_DTMF(0x14),
|
||||
SET_UP_EVENT_LIST(0x05),
|
||||
SET_UP_IDLE_MODE_TEXT(0x28),
|
||||
SET_UP_MENU(0x25),
|
||||
SET_UP_CALL(0x10);
|
||||
|
||||
private int mValue;
|
||||
@@ -72,7 +72,7 @@ public interface AppInterface {
|
||||
|
||||
/**
|
||||
* Create a CommandType object.
|
||||
*
|
||||
*
|
||||
* @param value Integer value to be converted to a CommandType object.
|
||||
* @return CommandType object whose "Type of Command" value is {@code
|
||||
* value}. If no CommandType object has that value, null is
|
||||
|
||||
@@ -36,17 +36,17 @@ class CommandDetails extends ValueObject implements Parcelable {
|
||||
public ComprehensionTlvTag getTag() {
|
||||
return ComprehensionTlvTag.COMMAND_DETAILS;
|
||||
}
|
||||
|
||||
|
||||
CommandDetails() {
|
||||
}
|
||||
|
||||
public boolean compareTo(CommandDetails other) {
|
||||
return (this.compRequired == other.compRequired &&
|
||||
this.commandNumber == other.commandNumber &&
|
||||
this.commandQualifier == other.commandQualifier &&
|
||||
this.commandQualifier == other.commandQualifier &&
|
||||
this.typeOfCommand == other.typeOfCommand);
|
||||
}
|
||||
|
||||
|
||||
public CommandDetails(Parcel in) {
|
||||
compRequired = true;
|
||||
commandNumber = in.readInt();
|
||||
@@ -60,7 +60,7 @@ class CommandDetails extends ValueObject implements Parcelable {
|
||||
dest.writeInt(commandQualifier);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<CommandDetails> CREATOR =
|
||||
public static final Parcelable.Creator<CommandDetails> CREATOR =
|
||||
new Parcelable.Creator<CommandDetails>() {
|
||||
public CommandDetails createFromParcel(Parcel in) {
|
||||
return new CommandDetails(in);
|
||||
@@ -85,7 +85,7 @@ class DeviceIdentities extends ValueObject {
|
||||
}
|
||||
}
|
||||
|
||||
// Container class to hold icon identifier value.
|
||||
// Container class to hold icon identifier value.
|
||||
class IconId extends ValueObject {
|
||||
int recordNumber;
|
||||
boolean selfExplanatory;
|
||||
@@ -95,7 +95,7 @@ class IconId extends ValueObject {
|
||||
}
|
||||
}
|
||||
|
||||
// Container class to hold item icon identifier list value.
|
||||
// Container class to hold item icon identifier list value.
|
||||
class ItemsIconId extends ValueObject {
|
||||
int [] recordNumbers;
|
||||
boolean selfExplanatory;
|
||||
|
||||
@@ -158,7 +158,7 @@ class GetInputParams extends CommandParams {
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
boolean setIcon(Bitmap icon) {
|
||||
boolean setIcon(Bitmap icon) {
|
||||
if (icon != null && input != null) {
|
||||
input.icon = icon;
|
||||
}
|
||||
|
||||
@@ -635,7 +635,7 @@ class CommandParamsFactory extends Handler {
|
||||
|
||||
/**
|
||||
* Processes SET_UP_EVENT_LIST proactive command from the SIM card.
|
||||
*
|
||||
*
|
||||
* @param cmdDet Command Details object retrieved.
|
||||
* @param ctlvs List of ComprehensionTlv objects following Command Details
|
||||
* object and Device Identities object within the proactive command
|
||||
|
||||
@@ -33,7 +33,7 @@ class ComprehensionTlv {
|
||||
private int mLength;
|
||||
private int mValueIndex;
|
||||
private byte[] mRawValue;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. Private on purpose. Use
|
||||
* {@link #decodeMany(byte[], int) decodeMany} or
|
||||
@@ -165,9 +165,9 @@ class ComprehensionTlv {
|
||||
} else {
|
||||
throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD);
|
||||
}
|
||||
|
||||
|
||||
return new ComprehensionTlv(tag, cr, length, data, curIndex);
|
||||
|
||||
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Container class for STK GET INPUT, GET IN KEY commands parameters.
|
||||
* Container class for STK GET INPUT, GET IN KEY commands parameters.
|
||||
*
|
||||
*/
|
||||
public class Input implements Parcelable {
|
||||
public String text;
|
||||
public String defaultText;
|
||||
public Bitmap icon;
|
||||
public Bitmap icon;
|
||||
public int minLen;
|
||||
public int maxLen;
|
||||
public boolean ucs2;
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Container class for STK menu (SET UP MENU, SELECT ITEM) parameters.
|
||||
* Container class for STK menu (SET UP MENU, SELECT ITEM) parameters.
|
||||
*
|
||||
*/
|
||||
public class Menu implements Parcelable {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2007 Google Inc.
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
@@ -56,7 +56,7 @@ class GetInkeyInputResponseData extends ResponseData {
|
||||
private boolean mIsYesNo;
|
||||
private boolean mYesNoResponse;
|
||||
public String mInData;
|
||||
|
||||
|
||||
// GetInKey Yes/No response characters constants.
|
||||
protected static final byte GET_INKEY_YES = 0x01;
|
||||
protected static final byte GET_INKEY_NO = 0x00;
|
||||
|
||||
@@ -20,9 +20,9 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Class used to pass STK messages from telephony to application. Application
|
||||
* Class used to pass STK messages from telephony to application. Application
|
||||
* should call getXXX() to get commands's specific values.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class StkCmdMessage implements Parcelable {
|
||||
// members
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class StkLog {
|
||||
Log.d("STK", className.substring(className.lastIndexOf('.') + 1) + ": "
|
||||
+ msg);
|
||||
}
|
||||
|
||||
|
||||
public static void d(String caller, String msg) {
|
||||
if (!DEBUG) {
|
||||
return;
|
||||
|
||||
@@ -115,7 +115,7 @@ public class StkService extends Handler implements AppInterface {
|
||||
|
||||
// Class members
|
||||
private static SIMRecords mSimRecords;
|
||||
|
||||
|
||||
// Service members.
|
||||
private static StkService sInstance;
|
||||
private CommandsInterface mCmdIf;
|
||||
@@ -556,15 +556,15 @@ public class StkService extends Handler implements AppInterface {
|
||||
}
|
||||
|
||||
private void handleCmdResponse(StkResponseMessage resMsg) {
|
||||
// Make sure the response details match the last valid command. An invalid
|
||||
// Make sure the response details match the last valid command. An invalid
|
||||
// response is a one that doesn't have a corresponding proactive command
|
||||
// and sending it can "confuse" the baseband/ril.
|
||||
// One reason for out of order responses can be UI glitches. For example,
|
||||
// if the application launch an activity, and that activity is stored
|
||||
// and sending it can "confuse" the baseband/ril.
|
||||
// One reason for out of order responses can be UI glitches. For example,
|
||||
// if the application launch an activity, and that activity is stored
|
||||
// by the framework inside the history stack. That activity will be
|
||||
// available for relaunch using the latest application dialog
|
||||
// (long press on the home button). Relaunching that activity can send
|
||||
// the same command's result again to the StkService and can cause it to
|
||||
// available for relaunch using the latest application dialog
|
||||
// (long press on the home button). Relaunching that activity can send
|
||||
// the same command's result again to the StkService and can cause it to
|
||||
// get out of sync with the SIM.
|
||||
if (!validateResponse(resMsg)) {
|
||||
return;
|
||||
@@ -617,7 +617,7 @@ public class StkService extends Handler implements AppInterface {
|
||||
mCmdIf.handleCallSetupRequestFromSim(resMsg.usersConfirm, null);
|
||||
// No need to send terminal response for SET UP CALL. The user's
|
||||
// confirmation result is send back using a dedicated ril message
|
||||
// invoked by the CommandInterface call above.
|
||||
// invoked by the CommandInterface call above.
|
||||
mCurrntCmd = null;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Container class for PlayTone commands parameters.
|
||||
* Container class for PlayTone commands parameters.
|
||||
*
|
||||
*/
|
||||
public class ToneSettings implements Parcelable {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2007 Google Inc.
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
@@ -28,7 +28,7 @@ abstract class ValueParser {
|
||||
|
||||
/**
|
||||
* Search for a Command Details object from a list.
|
||||
*
|
||||
*
|
||||
* @param ctlvs List of ComprehensionTlv objects used for search
|
||||
* @return An CtlvCommandDetails object found from the objects. If no
|
||||
* Command Details object is found, ResultException is thrown.
|
||||
@@ -53,7 +53,7 @@ abstract class ValueParser {
|
||||
|
||||
/**
|
||||
* Search for a Device Identities object from a list.
|
||||
*
|
||||
*
|
||||
* @param ctlvs List of ComprehensionTlv objects used for search
|
||||
* @return An CtlvDeviceIdentities object found from the objects. If no
|
||||
* Command Details object is found, ResultException is thrown.
|
||||
@@ -77,7 +77,7 @@ abstract class ValueParser {
|
||||
/**
|
||||
* Retrieves Duration information from the Duration COMPREHENSION-TLV
|
||||
* object.
|
||||
*
|
||||
*
|
||||
* @param ctlv A Text Attribute COMPREHENSION-TLV object
|
||||
* @return A Duration object
|
||||
* @throws ResultException
|
||||
@@ -100,7 +100,7 @@ abstract class ValueParser {
|
||||
|
||||
/**
|
||||
* Retrieves Item information from the COMPREHENSION-TLV object.
|
||||
*
|
||||
*
|
||||
* @param ctlv A Text Attribute COMPREHENSION-TLV object
|
||||
* @return An Item
|
||||
* @throws ResultException
|
||||
@@ -130,7 +130,7 @@ abstract class ValueParser {
|
||||
|
||||
/**
|
||||
* Retrieves Item id information from the COMPREHENSION-TLV object.
|
||||
*
|
||||
*
|
||||
* @param ctlv A Text Attribute COMPREHENSION-TLV object
|
||||
* @return An Item id
|
||||
* @throws ResultException
|
||||
@@ -152,7 +152,7 @@ abstract class ValueParser {
|
||||
|
||||
/**
|
||||
* Retrieves icon id from an Icon Identifier COMPREHENSION-TLV object
|
||||
*
|
||||
*
|
||||
* @param ctlv An Icon Identifier COMPREHENSION-TLV object
|
||||
* @return IconId instance
|
||||
* @throws ResultException
|
||||
@@ -175,7 +175,7 @@ abstract class ValueParser {
|
||||
/**
|
||||
* Retrieves item icons id from an Icon Identifier List COMPREHENSION-TLV
|
||||
* object
|
||||
*
|
||||
*
|
||||
* @param ctlv An Item Icon List Identifier COMPREHENSION-TLV object
|
||||
* @return ItemsIconId instance
|
||||
* @throws ResultException
|
||||
@@ -206,7 +206,7 @@ abstract class ValueParser {
|
||||
/**
|
||||
* Retrieves text attribute information from the Text Attribute
|
||||
* COMPREHENSION-TLV object.
|
||||
*
|
||||
*
|
||||
* @param ctlv A Text Attribute COMPREHENSION-TLV object
|
||||
* @return A list of TextAttribute objects
|
||||
* @throws ResultException
|
||||
@@ -266,7 +266,7 @@ abstract class ValueParser {
|
||||
/**
|
||||
* Retrieves alpha identifier from an Alpha Identifier COMPREHENSION-TLV
|
||||
* object.
|
||||
*
|
||||
*
|
||||
* @param ctlv An Alpha Identifier COMPREHENSION-TLV object
|
||||
* @return String corresponding to the alpha identifier
|
||||
* @throws ResultException
|
||||
@@ -290,7 +290,7 @@ abstract class ValueParser {
|
||||
/**
|
||||
* Retrieves text from the Text COMPREHENSION-TLV object, and decodes it
|
||||
* into a Java String.
|
||||
*
|
||||
*
|
||||
* @param ctlv A Text COMPREHENSION-TLV object
|
||||
* @return A Java String object decoded from the Text object
|
||||
* @throws ResultException
|
||||
|
||||
@@ -75,7 +75,7 @@ class LineReader
|
||||
* Returns NULL on EOF
|
||||
*/
|
||||
|
||||
String
|
||||
String
|
||||
getNextLine(boolean ctrlZ)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -131,7 +131,7 @@ class InterpreterEx extends Exception
|
||||
String result;
|
||||
}
|
||||
|
||||
public class ModelInterpreter
|
||||
public class ModelInterpreter
|
||||
implements Runnable, SimulatedRadioControl
|
||||
{
|
||||
static final int MAX_CALLS = 6;
|
||||
@@ -153,14 +153,14 @@ public class ModelInterpreter
|
||||
SimulatedGsmCallState simulatedCallState;
|
||||
|
||||
HandlerThread mHandlerThread;
|
||||
|
||||
|
||||
int pausedResponseCount;
|
||||
Object pausedResponseMonitor = new Object();
|
||||
|
||||
//***** Events
|
||||
|
||||
static final int PROGRESS_CALL_STATE = 1;
|
||||
|
||||
|
||||
//***** Constructor
|
||||
|
||||
public
|
||||
@@ -181,7 +181,7 @@ public class ModelInterpreter
|
||||
ss.bind(sa);
|
||||
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
private void
|
||||
init()
|
||||
@@ -190,7 +190,7 @@ public class ModelInterpreter
|
||||
mHandlerThread = new HandlerThread("ModelInterpreter");
|
||||
mHandlerThread.start();
|
||||
Looper looper = mHandlerThread.getLooper();
|
||||
simulatedCallState = new SimulatedGsmCallState(looper);
|
||||
simulatedCallState = new SimulatedGsmCallState(looper);
|
||||
}
|
||||
|
||||
//***** Runnable Implementation
|
||||
@@ -204,7 +204,7 @@ public class ModelInterpreter
|
||||
try {
|
||||
s = ss.accept();
|
||||
} catch (java.io.IOException ex) {
|
||||
Log.w(LOG_TAG,
|
||||
Log.w(LOG_TAG,
|
||||
"IOException on socket.accept(); stopping", ex);
|
||||
return;
|
||||
}
|
||||
@@ -213,15 +213,15 @@ public class ModelInterpreter
|
||||
in = s.getInputStream();
|
||||
out = s.getOutputStream();
|
||||
} catch (java.io.IOException ex) {
|
||||
Log.w(LOG_TAG,
|
||||
Log.w(LOG_TAG,
|
||||
"IOException on accepted socket(); re-listening", ex);
|
||||
continue;
|
||||
}
|
||||
|
||||
Log.i(LOG_TAG, "New connection accepted");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
lineReader = new LineReader (in);
|
||||
|
||||
println ("Welcome");
|
||||
@@ -271,14 +271,14 @@ public class ModelInterpreter
|
||||
|
||||
|
||||
//***** Instance Methods
|
||||
|
||||
|
||||
/** Start the simulated phone ringing */
|
||||
public void
|
||||
triggerRing(String number)
|
||||
{
|
||||
synchronized (this) {
|
||||
boolean success;
|
||||
|
||||
|
||||
success = simulatedCallState.triggerRing(number);
|
||||
|
||||
if (success) {
|
||||
@@ -307,10 +307,10 @@ public class ModelInterpreter
|
||||
*/
|
||||
public void
|
||||
setAutoProgressConnectingCall(boolean b)
|
||||
{
|
||||
{
|
||||
simulatedCallState.setAutoProgressConnectingCall(b);
|
||||
}
|
||||
|
||||
|
||||
public void
|
||||
setNextDialFailImmediately(boolean b)
|
||||
{
|
||||
@@ -321,7 +321,7 @@ public class ModelInterpreter
|
||||
{
|
||||
//FIXME implement
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** hangup ringing, dialing, or actuve calls */
|
||||
public void
|
||||
@@ -373,7 +373,7 @@ public class ModelInterpreter
|
||||
|
||||
public void triggerSsn(int a, int b) {}
|
||||
public void triggerIncomingUssd(String statusCode, String message) {}
|
||||
|
||||
|
||||
public void
|
||||
triggerIncomingSMS(String message)
|
||||
{
|
||||
@@ -386,7 +386,7 @@ public class ModelInterpreter
|
||||
|
||||
// source address: +18005551212
|
||||
pdu.append("918100551521F0");
|
||||
|
||||
|
||||
// protocol ID and data coding scheme
|
||||
pdu.append("0000");
|
||||
|
||||
@@ -421,7 +421,7 @@ public class ModelInterpreter
|
||||
pausedResponseMonitor.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//***** Private Instance Methods
|
||||
|
||||
@@ -429,11 +429,11 @@ public class ModelInterpreter
|
||||
onAnswer() throws InterpreterEx
|
||||
{
|
||||
boolean success;
|
||||
|
||||
|
||||
success = simulatedCallState.onAnswer();
|
||||
|
||||
if (!success) {
|
||||
throw new InterpreterEx("ERROR");
|
||||
throw new InterpreterEx("ERROR");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ public class ModelInterpreter
|
||||
success = simulatedCallState.onAnswer();
|
||||
|
||||
if (!success) {
|
||||
throw new InterpreterEx("ERROR");
|
||||
throw new InterpreterEx("ERROR");
|
||||
}
|
||||
|
||||
finalResponse = "NO CARRIER";
|
||||
@@ -471,12 +471,12 @@ public class ModelInterpreter
|
||||
throw new InterpreterEx("ERROR");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void
|
||||
releaseHeldOrUDUB() throws InterpreterEx
|
||||
{
|
||||
boolean success;
|
||||
|
||||
|
||||
success = simulatedCallState.releaseHeldOrUDUB();
|
||||
|
||||
if (!success) {
|
||||
@@ -488,19 +488,19 @@ public class ModelInterpreter
|
||||
releaseActiveAcceptHeldOrWaiting() throws InterpreterEx
|
||||
{
|
||||
boolean success;
|
||||
|
||||
|
||||
success = simulatedCallState.releaseActiveAcceptHeldOrWaiting();
|
||||
|
||||
if (!success) {
|
||||
throw new InterpreterEx("ERROR");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void
|
||||
switchActiveAndHeldOrWaiting() throws InterpreterEx
|
||||
{
|
||||
boolean success;
|
||||
|
||||
|
||||
success = simulatedCallState.switchActiveAndHeldOrWaiting();
|
||||
|
||||
if (!success) {
|
||||
@@ -512,7 +512,7 @@ public class ModelInterpreter
|
||||
separateCall(int index) throws InterpreterEx
|
||||
{
|
||||
boolean success;
|
||||
|
||||
|
||||
success = simulatedCallState.separateCall(index);
|
||||
|
||||
if (!success) {
|
||||
@@ -524,7 +524,7 @@ public class ModelInterpreter
|
||||
conference() throws InterpreterEx
|
||||
{
|
||||
boolean success;
|
||||
|
||||
|
||||
success = simulatedCallState.conference();
|
||||
|
||||
if (!success) {
|
||||
@@ -536,7 +536,7 @@ public class ModelInterpreter
|
||||
onDial(String command) throws InterpreterEx
|
||||
{
|
||||
boolean success;
|
||||
|
||||
|
||||
success = simulatedCallState.onDial(command.substring(1));
|
||||
|
||||
if (!success) {
|
||||
@@ -566,7 +566,7 @@ public class ModelInterpreter
|
||||
|
||||
println("+CMGS: 1");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
processLine (String line) throws InterpreterEx
|
||||
{
|
||||
@@ -645,8 +645,8 @@ public class ModelInterpreter
|
||||
}
|
||||
***/
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
void
|
||||
println (String s)
|
||||
{
|
||||
synchronized(this) {
|
||||
@@ -663,7 +663,7 @@ public class ModelInterpreter
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
print (String s)
|
||||
{
|
||||
synchronized(this) {
|
||||
@@ -714,8 +714,8 @@ public class ModelInterpreter
|
||||
{"+CIMI", "320720000000000\r"},
|
||||
{"+CSCS=?", "+CSCS: (\"HEX\",\"UCS2\")\r"},
|
||||
{"+CFUN?", "+CFUN: 1\r"},
|
||||
{"+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS?",
|
||||
"+COPS: 0,0,\"Android\"\r"
|
||||
{"+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS?",
|
||||
"+COPS: 0,0,\"Android\"\r"
|
||||
+ "+COPS: 0,1,\"Android\"\r"
|
||||
+ "+COPS: 0,2,\"310995\"\r"},
|
||||
{"+CREG?", "+CREG: 2,5, \"0113\", \"6614\"\r"},
|
||||
|
||||
@@ -37,7 +37,7 @@ class CallInfo {
|
||||
WAITING(5); // MT call only
|
||||
|
||||
State (int value) {this.value = value;}
|
||||
|
||||
|
||||
private final int value;
|
||||
public int value() {return value;};
|
||||
};
|
||||
@@ -73,7 +73,7 @@ class CallInfo {
|
||||
|
||||
String
|
||||
toCLCCLine(int index) {
|
||||
return
|
||||
return
|
||||
"+CLCC: "
|
||||
+ index + "," + (isMT ? "1" : "0") +","
|
||||
+ state.value() + ",0," + (isMpty ? "1" : "0")
|
||||
@@ -82,7 +82,7 @@ class CallInfo {
|
||||
|
||||
DriverCall
|
||||
toDriverCall(int index) {
|
||||
DriverCall ret;
|
||||
DriverCall ret;
|
||||
|
||||
ret = new DriverCall();
|
||||
|
||||
@@ -136,7 +136,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
|
||||
private boolean autoProgressConnecting = true;
|
||||
private boolean nextDialFailImmediately;
|
||||
|
||||
|
||||
|
||||
//***** Event Constants
|
||||
|
||||
@@ -169,8 +169,8 @@ class SimulatedGsmCallState extends Handler {
|
||||
|
||||
//***** Public Methods
|
||||
|
||||
/**
|
||||
* Start the simulated phone ringing
|
||||
/**
|
||||
* Start the simulated phone ringing
|
||||
* true if succeeded, false if failed
|
||||
*/
|
||||
public boolean
|
||||
@@ -185,7 +185,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
|
||||
if (call == null && empty < 0) {
|
||||
empty = i;
|
||||
} else if (call != null
|
||||
} else if (call != null
|
||||
&& (call.state == CallInfo.State.INCOMING
|
||||
|| call.state == CallInfo.State.WAITING)
|
||||
) {
|
||||
@@ -208,7 +208,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
if (isCallWaiting) {
|
||||
calls[empty].state = CallInfo.State.WAITING;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -225,11 +225,11 @@ class SimulatedGsmCallState extends Handler {
|
||||
|
||||
if (autoProgressConnecting) {
|
||||
sendMessageDelayed(
|
||||
obtainMessage(EVENT_PROGRESS_CALL_STATE, call),
|
||||
obtainMessage(EVENT_PROGRESS_CALL_STATE, call),
|
||||
CONNECTING_PAUSE_MSEC);
|
||||
}
|
||||
break;
|
||||
} else if (call != null
|
||||
} else if (call != null
|
||||
&& call.state == CallInfo.State.ALERTING
|
||||
) {
|
||||
call.state = CallInfo.State.ACTIVE;
|
||||
@@ -246,7 +246,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
for (int i = 0 ; i < calls.length ; i++) {
|
||||
CallInfo call = calls[i];
|
||||
|
||||
if (call != null && (call.state == CallInfo.State.DIALING
|
||||
if (call != null && (call.state == CallInfo.State.DIALING
|
||||
|| call.state == CallInfo.State.ALERTING)
|
||||
) {
|
||||
call.state = CallInfo.State.ACTIVE;
|
||||
@@ -263,13 +263,13 @@ class SimulatedGsmCallState extends Handler {
|
||||
setAutoProgressConnectingCall(boolean b) {
|
||||
autoProgressConnecting = b;
|
||||
}
|
||||
|
||||
|
||||
public void
|
||||
setNextDialFailImmediately(boolean b) {
|
||||
nextDialFailImmediately = b;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* hangup ringing, dialing, or active calls
|
||||
* returns true if call was hung up, false if not
|
||||
*/
|
||||
@@ -283,7 +283,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
for (int i = 0 ; i < calls.length ; i++) {
|
||||
CallInfo call = calls[i];
|
||||
|
||||
if (call != null
|
||||
if (call != null
|
||||
&& (call.state == CallInfo.State.INCOMING
|
||||
|| call.state == CallInfo.State.WAITING)
|
||||
) {
|
||||
@@ -295,7 +295,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
for (int i = 0 ; i < calls.length ; i++) {
|
||||
CallInfo call = calls[i];
|
||||
|
||||
if (call != null
|
||||
if (call != null
|
||||
&& (call.state == CallInfo.State.DIALING
|
||||
|| call.state == CallInfo.State.ACTIVE
|
||||
|| call.state == CallInfo.State.ALERTING)
|
||||
@@ -308,7 +308,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* hangup holding calls
|
||||
* returns true if call was hung up, false if not
|
||||
*/
|
||||
@@ -330,7 +330,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* hangup all
|
||||
* returns true if call was hung up, false if not
|
||||
*/
|
||||
@@ -359,7 +359,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
for (int i = 0 ; i < calls.length ; i++) {
|
||||
CallInfo call = calls[i];
|
||||
|
||||
if (call != null
|
||||
if (call != null
|
||||
&& (call.state == CallInfo.State.INCOMING
|
||||
|| call.state == CallInfo.State.WAITING)
|
||||
) {
|
||||
@@ -399,7 +399,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (c0) {
|
||||
case '0':
|
||||
ret = releaseHeldOrUDUB();
|
||||
@@ -442,7 +442,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public boolean
|
||||
releaseHeldOrUDUB() {
|
||||
boolean found = false;
|
||||
@@ -493,8 +493,8 @@ class SimulatedGsmCallState extends Handler {
|
||||
for (int i = 0 ; i < calls.length ; i++) {
|
||||
CallInfo c = calls[i];
|
||||
|
||||
if (c != null
|
||||
&& (c.state == CallInfo.State.DIALING
|
||||
if (c != null
|
||||
&& (c.state == CallInfo.State.DIALING
|
||||
|| c.state == CallInfo.State.ALERTING)
|
||||
) {
|
||||
calls[i] = null;
|
||||
@@ -531,7 +531,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
public boolean
|
||||
switchActiveAndHeldOrWaiting() {
|
||||
boolean hasHeld = false;
|
||||
|
||||
|
||||
// first, are there held calls?
|
||||
for (int i = 0 ; i < calls.length ; i++) {
|
||||
CallInfo c = calls[i];
|
||||
@@ -595,7 +595,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (InvalidStateEx ex) {
|
||||
} catch (InvalidStateEx ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -612,7 +612,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
|
||||
if (c != null) {
|
||||
countCalls++;
|
||||
|
||||
|
||||
if (c.isConnecting()) {
|
||||
return false;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
if (c != null) {
|
||||
c.state = CallInfo.State.ACTIVE;
|
||||
if (countCalls > 0) {
|
||||
c.isMpty = true;
|
||||
c.isMpty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -659,12 +659,12 @@ class SimulatedGsmCallState extends Handler {
|
||||
int freeSlot = -1;
|
||||
|
||||
Log.d("GSM", "SC> dial '" + address + "'");
|
||||
|
||||
|
||||
if (nextDialFailImmediately) {
|
||||
nextDialFailImmediately = false;
|
||||
|
||||
Log.d("GSM", "SC< dial fail (per request)");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
String phNum = PhoneNumberUtils.extractNetworkPortion(address);
|
||||
@@ -696,15 +696,15 @@ class SimulatedGsmCallState extends Handler {
|
||||
if (freeSlot < 0 && calls[i] == null) {
|
||||
freeSlot = i;
|
||||
}
|
||||
|
||||
|
||||
if (calls[i] != null && !calls[i].isActiveOrHeld()) {
|
||||
// Can't make outgoing calls when there is a ringing or
|
||||
// Can't make outgoing calls when there is a ringing or
|
||||
// connecting outgoing call
|
||||
Log.d("GSM", "SC< dial fail (invalid call state)");
|
||||
return false;
|
||||
} else if (calls[i] != null && calls[i].state == CallInfo.State.ACTIVE) {
|
||||
// All active calls behome held
|
||||
calls[i].state = CallInfo.State.HOLDING;
|
||||
calls[i].state = CallInfo.State.HOLDING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,7 +717,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
|
||||
if (autoProgressConnecting) {
|
||||
sendMessageDelayed(
|
||||
obtainMessage(EVENT_PROGRESS_CALL_STATE, calls[freeSlot]),
|
||||
obtainMessage(EVENT_PROGRESS_CALL_STATE, calls[freeSlot]),
|
||||
CONNECTING_PAUSE_MSEC);
|
||||
}
|
||||
|
||||
@@ -776,7 +776,7 @@ class SimulatedGsmCallState extends Handler {
|
||||
if (call != null) {
|
||||
if (!hasMpty && call.isMpty) {
|
||||
mptyIsHeld = call.state == CallInfo.State.HOLDING;
|
||||
} else if (call.isMpty && mptyIsHeld
|
||||
} else if (call.isMpty && mptyIsHeld
|
||||
&& call.state == CallInfo.State.ACTIVE
|
||||
) {
|
||||
Log.e("ModelInterpreter", "Invalid state");
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface SimulatedRadioControl
|
||||
|
||||
/** see pauseResponses */
|
||||
public void resumeResponses();
|
||||
|
||||
|
||||
public void triggerSsn(int type, int code);
|
||||
|
||||
/** Generates an incoming USSD message. */
|
||||
|
||||
Reference in New Issue
Block a user