diff options
Diffstat (limited to 'telecomm')
9 files changed, 139 insertions, 12 deletions
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index cd10050..3060f40 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -339,6 +339,7 @@ public abstract class Connection implements Conferenceable { public void onConferenceParticipantsChanged(Connection c, List<ConferenceParticipant> participants) {} public void onConferenceStarted() {} + public void onConferenceMergeFailed(Connection c) {} } public static abstract class VideoProvider { @@ -1544,6 +1545,17 @@ public abstract class Connection implements Conferenceable { } /** + * Notifies listeners that the merge request failed. + * + * @hide + */ + protected final void notifyConferenceMergeFailed() { + for (Listener l : mListeners) { + l.onConferenceMergeFailed(this); + } + } + + /** * Notifies listeners of a change to conference participant(s). * * @param conferenceParticipants The participants. diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index c039acf..4185651 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -562,6 +562,14 @@ public abstract class ConnectionService extends Service { mAdapter.setIsConferenced(id, conferenceId); } } + + @Override + public void onConferenceMergeFailed(Connection connection) { + String id = mIdByConnection.get(connection); + if (id != null) { + mAdapter.onConferenceMergeFailed(id); + } + } }; /** {@inheritDoc} */ diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index d026a28..a87dbe7 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -203,6 +203,21 @@ final class ConnectionServiceAdapter implements DeathRecipient { } /** + * Indicates that the merge request on this call has failed. + * + * @param callId The unique ID of the call being conferenced. + */ + void onConferenceMergeFailed(String callId) { + for (IConnectionServiceAdapter adapter : mAdapters) { + try { + Log.d(this, "merge failed for call %s", callId); + adapter.setConferenceMergeFailed(callId); + } catch (RemoteException ignored) { + } + } + } + + /** * Indicates that the call no longer exists. Can be used with either a call or a conference * call. * diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java index 429f296..db815ba 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java @@ -59,6 +59,7 @@ final class ConnectionServiceAdapterServant { private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20; private static final int MSG_ADD_EXISTING_CONNECTION = 21; private static final int MSG_ON_POST_DIAL_CHAR = 22; + private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23; private final IConnectionServiceAdapter mDelegate; @@ -220,6 +221,15 @@ final class ConnectionServiceAdapterServant { } break; } + case MSG_SET_CONFERENCE_MERGE_FAILED: { + SomeArgs args = (SomeArgs) msg.obj; + try { + mDelegate.setConferenceMergeFailed((String) args.arg1); + } finally { + args.recycle(); + } + break; + } } } }; @@ -280,6 +290,13 @@ final class ConnectionServiceAdapterServant { } @Override + public void setConferenceMergeFailed(String callId) { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = callId; + mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget(); + } + + @Override public void setIsConferenced(String callId, String conferenceCallId) { SomeArgs args = SomeArgs.obtain(); args.arg1 = callId; diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java index b5d566a..fd0c06d 100644 --- a/telecomm/java/android/telecom/DefaultDialerManager.java +++ b/telecomm/java/android/telecom/DefaultDialerManager.java @@ -14,6 +14,7 @@ package android.telecom; +import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; @@ -35,15 +36,27 @@ public class DefaultDialerManager { private static final String TAG = "DefaultDialerManager"; /** - * Sets the specified package name as the default dialer application. The caller of this method - * needs to have permission to write to secure settings. + * Sets the specified package name as the default dialer application for the current user. + * The caller of this method needs to have permission to write to secure settings and + * manage users on the device. * * @hide * */ public static void setDefaultDialerApplication(Context context, String packageName) { + setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser()); + } + + /** + * Sets the specified package name as the default dialer application for the specified user. + * The caller of this method needs to have permission to write to secure settings and + * manage users on the device. + * + * @hide + * */ + public static void setDefaultDialerApplication(Context context, String packageName, int user) { // Get old package name - String oldPackageName = Settings.Secure.getString(context.getContentResolver(), - Settings.Secure.DIALER_DEFAULT_APPLICATION); + String oldPackageName = Settings.Secure.getStringForUser(context.getContentResolver(), + Settings.Secure.DIALER_DEFAULT_APPLICATION, user); if (packageName != null && oldPackageName != null && packageName.equals(oldPackageName)) { // No change @@ -55,26 +68,44 @@ public class DefaultDialerManager { if (packageNames.contains(packageName)) { // Update the secure setting. - Settings.Secure.putString(context.getContentResolver(), - Settings.Secure.DIALER_DEFAULT_APPLICATION, packageName); + Settings.Secure.putStringForUser(context.getContentResolver(), + Settings.Secure.DIALER_DEFAULT_APPLICATION, packageName, user); } } /** - * Returns the installed dialer application that will be used to receive incoming calls, and is - * allowed to make emergency calls. + * Returns the installed dialer application for the current user that will be used to receive + * incoming calls, and is allowed to make emergency calls. * * The application will be returned in order of preference: * 1) User selected phone application (if still installed) * 2) Pre-installed system dialer (if not disabled) * 3) Null * + * The caller of this method needs to have permission to manage users on the device. + * * @hide * */ public static String getDefaultDialerApplication(Context context) { - String defaultPackageName = Settings.Secure.getString(context.getContentResolver(), - Settings.Secure.DIALER_DEFAULT_APPLICATION); + return getDefaultDialerApplication(context, ActivityManager.getCurrentUser()); + } + /** + * Returns the installed dialer application for the specified user that will be used to receive + * incoming calls, and is allowed to make emergency calls. + * + * The application will be returned in order of preference: + * 1) User selected phone application (if still installed) + * 2) Pre-installed system dialer (if not disabled) + * 3) Null + * + * The caller of this method needs to have permission to manage users on the device. + * + * @hide + * */ + public static String getDefaultDialerApplication(Context context, int user) { + String defaultPackageName = Settings.Secure.getStringForUser(context.getContentResolver(), + Settings.Secure.DIALER_DEFAULT_APPLICATION, user); final List<String> packageNames = getInstalledDialerApplications(context); diff --git a/telecomm/java/android/telecom/ParcelableConference.java b/telecomm/java/android/telecom/ParcelableConference.java index e54e79d..3d0c558 100644 --- a/telecomm/java/android/telecom/ParcelableConference.java +++ b/telecomm/java/android/telecom/ParcelableConference.java @@ -121,11 +121,10 @@ public final class ParcelableConference implements Parcelable { List<String> connectionIds = new ArrayList<>(2); source.readList(connectionIds, classLoader); long connectTimeMillis = source.readLong(); - StatusHints statusHints = source.readParcelable(classLoader); - IVideoProvider videoCallProvider = IVideoProvider.Stub.asInterface(source.readStrongBinder()); int videoState = source.readInt(); + StatusHints statusHints = source.readParcelable(classLoader); return new ParcelableConference(phoneAccount, state, capabilities, connectionIds, videoCallProvider, videoState, connectTimeMillis, statusHints); diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index a9b725b..0208744 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -176,6 +176,13 @@ final class RemoteConnectionService { } @Override + public void setConferenceMergeFailed(String callId) { + // Nothing to do here. + // The event has already been handled and there is no state to update + // in the underlying connection or conference objects + } + + @Override public void addConferenceCall( final String callId, ParcelableConference parcel) { diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java index 2fd438a..902fddb 100644 --- a/telecomm/java/android/telecom/VideoProfile.java +++ b/telecomm/java/android/telecom/VideoProfile.java @@ -144,6 +144,17 @@ public class VideoProfile implements Parcelable { dest.writeInt(mQuality); } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[VideoProfile videoState = "); + sb.append(VideoState.videoStateToString(mVideoState)); + sb.append(" videoQuality = "); + sb.append(mQuality); + sb.append("]"); + return sb.toString(); + } + /** * The video state of the call, stored as a bit-field describing whether video transmission and * receipt it enabled, as well as whether the video is currently muted. @@ -241,5 +252,30 @@ public class VideoProfile implements Parcelable { private static boolean hasState(int videoState, int state) { return (videoState & state) == state; } + + /** + * Generates a string representation of a {@link VideoState}. + * + * @param videoState The video state. + * @return String representation of the {@link VideoState}. + */ + public static String videoStateToString(int videoState) { + StringBuilder sb = new StringBuilder(); + sb.append("Audio"); + + if (VideoProfile.VideoState.isTransmissionEnabled(videoState)) { + sb.append(" Tx"); + } + + if (VideoProfile.VideoState.isReceptionEnabled(videoState)) { + sb.append(" Rx"); + } + + if (VideoProfile.VideoState.isPaused(videoState)) { + sb.append(" Pause"); + } + + return sb.toString(); + } } } diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl index 7e7e9cc..67e2edb 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl @@ -56,6 +56,8 @@ oneway interface IConnectionServiceAdapter { void setIsConferenced(String callId, String conferenceCallId); + void setConferenceMergeFailed(String callId); + void addConferenceCall(String callId, in ParcelableConference conference); void removeCall(String callId); |
