From b635fb8eb3cc07bb5ee6b011b6e71115f0a4f66e Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Wed, 26 Dec 2018 17:14:25 -0800 Subject: [PATCH] Fix BSIC Check in CellIdentityGsm Because Java uses signed bytes, a comparison between a byte and 0xFF will always fail after integer promotion. Fix this by forcing 0xFF to be treated as a byte for comparison. Bug: 119224773 Test: fixes build breakage Change-Id: I9615667a6b442060f1d43084d56bc9c3fdb3ba35 --- telephony/java/android/telephony/CellIdentityGsm.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java index c4fb5aae9db8f..9a24e47288c36 100644 --- a/telephony/java/android/telephony/CellIdentityGsm.java +++ b/telephony/java/android/telephony/CellIdentityGsm.java @@ -77,13 +77,14 @@ public final class CellIdentityGsm extends CellIdentity { /** @hide */ public CellIdentityGsm(android.hardware.radio.V1_0.CellIdentityGsm cid) { this(cid.lac, cid.cid, cid.arfcn, - cid.bsic == 0xFF ? CellInfo.UNAVAILABLE : cid.bsic, cid.mcc, cid.mnc, "", ""); + cid.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.bsic, + cid.mcc, cid.mnc, "", ""); } /** @hide */ public CellIdentityGsm(android.hardware.radio.V1_2.CellIdentityGsm cid) { this(cid.base.lac, cid.base.cid, cid.base.arfcn, - cid.base.bsic == 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc, + cid.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort); }