summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-08-15 23:22:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-15 18:56:10 +0000
commita2897ea9d8d6eb7c1c0aace695ed835da96bb39c (patch)
tree7537baf93fc4b7510653353c2382883be2bd521d /telecomm
parent91306bccf16715f0867a10f3537122179527f7c3 (diff)
parent0dae9a4cfa9d51cadb0f731b65f742d48e9e893c (diff)
downloadframeworks_base-a2897ea9d8d6eb7c1c0aace695ed835da96bb39c.zip
frameworks_base-a2897ea9d8d6eb7c1c0aace695ed835da96bb39c.tar.gz
frameworks_base-a2897ea9d8d6eb7c1c0aace695ed835da96bb39c.tar.bz2
Merge "Add BIND_CONNECTION_SERVICE permission." into lmp-dev
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecomm/ConnectionService.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java
index c2b401d..8ab5e13 100644
--- a/telecomm/java/android/telecomm/ConnectionService.java
+++ b/telecomm/java/android/telecomm/ConnectionService.java
@@ -16,6 +16,7 @@
package android.telecomm;
+import android.Manifest;
import android.annotation.SdkConstant;
import android.app.PendingIntent;
import android.app.Service;
@@ -26,6 +27,8 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
+import android.os.Parcel;
+import android.os.RemoteException;
import android.telephony.DisconnectCause;
import com.android.internal.os.SomeArgs;
@@ -45,7 +48,6 @@ import java.util.Map;
* Android device.
*/
public abstract class ConnectionService extends Service {
-
/**
* The {@link Intent} that must be declared as handled by the service.
*/
@@ -81,6 +83,18 @@ public abstract class ConnectionService extends Service {
private final ConnectionServiceAdapter mAdapter = new ConnectionServiceAdapter();
private final IBinder mBinder = new IConnectionService.Stub() {
+ /**
+ * Enforces the requirement that all calls into the ConnectionService require the
+ * {@code BIND_CONNECTION_SERVICE} permission.
+ */
+ @Override
+ public boolean onTransact(int code, Parcel data, Parcel reply,
+ int flags) throws RemoteException
+ {
+ enforceBindConnectionServicePermission();
+ return super.onTransact(code, data, reply, flags);
+ }
+
@Override
public void addConnectionServiceAdapter(IConnectionServiceAdapter adapter) {
mHandler.obtainMessage(MSG_ADD_CONNECTION_SERVICE_ADAPTER, adapter).sendToTarget();
@@ -617,7 +631,8 @@ public abstract class ConnectionService extends Service {
public void onError(String request, int code, String reason) {
// no-op
}
- });
+ }
+ );
}
private void splitFromConference(String callId) {
@@ -830,4 +845,10 @@ public abstract class ConnectionService extends Service {
return Connection.getNullConnection();
}
+ /**
+ * Enforces the {@code BIND_CONNECTION_SERVICE} permission for connection service calls.
+ */
+ private void enforceBindConnectionServicePermission() {
+ enforceCallingPermission(Manifest.permission.BIND_CONNECTION_SERVICE, null);
+ }
}