merge from open-source master

Change-Id: Ib092e6ae5151bbcdf56b9b3a7adbaee7bb5df8b5
This commit is contained in:
The Android Open Source Project
2010-05-12 14:39:38 -07:00
13 changed files with 238 additions and 12 deletions

View File

@@ -659,6 +659,19 @@ public interface CommandsInterface {
*/
void dial (String address, int clirMode, Message result);
/**
* returned message
* retMsg.obj = AsyncResult ar
* ar.exception carries exception on failure
* ar.userObject contains the orignal value of result.obj
* ar.result is null on success and failure
*
* CLIR_DEFAULT == on "use subscription default value"
* CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
* CLIR_INVOCATION == on "CLIR invocation" (restrict CLI presentation)
*/
void dial(String address, int clirMode, UUSInfo uusInfo, Message result);
/**
* returned message
* retMsg.obj = AsyncResult ar

View File

@@ -273,6 +273,13 @@ public abstract class Connection {
*/
public abstract int getNumberPresentation();
/**
* Returns the User to User Signaling (UUS) information associated with
* incoming and waiting calls
* @return UUSInfo containing the UUS userdata.
*/
public abstract UUSInfo getUUSInfo();
/**
* Build a human representation of a connection instance, suitable for debugging.
* Don't log personal stuff unless in debug mode.

View File

@@ -49,6 +49,7 @@ public class DriverCall implements Comparable {
public int numberPresentation;
public String name;
public int namePresentation;
public UUSInfo uusInfo;
/** returns null on error */
static DriverCall

View File

@@ -788,6 +788,19 @@ public interface Phone {
*/
Connection dial(String dialString) throws CallStateException;
/**
* Initiate a new voice connection with supplementary User to User
* Information. This happens asynchronously, so you cannot assume the audio
* path is connected (or a call index has been assigned) until
* PhoneStateChanged notification has occurred.
*
* @exception CallStateException if a new outgoing call is not currently
* possible because no more call slots exist or a call exists
* that is dialing, alerting, ringing, or waiting. Other
* errors are handled asynchronously.
*/
Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException;
/**
* Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
* without SEND (so <code>dial</code> is not appropriate).

View File

@@ -423,6 +423,10 @@ public class PhoneProxy extends Handler implements Phone {
return mActivePhone.dial(dialString);
}
public Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException {
return mActivePhone.dial(dialString, uusInfo);
}
public boolean handlePinMmi(String dialString) {
return mActivePhone.handlePinMmi(dialString);
}

View File

@@ -796,12 +796,26 @@ public final class RIL extends BaseCommands implements CommandsInterface {
public void
dial (String address, int clirMode, Message result) {
dial(address, clirMode, null, result);
}
public void
dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
rr.mp.writeString(address);
rr.mp.writeInt(clirMode);
rr.mp.writeInt(0); // UUS information is absent
if (uusInfo == null) {
rr.mp.writeInt(0); // UUS information is absent
} else {
rr.mp.writeInt(1); // UUS information is present
rr.mp.writeInt(uusInfo.getType());
rr.mp.writeInt(uusInfo.getDcs());
rr.mp.writeByteArray(uusInfo.getUserData());
}
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
@@ -2837,10 +2851,21 @@ public final class RIL extends BaseCommands implements CommandsInterface {
dc.namePresentation = p.readInt();
int uusInfoPresent = p.readInt();
if (uusInfoPresent == 1) {
// TODO: Copy the data to dc to forward to the apps.
p.readInt();
p.readInt();
p.createByteArray();
dc.uusInfo = new UUSInfo();
dc.uusInfo.setType(p.readInt());
dc.uusInfo.setDcs(p.readInt());
byte[] userData = p.createByteArray();
dc.uusInfo.setUserData(userData);
Log
.v(LOG_TAG, String.format("Incoming UUS : type=%d, dcs=%d, length=%d",
dc.uusInfo.getType(), dc.uusInfo.getDcs(),
dc.uusInfo.getUserData().length));
Log.v(LOG_TAG, "Incoming UUS : data (string)="
+ new String(dc.uusInfo.getUserData()));
Log.v(LOG_TAG, "Incoming UUS : data (hex): "
+ IccUtils.bytesToHexString(dc.uusInfo.getUserData()));
} else {
Log.v(LOG_TAG, "Incoming UUS : NOT present!");
}
// Make sure there's a leading + on addresses with a TOA of 145

View File

@@ -0,0 +1,112 @@
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Code Aurora nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package com.android.internal.telephony;
public class UUSInfo {
/*
* User-to-User signaling Info activation types derived from 3GPP 23.087
* v8.0
*/
public static final int UUS_TYPE1_IMPLICIT = 0;
public static final int UUS_TYPE1_REQUIRED = 1;
public static final int UUS_TYPE1_NOT_REQUIRED = 2;
public static final int UUS_TYPE2_REQUIRED = 3;
public static final int UUS_TYPE2_NOT_REQUIRED = 4;
public static final int UUS_TYPE3_REQUIRED = 5;
public static final int UUS_TYPE3_NOT_REQUIRED = 6;
/*
* User-to-User Signaling Information data coding schemes. Possible values
* for Octet 3 (Protocol Discriminator field) in the UUIE. The values have
* been specified in section 10.5.4.25 of 3GPP TS 24.008
*/
public static final int UUS_DCS_USP = 0; /* User specified protocol */
public static final int UUS_DCS_OSIHLP = 1; /* OSI higher layer protocol */
public static final int UUS_DCS_X244 = 2; /* X.244 */
public static final int UUS_DCS_RMCF = 3; /*
* Reserved for system management
* convergence function
*/
public static final int UUS_DCS_IA5c = 4; /* IA5 characters */
private int uusType;
private int uusDcs;
private byte[] uusData;
public UUSInfo() {
this.uusType = UUS_TYPE1_IMPLICIT;
this.uusDcs = UUS_DCS_IA5c;
this.uusData = null;
}
public UUSInfo(int uusType, int uusDcs, byte[] uusData) {
this.uusType = uusType;
this.uusDcs = uusDcs;
this.uusData = uusData;
}
public int getDcs() {
return uusDcs;
}
public void setDcs(int uusDcs) {
this.uusDcs = uusDcs;
}
public int getType() {
return uusType;
}
public void setType(int uusType) {
this.uusType = uusType;
}
public byte[] getUserData() {
return uusData;
}
public void setUserData(byte[] uusData) {
this.uusData = uusData;
}
}

View File

@@ -62,6 +62,7 @@ import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.PhoneSubInfo;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.UUSInfo;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
@@ -348,6 +349,10 @@ public class CDMAPhone extends PhoneBase {
return mCT.dial(newDialString);
}
public Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException {
throw new CallStateException("Sending UUS information NOT supported in CDMA!");
}
public SignalStrength getSignalStrength() {
return mSST.mSignalStrength;
}
@@ -1444,5 +1449,4 @@ public class CDMAPhone extends PhoneBase {
}
return false;
}
}

View File

@@ -945,4 +945,10 @@ public class CdmaConnection extends Connection {
public int getNumberPresentation() {
return numberPresentation;
}
@Override
public UUSInfo getUUSInfo() {
// UUS information not supported in CDMA
return null;
}
}

View File

@@ -67,6 +67,7 @@ import com.android.internal.telephony.PhoneNotifier;
import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.PhoneSubInfo;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.UUSInfo;
import com.android.internal.telephony.gsm.stk.StkService;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.IccVmNotSupportedException;
@@ -711,7 +712,12 @@ public class GSMPhone extends PhoneBase {
}
public Connection
dial (String dialString) throws CallStateException {
dial(String dialString) throws CallStateException {
return dial(dialString, null);
}
public Connection
dial (String dialString, UUSInfo uusInfo) throws CallStateException {
// Need to make sure dialString gets parsed properly
String newDialString = PhoneNumberUtils.stripSeparators(dialString);
@@ -727,9 +733,9 @@ public class GSMPhone extends PhoneBase {
"dialing w/ mmi '" + mmi + "'...");
if (mmi == null) {
return mCT.dial(newDialString);
return mCT.dial(newDialString, uusInfo);
} else if (mmi.isTemporaryModeCLIR()) {
return mCT.dial(mmi.dialingNumber, mmi.getCLIRMode());
return mCT.dial(mmi.dialingNumber, mmi.getCLIRMode(), uusInfo);
} else {
mPendingMMIs.add(mmi);
mMmiRegistrants.notifyRegistrants(new AsyncResult(null, mmi, null));

View File

@@ -37,6 +37,7 @@ import com.android.internal.telephony.DriverCall;
import com.android.internal.telephony.EventLogTags;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.UUSInfo;
import com.android.internal.telephony.gsm.CallFailCause;
import com.android.internal.telephony.gsm.GSMPhone;
import com.android.internal.telephony.gsm.GsmCall;
@@ -167,7 +168,7 @@ public final class GsmCallTracker extends CallTracker {
* clirMode is one of the CLIR_ constants
*/
Connection
dial (String dialString, int clirMode) throws CallStateException {
dial (String dialString, int clirMode, UUSInfo uusInfo) throws CallStateException {
// note that this triggers call state changed notif
clearDisconnected();
@@ -213,7 +214,7 @@ public final class GsmCallTracker extends CallTracker {
// Always unmute when initiating a new call
setMute(false);
cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
cm.dial(pendingMO.address, clirMode, uusInfo, obtainCompleteMessage());
}
updatePhoneState();
@@ -222,10 +223,19 @@ public final class GsmCallTracker extends CallTracker {
return pendingMO;
}
Connection
dial(String dialString) throws CallStateException {
return dial(dialString, CommandsInterface.CLIR_DEFAULT, null);
}
Connection
dial (String dialString) throws CallStateException {
return dial(dialString, CommandsInterface.CLIR_DEFAULT);
dial(String dialString, UUSInfo uusInfo) throws CallStateException {
return dial(dialString, CommandsInterface.CLIR_DEFAULT, uusInfo);
}
Connection
dial(String dialString, int clirMode) throws CallStateException {
return dial(dialString, clirMode, null);
}
void

View File

@@ -73,6 +73,7 @@ public class GsmConnection extends Connection {
DisconnectCause cause = DisconnectCause.NOT_DISCONNECTED;
PostDialState postDialState = PostDialState.NOT_STARTED;
int numberPresentation = Connection.PRESENTATION_ALLOWED;
UUSInfo uusInfo;
Handler h;
@@ -126,6 +127,7 @@ public class GsmConnection extends Connection {
isIncoming = dc.isMT;
createTime = System.currentTimeMillis();
numberPresentation = dc.numberPresentation;
uusInfo = dc.uusInfo;
this.index = index;
@@ -731,4 +733,9 @@ public class GsmConnection extends Connection {
public int getNumberPresentation() {
return numberPresentation;
}
@Override
public UUSInfo getUUSInfo() {
return uusInfo;
}
}

View File

@@ -29,6 +29,7 @@ import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.DataCallState;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.UUSInfo;
import com.android.internal.telephony.gsm.CallFailCause;
import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
import com.android.internal.telephony.gsm.SuppServiceNotification;
@@ -491,6 +492,23 @@ public final class SimulatedCommands extends BaseCommands
resultSuccess(result, null);
}
/**
* returned message
* retMsg.obj = AsyncResult ar
* ar.exception carries exception on failure
* ar.userObject contains the orignal value of result.obj
* ar.result is null on success and failure
*
* CLIR_DEFAULT == on "use subscription default value"
* CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
* CLIR_INVOCATION == on "CLIR invocation" (restrict CLI presentation)
*/
public void dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
simulatedCallState.onDial(address);
resultSuccess(result, null);
}
/**
* returned message
* retMsg.obj = AsyncResult ar