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

Commit 3cba38ed authored by William Escande's avatar William Escande
Browse files

Errorprone: NarrowingCompoundAssignment

Compound assignments from char to byte hide lossy casts
Compound assignments from int to byte hide lossy casts
Compound assignments from float to long hide lossy casts

Test: m Bluetooth
Bug: 344658662
Flag: Exempt, enforce error in the futur
Change-Id: Ia39032913388c5f60209f750c5d0d245690e79ab
parent 06c9932b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -348,6 +348,7 @@ android_app {
            "-Xep:MockNotUsedInProduction:ERROR",
            "-Xep:ModifyCollectionInEnhancedForLoop:ERROR",
            "-Xep:NarrowCalculation:ERROR",
            "-Xep:NarrowingCompoundAssignment:ERROR",
            "-Xep:NonApiType:ERROR",
            "-Xep:NonAtomicVolatileUpdate:ERROR",
            "-Xep:NonCanonicalType:ERROR",
+7 −4
Original line number Diff line number Diff line
@@ -106,10 +106,13 @@ class AvrcpPlayer {

    public void setPlayStatus(int playStatus) {
        if (mPlayTime != PlaybackStateCompat.PLAYBACK_POSITION_UNKNOWN) {
            mPlayTime +=
                    mPlaySpeed
            mPlayTime =
                    (long)
                            (mPlayTime
                                    + mPlaySpeed
                                            * (SystemClock.elapsedRealtime()
                                    - mPlaybackStateCompat.getLastPositionUpdateTime());
                                                    - mPlaybackStateCompat
                                                            .getLastPositionUpdateTime()));
        }
        mPlayStatus = playStatus;
        switch (mPlayStatus) {
+1 −1
Original line number Diff line number Diff line
@@ -957,7 +957,7 @@ public class AppScanStats {
        int lowPowerScan = mLowPowerScan;
        int balancedScan = mBalancedScan;
        int lowLatencyScan = mLowLantencyScan;
        int ambientDiscoveryScan = mAmbientDiscoveryScan;
        long ambientDiscoveryScan = mAmbientDiscoveryScan;

        if (!mOngoingScans.isEmpty()) {
            for (Integer key : mOngoingScans.keySet()) {
+3 −3
Original line number Diff line number Diff line
@@ -208,11 +208,11 @@ public class BluetoothMapUtils {
        for (int i = 0; i != length; i++) {
            c = nibbles[i];
            if (c >= '0' && c <= '9') {
                c -= '0';
                c = (byte) (c - '0');
            } else if (c >= 'A' && c <= 'F') {
                c -= ('A' - 10);
                c = (byte) (c - ('A' - 10));
            } else if (c >= 'a' && c <= 'f') {
                c -= ('a' - 10);
                c = (byte) (c - ('a' - 10));
            } else if (c <= ' ' || c == '-') {
                Log.v(
                        TAG,