Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java +16 −12 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; Loading Loading @@ -148,17 +151,18 @@ public class A2dpProfile implements LocalBluetoothProfile { } public boolean connect(BluetoothDevice device) { if (mService == null) return false; return mService.connect(device); if (mService == null) { return false; } return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } public boolean disconnect(BluetoothDevice device) { if (mService == null) return false; // Downgrade priority as user is disconnecting the headset. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService == null) { return false; } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } public int getConnectionStatus(BluetoothDevice device) { Loading @@ -182,12 +186,12 @@ public class A2dpProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -197,11 +201,11 @@ public class A2dpProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } boolean isA2dpPlaying() { Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothA2dpSink; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; Loading Loading @@ -116,18 +119,15 @@ final class A2dpSinkProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.connect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } public boolean disconnect(BluetoothDevice device) { if (mService == null) { return false; } // Downgrade priority as user is disconnecting the headset. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } public int getConnectionStatus(BluetoothDevice device) { Loading @@ -141,12 +141,12 @@ final class A2dpSinkProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -156,11 +156,11 @@ final class A2dpSinkProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/HeadsetProfile.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; Loading Loading @@ -112,18 +115,15 @@ public class HeadsetProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.connect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } public boolean disconnect(BluetoothDevice device) { if (mService == null) { return false; } // Downgrade priority as user is disconnecting the headset. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } public int getConnectionStatus(BluetoothDevice device) { Loading Loading @@ -165,12 +165,12 @@ public class HeadsetProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -180,11 +180,11 @@ public class HeadsetProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java +16 −12 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; Loading Loading @@ -146,17 +149,18 @@ public class HearingAidProfile implements LocalBluetoothProfile { } public boolean connect(BluetoothDevice device) { if (mService == null) return false; return mService.connect(device); if (mService == null) { return false; } return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } public boolean disconnect(BluetoothDevice device) { if (mService == null) return false; // Downgrade priority as user is disconnecting the hearing aid. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService == null) { return false; } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } public int getConnectionStatus(BluetoothDevice device) { Loading @@ -180,12 +184,12 @@ public class HearingAidProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -195,11 +199,11 @@ public class HearingAidProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/HfpClientProfile.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; Loading Loading @@ -126,7 +129,7 @@ final class HfpClientProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.connect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } @Override Loading @@ -134,11 +137,8 @@ final class HfpClientProfile implements LocalBluetoothProfile { if (mService == null) { return false; } // Downgrade priority as user is disconnecting the headset. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } @Override Loading @@ -154,13 +154,13 @@ final class HfpClientProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } @Override public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -171,11 +171,11 @@ final class HfpClientProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java +16 −12 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; Loading Loading @@ -148,17 +151,18 @@ public class A2dpProfile implements LocalBluetoothProfile { } public boolean connect(BluetoothDevice device) { if (mService == null) return false; return mService.connect(device); if (mService == null) { return false; } return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } public boolean disconnect(BluetoothDevice device) { if (mService == null) return false; // Downgrade priority as user is disconnecting the headset. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService == null) { return false; } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } public int getConnectionStatus(BluetoothDevice device) { Loading @@ -182,12 +186,12 @@ public class A2dpProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -197,11 +201,11 @@ public class A2dpProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } boolean isA2dpPlaying() { Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothA2dpSink; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; Loading Loading @@ -116,18 +119,15 @@ final class A2dpSinkProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.connect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } public boolean disconnect(BluetoothDevice device) { if (mService == null) { return false; } // Downgrade priority as user is disconnecting the headset. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } public int getConnectionStatus(BluetoothDevice device) { Loading @@ -141,12 +141,12 @@ final class A2dpSinkProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -156,11 +156,11 @@ final class A2dpSinkProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/HeadsetProfile.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; Loading Loading @@ -112,18 +115,15 @@ public class HeadsetProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.connect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } public boolean disconnect(BluetoothDevice device) { if (mService == null) { return false; } // Downgrade priority as user is disconnecting the headset. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } public int getConnectionStatus(BluetoothDevice device) { Loading Loading @@ -165,12 +165,12 @@ public class HeadsetProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -180,11 +180,11 @@ public class HeadsetProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java +16 −12 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; Loading Loading @@ -146,17 +149,18 @@ public class HearingAidProfile implements LocalBluetoothProfile { } public boolean connect(BluetoothDevice device) { if (mService == null) return false; return mService.connect(device); if (mService == null) { return false; } return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } public boolean disconnect(BluetoothDevice device) { if (mService == null) return false; // Downgrade priority as user is disconnecting the hearing aid. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService == null) { return false; } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } public int getConnectionStatus(BluetoothDevice device) { Loading @@ -180,12 +184,12 @@ public class HearingAidProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -195,11 +199,11 @@ public class HearingAidProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/HfpClientProfile.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settingslib.bluetooth; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; Loading Loading @@ -126,7 +129,7 @@ final class HfpClientProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.connect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } @Override Loading @@ -134,11 +137,8 @@ final class HfpClientProfile implements LocalBluetoothProfile { if (mService == null) { return false; } // Downgrade priority as user is disconnecting the headset. if (mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return mService.disconnect(device); return mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } @Override Loading @@ -154,13 +154,13 @@ final class HfpClientProfile implements LocalBluetoothProfile { if (mService == null) { return false; } return mService.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; } @Override public int getPreferred(BluetoothDevice device) { if (mService == null) { return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); } Loading @@ -171,11 +171,11 @@ final class HfpClientProfile implements LocalBluetoothProfile { return; } if (preferred) { if (mService.getConnectionPolicy(device) < BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { mService.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } } Loading