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

Commit 2290f7c5 authored by William Escande's avatar William Escande
Browse files

BluetoothApp: Enforce more error prone 3

This fix & enforce:
* EqualsGetClass
* ObjectEqualsForPrimitives
* ReferenceEquality

Test: m Bluetooth
Flag: Exempt refactor
Bug: 344658662
Change-Id: I8a3735bc315b9901b0896f57ab23063c73ffd736
parent 80c86846
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -331,6 +331,7 @@ android_app {
            "-Xep:ClassCanBeStatic:ERROR",
            "-Xep:DateFormatConstant:ERROR",
            "-Xep:EmptyBlockTag:ERROR",
            "-Xep:EqualsGetClass:ERROR",
            "-Xep:FallThrough:ERROR",
            "-Xep:HidingField:ERROR",
            "-Xep:InlineMeInliner:ERROR",
@@ -345,7 +346,9 @@ android_app {
            "-Xep:NonAtomicVolatileUpdate:ERROR",
            "-Xep:NonCanonicalType:ERROR",
            "-Xep:NotJavadoc:ERROR",
            "-Xep:ObjectEqualsForPrimitives:ERROR",
            "-Xep:OperatorPrecedence:ERROR",
            "-Xep:ReferenceEquality:ERROR",
            "-Xep:ReturnAtTheEndOfVoidFunction:ERROR",
            "-Xep:StringCaseLocaleUsage:ERROR",
            "-Xep:StringCharset:ERROR",
+8 −8
Original line number Diff line number Diff line
@@ -276,20 +276,20 @@ public class AvrcpItem {
        AvrcpItem other = ((AvrcpItem) o);
        return Objects.equals(mUuid, other.getUuid())
                && Objects.equals(mDevice, other.getDevice())
                && Objects.equals(mUid, other.getUid())
                && Objects.equals(mItemType, other.getItemType())
                && Objects.equals(mType, other.getType())
                && mUid == other.getUid()
                && mItemType == other.getItemType()
                && mType == other.getType()
                && Objects.equals(mTitle, other.getTitle())
                && Objects.equals(mDisplayableName, other.getDisplayableName())
                && Objects.equals(mArtistName, other.getArtistName())
                && Objects.equals(mAlbumName, other.getAlbumName())
                && Objects.equals(mTrackNumber, other.getTrackNumber())
                && Objects.equals(mTotalNumberOfTracks, other.getTotalNumberOfTracks())
                && mTrackNumber == other.getTrackNumber()
                && mTotalNumberOfTracks == other.getTotalNumberOfTracks()
                && Objects.equals(mGenre, other.getGenre())
                && Objects.equals(mPlayingTime, other.getPlayingTime())
                && mPlayingTime == other.getPlayingTime()
                && Objects.equals(mCoverArtHandle, other.getCoverArtHandle())
                && Objects.equals(mPlayable, other.isPlayable())
                && Objects.equals(mBrowsable, other.isBrowsable())
                && mPlayable == other.isPlayable()
                && mBrowsable == other.isBrowsable()
                && Objects.equals(mImageUri, other.getCoverArtLocation());
    }

+11 −8
Original line number Diff line number Diff line
@@ -145,16 +145,19 @@ public class BipAttachmentFormat {

    @Override
    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof BipAttachmentFormat)) return false;
        if (o == this) {
            return true;
        }
        if (!(o instanceof BipAttachmentFormat a)) {
            return false;
        }

        BipAttachmentFormat a = (BipAttachmentFormat) o;
        return a.getContentType() == getContentType()
                && a.getName() == getName()
                && a.getCharset() == getCharset()
        return a.getContentType().equals(getContentType())
                && a.getName().equals(getName())
                && Objects.equals(a.getCharset(), getCharset())
                && a.getSize() == getSize()
                && a.getCreatedDate() == getCreatedDate()
                && a.getModifiedDate() == getModifiedDate();
                && Objects.equals(a.getCreatedDate(), getCreatedDate())
                && Objects.equals(a.getModifiedDate(), getModifiedDate());
    }

    @Override
+7 −4
Original line number Diff line number Diff line
@@ -115,11 +115,14 @@ public class BipDateTime {

    @Override
    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof BipDateTime)) return false;
        if (o == this) {
            return true;
        }
        if (!(o instanceof BipDateTime d)) {
            return false;
        }

        BipDateTime d = (BipDateTime) o;
        return d.isUtc() == isUtc() && d.getTime() == getTime();
        return d.isUtc() == isUtc() && Objects.equals(d.getTime(), getTime());
    }

    @Override
+8 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.util.SparseArray;
import com.google.common.base.Ascii;

import java.util.HashMap;
import java.util.Objects;

/**
 * Represents an encoding method in which a BIP image is available.
@@ -172,12 +173,15 @@ public class BipEncoding {

    @Override
    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof BipEncoding)) return false;
        if (o == this) {
            return true;
        }
        if (!(o instanceof BipEncoding e)) {
            return false;
        }

        BipEncoding e = (BipEncoding) o;
        return e.getType() == getType()
                && e.getProprietaryEncodingId() == getProprietaryEncodingId();
                && Objects.equals(e.getProprietaryEncodingId(), getProprietaryEncodingId());
    }

    @Override
Loading