summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm/java/android')
-rw-r--r--telecomm/java/android/telecom/Call.java4
-rw-r--r--telecomm/java/android/telecom/Connection.java26
-rw-r--r--telecomm/java/android/telecom/DefaultDialerManager.java51
-rw-r--r--telecomm/java/android/telecom/ParcelableCall.java4
-rw-r--r--telecomm/java/android/telecom/RemoteConnection.java4
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java6
-rw-r--r--telecomm/java/android/telecom/VideoCallImpl.java24
7 files changed, 92 insertions, 27 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index fee6495..adab00b 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -1000,9 +1000,9 @@ public final class Call {
}
boolean videoCallChanged = parcelableCall.isVideoCallProviderChanged() &&
- !Objects.equals(mVideoCall, parcelableCall.getVideoCall());
+ !Objects.equals(mVideoCall, parcelableCall.getVideoCall(this));
if (videoCallChanged) {
- mVideoCall = parcelableCall.getVideoCall();
+ mVideoCall = parcelableCall.getVideoCall(this);
}
int state = parcelableCall.getState();
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 3060f40..4bc639b 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -16,6 +16,7 @@
package android.telecom;
+import com.android.internal.os.SomeArgs;
import com.android.internal.telecom.IVideoCallback;
import com.android.internal.telecom.IVideoProvider;
@@ -471,9 +472,16 @@ public abstract class Connection implements Conferenceable {
case MSG_SET_ZOOM:
onSetZoom((Float) msg.obj);
break;
- case MSG_SEND_SESSION_MODIFY_REQUEST:
- onSendSessionModifyRequest((VideoProfile) msg.obj);
+ case MSG_SEND_SESSION_MODIFY_REQUEST: {
+ SomeArgs args = (SomeArgs) msg.obj;
+ try {
+ onSendSessionModifyRequest((VideoProfile) args.arg1,
+ (VideoProfile) args.arg2);
+ } finally {
+ args.recycle();
+ }
break;
+ }
case MSG_SEND_SESSION_MODIFY_RESPONSE:
onSendSessionModifyResponse((VideoProfile) msg.obj);
break;
@@ -527,9 +535,11 @@ public abstract class Connection implements Conferenceable {
mMessageHandler.obtainMessage(MSG_SET_ZOOM, value).sendToTarget();
}
- public void sendSessionModifyRequest(VideoProfile requestProfile) {
- mMessageHandler.obtainMessage(
- MSG_SEND_SESSION_MODIFY_REQUEST, requestProfile).sendToTarget();
+ public void sendSessionModifyRequest(VideoProfile fromProfile, VideoProfile toProfile) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = fromProfile;
+ args.arg2 = toProfile;
+ mMessageHandler.obtainMessage(MSG_SEND_SESSION_MODIFY_REQUEST, args).sendToTarget();
}
public void sendSessionModifyResponse(VideoProfile responseProfile) {
@@ -606,9 +616,11 @@ public abstract class Connection implements Conferenceable {
* Some examples of session modification requests: upgrade connection from audio to video,
* downgrade connection from video to audio, pause video.
*
- * @param requestProfile The requested connection video properties.
+ * @param fromProfile The video properties prior to the request.
+ * @param toProfile The video properties with the requested changes made.
*/
- public abstract void onSendSessionModifyRequest(VideoProfile requestProfile);
+ public abstract void onSendSessionModifyRequest(VideoProfile fromProfile,
+ VideoProfile toProfile);
/**te
* Provides a response to a request to change the current connection session video
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/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index 1a30910..bb65ce9 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -178,10 +178,10 @@ public final class ParcelableCall implements Parcelable {
* Returns an object for remotely communicating through the video call provider's binder.
* @return The video call.
*/
- public InCallService.VideoCall getVideoCall() {
+ public InCallService.VideoCall getVideoCall(Call call) {
if (mVideoCall == null && mVideoCallProvider != null) {
try {
- mVideoCall = new VideoCallImpl(mVideoCallProvider);
+ mVideoCall = new VideoCallImpl(mVideoCallProvider, call);
} catch (RemoteException ignored) {
// Ignore RemoteException.
}
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index 1493b20..9ca9f31 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -350,9 +350,9 @@ public final class RemoteConnection {
}
}
- public void sendSessionModifyRequest(VideoProfile reqProfile) {
+ public void sendSessionModifyRequest(VideoProfile fromProfile, VideoProfile toProfile) {
try {
- mVideoProviderBinder.sendSessionModifyRequest(reqProfile);
+ mVideoProviderBinder.sendSessionModifyRequest(fromProfile, toProfile);
} catch (RemoteException e) {
}
}
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 1431eb8..ebd3f12 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -1143,8 +1143,12 @@ public class TelecomManager {
public void placeCall(Uri address, Bundle extras) {
ITelecomService service = getTelecomService();
if (service != null) {
+ if (address == null) {
+ Log.w(TAG, "Cannot place call to empty address.");
+ }
try {
- service.placeCall(address, extras, mContext.getOpPackageName());
+ service.placeCall(address, extras == null ? new Bundle() : extras,
+ mContext.getOpPackageName());
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#placeCall", e);
}
diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java
index 7a82c1b..331f57e 100644
--- a/telecomm/java/android/telecom/VideoCallImpl.java
+++ b/telecomm/java/android/telecom/VideoCallImpl.java
@@ -40,6 +40,8 @@ public class VideoCallImpl extends VideoCall {
private final IVideoProvider mVideoProvider;
private final VideoCallListenerBinder mBinder;
private VideoCall.Callback mCallback;
+ private int mVideoQuality = VideoProfile.QUALITY_UNKNOWN;
+ private Call mCall;
private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() {
@Override
@@ -161,6 +163,7 @@ public class VideoCallImpl extends VideoCall {
(CameraCapabilities) msg.obj);
break;
case MSG_CHANGE_VIDEO_QUALITY:
+ mVideoQuality = msg.arg1;
mCallback.onVideoQualityChanged(msg.arg1);
break;
default:
@@ -171,12 +174,13 @@ public class VideoCallImpl extends VideoCall {
private Handler mHandler;
- VideoCallImpl(IVideoProvider videoProvider) throws RemoteException {
+ VideoCallImpl(IVideoProvider videoProvider, Call call) throws RemoteException {
mVideoProvider = videoProvider;
mVideoProvider.asBinder().linkToDeath(mDeathRecipient, 0);
mBinder = new VideoCallListenerBinder();
mVideoProvider.addVideoCallback(mBinder);
+ mCall = call;
}
public void destroy() {
@@ -251,10 +255,24 @@ public class VideoCallImpl extends VideoCall {
}
}
- /** {@inheritDoc} */
+ /**
+ * Sends a session modification request to the video provider.
+ * <p>
+ * The {@link InCallService} will create the {@code requestProfile} based on the current
+ * video state (i.e. {@link Call.Details#getVideoState()}). It is, however, possible that the
+ * video state maintained by the {@link InCallService} could get out of sync with what is known
+ * by the {@link android.telecom.Connection.VideoProvider}. To remove ambiguity, the
+ * {@link VideoCallImpl} passes along the pre-modify video profile to the {@code VideoProvider}
+ * to ensure it has full context of the requested change.
+ *
+ * @param requestProfile The requested video profile.
+ */
public void sendSessionModifyRequest(VideoProfile requestProfile) {
try {
- mVideoProvider.sendSessionModifyRequest(requestProfile);
+ VideoProfile originalProfile = new VideoProfile(mCall.getDetails().getVideoState(),
+ mVideoQuality);
+
+ mVideoProvider.sendSessionModifyRequest(originalProfile, requestProfile);
} catch (RemoteException e) {
}
}