Loading src/com/android/settings/bluetooth/A2dpProfile.java +4 −23 Original line number Diff line number Diff line Loading @@ -56,13 +56,11 @@ final class A2dpProfile implements LocalBluetoothProfile { public void onServiceConnected(int profile, BluetoothProfile proxy) { if (V) Log.d(TAG,"Bluetooth service connected"); mService = (BluetoothA2dp) proxy; mProfileManager.setA2dpServiceUp(true); mIsProfileReady=true; } public void onServiceDisconnected(int profile) { if (V) Log.d(TAG,"Bluetooth service disconnected"); mProfileManager.setA2dpServiceUp(false); mIsProfileReady=false; } } Loading Loading @@ -106,21 +104,11 @@ final class A2dpProfile implements LocalBluetoothProfile { public boolean disconnect(BluetoothDevice device) { if (mService == null) return false; return mService.disconnect(device); } // This function is added as the AUTO CONNECT priority could not be set by using setPreferred(), // as setPreferred() takes only boolean input but getPreferred() supports interger output. // Also this need not implemented by all profiles so this has been added here. public void enableAutoConnect(BluetoothDevice device, boolean enable) { if (mService == null) return; if (enable) { mService.setPriority(device, BluetoothProfile.PRIORITY_AUTO_CONNECT); } else { // Downgrade priority as user is disconnecting the headset. if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON){ mService.setPriority(device, BluetoothProfile.PRIORITY_ON); } } return mService.disconnect(device); } public int getConnectionStatus(BluetoothDevice device) { Loading Loading @@ -150,13 +138,6 @@ final class A2dpProfile implements LocalBluetoothProfile { mService.setPriority(device, BluetoothProfile.PRIORITY_OFF); } } public void setUnbonded(BluetoothDevice device) { if (mService == null) return; mService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED); } boolean isA2dpPlaying() { if (mService == null) return false; List<BluetoothDevice> sinks = mService.getConnectedDevices(); Loading src/com/android/settings/bluetooth/BluetoothEventManager.java +0 −10 Original line number Diff line number Diff line Loading @@ -101,9 +101,6 @@ final class BluetoothEventManager { // Dock event broadcasts addHandler(Intent.ACTION_DOCK_EVENT, new DockEventHandler()); // Connect other profiles broadcast addHandler(BluetoothProfile.ACTION_CONNECT_OTHER_PROFILES, new ConnectOtherProfilesHandler()); mContext.registerReceiver(mBroadcastReceiver, mAdapterIntentFilter); } Loading Loading @@ -372,13 +369,6 @@ final class BluetoothEventManager { } } } private class ConnectOtherProfilesHandler implements Handler { public void onReceive(Context context, Intent intent, BluetoothDevice device) { mProfileManager.handleConnectOtherProfiles(device); } } boolean readPairedDevices() { Set<BluetoothDevice> bondedDevices = mLocalAdapter.getBondedDevices(); if (bondedDevices == null) { Loading src/com/android/settings/bluetooth/CachedBluetoothDevice.java +8 −36 Original line number Diff line number Diff line Loading @@ -119,30 +119,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { Log.d(TAG, "onProfileStateChanged: profile " + profile + " newProfileState " + newProfileState); } if (profile instanceof HeadsetProfile) { if (newProfileState == BluetoothProfile.STATE_CONNECTED) { if (BluetoothProfile.PRIORITY_AUTO_CONNECT != profile.getPreferred(mDevice)) mProfileManager.enableAutoConnectForHf(mDevice, true); } else if (newProfileState == BluetoothProfile.STATE_DISCONNECTED) { // dont reset auto connect priority when bluetooth turned off if ((BluetoothAdapter.STATE_ON == mLocalAdapter.getBluetoothState()) || (BluetoothAdapter.STATE_TURNING_ON == mLocalAdapter.getBluetoothState())) { mProfileManager.enableAutoConnectForHf(mDevice, false); } } } else if (profile instanceof A2dpProfile ) { if (newProfileState == BluetoothProfile.STATE_CONNECTED) { if (BluetoothProfile.PRIORITY_AUTO_CONNECT != profile.getPreferred(mDevice)) mProfileManager.enableAutoConnectForA2dp(mDevice,true); } else if (newProfileState == BluetoothProfile.STATE_DISCONNECTED) { // dont reset auto connect priority when bluetooth turned off if ((BluetoothAdapter.STATE_ON == mLocalAdapter.getBluetoothState()) || (BluetoothAdapter.STATE_TURNING_ON == mLocalAdapter.getBluetoothState())) { mProfileManager.enableAutoConnectForA2dp(mDevice, false); } } } mProfileConnectionState.put(profile, newProfileState); if (newProfileState == BluetoothProfile.STATE_CONNECTED) { if (!mProfiles.contains(profile)) { Loading Loading @@ -180,6 +156,14 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { for (LocalBluetoothProfile profile : mProfiles) { disconnect(profile); } // Disconnect PBAP server in case its connected // This is to ensure all the profiles are disconnected as some CK/Hs do not // disconnect PBAP connection when HF connection is brought down PbapServerProfile PbapProfile = mProfileManager.getPbapProfile(); if (PbapProfile.getConnectionStatus(mDevice) == BluetoothProfile.STATE_CONNECTED) { PbapProfile.disconnect(mDevice); } } void disconnect(LocalBluetoothProfile profile) { Loading Loading @@ -507,23 +491,11 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { .elapsedRealtime()) { connectWithoutResettingTimer(false); } // On an incoming pairing, set all the available profiles as preferred. for (LocalBluetoothProfile profile : mProfiles) { profile.setPreferred(mDevice, true); } dispatchAttributesChanged(); } // Clear service priority of Hid, A2DP and Headset profiles on unbond private void clearProfilePriorities() { for (LocalBluetoothProfile profile : mProfiles) { profile.setUnbonded(mDevice); } } void onBondingStateChanged(int bondState) { if (bondState == BluetoothDevice.BOND_NONE) { clearProfilePriorities(); mProfiles.clear(); mConnectAfterPairing = false; // cancel auto-connect setPhonebookPermissionChoice(PHONEBOOK_ACCESS_UNKNOWN); Loading src/com/android/settings/bluetooth/HeadsetProfile.java +0 −23 Original line number Diff line number Diff line Loading @@ -78,14 +78,12 @@ final class HeadsetProfile implements LocalBluetoothProfile { } mProfileManager.callServiceConnectedListeners(); mProfileManager.setHfServiceUp(true); mIsProfileReady=true; } public void onServiceDisconnected(int profile) { if (V) Log.d(TAG,"Bluetooth service disconnected"); mProfileManager.callServiceDisconnectedListeners(); mProfileManager.setHfServiceUp(false); mIsProfileReady=false; } } Loading Loading @@ -167,12 +165,6 @@ final class HeadsetProfile implements LocalBluetoothProfile { } } public void setUnbonded(BluetoothDevice device) { if (mService == null) return; mService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED); } public List<BluetoothDevice> getConnectedDevices() { if (mService == null) return new ArrayList<BluetoothDevice>(0); return mService.getDevicesMatchingConnectionStates( Loading @@ -181,21 +173,6 @@ final class HeadsetProfile implements LocalBluetoothProfile { BluetoothProfile.STATE_DISCONNECTING}); } // This function is added as the AUTO CONNECT priority could not be set by using setPreferred(), // as setPreferred() takes only boolean input but getPreferred() supports interger output. // Also this need not implemented by all profiles so this has been added here. public void enableAutoConnect(BluetoothDevice device, boolean enable) { if (mService == null) return; if (enable) { mService.setPriority(device, BluetoothProfile.PRIORITY_AUTO_CONNECT); } else { if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON) { mService.setPriority(device, BluetoothProfile.PRIORITY_ON); } } } public String toString() { return NAME; } Loading src/com/android/settings/bluetooth/HidProfile.java 100644 → 100755 +0 −6 Original line number Diff line number Diff line Loading @@ -118,12 +118,6 @@ final class HidProfile implements LocalBluetoothProfile { } } public void setUnbonded(BluetoothDevice device) { if (mService == null) return; mService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED); } public String toString() { return NAME; } Loading Loading
src/com/android/settings/bluetooth/A2dpProfile.java +4 −23 Original line number Diff line number Diff line Loading @@ -56,13 +56,11 @@ final class A2dpProfile implements LocalBluetoothProfile { public void onServiceConnected(int profile, BluetoothProfile proxy) { if (V) Log.d(TAG,"Bluetooth service connected"); mService = (BluetoothA2dp) proxy; mProfileManager.setA2dpServiceUp(true); mIsProfileReady=true; } public void onServiceDisconnected(int profile) { if (V) Log.d(TAG,"Bluetooth service disconnected"); mProfileManager.setA2dpServiceUp(false); mIsProfileReady=false; } } Loading Loading @@ -106,21 +104,11 @@ final class A2dpProfile implements LocalBluetoothProfile { public boolean disconnect(BluetoothDevice device) { if (mService == null) return false; return mService.disconnect(device); } // This function is added as the AUTO CONNECT priority could not be set by using setPreferred(), // as setPreferred() takes only boolean input but getPreferred() supports interger output. // Also this need not implemented by all profiles so this has been added here. public void enableAutoConnect(BluetoothDevice device, boolean enable) { if (mService == null) return; if (enable) { mService.setPriority(device, BluetoothProfile.PRIORITY_AUTO_CONNECT); } else { // Downgrade priority as user is disconnecting the headset. if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON){ mService.setPriority(device, BluetoothProfile.PRIORITY_ON); } } return mService.disconnect(device); } public int getConnectionStatus(BluetoothDevice device) { Loading Loading @@ -150,13 +138,6 @@ final class A2dpProfile implements LocalBluetoothProfile { mService.setPriority(device, BluetoothProfile.PRIORITY_OFF); } } public void setUnbonded(BluetoothDevice device) { if (mService == null) return; mService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED); } boolean isA2dpPlaying() { if (mService == null) return false; List<BluetoothDevice> sinks = mService.getConnectedDevices(); Loading
src/com/android/settings/bluetooth/BluetoothEventManager.java +0 −10 Original line number Diff line number Diff line Loading @@ -101,9 +101,6 @@ final class BluetoothEventManager { // Dock event broadcasts addHandler(Intent.ACTION_DOCK_EVENT, new DockEventHandler()); // Connect other profiles broadcast addHandler(BluetoothProfile.ACTION_CONNECT_OTHER_PROFILES, new ConnectOtherProfilesHandler()); mContext.registerReceiver(mBroadcastReceiver, mAdapterIntentFilter); } Loading Loading @@ -372,13 +369,6 @@ final class BluetoothEventManager { } } } private class ConnectOtherProfilesHandler implements Handler { public void onReceive(Context context, Intent intent, BluetoothDevice device) { mProfileManager.handleConnectOtherProfiles(device); } } boolean readPairedDevices() { Set<BluetoothDevice> bondedDevices = mLocalAdapter.getBondedDevices(); if (bondedDevices == null) { Loading
src/com/android/settings/bluetooth/CachedBluetoothDevice.java +8 −36 Original line number Diff line number Diff line Loading @@ -119,30 +119,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { Log.d(TAG, "onProfileStateChanged: profile " + profile + " newProfileState " + newProfileState); } if (profile instanceof HeadsetProfile) { if (newProfileState == BluetoothProfile.STATE_CONNECTED) { if (BluetoothProfile.PRIORITY_AUTO_CONNECT != profile.getPreferred(mDevice)) mProfileManager.enableAutoConnectForHf(mDevice, true); } else if (newProfileState == BluetoothProfile.STATE_DISCONNECTED) { // dont reset auto connect priority when bluetooth turned off if ((BluetoothAdapter.STATE_ON == mLocalAdapter.getBluetoothState()) || (BluetoothAdapter.STATE_TURNING_ON == mLocalAdapter.getBluetoothState())) { mProfileManager.enableAutoConnectForHf(mDevice, false); } } } else if (profile instanceof A2dpProfile ) { if (newProfileState == BluetoothProfile.STATE_CONNECTED) { if (BluetoothProfile.PRIORITY_AUTO_CONNECT != profile.getPreferred(mDevice)) mProfileManager.enableAutoConnectForA2dp(mDevice,true); } else if (newProfileState == BluetoothProfile.STATE_DISCONNECTED) { // dont reset auto connect priority when bluetooth turned off if ((BluetoothAdapter.STATE_ON == mLocalAdapter.getBluetoothState()) || (BluetoothAdapter.STATE_TURNING_ON == mLocalAdapter.getBluetoothState())) { mProfileManager.enableAutoConnectForA2dp(mDevice, false); } } } mProfileConnectionState.put(profile, newProfileState); if (newProfileState == BluetoothProfile.STATE_CONNECTED) { if (!mProfiles.contains(profile)) { Loading Loading @@ -180,6 +156,14 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { for (LocalBluetoothProfile profile : mProfiles) { disconnect(profile); } // Disconnect PBAP server in case its connected // This is to ensure all the profiles are disconnected as some CK/Hs do not // disconnect PBAP connection when HF connection is brought down PbapServerProfile PbapProfile = mProfileManager.getPbapProfile(); if (PbapProfile.getConnectionStatus(mDevice) == BluetoothProfile.STATE_CONNECTED) { PbapProfile.disconnect(mDevice); } } void disconnect(LocalBluetoothProfile profile) { Loading Loading @@ -507,23 +491,11 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { .elapsedRealtime()) { connectWithoutResettingTimer(false); } // On an incoming pairing, set all the available profiles as preferred. for (LocalBluetoothProfile profile : mProfiles) { profile.setPreferred(mDevice, true); } dispatchAttributesChanged(); } // Clear service priority of Hid, A2DP and Headset profiles on unbond private void clearProfilePriorities() { for (LocalBluetoothProfile profile : mProfiles) { profile.setUnbonded(mDevice); } } void onBondingStateChanged(int bondState) { if (bondState == BluetoothDevice.BOND_NONE) { clearProfilePriorities(); mProfiles.clear(); mConnectAfterPairing = false; // cancel auto-connect setPhonebookPermissionChoice(PHONEBOOK_ACCESS_UNKNOWN); Loading
src/com/android/settings/bluetooth/HeadsetProfile.java +0 −23 Original line number Diff line number Diff line Loading @@ -78,14 +78,12 @@ final class HeadsetProfile implements LocalBluetoothProfile { } mProfileManager.callServiceConnectedListeners(); mProfileManager.setHfServiceUp(true); mIsProfileReady=true; } public void onServiceDisconnected(int profile) { if (V) Log.d(TAG,"Bluetooth service disconnected"); mProfileManager.callServiceDisconnectedListeners(); mProfileManager.setHfServiceUp(false); mIsProfileReady=false; } } Loading Loading @@ -167,12 +165,6 @@ final class HeadsetProfile implements LocalBluetoothProfile { } } public void setUnbonded(BluetoothDevice device) { if (mService == null) return; mService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED); } public List<BluetoothDevice> getConnectedDevices() { if (mService == null) return new ArrayList<BluetoothDevice>(0); return mService.getDevicesMatchingConnectionStates( Loading @@ -181,21 +173,6 @@ final class HeadsetProfile implements LocalBluetoothProfile { BluetoothProfile.STATE_DISCONNECTING}); } // This function is added as the AUTO CONNECT priority could not be set by using setPreferred(), // as setPreferred() takes only boolean input but getPreferred() supports interger output. // Also this need not implemented by all profiles so this has been added here. public void enableAutoConnect(BluetoothDevice device, boolean enable) { if (mService == null) return; if (enable) { mService.setPriority(device, BluetoothProfile.PRIORITY_AUTO_CONNECT); } else { if (mService.getPriority(device) > BluetoothProfile.PRIORITY_ON) { mService.setPriority(device, BluetoothProfile.PRIORITY_ON); } } } public String toString() { return NAME; } Loading
src/com/android/settings/bluetooth/HidProfile.java 100644 → 100755 +0 −6 Original line number Diff line number Diff line Loading @@ -118,12 +118,6 @@ final class HidProfile implements LocalBluetoothProfile { } } public void setUnbonded(BluetoothDevice device) { if (mService == null) return; mService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED); } public String toString() { return NAME; } Loading