Loading src/com/android/bluetooth/Utils.java +9 −1 Original line number Diff line number Diff line Loading @@ -286,7 +286,15 @@ public final class Utils { public static boolean callerIsSystemOrActiveUser(String tag, String method) { if (!checkCaller()) { Log.w(TAG, method + "() - Not allowed for non-active user and non system user"); Log.w(TAG, method + "() - Not allowed for non-active user and non-system user"); return false; } return true; } public static boolean callerIsSystemOrActiveOrManagedUser(Context context, String tag, String method) { if (!checkCallerAllowManagedProfiles(context)) { Log.w(TAG, method + "() - Not allowed for non-active user and non-system and non-managed user"); return false; } return true; Loading src/com/android/bluetooth/btservice/AdapterProperties.java +0 −9 Original line number Diff line number Diff line Loading @@ -916,15 +916,6 @@ class AdapterProperties { setScanMode(AbstractionLayer.BT_SCAN_MODE_NONE); } void onBluetoothDisable() { // From STATE_ON to BLE_ON debugLog("onBluetoothDisable()"); // Turn off any Device Search/Inquiry mService.cancelDiscovery(); // Set the scan_mode to NONE (no incoming connections). setScanMode(AbstractionLayer.BT_SCAN_MODE_NONE); } void discoveryStateChangeCallback(int state) { infoLog("Callback:discoveryStateChangeCallback with state:" + state); synchronized (mObject) { Loading src/com/android/bluetooth/btservice/AdapterService.java +92 −167 File changed.Preview size limit exceeded, changes collapsed. Show changes tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ public class AdapterServiceTest { private static final String TAG = AdapterServiceTest.class.getSimpleName(); private AdapterService mAdapterService; private AdapterService.AdapterServiceBinder mServiceBinder; private @Mock Context mMockContext; private @Mock ApplicationInfo mMockApplicationInfo; Loading Loading @@ -119,6 +120,7 @@ public class AdapterServiceTest { InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> mAdapterService = new AdapterService()); mServiceBinder = new AdapterService.AdapterServiceBinder(mAdapterService); mMockPackageManager = mock(PackageManager.class); mMockContentResolver = new MockContentResolver(mMockContext); MockitoAnnotations.initMocks(this); Loading Loading @@ -220,7 +222,7 @@ public class AdapterServiceTest { verify(mMockContext, timeout(CONTEXT_SWITCH_MS).times(2 * invocationNumber + 2)) .sendBroadcast(any(), eq(android.Manifest.permission.BLUETOOTH)); final int scanMode = mAdapterService.getScanMode(); final int scanMode = mServiceBinder.getScanMode(); Assert.assertTrue(scanMode == BluetoothAdapter.SCAN_MODE_CONNECTABLE || scanMode == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE); Assert.assertTrue(mAdapterService.getState() == BluetoothAdapter.STATE_ON); Loading Loading
src/com/android/bluetooth/Utils.java +9 −1 Original line number Diff line number Diff line Loading @@ -286,7 +286,15 @@ public final class Utils { public static boolean callerIsSystemOrActiveUser(String tag, String method) { if (!checkCaller()) { Log.w(TAG, method + "() - Not allowed for non-active user and non system user"); Log.w(TAG, method + "() - Not allowed for non-active user and non-system user"); return false; } return true; } public static boolean callerIsSystemOrActiveOrManagedUser(Context context, String tag, String method) { if (!checkCallerAllowManagedProfiles(context)) { Log.w(TAG, method + "() - Not allowed for non-active user and non-system and non-managed user"); return false; } return true; Loading
src/com/android/bluetooth/btservice/AdapterProperties.java +0 −9 Original line number Diff line number Diff line Loading @@ -916,15 +916,6 @@ class AdapterProperties { setScanMode(AbstractionLayer.BT_SCAN_MODE_NONE); } void onBluetoothDisable() { // From STATE_ON to BLE_ON debugLog("onBluetoothDisable()"); // Turn off any Device Search/Inquiry mService.cancelDiscovery(); // Set the scan_mode to NONE (no incoming connections). setScanMode(AbstractionLayer.BT_SCAN_MODE_NONE); } void discoveryStateChangeCallback(int state) { infoLog("Callback:discoveryStateChangeCallback with state:" + state); synchronized (mObject) { Loading
src/com/android/bluetooth/btservice/AdapterService.java +92 −167 File changed.Preview size limit exceeded, changes collapsed. Show changes
tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ public class AdapterServiceTest { private static final String TAG = AdapterServiceTest.class.getSimpleName(); private AdapterService mAdapterService; private AdapterService.AdapterServiceBinder mServiceBinder; private @Mock Context mMockContext; private @Mock ApplicationInfo mMockApplicationInfo; Loading Loading @@ -119,6 +120,7 @@ public class AdapterServiceTest { InstrumentationRegistry.getInstrumentation().runOnMainSync( () -> mAdapterService = new AdapterService()); mServiceBinder = new AdapterService.AdapterServiceBinder(mAdapterService); mMockPackageManager = mock(PackageManager.class); mMockContentResolver = new MockContentResolver(mMockContext); MockitoAnnotations.initMocks(this); Loading Loading @@ -220,7 +222,7 @@ public class AdapterServiceTest { verify(mMockContext, timeout(CONTEXT_SWITCH_MS).times(2 * invocationNumber + 2)) .sendBroadcast(any(), eq(android.Manifest.permission.BLUETOOTH)); final int scanMode = mAdapterService.getScanMode(); final int scanMode = mServiceBinder.getScanMode(); Assert.assertTrue(scanMode == BluetoothAdapter.SCAN_MODE_CONNECTABLE || scanMode == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE); Assert.assertTrue(mAdapterService.getState() == BluetoothAdapter.STATE_ON); Loading