Merge "Get rid of not specifying a user errors in bluetooth."

This commit is contained in:
Dianne Hackborn
2014-03-24 18:37:18 +00:00
committed by Android (Google) Code Review
7 changed files with 15 additions and 9 deletions

View File

@@ -162,7 +162,8 @@ public final class BluetoothA2dp implements BluetoothProfile {
Intent intent = new Intent(IBluetoothA2dp.class.getName());
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
intent.setComponent(comp);
if (comp == null || !mContext.bindService(intent, mConnection, 0)) {
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
android.os.Process.myUserHandle())) {
Log.e(TAG, "Could not bind to Bluetooth A2DP Service with " + intent);
return false;
}

View File

@@ -280,7 +280,8 @@ public final class BluetoothHeadset implements BluetoothProfile {
Intent intent = new Intent(IBluetoothHeadset.class.getName());
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
intent.setComponent(comp);
if (comp == null || !mContext.bindService(intent, mConnection, 0)) {
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
android.os.Process.myUserHandle())) {
Log.e(TAG, "Could not bind to Bluetooth Headset Service with " + intent);
return false;
}

View File

@@ -487,7 +487,8 @@ public final class BluetoothHealth implements BluetoothProfile {
Intent intent = new Intent(IBluetoothHealth.class.getName());
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
intent.setComponent(comp);
if (comp == null || !mContext.bindService(intent, mConnection, 0)) {
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
android.os.Process.myUserHandle())) {
Log.e(TAG, "Could not bind to Bluetooth Health Service with " + intent);
return false;
}

View File

@@ -259,7 +259,8 @@ public final class BluetoothInputDevice implements BluetoothProfile {
Intent intent = new Intent(IBluetoothInputDevice.class.getName());
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
intent.setComponent(comp);
if (comp == null || !mContext.bindService(intent, mConnection, 0)) {
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
android.os.Process.myUserHandle())) {
Log.e(TAG, "Could not bind to Bluetooth HID Service with " + intent);
return false;
}

View File

@@ -22,8 +22,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.RemoteException;
import android.os.IBinder;
import android.os.*;
import android.util.Log;
/**
@@ -105,7 +104,8 @@ public final class BluetoothMap implements BluetoothProfile {
Intent intent = new Intent(IBluetoothMap.class.getName());
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
intent.setComponent(comp);
if (comp == null || !mContext.bindService(intent, mConnection, 0)) {
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
android.os.Process.myUserHandle())) {
Log.e(TAG, "Could not bind to Bluetooth MAP Service with " + intent);
return false;
}

View File

@@ -145,7 +145,8 @@ public final class BluetoothPan implements BluetoothProfile {
Intent intent = new Intent(IBluetoothPan.class.getName());
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
intent.setComponent(comp);
if (comp == null || !mContext.bindService(intent, mConnection, 0)) {
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
android.os.Process.myUserHandle())) {
Log.e(TAG, "Could not bind to Bluetooth Pan Service with " + intent);
return false;
}

View File

@@ -160,7 +160,8 @@ public class BluetoothPbap {
Intent intent = new Intent(IBluetoothPbap.class.getName());
ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
intent.setComponent(comp);
if (comp == null || !mContext.bindService(intent, mConnection, 0)) {
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
android.os.Process.myUserHandle())) {
Log.e(TAG, "Could not bind to Bluetooth Pbap Service with " + intent);
return false;
}