Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c72ad88 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge changes I4b71eb98,Ied6afa11,I74f6a05b,Ie5e08865,I400a8baa

* changes:
  Replace mBinding with hasMessage
  Remove code called twice
  Simplify sending message
  ERROR_PRONE: enforce AlreadyChecked and fix it
  Fix legacy test to use the new Looper
parents a654522b 6d3c58f7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ java_defaults {
    defaults: ["bluetooth-module-sdk-version-defaults"],
    errorprone: {
        javacflags: [
            "-Xep:AlreadyChecked:ERROR",
            "-Xep:CheckReturnValue:ERROR",
            "-Xep:ClassCanBeStatic:ERROR",
            "-Xep:EqualsIncompatibleType:ERROR",
+67 −121

File changed.

Preview size limit exceeded, changes collapsed.

+0 −4
Original line number Diff line number Diff line
@@ -67,8 +67,4 @@ class BluetoothServerProxy {
    int getBluetoothPersistedState(ContentResolver resolver, int defaultValue) {
        return Settings.Global.getInt(resolver, Settings.Global.BLUETOOTH_ON, defaultValue);
    }

    boolean handlerSendWhatMessage(BluetoothManagerService.BluetoothHandler handler, int what) {
        return handler.sendMessage(handler.obtainMessage(what));
    }
}
+1 −5
Original line number Diff line number Diff line
@@ -182,17 +182,13 @@ public class BluetoothManagerServiceTest {
                .hasUserRestrictionForUser(eq(UserManager.DISALLOW_BLUETOOTH_SHARING), any());

        // Check if disable message sent once for system user only
        // Since Message object is recycled after processed, use proxy function to get what value

        // test run on user -1, should not turning Bluetooth off
        mManagerService.onUserRestrictionsChanged(UserHandle.CURRENT);
        verify(mBluetoothServerProxy, times(0))
                .handlerSendWhatMessage(any(), eq(BluetoothManagerService.MESSAGE_DISABLE));
        assertThat(mLooper.nextMessage()).isNull();

        // called from SYSTEM user, should try to toggle Bluetooth off
        mManagerService.onUserRestrictionsChanged(UserHandle.SYSTEM);
        verify(mBluetoothServerProxy)
                .handlerSendWhatMessage(any(), eq(BluetoothManagerService.MESSAGE_DISABLE));
        syncHandler(MESSAGE_DISABLE);
    }