Loading android/app/src/com/android/bluetooth/hdp/HealthService.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -401,6 +401,12 @@ public class HealthService extends ProfileService { IBluetoothHealthCallback callback) { IBluetoothHealthCallback callback) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); "Need BLUETOOTH permission"); if (config == null) { Log.e(TAG, "Trying to use a null config for registration"); return false; } if (mApps.get(config) != null) { if (mApps.get(config) != null) { if (DBG) Log.d(TAG, "Config has already been registered"); if (DBG) Log.d(TAG, "Config has already been registered"); return false; return false; Loading android/app/tests/src/com/android/bluetooth/tests/hdp/HealthServiceTest.java 0 → 100644 +19 −0 Original line number Original line Diff line number Diff line package com.android.bluetooth.hdp; import android.test.InstrumentationTestCase; import junit.framework.Assert; public class HealthServiceTest extends InstrumentationTestCase { public void testRegisterAppConfiguration() { HealthService testService = new HealthService(); // Attach a context to the Health Service for permission checks testService.attach(getInstrumentation().getContext(), null, null, null, null, null); // Test registering a null config assertEquals(false, testService.registerAppConfiguration(null, null)); } } Loading
android/app/src/com/android/bluetooth/hdp/HealthService.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -401,6 +401,12 @@ public class HealthService extends ProfileService { IBluetoothHealthCallback callback) { IBluetoothHealthCallback callback) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); "Need BLUETOOTH permission"); if (config == null) { Log.e(TAG, "Trying to use a null config for registration"); return false; } if (mApps.get(config) != null) { if (mApps.get(config) != null) { if (DBG) Log.d(TAG, "Config has already been registered"); if (DBG) Log.d(TAG, "Config has already been registered"); return false; return false; Loading
android/app/tests/src/com/android/bluetooth/tests/hdp/HealthServiceTest.java 0 → 100644 +19 −0 Original line number Original line Diff line number Diff line package com.android.bluetooth.hdp; import android.test.InstrumentationTestCase; import junit.framework.Assert; public class HealthServiceTest extends InstrumentationTestCase { public void testRegisterAppConfiguration() { HealthService testService = new HealthService(); // Attach a context to the Health Service for permission checks testService.attach(getInstrumentation().getContext(), null, null, null, null, null); // Test registering a null config assertEquals(false, testService.registerAppConfiguration(null, null)); } }