From cf5c66e69d2feb3eff1d28523ea131a7f402543e Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Fri, 3 Feb 2023 12:34:25 -0800 Subject: [PATCH] Added the extra to report last known country Unhide the extra key EXTRA_LAST_KNOWN_NETWORK_COUNTRY for clients to get last known country derived from the last known network. Fix: 261774369 Test: atest TelephonyManagerTest#testLastKnownCountryIso Change-Id: I4fdc93af38c214454183a24feec844fec3bfd4b3 --- core/api/current.txt | 1 + .../java/android/telephony/TelephonyManager.java | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index d3de15830ffae..30a99fab16e01 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -45358,6 +45358,7 @@ package android.telephony { field public static final String EXTRA_HIDE_PUBLIC_SETTINGS = "android.telephony.extra.HIDE_PUBLIC_SETTINGS"; field @Deprecated public static final String EXTRA_INCOMING_NUMBER = "incoming_number"; field public static final String EXTRA_IS_REFRESH = "android.telephony.extra.IS_REFRESH"; + field public static final String EXTRA_LAST_KNOWN_NETWORK_COUNTRY = "android.telephony.extra.LAST_KNOWN_NETWORK_COUNTRY"; field public static final String EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT = "android.telephony.extra.LAUNCH_VOICEMAIL_SETTINGS_INTENT"; field public static final String EXTRA_NETWORK_COUNTRY = "android.telephony.extra.NETWORK_COUNTRY"; field public static final String EXTRA_NOTIFICATION_COUNT = "android.telephony.extra.NOTIFICATION_COUNT"; diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index c238f2423f120..819b0b2ee713b 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -14894,7 +14894,10 @@ public class TelephonyManager { /** * The extra used with an {@link #ACTION_NETWORK_COUNTRY_CHANGED} to specify the - * the country code in ISO-3166-1 alpha-2 format. + * the country code in ISO-3166-1 alpha-2 format. This is the same country code returned by + * {@link #getNetworkCountryIso()}. This might be an empty string when the country code is not + * available. + * *

* Retrieve with {@link android.content.Intent#getStringExtra(String)}. */ @@ -14903,11 +14906,11 @@ public class TelephonyManager { /** * The extra used with an {@link #ACTION_NETWORK_COUNTRY_CHANGED} to specify the - * last known the country code in ISO-3166-1 alpha-2 format. + * last known the country code in ISO-3166-1 alpha-2 format. This might be an empty string when + * the country code was never available. The last known country code persists across reboot. + * *

* Retrieve with {@link android.content.Intent#getStringExtra(String)}. - * - * @hide */ public static final String EXTRA_LAST_KNOWN_NETWORK_COUNTRY = "android.telephony.extra.LAST_KNOWN_NETWORK_COUNTRY";