summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothHealth.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2016-11-04 11:23:46 -0600
committerJeff Sharkey <jsharkey@android.com>2016-11-07 17:03:37 -0700
commit73458a81e89e0f1955f326d8d29e710a9b4eb746 (patch)
tree714722e23ba633c5b1717d9a329a245e76877903 /framework/java/android/bluetooth/BluetoothHealth.java
parenteb78edfed1abb24d41b98a2317247c4c3851aabd (diff)
Detect non-oneway calls leaving system_server.
To protect system stability, any Binder calls leaving the system_server must carefully be performed using FLAG_ONEWAY (or the 'oneway' verb in AIDL) which prevents the call from blocking indefinitely on the remote process. In this CL, the system_server uses the new Binder.setWarnOnBlocking() method to enable detection by default for all remote Binder interfaces. It can also use Binder.allowBlocking() to allow blocking calls on certain remote interfaces that have been determined to be safe. This CL adds the 'oneway' verb to several interfaces and methods where it should have been added, and marks a handful of system ContentProviders as being safe to call into. Also, we assume that any services obtained from ServiceManager are part of the core OS, and are okay to make blocking calls to. Test: builds, boots, runs with minimal logs triggered Bug: 32715088 Change-Id: Ide476e120cb40436a94b7faf7615c943d691f4c0
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHealth.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothHealth.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHealth.java b/framework/java/android/bluetooth/BluetoothHealth.java
index 4949c24372..8d77888193 100644
--- a/framework/java/android/bluetooth/BluetoothHealth.java
+++ b/framework/java/android/bluetooth/BluetoothHealth.java
@@ -20,6 +20,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.os.Binder;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -522,7 +523,7 @@ public final class BluetoothHealth implements BluetoothProfile {
private final ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
if (DBG) Log.d(TAG, "Proxy object connected");
- mService = IBluetoothHealth.Stub.asInterface(service);
+ mService = IBluetoothHealth.Stub.asInterface(Binder.allowBlocking(service));
if (mServiceListener != null) {
mServiceListener.onServiceConnected(BluetoothProfile.HEALTH, BluetoothHealth.this);