Check HIDL Discriminator for CSG Info
ART throws an exception if an unpopulated safe union element
is accessed at runtime, so instead we have to check the
hidl_discriminator to see whether the element is populated
before trying to access it (and thus we skip the null check).
Bug: 152486447
Test: atest testCellIdentityLte_1_5_CsgInfo \
testCellIdentityWcdma_1_5_CsgInfo \
testCellIdentityTdscdma_1_5_CsgInfo
Change-Id: I08dc0d2050a9f4d4b574178e1c68a23d015768e4
This commit is contained in:
@@ -151,8 +151,10 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
cid.bands.stream().mapToInt(Integer::intValue).toArray(), cid.base.bandwidth,
|
||||
cid.base.base.mcc, cid.base.base.mnc, cid.base.operatorNames.alphaLong,
|
||||
cid.base.operatorNames.alphaShort, cid.additionalPlmns,
|
||||
cid.optionalCsgInfo.csgInfo() != null
|
||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
||||
cid.optionalCsgInfo.getDiscriminator()
|
||||
== android.hardware.radio.V1_5.OptionalCsgInfo.hidl_discriminator.csgInfo
|
||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo())
|
||||
: null);
|
||||
}
|
||||
|
||||
private CellIdentityLte(@NonNull CellIdentityLte cid) {
|
||||
|
||||
@@ -126,8 +126,11 @@ public final class CellIdentityTdscdma extends CellIdentity {
|
||||
this(cid.base.base.mcc, cid.base.base.mnc, cid.base.base.lac, cid.base.base.cid,
|
||||
cid.base.base.cpid, cid.base.uarfcn, cid.base.operatorNames.alphaLong,
|
||||
cid.base.operatorNames.alphaShort,
|
||||
cid.additionalPlmns, cid.optionalCsgInfo.csgInfo() != null
|
||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
||||
cid.additionalPlmns,
|
||||
cid.optionalCsgInfo.getDiscriminator()
|
||||
== android.hardware.radio.V1_5.OptionalCsgInfo.hidl_discriminator.csgInfo
|
||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo())
|
||||
: null);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
|
||||
@@ -121,8 +121,10 @@ public final class CellIdentityWcdma extends CellIdentity {
|
||||
this(cid.base.base.lac, cid.base.base.cid, cid.base.base.psc, cid.base.base.uarfcn,
|
||||
cid.base.base.mcc, cid.base.base.mnc, cid.base.operatorNames.alphaLong,
|
||||
cid.base.operatorNames.alphaShort, cid.additionalPlmns,
|
||||
cid.optionalCsgInfo.csgInfo() != null
|
||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
||||
cid.optionalCsgInfo.getDiscriminator()
|
||||
== android.hardware.radio.V1_5.OptionalCsgInfo.hidl_discriminator.csgInfo
|
||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo())
|
||||
: null);
|
||||
}
|
||||
|
||||
private CellIdentityWcdma(@NonNull CellIdentityWcdma cid) {
|
||||
|
||||
Reference in New Issue
Block a user