From 816fdbb2b9378545af1cac3b2333c3e490c8c5b2 Mon Sep 17 00:00:00 2001 From: Brad Ebinger Date: Fri, 6 Mar 2020 14:05:16 -0800 Subject: [PATCH] API fix: getProprietaryCallExtras should not return null Fixes: 149216142 Test: atest CtsTelephonyTestCases Change-Id: I7bd0d44f08169d41396a8cb202f3928e14bc5939 --- api/system-current.txt | 2 +- api/test-current.txt | 2 +- .../java/android/telephony/ims/ImsCallProfile.java | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index e81af5a352982..bcc84d15e8905 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -12245,7 +12245,7 @@ package android.telephony.ims { method public int getEmergencyServiceCategories(); method @NonNull public java.util.List getEmergencyUrns(); method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile(); - method @Nullable public android.os.Bundle getProprietaryCallExtras(); + method @NonNull public android.os.Bundle getProprietaryCallExtras(); method public int getRestrictCause(); method public int getServiceType(); method public static int getVideoStateFromCallType(int); diff --git a/api/test-current.txt b/api/test-current.txt index a42710da10009..f5f2feb91dd9d 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -3833,7 +3833,7 @@ package android.telephony.ims { method public int getEmergencyServiceCategories(); method @NonNull public java.util.List getEmergencyUrns(); method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile(); - method @Nullable public android.os.Bundle getProprietaryCallExtras(); + method @NonNull public android.os.Bundle getProprietaryCallExtras(); method public int getRestrictCause(); method public int getServiceType(); method public static int getVideoStateFromCallType(int); diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java index 9c1be48e247ac..1597cd5a2f890 100644 --- a/telephony/java/android/telephony/ims/ImsCallProfile.java +++ b/telephony/java/android/telephony/ims/ImsCallProfile.java @@ -18,7 +18,6 @@ package android.telephony.ims; import android.annotation.IntDef; import android.annotation.NonNull; -import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; @@ -718,11 +717,16 @@ public final class ImsCallProfile implements Parcelable { * @return A {@link Bundle} containing proprietary call extras that were not set by the * platform. */ - public @Nullable Bundle getProprietaryCallExtras() { + public @NonNull Bundle getProprietaryCallExtras() { if (mCallExtras == null) { - return null; + return new Bundle(); } - return mCallExtras.getBundle(EXTRA_OEM_EXTRAS); + Bundle proprietaryExtras = mCallExtras.getBundle(EXTRA_OEM_EXTRAS); + if (proprietaryExtras == null) { + return new Bundle(); + } + // Make a copy so users do not accidentally change this copy of the extras. + return new Bundle(proprietaryExtras); } public ImsStreamMediaProfile getMediaProfile() {