Skip to content
Snippets Groups Projects
Commit 2193b30f authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Gerrit Code Review
Browse files

Revert "Checks the service is supported before binding the service"

This reverts commit 29b0d287.

Reason for revert: Change breaks multiple tests, see b/257340301

Change-Id: I4a5d7ac69b32a6dc1b782e5d4643ca4529108c22
parent 29b0d287
No related branches found
No related tags found
No related merge requests found
......@@ -129,27 +129,13 @@ public abstract class BluetoothProfileConnector<T> {
if (mService == null) {
logDebug("Binding service...");
mCloseGuard.open("doUnbind");
List<Integer> mSupportedProfileList =
BluetoothAdapter.getDefaultAdapter().getSupportedProfiles();
if (!mSupportedProfileList.contains(mProfileId)) {
logDebug("Skip binding " + mProfileName + " service due to not supported");
return false;
}
try {
Intent intent = new Intent(mServiceName);
ComponentName comp = resolveSystemService(intent, mContext.getPackageManager());
intent.setComponent(comp);
if (comp == null) {
logError("Component is null");
return false;
}
if (!mContext.bindServiceAsUser(intent, mConnection, 0,
if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
USER_HANDLE_CURRENT_OR_SELF)) {
logError("Could not bind to Bluetooth Service with " + intent);
mContext.unbindService(mConnection);
return false;
}
} catch (SecurityException se) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment