From 6475b2182a8c82e14e6bfc8284c8aae1457b9e1a Mon Sep 17 00:00:00 2001 From: Pengquan Meng Date: Fri, 20 Sep 2019 10:19:06 -0700 Subject: [PATCH] Fix inconsistentcy API in CellInfoNr Add the annotation CovariantReturnType to CellInroNr#getCellSignalStrength() and CellInfo#getCellIdentity() to modify the return class to a NR specific class. bug: 136514894 Test: atest CellInfoTest Change-Id: If87b6bf13a84c60632a526ad9c49ca0ca77b5f8f --- telephony/java/android/telephony/CellInfoNr.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telephony/java/android/telephony/CellInfoNr.java b/telephony/java/android/telephony/CellInfoNr.java index 9775abd5075cd..cea83230391d9 100644 --- a/telephony/java/android/telephony/CellInfoNr.java +++ b/telephony/java/android/telephony/CellInfoNr.java @@ -19,6 +19,8 @@ package android.telephony; import android.annotation.NonNull; import android.os.Parcel; +import dalvik.annotation.codegen.CovariantReturnType; + import java.util.Objects; /** @@ -46,6 +48,7 @@ public final class CellInfoNr extends CellInfo { /** * @return a {@link CellIdentityNr} instance. */ + @CovariantReturnType(returnType = CellIdentityNr.class, presentAfter = 29) @Override @NonNull public CellIdentity getCellIdentity() { @@ -55,6 +58,7 @@ public final class CellInfoNr extends CellInfo { /** * @return a {@link CellSignalStrengthNr} instance. */ + @CovariantReturnType(returnType = CellSignalStrengthNr.class, presentAfter = 29) @Override @NonNull public CellSignalStrength getCellSignalStrength() {