diff --git a/api/system-current.txt b/api/system-current.txt index 465bfb5971ab6..8a4d11c18c89b 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8634,6 +8634,7 @@ package android.telephony { method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDeviceSoftwareVersion(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode(); + method public int getEmergencyNumberDbVersion(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst(); method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map getLogicalToPhysicalSlotMapping(); @@ -8672,6 +8673,7 @@ package android.telephony { method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isVideoCallingEnabled(); method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle); method public boolean needsOtaServiceProvisioning(); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyOtaEmergencyNumberDbInstalled(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean rebootRadio(); method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull android.os.WorkSource, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void requestNumberVerification(@NonNull android.telephony.PhoneNumberRange, long, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.NumberVerificationCallback); @@ -8699,8 +8701,8 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean switchSlots(int[]); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void toggleRadioOnOff(); method public void updateServiceLocation(); + method @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public void updateTestOtaEmergencyNumberDbFilePath(@NonNull String); field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_ANOMALY_REPORTED = "android.telephony.action.ANOMALY_REPORTED"; - field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_OTA_EMERGENCY_NUMBER_DB_INSTALLED = "android.telephony.action.OTA_EMERGENCY_NUMBER_DB_INSTALLED"; field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; @@ -8713,6 +8715,7 @@ package android.telephony { field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE"; field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL"; field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING"; + field public static final int INVALID_EMERGENCY_NUMBER_DB_VERSION = -1; // 0xffffffff field public static final int KEY_TYPE_EPDG = 1; // 0x1 field public static final int KEY_TYPE_WLAN = 2; // 0x2 field public static final long NETWORK_TYPE_BITMASK_1xRTT = 64L; // 0x40L diff --git a/api/test-current.txt b/api/test-current.txt index d59d15abfee68..1fe4274460b23 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -3021,16 +3021,19 @@ package android.telephony { method public int getCarrierIdListVersion(); method public java.util.List getCarrierPackageNamesForIntent(android.content.Intent); method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean); + method public int getEmergencyNumberDbVersion(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag(); method @NonNull public String getNetworkCountryIso(int); method public android.util.Pair getRadioHalVersion(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile(); method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String); method public void setCarrierTestOverride(String, String, String, String, String, String, String, String, String); + method @RequiresPermission("android.permission.READ_ACTIVE_EMERGENCY_SESSION") public void updateTestOtaEmergencyNumberDbFilePath(@NonNull String); field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1 field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0 field public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; // 0xffffffff + field public static final int INVALID_EMERGENCY_NUMBER_DB_VERSION = -1; // 0xffffffff field public static final int UNKNOWN_CARRIER_ID_LIST_VERSION = -1; // 0xffffffff } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index a46b4b2b9f5fd..2c3967305fe33 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -499,7 +499,6 @@ - diff --git a/services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java b/services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java index cb0b45ceaf050..c78a8e62cf855 100644 --- a/services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java +++ b/services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java @@ -37,9 +37,8 @@ public class EmergencyNumberDbInstallReceiver extends ConfigUpdateInstallReceive Slog.i(TAG, "Emergency number database is updated in file partition"); // Notify EmergencyNumberTracker for emergency number installation complete. - Intent notifyInstallComplete = new Intent( - TelephonyManager.ACTION_OTA_EMERGENCY_NUMBER_DB_INSTALLED); - context.sendBroadcast( - notifyInstallComplete, android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE); + TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService( + Context.TELEPHONY_SERVICE); + telephonyManager.notifyOtaEmergencyNumberDbInstalled(); } } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 2925b1154f149..1a5796bb810db 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -10910,14 +10910,66 @@ public class TelephonyManager { } /** - * Broadcast intent action for Ota emergency number database installation complete. + * Indicates Emergency number database version is invalid. * * @hide */ - @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @TestApi @SystemApi - public static final String ACTION_OTA_EMERGENCY_NUMBER_DB_INSTALLED = - "android.telephony.action.OTA_EMERGENCY_NUMBER_DB_INSTALLED"; + public static final int INVALID_EMERGENCY_NUMBER_DB_VERSION = -1; + + /** + * Notify Telephony for OTA emergency number database installation complete. + * + *

Requires permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @SystemApi + public void notifyOtaEmergencyNumberDbInstalled() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.notifyOtaEmergencyNumberDbInstalled(); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + Log.e(TAG, "notifyOtaEmergencyNumberDatabaseInstalled RemoteException", ex); + ex.rethrowAsRuntimeException(); + } + } + + /** + * Override the file path for testing OTA emergency number database in a file partition. + * + * @param otaFilePath The test OTA emergency number database file path; + * if "RESET", recover the original database file partition. + * Format: @ + * + *

Requires permission: + * {@link android.Manifest.permission#READ_ACTIVE_EMERGENCY_SESSION} + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) + @SystemApi + @TestApi + public void updateTestOtaEmergencyNumberDbFilePath(@NonNull String otaFilePath) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.updateTestOtaEmergencyNumberDbFilePath(otaFilePath); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + Log.e(TAG, "notifyOtaEmergencyNumberDatabaseInstalled RemoteException", ex); + ex.rethrowAsRuntimeException(); + } + } /** * Returns whether {@link TelephonyManager#ACTION_EMERGENCY_ASSISTANCE emergency assistance} is @@ -11114,6 +11166,29 @@ public class TelephonyManager { return false; } + /** + * A test API to return the emergency number db version. + * + *

Requires Permission: + * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} + * + * @hide + */ + @TestApi + @SystemApi + public int getEmergencyNumberDbVersion() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getEmergencyNumberDbVersion(getSubId()); + } + } catch (RemoteException ex) { + Log.e(TAG, "getEmergencyNumberDbVersion RemoteException", ex); + ex.rethrowAsRuntimeException(); + } + return INVALID_EMERGENCY_NUMBER_DB_VERSION; + } + /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"SET_OPPORTUNISTIC_SUB"}, value = { diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 2f18049e7e714..eedfc6a53e096 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1990,6 +1990,21 @@ interface ITelephony { */ List getEmergencyNumberListTestMode(); + /** + * A test API to return the emergency number db version. + */ + int getEmergencyNumberDbVersion(int subId); + + /** + * Notify Telephony for OTA emergency number database installation complete. + */ + void notifyOtaEmergencyNumberDbInstalled(); + + /** + * Override the file partition name for testing OTA emergency number database. + */ + void updateTestOtaEmergencyNumberDbFilePath(String otaFilePath); + /** * Enable or disable a logical modem stack associated with the slotIndex. */