Merge "Get rid of not specifying a user errors in bluetooth."
This commit is contained in:
committed by
Android (Google) Code Review
commit
7d86734297
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user