diff options
author | 2019-05-17 10:49:16 -0700 | |
---|---|---|
committer | 2019-05-17 10:49:38 -0700 | |
commit | 4c69fb3d7b913f4870959314e9572f4ba80c2afe (patch) | |
tree | 2ffc5023616e0a002125f8bfa4a1c39f38c2e077 | |
parent | c3bfdf5267958a1c792e958f5e2d3f8306f28776 (diff) |
Make queryRemoteConnectionServices DSDS aware.
The method queryRemoteConnectionServices had the issue that it assumes
there is a single connection manager for the device. This assumption does
not work on a multisim device. Since the ConnectionManager is associated
with a particular carrier, this means that the connection mgr for one
carrier could try to impact calls destined for another carrier.
This change ensures that the calling package is passed into Telecom so
that we can determine which RemoteConnectionServices which are available to
the calling connection manager.
Test: Manual test on DSDS with a connection mgr carrier and another carrier.
Bug: 131856987
Change-Id: I46d80dc68adaab7fd4374f023d7ba4242804c253
5 files changed, 19 insertions, 8 deletions
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 49b34b38c663..c66e92b5e099 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -1937,6 +1937,8 @@ public abstract class ConnectionService extends Service { return; } + String callingPackage = getOpPackageName(); + mAdapter.queryRemoteConnectionServices(new RemoteServiceCallback.Stub() { @Override public void onResult( @@ -1965,7 +1967,7 @@ public abstract class ConnectionService extends Service { } }.prepare()); } - }); + }, callingPackage); } /** diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index 6c3f4f34ff2d..3acd83a41396 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -316,11 +316,11 @@ final class ConnectionServiceAdapter implements DeathRecipient { /** * Retrieves a list of remote connection services usable to place calls. */ - void queryRemoteConnectionServices(RemoteServiceCallback callback) { + void queryRemoteConnectionServices(RemoteServiceCallback callback, String callingPackage) { // Only supported when there is only one adapter. if (mAdapters.size() == 1) { try { - mAdapters.iterator().next().queryRemoteConnectionServices(callback, + mAdapters.iterator().next().queryRemoteConnectionServices(callback, callingPackage, Log.getExternalSession()); } catch (RemoteException e) { Log.e(this, e, "Exception trying to query for remote CSs"); diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java index f99b218bd9b9..b28158913dc4 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java @@ -186,8 +186,13 @@ final class ConnectionServiceAdapterServant { break; } case MSG_QUERY_REMOTE_CALL_SERVICES: - mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj, - null /*Session.Info*/); + SomeArgs args2 = (SomeArgs) msg.obj; + try { + mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) args2.arg1, + (String) args2.arg2, null /*Session.Info*/); + } finally { + args2.recycle(); + } break; case MSG_SET_VIDEO_STATE: mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/); @@ -468,7 +473,10 @@ final class ConnectionServiceAdapterServant { @Override public void queryRemoteConnectionServices(RemoteServiceCallback callback, - Session.Info sessionInfo) { + String callingPackage, Session.Info sessionInfo) { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = callback; + args.arg2 = callingPackage; mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget(); } diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index 744544eb01f1..1e73bd61d68e 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -288,7 +288,7 @@ final class RemoteConnectionService { @Override public void queryRemoteConnectionServices(RemoteServiceCallback callback, - Session.Info sessionInfo) { + String callingPackage, Session.Info sessionInfo) { // Not supported from remote connection service. } diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl index 76ac88e9fbaa..9cf098c75177 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl @@ -78,7 +78,8 @@ oneway interface IConnectionServiceAdapter { void onPostDialChar(String callId, char nextChar, in Session.Info sessionInfo); - void queryRemoteConnectionServices(RemoteServiceCallback callback, in Session.Info sessionInfo); + void queryRemoteConnectionServices(RemoteServiceCallback callback, String callingPackage, + in Session.Info sessionInfo); void setVideoProvider(String callId, IVideoProvider videoProvider, in Session.Info sessionInfo); |