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

Commit 4691705d authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix errorprone issues - part 2

Errorprone build that is triggered for BluetoothInstrumentationTests is
throwing some new errors that must be fixed before new tests are added.

Bug: 150670922
Test: BluetoothInstrumentationTests
Tag: #stability
Change-Id: Ie492b115773e97e346170821d76b412569e9064a
parent 48d8e1e1
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -918,7 +918,7 @@ public class StateMachineTest {
            }
            }
        }
        }


        class ChildState extends State {
        static class ChildState extends State {
            @Override
            @Override
            public boolean processMessage(Message message) {
            public boolean processMessage(Message message) {
                return NOT_HANDLED;
                return NOT_HANDLED;
@@ -1013,7 +1013,7 @@ public class StateMachineTest {
            }
            }
        }
        }


        class ChildState2 extends State {
        static class ChildState2 extends State {
            @Override
            @Override
            public boolean processMessage(Message message) {
            public boolean processMessage(Message message) {
                return NOT_HANDLED;
                return NOT_HANDLED;
@@ -1586,7 +1586,7 @@ public class StateMachineTest {
         * without a delay the arrival time difference should always >= to SM7_DELAY_TIME.
         * without a delay the arrival time difference should always >= to SM7_DELAY_TIME.
         */
         */
        long arrivalTimeDiff = sm7.mArrivalTimeMsg3 - sm7.mArrivalTimeMsg2;
        long arrivalTimeDiff = sm7.mArrivalTimeMsg3 - sm7.mArrivalTimeMsg2;
        long expectedDelay = sm7.SM7_DELAY_TIME - SM7_DELAY_FUDGE;
        long expectedDelay = (long) sm7.SM7_DELAY_TIME - SM7_DELAY_FUDGE;
        if (sm7.isDbg()) tlog("testStateMachine7: expect " + arrivalTimeDiff
        if (sm7.isDbg()) tlog("testStateMachine7: expect " + arrivalTimeDiff
                + " >= " + expectedDelay);
                + " >= " + expectedDelay);
        Assert.assertTrue(arrivalTimeDiff >= expectedDelay);
        Assert.assertTrue(arrivalTimeDiff >= expectedDelay);
+0 −1
Original line number Original line Diff line number Diff line
@@ -89,7 +89,6 @@ public class MediaPlayerListTest {
        when(mMockContext.registerReceiver(any(), any())).thenReturn(null);
        when(mMockContext.registerReceiver(any(), any())).thenReturn(null);
        when(mMockContext.getApplicationContext()).thenReturn(mMockContext);
        when(mMockContext.getApplicationContext()).thenReturn(mMockContext);
        when(mMockContext.getPackageManager()).thenReturn(mockPackageManager);
        when(mMockContext.getPackageManager()).thenReturn(mockPackageManager);
        List<ResolveInfo> playerList = new ArrayList<ResolveInfo>();
        when(mockPackageManager.queryIntentServices(any(), anyInt())).thenReturn(null);
        when(mockPackageManager.queryIntentServices(any(), anyInt())).thenReturn(null);


        Method method = BrowsablePlayerConnector.class.getDeclaredMethod("setInstanceForTesting",
        Method method = BrowsablePlayerConnector.class.getDeclaredMethod("setInstanceForTesting",
+3 −3
Original line number Original line Diff line number Diff line
@@ -371,7 +371,7 @@ public final class AvrcpItemTest {
        Assert.assertEquals(UUID, desc.getMediaId());
        Assert.assertEquals(UUID, desc.getMediaId());
        Assert.assertEquals(null, desc.getMediaUri());
        Assert.assertEquals(null, desc.getMediaUri());
        Assert.assertEquals(title, desc.getTitle().toString());
        Assert.assertEquals(title, desc.getTitle().toString());
        Assert.assertEquals(null, desc.getSubtitle());
        Assert.assertEquals(desc.getSubtitle(), null);
        Assert.assertEquals(uri, desc.getIconUri());
        Assert.assertEquals(uri, desc.getIconUri());
        Assert.assertEquals(null, desc.getIconBitmap());
        Assert.assertEquals(null, desc.getIconBitmap());
    }
    }
@@ -400,7 +400,7 @@ public final class AvrcpItemTest {
        Assert.assertEquals(UUID, desc.getMediaId());
        Assert.assertEquals(UUID, desc.getMediaId());
        Assert.assertEquals(null, desc.getMediaUri());
        Assert.assertEquals(null, desc.getMediaUri());
        Assert.assertEquals(displayName, desc.getTitle().toString());
        Assert.assertEquals(displayName, desc.getTitle().toString());
        Assert.assertEquals(null, desc.getSubtitle());
        Assert.assertEquals(desc.getSubtitle(), null);
        Assert.assertEquals(uri, desc.getIconUri());
        Assert.assertEquals(uri, desc.getIconUri());
        Assert.assertEquals(null, desc.getIconBitmap());
        Assert.assertEquals(null, desc.getIconBitmap());
    }
    }
@@ -427,7 +427,7 @@ public final class AvrcpItemTest {
        Assert.assertEquals(UUID, desc.getMediaId());
        Assert.assertEquals(UUID, desc.getMediaId());
        Assert.assertEquals(null, desc.getMediaUri());
        Assert.assertEquals(null, desc.getMediaUri());
        Assert.assertEquals(title, desc.getTitle().toString());
        Assert.assertEquals(title, desc.getTitle().toString());
        Assert.assertEquals(null, desc.getSubtitle());
        Assert.assertEquals(desc.getSubtitle(), null);
        Assert.assertEquals(uri, desc.getIconUri());
        Assert.assertEquals(uri, desc.getIconUri());
        Assert.assertEquals(null, desc.getIconBitmap());
        Assert.assertEquals(null, desc.getIconBitmap());
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Paths;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;


@@ -113,7 +113,7 @@ public final class BluetoothKeystoreServiceTest {
            "LE_KEY_LID ="
            "LE_KEY_LID ="
            );
            );


    private List<String> mConfigData = new LinkedList<>();
    private List<String> mConfigData = new ArrayList<>();


    private Map<String, String> mNameDecryptKeyResult = new HashMap<>();
    private Map<String, String> mNameDecryptKeyResult = new HashMap<>();


+10 −10
Original line number Original line Diff line number Diff line
@@ -166,7 +166,7 @@ public class HidDeviceTest {
            try {
            try {
                mConnectionStateChangedQueue.put(intent);
                mConnectionStateChangedQueue.put(intent);
            } catch (InterruptedException e) {
            } catch (InterruptedException e) {
                Assert.fail("Cannot add Intent to the queue");
                throw new AssertionError("Cannot add Intent to the queue", e);
            }
            }
        }
        }
    }
    }
@@ -177,9 +177,8 @@ public class HidDeviceTest {
            Assert.assertNotNull(intent);
            Assert.assertNotNull(intent);
            return intent;
            return intent;
        } catch (InterruptedException e) {
        } catch (InterruptedException e) {
            Assert.fail("Cannot obtain an Intent from the queue");
            throw new AssertionError("Cannot obtain an Intent from the queue", e);
        }
        }
        return null;
    }
    }


    private void verifyConnectionStateIntent(int timeoutMs, BluetoothDevice device, int newState,
    private void verifyConnectionStateIntent(int timeoutMs, BluetoothDevice device, int newState,
@@ -200,7 +199,7 @@ public class HidDeviceTest {
            int lastCallbackType = lastCallback;
            int lastCallbackType = lastCallback;
            Assert.assertEquals(callbackType, lastCallbackType);
            Assert.assertEquals(callbackType, lastCallbackType);
        } catch (InterruptedException e) {
        } catch (InterruptedException e) {
            Assert.fail("Cannot obtain a callback from the queue");
            throw new AssertionError("Cannot obtain a callback from the queue", e);
        }
        }
    }
    }


@@ -213,7 +212,7 @@ public class HidDeviceTest {
                    mCallbackQueue.put(CALLBACK_APP_UNREGISTERED);
                    mCallbackQueue.put(CALLBACK_APP_UNREGISTERED);
                }
                }
            } catch (InterruptedException e) {
            } catch (InterruptedException e) {
                Assert.fail("Cannot add Intent to the queue");
                throw new AssertionError("Cannot add Intent to the queue", e);
            }
            }
        }
        }


@@ -225,7 +224,7 @@ public class HidDeviceTest {
            try {
            try {
                mCallbackQueue.put(CALLBACK_ON_GET_REPORT);
                mCallbackQueue.put(CALLBACK_ON_GET_REPORT);
            } catch (InterruptedException e) {
            } catch (InterruptedException e) {
                Assert.fail("Cannot add Intent to the queue");
                throw new AssertionError("Cannot add Intent to the queue", e);
            }
            }
        }
        }


@@ -233,7 +232,7 @@ public class HidDeviceTest {
            try {
            try {
                mCallbackQueue.put(CALLBACK_ON_SET_REPORT);
                mCallbackQueue.put(CALLBACK_ON_SET_REPORT);
            } catch (InterruptedException e) {
            } catch (InterruptedException e) {
                Assert.fail("Cannot add Intent to the queue");
                throw new AssertionError("Cannot add Intent to the queue", e);
            }
            }
        }
        }


@@ -241,7 +240,7 @@ public class HidDeviceTest {
            try {
            try {
                mCallbackQueue.put(CALLBACK_ON_SET_PROTOCOL);
                mCallbackQueue.put(CALLBACK_ON_SET_PROTOCOL);
            } catch (InterruptedException e) {
            } catch (InterruptedException e) {
                Assert.fail("Cannot add Intent to the queue");
                throw new AssertionError("Cannot add Intent to the queue", e);
            }
            }
        }
        }


@@ -249,7 +248,8 @@ public class HidDeviceTest {
            try {
            try {
                mCallbackQueue.put(CALLBACK_ON_INTR_DATA);
                mCallbackQueue.put(CALLBACK_ON_INTR_DATA);
            } catch (InterruptedException e) {
            } catch (InterruptedException e) {
                Assert.fail("Cannot add Intent to the queue");
                throw new AssertionError("Cannot add Intent to the queue", e);

            }
            }
        }
        }


@@ -257,7 +257,7 @@ public class HidDeviceTest {
            try {
            try {
                mCallbackQueue.put(CALLBACK_ON_VIRTUAL_UNPLUG);
                mCallbackQueue.put(CALLBACK_ON_VIRTUAL_UNPLUG);
            } catch (InterruptedException e) {
            } catch (InterruptedException e) {
                Assert.fail("Cannot add Intent to the queue");
                throw new AssertionError("Cannot add Intent to the queue", e);
            }
            }
        }
        }
    }
    }
Loading