diff options
Diffstat (limited to 'telephony/java')
14 files changed, 399 insertions, 5 deletions
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java index 1c75658..8681344 100644 --- a/telephony/java/android/telephony/DisconnectCause.java +++ b/telephony/java/android/telephony/DisconnectCause.java @@ -17,10 +17,7 @@ package android.telephony; /** - * Contains disconnect call causes generated by the - * framework and the RIL. - * - * @hide + * Contains disconnect call causes generated by the framework and the RIL. */ public class DisconnectCause { diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index c79e9bf..9da032a 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1492,6 +1492,10 @@ public class PhoneNumberUtils * @return the normalized number. */ public static String normalizeNumber(String phoneNumber) { + if (TextUtils.isEmpty(phoneNumber)) { + return ""; + } + StringBuilder sb = new StringBuilder(); int len = phoneNumber.length(); for (int i = 0; i < len; i++) { diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index df972d5..7002744 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -19,6 +19,7 @@ package android.telephony; import android.annotation.PrivateApi; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.content.ComponentName; import android.content.Context; import android.os.Bundle; import android.os.Handler; @@ -67,6 +68,20 @@ public class TelephonyManager { private static ITelephonyRegistry sRegistry; + /** + * The allowed states of Wi-Fi calling. + * + * @hide + */ + public interface WifiCallingChoices { + /** Always use Wi-Fi calling */ + static final int ALWAYS_USE = 0; + /** Ask the user whether to use Wi-Fi on every call */ + static final int ASK_EVERY_TIME = 1; + /** Never use Wi-Fi calling */ + static final int NEVER_USE = 2; + } + private final HashMap<CallStateListener,Listener> mListeners = new HashMap<CallStateListener,Listener>(); private final Context mContext; diff --git a/telephony/java/com/android/internal/telephony/CallInfo.aidl b/telephony/java/com/android/internal/telephony/CallInfo.aidl new file mode 100644 index 0000000..9140388 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CallInfo.aidl @@ -0,0 +1,19 @@ +/* +** Copyright 2013, 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 +** +** 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 +** limitations under the License. +*/ + +package com.android.internal.telephony; + +parcelable CallInfo; diff --git a/telephony/java/com/android/internal/telephony/CallInfo.java b/telephony/java/com/android/internal/telephony/CallInfo.java new file mode 100644 index 0000000..6bfc9d7 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CallInfo.java @@ -0,0 +1,77 @@ +/* +** Copyright 2013, 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 +** +** 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 +** limitations under the License. +*/ + +package com.android.internal.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * A parcelable holder class of Call information data. + */ +public class CallInfo implements Parcelable { + + /** + * Endpoint to which the call is connected. + * This could be the dialed value for outgoing calls or the caller id of incoming calls. + */ + private String handle; + + public CallInfo(String handle) { + this.handle = handle; + } + + public String getHandle() { + return handle; + } + + // + // Parcelling related code below here. + // + + /** + * Responsible for creating CallInfo objects for deserialized Parcels. + */ + public static final Parcelable.Creator<CallInfo> CREATOR + = new Parcelable.Creator<CallInfo> () { + + @Override + public CallInfo createFromParcel(Parcel source) { + return new CallInfo(source.readString()); + } + + @Override + public CallInfo[] newArray(int size) { + return new CallInfo[size]; + } + }; + + /** + * {@inheritDoc} + */ + @Override + public int describeContents() { + return 0; + } + + /** + * Writes CallInfo object into a serializeable Parcel. + */ + @Override + public void writeToParcel(Parcel destination, int flags) { + destination.writeString(handle); + } +} diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl new file mode 100644 index 0000000..cb9b2e8 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallService.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 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 + * + * 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 + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.ICallServiceAdapter; + +/** + * Service interface for services which would like to provide calls to be + * managed by the system in-call UI. + * + * This interface provides methods that the android framework can use to deliver commands + * for calls provided by this call service including making new calls and disconnecting + * existing ones. A binding to ICallService implementations exists for two conditions: + * 1) There exists one or more live calls for that call service, + * 2) Prior to an outbound call to test if this call service is compatible with the outgoing call. + */ +oneway interface ICallService { + + /** + * Determines if the CallService can make calls to the handle. + * TODO(santoscordon): Move this method into its own service interface long term. + * TODO(santoscordon): Add response callback parameter. + */ + void isCompatibleWith(String handle); + + /** + * Attempts to call the relevant party using the specified handle, be it a phone number, + * SIP address, or some other kind of user ID. Note that the set of handle types is + * dynamically extensible since call providers should be able to implement arbitrary + * handle-calling systems. See {@link #isCompatibleWith}. + * TODO(santoscordon): Should this have a response attached to it to ensure that the call + * service actually plans to make the call? + */ + void call(String handle); + + /** + * Disconnects the call identified by callId. + */ + void disconnect(String callId); + + /** + * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls + * and communicate state changes of existing calls. This is the first method that is called + * after a the framework binds to the call service. + */ + void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); +} diff --git a/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl new file mode 100644 index 0000000..bc900f0 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 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 + * + * 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 + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.CallInfo; + +/** + * Provides methods for ICallService implementations to interact with the system phone app. + */ +oneway interface ICallServiceAdapter { + + /** + * Retrieves a new unique call id for use with newOutgoingCall and newIncomingCall. + */ + void getNextCallId(/* TODO(santoscordon): Needs response object */); + + /** + * Tells CallsManager of a new incoming call. + */ + void newIncomingCall(String callId, in CallInfo info); + + /** + * Tells CallsManager of a new outgoing call. + */ + void newOutgoingCall(String callId, in CallInfo info); + + /** + * Sets a call's state to active (e.g., an ongoing call where two parties can actively + * communicate). + */ + void setActive(String callId); + + /** + * Sets a call's state to ringing (e.g., an inbound ringing call). + */ + void setRinging(String callId); + + /** + * Sets a call's state to dialing (e.g., dialing an outbound call). + */ + void setDialing(String callId); + + /** + * Sets a call's state to disconnected. + */ + void setDisconnected(String callId); +} diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index fa74494..72398ad 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -16,6 +16,7 @@ package com.android.internal.telephony; +import android.content.ComponentName; import android.os.Bundle; import android.telephony.CellInfo; import android.telephony.NeighboringCellInfo; @@ -24,6 +25,8 @@ import com.android.internal.telephony.ITelephonyListener; import java.util.List; +import java.util.List; + /** * Interface used to interact with the phone. Mostly this is used by the * TelephonyManager class. A few places are still using this directly. @@ -407,7 +410,7 @@ interface ITelephony { */ boolean nvResetConfig(int resetType); - /** + /* * Get the preferred network type. * Used for device configuration by some CDMA operators. * diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl new file mode 100644 index 0000000..bcf2d81 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2013 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 + * + * 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 + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.IThirdPartyCallProvider; + +/** + * Interface provided to ThirdPartyCallService. The service can use this to notify the listener of + * changes to the call state. + */ +oneway interface IThirdPartyCallListener { + /** + * Called by the service when a call provider is available to perform the outgoing or incoming + * call. + */ + void onCallProviderAttached(IThirdPartyCallProvider callProvider); + + /** + * Notifies the listener that ringing has started for this call. + */ + void onRingingStarted(); + + /** + * Notifies the listener that the call has been successfully established. + */ + void onCallEstablished(); + + /** + * Notifies the listener that the call has ended. + */ + void onCallEnded(int reason); +} diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl new file mode 100644 index 0000000..9d595b0 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2013 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 + * + * 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 + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.IThirdPartyCallListener; +import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback; + +/** + * Interface sent to ThirdPartyCallListener.onCallProviderAttached. This is used to control an + * outgoing or incoming call. + */ +oneway interface IThirdPartyCallProvider { + /** + * Mutes or unmutes the call. + */ + void mute(boolean shouldMute); + + /** + * Ends the current call. If this is an unanswered incoming call then the call is rejected (for + * example, a notification is sent to a server that the user declined the call). + */ + void hangup(); + + /** + * Accepts the incoming call. + */ + void incomingCallAccept(); + + /** + * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'. + */ + void sendDtmf(char c, IThirdPartyCallSendDtmfCallback callback); +} diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl new file mode 100644 index 0000000..3a02b06 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2013 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 + * + * 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 + * limitations under the License. + */ + +package com.android.internal.telephony; + +/** + * Callback interface for when DTMF has been sent. + */ +oneway interface IThirdPartyCallSendDtmfCallback { + /** + * Called when the DTMF code has been sent. + */ + void onSendDtmfCompleted(); +} diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl new file mode 100644 index 0000000..597567a --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2013 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 + * + * 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 + * limitations under the License. + */ + +package com.android.internal.telephony; + +import com.android.internal.telephony.IThirdPartyCallListener; + +/** + * Interface provided by a service to start outgoing calls and attach to incoming calls. + */ +oneway interface IThirdPartyCallService { + /** + * Call to start a new outgoing call. + */ + void outgoingCallInitiate(IThirdPartyCallListener listener, String number); + + /** + * Call to attach to an incoming call. This is in response to a call to + * TelephonyManager.newIncomingThirdPartyCall. + */ + void incomingCallAttach(IThirdPartyCallListener listener, String callId); +} diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index 6ad57cf..08f4379 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -57,6 +57,7 @@ public class PhoneConstants { public static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE; public static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE; public static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE; + public static final int PHONE_TYPE_THIRD_PARTY = RILConstants.THIRD_PARTY_PHONE; // Modes for LTE_ON_CDMA public static final int LTE_ON_CDMA_UNKNOWN = RILConstants.LTE_ON_CDMA_UNKNOWN; diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index d338857..815211c 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -84,6 +84,7 @@ public interface RILConstants { int GSM_PHONE = 1; int CDMA_PHONE = 2; int SIP_PHONE = 3; + int THIRD_PARTY_PHONE = 4; int LTE_ON_CDMA_UNKNOWN = -1; int LTE_ON_CDMA_FALSE = 0; |
