Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,8 @@ public class LocalBluetoothManager { mCachedDeviceManager, context); mProfileManager = new LocalBluetoothProfileManager(context, mLocalAdapter, mCachedDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); mEventManager.readPairedDevices(); } Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +0 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,6 @@ public class LocalBluetoothProfileManager { // pass this reference to adapter and event manager (circular dependency) adapter.setProfileManager(this); updateLocalProfiles(); if (DEBUG) Log.d(TAG, "LocalBluetoothProfileManager construction complete"); } Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManagerTest.java +19 −18 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class LocalBluetoothProfileManagerTest { mContext)); mShadowBluetoothAdapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter()); when(mDeviceManager.findDevice(mDevice)).thenReturn(mCachedBluetoothDevice); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); } /** Loading @@ -88,20 +90,26 @@ public class LocalBluetoothProfileManagerTest { public void constructor_initiateHidAndHidDeviceProfile() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.HID_HOST, BluetoothProfile.HID_DEVICE})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); assertThat(mProfileManager.getHidProfile()).isNotNull(); assertThat(mProfileManager.getHidDeviceProfile()).isNotNull(); } @Test public void constructor_doNotUpdateProfiles() { mProfileManager = spy(new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager)); verify(mProfileManager, never()).updateLocalProfiles(); } /** * Verify updateLocalProfiles() for a local A2DP source adds A2dpProfile */ @Test public void updateLocalProfiles_addA2dpToLocalProfiles() { mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); assertThat(mProfileManager.getA2dpProfile()).isNull(); assertThat(mProfileManager.getHeadsetProfile()).isNull(); Loading @@ -120,8 +128,7 @@ public class LocalBluetoothProfileManagerTest { public void updateProfiles_addHidProfileForRemoteDevice() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.HID_HOST})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); ParcelUuid[] uuids = new ParcelUuid[]{BluetoothUuid.Hid}; ParcelUuid[] localUuids = new ParcelUuid[]{}; List<LocalBluetoothProfile> profiles = new ArrayList<>(); Loading @@ -143,8 +150,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receiveA2dpConnectionStateChanged_shouldDispatchCallback() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.A2DP})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -167,8 +173,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receiveHeadsetConnectionStateChanged_shouldDispatchCallback() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.HEADSET})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -191,8 +196,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receiveHAPConnectionStateChanged_shouldDispatchCallback() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.HEARING_AID})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -215,8 +219,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receivePanConnectionStateChanged_shouldNotDispatchCallback() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.PAN})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -239,8 +242,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receivePanConnectionStateChangedWithoutProfile_shouldNotRefresh () { mShadowBluetoothAdapter.setSupportedProfiles(null); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -262,8 +264,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receivePanConnectionStateChangedWithProfile_shouldRefresh() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.PAN})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,8 @@ public class LocalBluetoothManager { mCachedDeviceManager, context); mProfileManager = new LocalBluetoothProfileManager(context, mLocalAdapter, mCachedDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); mEventManager.readPairedDevices(); } Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +0 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,6 @@ public class LocalBluetoothProfileManager { // pass this reference to adapter and event manager (circular dependency) adapter.setProfileManager(this); updateLocalProfiles(); if (DEBUG) Log.d(TAG, "LocalBluetoothProfileManager construction complete"); } Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManagerTest.java +19 −18 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class LocalBluetoothProfileManagerTest { mContext)); mShadowBluetoothAdapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter()); when(mDeviceManager.findDevice(mDevice)).thenReturn(mCachedBluetoothDevice); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); } /** Loading @@ -88,20 +90,26 @@ public class LocalBluetoothProfileManagerTest { public void constructor_initiateHidAndHidDeviceProfile() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.HID_HOST, BluetoothProfile.HID_DEVICE})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); assertThat(mProfileManager.getHidProfile()).isNotNull(); assertThat(mProfileManager.getHidDeviceProfile()).isNotNull(); } @Test public void constructor_doNotUpdateProfiles() { mProfileManager = spy(new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager)); verify(mProfileManager, never()).updateLocalProfiles(); } /** * Verify updateLocalProfiles() for a local A2DP source adds A2dpProfile */ @Test public void updateLocalProfiles_addA2dpToLocalProfiles() { mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); assertThat(mProfileManager.getA2dpProfile()).isNull(); assertThat(mProfileManager.getHeadsetProfile()).isNull(); Loading @@ -120,8 +128,7 @@ public class LocalBluetoothProfileManagerTest { public void updateProfiles_addHidProfileForRemoteDevice() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.HID_HOST})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); ParcelUuid[] uuids = new ParcelUuid[]{BluetoothUuid.Hid}; ParcelUuid[] localUuids = new ParcelUuid[]{}; List<LocalBluetoothProfile> profiles = new ArrayList<>(); Loading @@ -143,8 +150,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receiveA2dpConnectionStateChanged_shouldDispatchCallback() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.A2DP})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -167,8 +173,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receiveHeadsetConnectionStateChanged_shouldDispatchCallback() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.HEADSET})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -191,8 +196,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receiveHAPConnectionStateChanged_shouldDispatchCallback() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.HEARING_AID})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -215,8 +219,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receivePanConnectionStateChanged_shouldNotDispatchCallback() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.PAN})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -239,8 +242,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receivePanConnectionStateChangedWithoutProfile_shouldNotRefresh () { mShadowBluetoothAdapter.setSupportedProfiles(null); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading @@ -262,8 +264,7 @@ public class LocalBluetoothProfileManagerTest { public void stateChangedHandler_receivePanConnectionStateChangedWithProfile_shouldRefresh() { mShadowBluetoothAdapter.setSupportedProfiles(generateList( new int[] {BluetoothProfile.PAN})); mProfileManager = new LocalBluetoothProfileManager(mContext, mLocalBluetoothAdapter, mDeviceManager, mEventManager); mProfileManager.updateLocalProfiles(); // Refer to BluetoothControllerImpl, it will call setReceiverHandler after // LocalBluetoothProfileManager created. mEventManager.setReceiverHandler(null); Loading