diff options
Diffstat (limited to 'telephony/java')
43 files changed, 2428 insertions, 582 deletions
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java new file mode 100644 index 0000000..e861668 --- /dev/null +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -0,0 +1,559 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import com.android.internal.telephony.ICarrierConfigLoader; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.annotation.SystemApi; +import android.content.Context; +import android.os.PersistableBundle; +import android.os.RemoteException; +import android.os.ServiceManager; + +/** + * Provides access to telephony configuration values that are carrier-specific. + * <p> + * Users should obtain an instance of this class by calling + * {@code mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);} + * </p> + * + * @see Context#getSystemService + * @see Context#CARRIER_CONFIG_SERVICE + */ +public class CarrierConfigManager { + private final static String TAG = "CarrierConfigManager"; + + /** + * @hide + */ + public CarrierConfigManager() { + } + + /** + * This intent is broadcast by the system when carrier config changes. + */ + public static final String + ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED"; + + // Below are the keys used in carrier config bundles. To add a new variable, define the key and + // give it a default value in sDefaults. If you need to ship a per-network override in the + // system image, that can be added in packages/apps/CarrierConfig. + + /** + * Flag indicating whether the Phone app should ignore EVENT_SIM_NETWORK_LOCKED + * events from the Sim. + * If true, this will prevent the IccNetworkDepersonalizationPanel from being shown, and + * effectively disable the "Sim network lock" feature. + */ + public static final String + KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool"; + + /** + * Flag indicating whether the Phone app should provide a "Dismiss" button on the SIM network + * unlock screen. The default value is true. If set to false, there will be *no way* to dismiss + * the SIM network unlock screen if you don't enter the correct unlock code. (One important + * consequence: there will be no way to make an Emergency Call if your SIM is network-locked and + * you don't know the PIN.) + */ + public static final String + KEY_SIM_NETWORK_UNLOCK_ALLOW_DISMISS_BOOL = "sim_network_unlock_allow_dismiss_bool"; + + /** Flag indicating if the phone is a world phone */ + public static final String KEY_WORLD_PHONE_BOOL = "world_phone_bool"; + + /** + * If true, enable vibration (haptic feedback) for key presses in the EmergencyDialer activity. + * The pattern is set on a per-platform basis using config_virtualKeyVibePattern. To be + * consistent with the regular Dialer, this value should agree with the corresponding values + * from config.xml under apps/Contacts. + */ + public static final String + KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_key_vibration_bool"; + + /** Flag indicating if dtmf tone type is enabled */ + public static final String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool"; + + /** Flag indicating if auto retry is enabled */ + public static final String KEY_AUTO_RETRY_ENABLED_BOOL = "auto_retry_enabled_bool"; + + /** + * Determine whether we want to play local DTMF tones in a call, or just let the radio/BP handle + * playing of the tones. + */ + public static final String KEY_ALLOW_LOCAL_DTMF_TONES_BOOL = "allow_local_dtmf_tones_bool"; + + /** + * If true, show an onscreen "Dial" button in the dialer. In practice this is used on all + * platforms, even the ones with hard SEND/END keys, but for maximum flexibility it's controlled + * by a flag here (which can be overridden on a per-product basis.) + */ + public static final String KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL = "show_onscreen_dial_button_bool"; + + /** Determines if device implements a noise suppression device for in call audio. */ + public static final String + KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool"; + + /** + * Determines if the current device should allow emergency numbers to be logged in the Call Log. + * (Some carriers require that emergency calls *not* be logged, presumably to avoid the risk of + * accidental redialing from the call log UI. This is a good idea, so the default here is + * false.) + */ + public static final String + KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool"; + + /** If true, removes the Voice Privacy option from Call Settings */ + public static final String KEY_VOICE_PRIVACY_DISABLE_UI_BOOL = "voice_privacy_disable_ui_bool"; + + /** Control whether users can reach the carrier portions of Cellular Network Settings. */ + public static final String + KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool"; + + /** Control whether users can reach the SIM lock settings. */ + public static final String + KEY_HIDE_SIM_LOCK_SETTINGS_BOOL = "hide_sim_lock_settings_bool"; + + /** Control whether users can edit APNs in Settings. */ + public static final String KEY_APN_EXPAND_BOOL = "apn_expand_bool"; + + /** Control whether users can choose a network operator. */ + public static final String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool"; + + /** Used in Cellular Network Settings for preferred network type. */ + public static final String KEY_PREFER_2G_BOOL = "prefer_2g_bool"; + + /** Show cdma network mode choices 1x, 3G, global etc. */ + public static final String KEY_SHOW_CDMA_CHOICES_BOOL = "show_cdma_choices_bool"; + + /** CDMA activation goes through HFA */ + public static final String KEY_USE_HFA_FOR_PROVISIONING_BOOL = "use_hfa_for_provisioning_bool"; + + /** + * CDMA activation goes through OTASP. + * <p> + * TODO: This should be combined with config_use_hfa_for_provisioning and implemented as an enum + * (NONE, HFA, OTASP). + */ + public static final String KEY_USE_OTASP_FOR_PROVISIONING_BOOL = "use_otasp_for_provisioning_bool"; + + /** Display carrier settings menu if true */ + public static final String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool"; + + /** Does not display additional call seting for IMS phone based on GSM Phone */ + public static final String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool"; + + /** Show APN Settings for some CDMA carriers */ + public static final String KEY_SHOW_APN_SETTING_CDMA_BOOL = "show_apn_setting_cdma_bool"; + + /** After a CDMA conference call is merged, the swap button should be displayed. */ + public static final String KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL = "support_swap_after_merge_bool"; + + /** + * Determine whether the voicemail notification is persistent in the notification bar. If true, + * the voicemail notifications cannot be dismissed from the notification bar. + */ + public static final String + KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL = "voicemail_notification_persistent_bool"; + + /** For IMS video over LTE calls, determines whether video pause signalling is supported. */ + public static final String + KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL = "support_pause_ims_video_calls_bool"; + + /** + * Disables dialing "*228" (OTASP provisioning) on CDMA carriers where it is not supported or is + * potentially harmful by locking the SIM to 3G. + */ + public static final String + KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool"; + + /** + * Override the platform's notion of a network operator being considered roaming. + * Value is string array of MCCMNCs to be considered roaming for 3GPP RATs. + */ + public static final String + KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY = "gsm_roaming_networks_string_array"; + + /** + * Override the platform's notion of a network operator being considered not roaming. + * Value is string array of MCCMNCs to be considered not roaming for 3GPP RATs. + */ + public static final String + KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY = "gsm_nonroaming_networks_string_array"; + + /** + * Override the platform's notion of a network operator being considered roaming. + * Value is string array of SIDs to be considered roaming for 3GPP2 RATs. + */ + public static final String + KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY = "cdma_roaming_networks_string_array"; + + /** + * Override the platform's notion of a network operator being considered non roaming. + * Value is string array of SIDs to be considered not roaming for 3GPP2 RATs. + */ + public static final String + KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY = "cdma_nonroaming_networks_string_array"; + + /** + * Override the platform's notion of a network operator being considered non roaming. + * If true all networks are considered as home network a.k.a non-roaming. When false, + * the 2 pairs of CMDA and GSM roaming/non-roaming arrays are consulted. + * + * @see KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY + * @see KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY + * @see KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY + * @see KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY + */ + public static final String + KEY_FORCE_HOME_NETWORK_BOOL = "force_home_network_bool"; + + /** + * Flag specifying whether VoLTE should be available for carrier, independent of carrier + * provisioning. If false: hard disabled. If true: then depends on carrier provisioning, + * availability, etc. + */ + public static final String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool"; + + /** + * Flag specifying whether video telephony is available for carrier. If false: hard disabled. + * If true: then depends on carrier provisioning, availability, etc. + */ + public static final String KEY_CARRIER_VT_AVAILABLE_BOOL = "carrier_vt_available_bool"; + + /** + * Flag specifying whether WFC over IMS should be available for carrier: independent of + * carrier provisioning. If false: hard disabled. If true: then depends on carrier + * provisioning, availability etc. + */ + public static final String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool"; + + /** Flag specifying whether provisioning is required for VOLTE. */ + public static final String KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL + = "carrier_volte_provisioning_required_bool"; + + /** Flag specifying whether VoLTE TTY is supported. */ + public static final String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL + = "carrier_volte_tty_supported_bool"; + + /** + * Flag specifying whether IMS service can be turned off. If false then the service will not be + * turned-off completely, but individual features can be disabled. + */ + public static final String KEY_CARRIER_ALLOW_TURNOFF_IMS_BOOL + = "carrier_allow_turnoff_ims_bool"; + + /** + * If Voice Radio Technology is RIL_RADIO_TECHNOLOGY_LTE:14 or RIL_RADIO_TECHNOLOGY_UNKNOWN:0 + * this is the value that should be used instead. A configuration value of + * RIL_RADIO_TECHNOLOGY_UNKNOWN:0 means there is no replacement value and that the default + * assumption for phone type (GSM) should be used. + */ + public static final String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int"; + + /** + * The default sim call manager to use when the default dialer doesn't implement one. A sim call + * manager can control and route outgoing and incoming phone calls, even if they're placed + * using another connection service (PSTN, for example). + */ + public static final String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string"; + + /* The following 3 fields are related to carrier visual voicemail. */ + + /** + * The carrier number mobile outgoing (MO) sms messages are sent to. + */ + public static final String KEY_VVM_DESTINATION_NUMBER_STRING = "vvm_destination_number_string"; + + /** + * The port through which the mobile outgoing (MO) sms messages are sent through. + */ + public static final String KEY_VVM_PORT_NUMBER_INT = "vvm_port_number_int"; + + /** + * The type of visual voicemail protocol the carrier adheres to. See {@link TelephonyManager} + * for possible values. For example {@link TelephonyManager#VVM_TYPE_OMTP}. + */ + public static final String KEY_VVM_TYPE_STRING = "vvm_type_string"; + + /** + * The package name of the carrier's visual voicemail app to ensure that dialer visual voicemail + * and carrier visual voicemail are not active at the same time. + */ + public static final String KEY_CARRIER_VVM_PACKAGE_NAME_STRING = "carrier_vvm_package_name_string"; + + /** + * Flag specifying whether an additional (client initiated) intent needs to be sent on System + * update + * @hide + */ + public static final String KEY_CI_ACTION_ON_SYS_UPDATE_BOOL = "ci_action_on_sys_update_bool"; + + /** + * Intent to be sent for the additional action on System update + * @hide + */ + public static final String KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING = + "ci_action_on_sys_update_intent_string"; + + /** + * Extra to be included in the intent sent for additional action on System update + * @hide + */ + public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING = + "ci_action_on_sys_update_extra_string"; + + /** + * Value of extra included in intent sent for additional action on System update + * @hide + */ + public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING = + "ci_action_on_sys_update_extra_val_string"; + + /** + * If this is true, the SIM card (through Customer Service Profile EF file) will be able to + * prevent manual operator selection. If false, this SIM setting will be ignored and manual + * operator selection will always be available. See CPHS4_2.WW6, CPHS B.4.7.1 for more + * information + */ + public static final String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool"; + + // These variables are used by the MMS service and exposed through another API, {@link + // SmsManager}. The variable names and string values are copied from there. + public static final String KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled"; + public static final String KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL = "allowAttachAudio"; + public static final String KEY_MMS_APPEND_TRANSACTION_ID_BOOL = "enabledTransID"; + public static final String KEY_MMS_GROUP_MMS_ENABLED_BOOL = "enableGroupMms"; + public static final String KEY_MMS_MMS_DELIVERY_REPORT_ENABLED_BOOL = "enableMMSDeliveryReports"; + public static final String KEY_MMS_MMS_ENABLED_BOOL = "enabledMMS"; + public static final String KEY_MMS_MMS_READ_REPORT_ENABLED_BOOL = "enableMMSReadReports"; + public static final String KEY_MMS_MULTIPART_SMS_ENABLED_BOOL = "enableMultipartSMS"; + public static final String KEY_MMS_NOTIFY_WAP_MMSC_ENABLED_BOOL = "enabledNotifyWapMMSC"; + public static final String KEY_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES_BOOL = "sendMultipartSmsAsSeparateMessages"; + public static final String KEY_MMS_SHOW_CELL_BROADCAST_APP_LINKS_BOOL = "config_cellBroadcastAppLinks"; + public static final String KEY_MMS_SMS_DELIVERY_REPORT_ENABLED_BOOL = "enableSMSDeliveryReports"; + public static final String KEY_MMS_SUPPORT_HTTP_CHARSET_HEADER_BOOL = "supportHttpCharsetHeader"; + public static final String KEY_MMS_SUPPORT_MMS_CONTENT_DISPOSITION_BOOL = "supportMmsContentDisposition"; + public static final String KEY_MMS_ALIAS_MAX_CHARS_INT = "aliasMaxChars"; + public static final String KEY_MMS_ALIAS_MIN_CHARS_INT = "aliasMinChars"; + public static final String KEY_MMS_HTTP_SOCKET_TIMEOUT_INT = "httpSocketTimeout"; + public static final String KEY_MMS_MAX_IMAGE_HEIGHT_INT = "maxImageHeight"; + public static final String KEY_MMS_MAX_IMAGE_WIDTH_INT = "maxImageWidth"; + public static final String KEY_MMS_MAX_MESSAGE_SIZE_INT = "maxMessageSize"; + public static final String KEY_MMS_MESSAGE_TEXT_MAX_SIZE_INT = "maxMessageTextSize"; + public static final String KEY_MMS_RECIPIENT_LIMIT_INT = "recipientLimit"; + public static final String KEY_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD_INT = "smsToMmsTextLengthThreshold"; + public static final String KEY_MMS_SMS_TO_MMS_TEXT_THRESHOLD_INT = "smsToMmsTextThreshold"; + public static final String KEY_MMS_SUBJECT_MAX_LENGTH_INT = "maxSubjectLength"; + public static final String KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING = "emailGatewayNumber"; + public static final String KEY_MMS_HTTP_PARAMS_STRING = "httpParams"; + public static final String KEY_MMS_NAI_SUFFIX_STRING = "naiSuffix"; + public static final String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName"; + public static final String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl"; + public static final String KEY_MMS_USER_AGENT_STRING = "userAgent"; + + /** The default value for every variable. */ + private final static PersistableBundle sDefaults; + + static { + sDefaults = new PersistableBundle(); + sDefaults.putBoolean(KEY_ADDITIONAL_CALL_SETTING_BOOL, true); + sDefaults.putBoolean(KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL, false); + sDefaults.putBoolean(KEY_ALLOW_LOCAL_DTMF_TONES_BOOL, true); + sDefaults.putBoolean(KEY_APN_EXPAND_BOOL, true); + sDefaults.putBoolean(KEY_AUTO_RETRY_ENABLED_BOOL, false); + sDefaults.putBoolean(KEY_CARRIER_SETTINGS_ENABLE_BOOL, false); + sDefaults.putBoolean(KEY_CARRIER_VOLTE_AVAILABLE_BOOL, false); + sDefaults.putBoolean(KEY_CARRIER_VT_AVAILABLE_BOOL, false); + sDefaults.putBoolean(KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL, false); + sDefaults.putBoolean(KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL, false); + sDefaults.putBoolean(KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, true); + sDefaults.putBoolean(KEY_CARRIER_ALLOW_TURNOFF_IMS_BOOL, true); + sDefaults.putBoolean(KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL, false); + sDefaults.putBoolean(KEY_DTMF_TYPE_ENABLED_BOOL, false); + sDefaults.putBoolean(KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL, true); + sDefaults.putBoolean(KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL, false); + sDefaults.putBoolean(KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL, false); + sDefaults.putBoolean(KEY_HIDE_SIM_LOCK_SETTINGS_BOOL, false); + sDefaults.putBoolean(KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL, false); + sDefaults.putBoolean(KEY_OPERATOR_SELECTION_EXPAND_BOOL, true); + sDefaults.putBoolean(KEY_PREFER_2G_BOOL, true); + sDefaults.putBoolean(KEY_SHOW_APN_SETTING_CDMA_BOOL, false); + sDefaults.putBoolean(KEY_SHOW_CDMA_CHOICES_BOOL, false); + sDefaults.putBoolean(KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL, true); + sDefaults.putBoolean(KEY_SIM_NETWORK_UNLOCK_ALLOW_DISMISS_BOOL, true); + sDefaults.putBoolean(KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL, true); + sDefaults.putBoolean(KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL, true); + sDefaults.putBoolean(KEY_USE_HFA_FOR_PROVISIONING_BOOL, false); + sDefaults.putBoolean(KEY_USE_OTASP_FOR_PROVISIONING_BOOL, false); + sDefaults.putBoolean(KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL, false); + sDefaults.putBoolean(KEY_VOICE_PRIVACY_DISABLE_UI_BOOL, false); + sDefaults.putBoolean(KEY_WORLD_PHONE_BOOL, false); + sDefaults.putInt(KEY_VOLTE_REPLACEMENT_RAT_INT, 0); + sDefaults.putString(KEY_DEFAULT_SIM_CALL_MANAGER_STRING, ""); + sDefaults.putString(KEY_VVM_DESTINATION_NUMBER_STRING, ""); + sDefaults.putInt(KEY_VVM_PORT_NUMBER_INT, 0); + sDefaults.putString(KEY_VVM_TYPE_STRING, ""); + sDefaults.putString(KEY_CARRIER_VVM_PACKAGE_NAME_STRING, ""); + sDefaults.putBoolean(KEY_CI_ACTION_ON_SYS_UPDATE_BOOL, false); + sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, ""); + sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, ""); + sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING, ""); + sDefaults.putBoolean(KEY_CSP_ENABLED_BOOL, false); + + sDefaults.putStringArray(KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY, null); + sDefaults.putStringArray(KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY, null); + sDefaults.putStringArray(KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY, null); + sDefaults.putStringArray(KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY, null); + sDefaults.putBoolean(KEY_FORCE_HOME_NETWORK_BOOL, false); + + // MMS defaults + sDefaults.putBoolean(KEY_MMS_ALIAS_ENABLED_BOOL, false); + sDefaults.putBoolean(KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL, true); + sDefaults.putBoolean(KEY_MMS_APPEND_TRANSACTION_ID_BOOL, false); + sDefaults.putBoolean(KEY_MMS_GROUP_MMS_ENABLED_BOOL, true); + sDefaults.putBoolean(KEY_MMS_MMS_DELIVERY_REPORT_ENABLED_BOOL, false); + sDefaults.putBoolean(KEY_MMS_MMS_ENABLED_BOOL, true); + sDefaults.putBoolean(KEY_MMS_MMS_READ_REPORT_ENABLED_BOOL, false); + sDefaults.putBoolean(KEY_MMS_MULTIPART_SMS_ENABLED_BOOL, true); + sDefaults.putBoolean(KEY_MMS_NOTIFY_WAP_MMSC_ENABLED_BOOL, false); + sDefaults.putBoolean(KEY_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES_BOOL, false); + sDefaults.putBoolean(KEY_MMS_SHOW_CELL_BROADCAST_APP_LINKS_BOOL, true); + sDefaults.putBoolean(KEY_MMS_SMS_DELIVERY_REPORT_ENABLED_BOOL, true); + sDefaults.putBoolean(KEY_MMS_SUPPORT_HTTP_CHARSET_HEADER_BOOL, false); + sDefaults.putBoolean(KEY_MMS_SUPPORT_MMS_CONTENT_DISPOSITION_BOOL, true); + sDefaults.putInt(KEY_MMS_ALIAS_MAX_CHARS_INT, 48); + sDefaults.putInt(KEY_MMS_ALIAS_MIN_CHARS_INT, 2); + sDefaults.putInt(KEY_MMS_HTTP_SOCKET_TIMEOUT_INT, 60 * 1000); + sDefaults.putInt(KEY_MMS_MAX_IMAGE_HEIGHT_INT, 480); + sDefaults.putInt(KEY_MMS_MAX_IMAGE_WIDTH_INT, 640); + sDefaults.putInt(KEY_MMS_MAX_MESSAGE_SIZE_INT, 300 * 1024); + sDefaults.putInt(KEY_MMS_MESSAGE_TEXT_MAX_SIZE_INT, -1); + sDefaults.putInt(KEY_MMS_RECIPIENT_LIMIT_INT, Integer.MAX_VALUE); + sDefaults.putInt(KEY_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD_INT, -1); + sDefaults.putInt(KEY_MMS_SMS_TO_MMS_TEXT_THRESHOLD_INT, -1); + sDefaults.putInt(KEY_MMS_SUBJECT_MAX_LENGTH_INT, 40); + sDefaults.putString(KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING, ""); + sDefaults.putString(KEY_MMS_HTTP_PARAMS_STRING, ""); + sDefaults.putString(KEY_MMS_NAI_SUFFIX_STRING, ""); + sDefaults.putString(KEY_MMS_UA_PROF_TAG_NAME_STRING, "x-wap-profile"); + sDefaults.putString(KEY_MMS_UA_PROF_URL_STRING, ""); + sDefaults.putString(KEY_MMS_USER_AGENT_STRING, ""); + } + + /** + * Gets the configuration values for a particular subscription, which is associated with a + * specific SIM card. If an invalid subId is used, the returned config will contain default + * values. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * + * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}. + * @return A {@link PersistableBundle} containing the config for the given subId, or default + * values for an invalid subId. + */ + @Nullable + public PersistableBundle getConfigForSubId(int subId) { + try { + return getICarrierConfigLoader().getConfigForSubId(subId); + } catch (RemoteException ex) { + Rlog.e(TAG, "Error getting config for subId " + Integer.toString(subId) + ": " + + ex.toString()); + } catch (NullPointerException ex) { + Rlog.e(TAG, "Error getting config for subId " + Integer.toString(subId) + ": " + + ex.toString()); + } + return null; + } + + /** + * Gets the configuration values for the default subscription. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * + * @see #getConfigForSubId + */ + @Nullable + public PersistableBundle getConfig() { + return getConfigForSubId(SubscriptionManager.getDefaultSubId()); + } + + /** + * Calling this method triggers telephony services to fetch the current carrier configuration. + * <p> + * Normally this does not need to be called because the platform reloads config on its own. + * This should be called by a carrier service app if it wants to update config at an arbitrary + * moment. + * </p> + * <p>Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges + * <p> + * This method returns before the reload has completed, and + * {@link android.service.carrier.CarrierService#onLoadConfig} will be called from an + * arbitrary thread. + * </p> + */ + public void notifyConfigChangedForSubId(int subId) { + try { + getICarrierConfigLoader().notifyConfigChangedForSubId(subId); + } catch (RemoteException ex) { + Rlog.e(TAG, "Error reloading config for subId=" + subId + ": " + ex.toString()); + } catch (NullPointerException ex) { + Rlog.e(TAG, "Error reloading config for subId=" + subId + ": " + ex.toString()); + } + } + + /** + * Request the carrier config loader to update the cofig for phoneId. + * <p> + * Depending on simState, the config may be cleared or loaded from config app. This is only used + * by SubscriptionInfoUpdater. + * </p> + * + * @hide + */ + @SystemApi + public void updateConfigForPhoneId(int phoneId, String simState) { + try { + getICarrierConfigLoader().updateConfigForPhoneId(phoneId, simState); + } catch (RemoteException ex) { + Rlog.e(TAG, "Error updating config for phoneId=" + phoneId + ": " + ex.toString()); + } catch (NullPointerException ex) { + Rlog.e(TAG, "Error updating config for phoneId=" + phoneId + ": " + ex.toString()); + } + } + + /** + * Returns a new bundle with the default value for every supported configuration variable. + * + * @hide + */ + @NonNull + @SystemApi + public static PersistableBundle getDefaultConfig() { + return new PersistableBundle(sDefaults); + } + + /** @hide */ + private ICarrierConfigLoader getICarrierConfigLoader() { + return ICarrierConfigLoader.Stub + .asInterface(ServiceManager.getService(Context.CARRIER_CONFIG_SERVICE)); + } +} diff --git a/telephony/java/android/telephony/CellIdentityCdma.java b/telephony/java/android/telephony/CellIdentityCdma.java index dbd48d9..b39b4c7 100644 --- a/telephony/java/android/telephony/CellIdentityCdma.java +++ b/telephony/java/android/telephony/CellIdentityCdma.java @@ -20,6 +20,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.telephony.Rlog; +import java.util.Objects; + /** * CellIdentity is to represent a unique CDMA cell */ @@ -137,27 +139,25 @@ public final class CellIdentityCdma implements Parcelable { @Override public int hashCode() { - int primeNum = 31; - return (mNetworkId * primeNum) + (mSystemId * primeNum) + (mBasestationId * primeNum) + - (mLatitude * primeNum) + (mLongitude * primeNum); + return Objects.hash(mNetworkId, mSystemId, mBasestationId, mLatitude, mLongitude); } @Override public boolean equals(Object other) { - if (super.equals(other)) { - try { - CellIdentityCdma o = (CellIdentityCdma)other; - return mNetworkId == o.mNetworkId && - mSystemId == o.mSystemId && - mBasestationId == o.mBasestationId && - mLatitude == o.mLatitude && - mLongitude == o.mLongitude; - } catch (ClassCastException e) { - return false; - } - } else { + if (this == other) { + return true; + } + + if (!(other instanceof CellIdentityCdma)) { return false; } + + CellIdentityCdma o = (CellIdentityCdma) other; + return mNetworkId == o.mNetworkId && + mSystemId == o.mSystemId && + mBasestationId == o.mBasestationId && + mLatitude == o.mLatitude && + mLongitude == o.mLongitude; } @Override diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java index 6f8cc91..90d2aa0 100644 --- a/telephony/java/android/telephony/CellIdentityGsm.java +++ b/telephony/java/android/telephony/CellIdentityGsm.java @@ -20,6 +20,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.telephony.Rlog; +import java.util.Objects; + /** * CellIdentity to represent a unique GSM cell */ @@ -113,25 +115,24 @@ public final class CellIdentityGsm implements Parcelable { @Override public int hashCode() { - int primeNum = 31; - return (mMcc * primeNum) + (mMnc * primeNum) + (mLac * primeNum) + (mCid * primeNum); + return Objects.hash(mMcc, mMnc, mLac, mCid); } @Override public boolean equals(Object other) { - if (super.equals(other)) { - try { - CellIdentityGsm o = (CellIdentityGsm)other; - return mMcc == o.mMcc && - mMnc == o.mMnc && - mLac == o.mLac && - mCid == o.mCid; - } catch (ClassCastException e) { - return false; - } - } else { + if (this == other) { + return true; + } + + if (!(other instanceof CellIdentityGsm)) { return false; } + + CellIdentityGsm o = (CellIdentityGsm) other; + return mMcc == o.mMcc && + mMnc == o.mMnc && + mLac == o.mLac && + mCid == o.mCid; } @Override diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java index 72578a4..1e7ac08 100644 --- a/telephony/java/android/telephony/CellIdentityLte.java +++ b/telephony/java/android/telephony/CellIdentityLte.java @@ -20,6 +20,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.telephony.Rlog; +import java.util.Objects; + /** * CellIdentity is to represent a unique LTE cell */ @@ -117,27 +119,25 @@ public final class CellIdentityLte implements Parcelable { @Override public int hashCode() { - int primeNum = 31; - return (mMcc * primeNum) + (mMnc * primeNum) + (mCi * primeNum) + (mPci * primeNum) + - (mTac * primeNum); + return Objects.hash(mMcc, mMnc, mCi, mPci, mTac); } @Override public boolean equals(Object other) { - if (super.equals(other)) { - try { - CellIdentityLte o = (CellIdentityLte)other; - return mMcc == o.mMcc && - mMnc == o.mMnc && - mCi == o.mCi && - mPci == o.mPci && - mTac == o.mTac; - } catch (ClassCastException e) { - return false; - } - } else { + if (this == other) { + return true; + } + + if (!(other instanceof CellIdentityLte)) { return false; } + + CellIdentityLte o = (CellIdentityLte) other; + return mMcc == o.mMcc && + mMnc == o.mMnc && + mCi == o.mCi && + mPci == o.mPci && + mTac == o.mTac; } @Override diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java index 2f8fa42..56ee8c9 100644 --- a/telephony/java/android/telephony/CellIdentityWcdma.java +++ b/telephony/java/android/telephony/CellIdentityWcdma.java @@ -20,6 +20,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.telephony.Rlog; +import java.util.Objects; + /** * CellIdentity to represent a unique UMTS cell */ @@ -118,27 +120,25 @@ public final class CellIdentityWcdma implements Parcelable { @Override public int hashCode() { - int primeNum = 31; - return (mMcc * primeNum) + (mMnc * primeNum) + (mLac * primeNum) + (mCid * primeNum) + - (mPsc * primeNum); + return Objects.hash(mMcc, mMnc, mLac, mCid, mPsc); } @Override public boolean equals(Object other) { - if (super.equals(other)) { - try { - CellIdentityWcdma o = (CellIdentityWcdma)other; - return mMcc == o.mMcc && - mMnc == o.mMnc && - mLac == o.mLac && - mCid == o.mCid && - mPsc == o.mPsc; - } catch (ClassCastException e) { - return false; - } - } else { + if (this == other) { + return true; + } + + if (!(other instanceof CellIdentityWcdma)) { return false; } + + CellIdentityWcdma o = (CellIdentityWcdma) other; + return mMcc == o.mMcc && + mMnc == o.mMnc && + mLac == o.mLac && + mCid == o.mCid && + mPsc == o.mPsc; } @Override diff --git a/telephony/java/android/telephony/CellSignalStrength.java b/telephony/java/android/telephony/CellSignalStrength.java index 9c23f78..2a3ef21 100644 --- a/telephony/java/android/telephony/CellSignalStrength.java +++ b/telephony/java/android/telephony/CellSignalStrength.java @@ -21,18 +21,19 @@ package android.telephony; */ public abstract class CellSignalStrength { - /** @hide */ public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0; - /** @hide */ + public static final int SIGNAL_STRENGTH_POOR = 1; - /** @hide */ + public static final int SIGNAL_STRENGTH_MODERATE = 2; - /** @hide */ + public static final int SIGNAL_STRENGTH_GOOD = 3; - /** @hide */ + public static final int SIGNAL_STRENGTH_GREAT = 4; + /** @hide */ public static final int NUM_SIGNAL_STRENGTH_BINS = 5; + /** @hide */ public static final String[] SIGNAL_STRENGTH_NAMES = { "none", "poor", "moderate", "good", "great" @@ -47,6 +48,12 @@ public abstract class CellSignalStrength { /** * Get signal level as an int from 0..4 + * <p> + * @see SIGNAL_STRENGTH_NONE_OR_UNKNOWN + * @see SIGNAL_STRENGTH_POOR + * @see SIGNAL_STRENGTH_MODERATE + * @see SIGNAL_STRENGTH_GOOD + * @see SIGNAL_STRENGTH_GREAT */ public abstract int getLevel(); diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java index 674777e..8443490 100644 --- a/telephony/java/android/telephony/DisconnectCause.java +++ b/telephony/java/android/telephony/DisconnectCause.java @@ -153,17 +153,17 @@ public class DisconnectCause { /** * The outgoing call failed with an unknown cause. */ - public static final int OUTGOING_FAILURE = 43; + public static final int OUTGOING_FAILURE = 43; /** * The outgoing call was canceled by the {@link android.telecom.ConnectionService}. */ - public static final int OUTGOING_CANCELED = 44; + public static final int OUTGOING_CANCELED = 44; /** * The call, which was an IMS call, disconnected because it merged with another call. */ - public static final int IMS_MERGED_SUCCESSFULLY = 45; + public static final int IMS_MERGED_SUCCESSFULLY = 45; /** * Stk Call Control modified DIAL request to USSD request. @@ -181,6 +181,12 @@ public class DisconnectCause { */ public static final int DIAL_MODIFIED_TO_DIAL = 48; + /** + * The call was terminated because CDMA phone service and roaming have already been activated. + * {@hide} + */ + public static final int CDMA_ALREADY_ACTIVATED = 49; + //********************************************************************************************* // When adding a disconnect type: // 1) Please assign the new type the next id value below. @@ -189,14 +195,14 @@ public class DisconnectCause { // 4) Update toString() with the newly added disconnect type. // 5) Update android.telecom.DisconnectCauseUtil with any mappings to a telecom.DisconnectCause. // - // NextId: 49 + // NextId: 50 //********************************************************************************************* /** Smallest valid value for call disconnect codes. */ public static final int MINIMUM_VALID_VALUE = NOT_DISCONNECTED; /** Largest valid value for call disconnect codes. */ - public static final int MAXIMUM_VALID_VALUE = DIAL_MODIFIED_TO_DIAL; + public static final int MAXIMUM_VALID_VALUE = CDMA_ALREADY_ACTIVATED; /** Private constructor to avoid class instantiation. */ private DisconnectCause() { @@ -302,6 +308,8 @@ public class DisconnectCause { return "OUTGOING_CANCELED"; case IMS_MERGED_SUCCESSFULLY: return "IMS_MERGED_SUCCESSFULLY"; + case CDMA_ALREADY_ACTIVATED: + return "CDMA_ALREADY_ACTIVATED"; default: return "INVALID: " + cause; } diff --git a/telephony/java/android/telephony/ModemActivityInfo.aidl b/telephony/java/android/telephony/ModemActivityInfo.aidl new file mode 100644 index 0000000..b85ef7a --- /dev/null +++ b/telephony/java/android/telephony/ModemActivityInfo.aidl @@ -0,0 +1,20 @@ +/* +** +** Copyright 2015, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package android.telephony; + +parcelable ModemActivityInfo; diff --git a/telephony/java/android/telephony/ModemActivityInfo.java b/telephony/java/android/telephony/ModemActivityInfo.java new file mode 100644 index 0000000..ea96e7c --- /dev/null +++ b/telephony/java/android/telephony/ModemActivityInfo.java @@ -0,0 +1,159 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.Arrays; + +/** + * Reports modem activity information + * @hide + */ +public class ModemActivityInfo implements Parcelable { + /** + * Tx power index + * index 0 = tx_power < 0dBm + * index 1 = 0dBm < tx_power < 5dBm + * index 2 = 5dBm < tx_power < 15dBm + * index 3 = 15dBm < tx_power < 20dBm + * index 4 = tx_power > 20dBm + */ + public static final int TX_POWER_LEVELS = 5; + + private final long mTimestamp; + private final int mSleepTimeMs; + private final int mIdleTimeMs; + private final int [] mTxTimeMs = new int[TX_POWER_LEVELS]; + private final int mRxTimeMs; + private final int mEnergyUsed; + + public ModemActivityInfo(long timestamp, int sleepTimeMs, int idleTimeMs, + int[] txTimeMs, int rxTimeMs, int energyUsed) { + mTimestamp = timestamp; + mSleepTimeMs = sleepTimeMs; + mIdleTimeMs = idleTimeMs; + System.arraycopy(txTimeMs, 0, mTxTimeMs, 0, Math.min(txTimeMs.length, TX_POWER_LEVELS)); + mRxTimeMs = rxTimeMs; + mEnergyUsed = energyUsed; + } + + @Override + public String toString() { + return "ModemActivityInfo{" + + " mTimestamp=" + mTimestamp + + " mSleepTimeMs=" + mSleepTimeMs + + " mTxTimeMs[]=" + Arrays.toString(mTxTimeMs) + + " mRxTimeMs=" + mRxTimeMs + + " mEnergyUsed=" + mEnergyUsed + + "}"; + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<ModemActivityInfo> CREATOR = + new Parcelable.Creator<ModemActivityInfo>() { + public ModemActivityInfo createFromParcel(Parcel in) { + long timestamp = in.readLong(); + int sleepTimeMs = in.readInt(); + int idleTimeMs = in.readInt(); + int[] txTimeMs = new int[TX_POWER_LEVELS]; + for (int i = 0; i < TX_POWER_LEVELS; i++) { + txTimeMs[i] = in.readInt(); + } + int rxTimeMs = in.readInt(); + int energyUsed = in.readInt(); + return new ModemActivityInfo(timestamp, sleepTimeMs, idleTimeMs, + txTimeMs, rxTimeMs, energyUsed); + } + + public ModemActivityInfo[] newArray(int size) { + return new ModemActivityInfo[size]; + } + }; + + public void writeToParcel(Parcel dest, int flags) { + dest.writeLong(mTimestamp); + dest.writeInt(mSleepTimeMs); + dest.writeInt(mIdleTimeMs); + for (int i = 0; i < TX_POWER_LEVELS; i++) { + dest.writeInt(mTxTimeMs[i]); + } + dest.writeInt(mRxTimeMs); + dest.writeInt(mEnergyUsed); + } + + /** + * @return timestamp of record creation + */ + public long getTimestamp() { + return mTimestamp; + } + + /** + * @return tx time in ms. It's an array of tx times + * with each index... + */ + public int [] getTxTimeMillis() { + return mTxTimeMs; + } + + /** + * @return sleep time in ms. + */ + public int getSleepTimeMillis() { + return mSleepTimeMs; + } + + /** + * @return idle time in ms. + */ + public int getIdleTimeMillis() { + return mIdleTimeMs; + } + + /** + * @return rx time in ms. + */ + public int getRxTimeMillis() { + return mRxTimeMs; + } + + /** + * product of current(mA), voltage(V) and time(ms) + * @return energy used + */ + public int getEnergyUsed () { + return mEnergyUsed; + } + + /** + * @return if the record is valid + */ + public boolean isValid() { + int totalTxTimeMs = 0; + int txTime [] = getTxTimeMillis(); + for (int i = 0; i < TX_POWER_LEVELS; i++) { + totalTxTimeMs += txTime[i]; + } + return ((getIdleTimeMillis() != 0) || (totalTxTimeMs != 0) + || (getSleepTimeMillis() != 0) || (getIdleTimeMillis() != 0)); + } +} diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 729eefa..d18b86a 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -34,11 +34,9 @@ import android.text.Editable; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.TextUtils; -import android.telephony.Rlog; import android.text.style.TtsSpan; import android.util.SparseIntArray; -import static com.android.internal.telephony.PhoneConstants.SUBSCRIPTION_KEY; import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_IDP_STRING; import java.util.Locale; @@ -1143,6 +1141,7 @@ public class PhoneNumberUtils * * @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead */ + @Deprecated public static String formatNumber(String source) { SpannableStringBuilder text = new SpannableStringBuilder(source); formatNumber(text, getFormatTypeForLocale(Locale.getDefault())); @@ -1161,6 +1160,7 @@ public class PhoneNumberUtils * @hide * @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead */ + @Deprecated public static String formatNumber(String source, int defaultFormattingType) { SpannableStringBuilder text = new SpannableStringBuilder(source); formatNumber(text, defaultFormattingType); @@ -1176,6 +1176,7 @@ public class PhoneNumberUtils * * @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead */ + @Deprecated public static int getFormatTypeForLocale(Locale locale) { String country = locale.getCountry(); @@ -1192,6 +1193,7 @@ public class PhoneNumberUtils * * @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead */ + @Deprecated public static void formatNumber(Editable text, int defaultFormattingType) { int formatType = defaultFormattingType; @@ -1240,6 +1242,7 @@ public class PhoneNumberUtils * * @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead */ + @Deprecated public static void formatNanpNumber(Editable text) { int length = text.length(); if (length > "+1-nnn-nnn-nnnn".length()) { @@ -1355,6 +1358,7 @@ public class PhoneNumberUtils * * @deprecated Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead */ + @Deprecated public static void formatJapaneseNumber(Editable text) { JapanesePhoneNumberFormatter.format(text); } @@ -1376,32 +1380,52 @@ public class PhoneNumberUtils } /** - * Format the given phoneNumber to the E.164 representation. + * Formats the specified {@code phoneNumber} to the E.164 representation. + * + * @param phoneNumber the phone number to format. + * @param defaultCountryIso the ISO 3166-1 two letters country code. + * @return the E.164 representation, or null if the given phone number is not valid. + */ + public static String formatNumberToE164(String phoneNumber, String defaultCountryIso) { + return formatNumberInternal(phoneNumber, defaultCountryIso, PhoneNumberFormat.E164); + } + + /** + * Formats the specified {@code phoneNumber} to the RFC3966 representation. + * + * @param phoneNumber the phone number to format. + * @param defaultCountryIso the ISO 3166-1 two letters country code. + * @return the RFC3966 representation, or null if the given phone number is not valid. + */ + public static String formatNumberToRFC3966(String phoneNumber, String defaultCountryIso) { + return formatNumberInternal(phoneNumber, defaultCountryIso, PhoneNumberFormat.RFC3966); + } + + /** + * Formats the raw phone number (string) using the specified {@code formatIdentifier}. * <p> - * The given phone number must have an area code and could have a country - * code. + * The given phone number must have an area code and could have a country code. * <p> - * The defaultCountryIso is used to validate the given number and generate - * the E.164 phone number if the given number doesn't have a country code. + * The defaultCountryIso is used to validate the given number and generate the formatted number + * if the specified number doesn't have a country code. * - * @param phoneNumber - * the phone number to format - * @param defaultCountryIso - * the ISO 3166-1 two letters country code - * @return the E.164 representation, or null if the given phone number is - * not valid. + * @param rawPhoneNumber The phone number to format. + * @param defaultCountryIso The ISO 3166-1 two letters country code. + * @param formatIdentifier The (enum) identifier of the desired format. + * @return the formatted representation, or null if the specified number is not valid. */ - public static String formatNumberToE164(String phoneNumber, String defaultCountryIso) { + private static String formatNumberInternal( + String rawPhoneNumber, String defaultCountryIso, PhoneNumberFormat formatIdentifier) { + PhoneNumberUtil util = PhoneNumberUtil.getInstance(); - String result = null; try { - PhoneNumber pn = util.parse(phoneNumber, defaultCountryIso); - if (util.isValidNumber(pn)) { - result = util.format(pn, PhoneNumberFormat.E164); + PhoneNumber phoneNumber = util.parse(rawPhoneNumber, defaultCountryIso); + if (util.isValidNumber(phoneNumber)) { + return util.format(phoneNumber, formatIdentifier); } - } catch (NumberParseException e) { - } - return result; + } catch (NumberParseException ignored) { } + + return null; } /** @@ -2056,14 +2080,35 @@ public class PhoneNumberUtils * @hide */ public static boolean isVoiceMailNumber(int subId, String number) { - String vmNumber; + return isVoiceMailNumber(null, subId, number); + } + /** + * isVoiceMailNumber: checks a given number against the voicemail + * number provided by the RIL and SIM card. The caller must have + * the READ_PHONE_STATE credential. + * + * @param context a non-null {@link Context}. + * @param subId the subscription id of the SIM. + * @param number the number to look up. + * @return true if the number is in the list of voicemail. False + * otherwise, including if the caller does not have the permission + * to read the VM number. + * @hide + */ + public static boolean isVoiceMailNumber(Context context, int subId, String number) { + String vmNumber; try { - vmNumber = TelephonyManager.getDefault().getVoiceMailNumber(subId); + final TelephonyManager tm; + if (context == null) { + tm = TelephonyManager.getDefault(); + } else { + tm = TelephonyManager.from(context); + } + vmNumber = tm.getVoiceMailNumber(subId); } catch (SecurityException ex) { return false; } - // Strip the separators from the number before comparing it // to the list. number = extractNetworkPortionAlt(number); @@ -2311,15 +2356,13 @@ public class PhoneNumberUtils * * @param phoneNumber A {@code CharSequence} the entirety of which represents a phone number. * @return A {@code CharSequence} with appropriate annotations. - * - * @hide */ - public static CharSequence ttsSpanAsPhoneNumber(CharSequence phoneNumber) { + public static CharSequence createTtsSpannable(CharSequence phoneNumber) { if (phoneNumber == null) { return null; } Spannable spannable = Spannable.Factory.getInstance().newSpannable(phoneNumber); - PhoneNumberUtils.ttsSpanAsPhoneNumber(spannable, 0, spannable.length()); + PhoneNumberUtils.addTtsSpan(spannable, 0, spannable.length()); return spannable; } @@ -2329,18 +2372,82 @@ public class PhoneNumberUtils * * @param s A {@code Spannable} to annotate. * @param start The starting character position of the phone number in {@code s}. + * @param endExclusive The position after the ending character in the phone number {@code s}. + */ + public static void addTtsSpan(Spannable s, int start, int endExclusive) { + s.setSpan(createTtsSpan(s.subSequence(start, endExclusive).toString()), + start, + endExclusive, + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + + /** + * Wrap the supplied {@code CharSequence} with a {@code TtsSpan}, annotating it as + * containing a phone number in its entirety. + * + * @param phoneNumber A {@code CharSequence} the entirety of which represents a phone number. + * @return A {@code CharSequence} with appropriate annotations. + * @deprecated Renamed {@link #createTtsSpannable}. + * + * @hide + */ + @Deprecated + public static CharSequence ttsSpanAsPhoneNumber(CharSequence phoneNumber) { + return createTtsSpannable(phoneNumber); + } + + /** + * Attach a {@link TtsSpan} to the supplied {@code Spannable} at the indicated location, + * annotating that location as containing a phone number. + * + * @param s A {@code Spannable} to annotate. + * @param start The starting character position of the phone number in {@code s}. * @param end The ending character position of the phone number in {@code s}. * + * @deprecated Renamed {@link #addTtsSpan}. + * * @hide */ + @Deprecated public static void ttsSpanAsPhoneNumber(Spannable s, int start, int end) { - s.setSpan( - new TtsSpan.TelephoneBuilder() - .setNumberParts(splitAtNonNumerics(s.subSequence(start, end))) - .build(), - start, - end, - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + addTtsSpan(s, start, end); + } + + /** + * Create a {@code TtsSpan} for the supplied {@code String}. + * + * @param phoneNumberString A {@code String} the entirety of which represents a phone number. + * @return A {@code TtsSpan} for {@param phoneNumberString}. + */ + public static TtsSpan createTtsSpan(String phoneNumberString) { + if (phoneNumberString == null) { + return null; + } + + // Parse the phone number + final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance(); + PhoneNumber phoneNumber = null; + try { + // Don't supply a defaultRegion so this fails for non-international numbers because + // we don't want to TalkBalk to read a country code (e.g. +1) if it is not already + // present + phoneNumber = phoneNumberUtil.parse(phoneNumberString, /* defaultRegion */ null); + } catch (NumberParseException ignored) { + } + + // Build a telephone tts span + final TtsSpan.TelephoneBuilder builder = new TtsSpan.TelephoneBuilder(); + if (phoneNumber == null) { + // Strip separators otherwise TalkBack will be silent + // (this behavior was observed with TalkBalk 4.0.2 from their alpha channel) + builder.setNumberParts(splitAtNonNumerics(phoneNumberString)); + } else { + if (phoneNumber.hasCountryCode()) { + builder.setCountryCode(Integer.toString(phoneNumber.getCountryCode())); + } + builder.setNumberParts(Long.toString(phoneNumber.getNationalNumber())); + } + return builder.build(); } // Split a phone number like "+20(123)-456#" using spaces, ignoring anything that is not @@ -2456,7 +2563,7 @@ public class PhoneNumberUtils * * @param number SIP address of the form "username@domainname" * (or the URI-escaped equivalent "username%40domainname") - * @see isUriNumber + * @see #isUriNumber * * @hide */ diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index fce4ae7..16472c8 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -27,13 +27,10 @@ import android.telephony.VoLteServiceState; import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SignalStrength; -import android.telephony.SubscriptionManager; import android.telephony.PreciseCallState; import android.telephony.PreciseDataConnectionState; import com.android.internal.telephony.IPhoneStateListener; -import com.android.internal.telephony.PhoneConstants; - import java.util.List; /** @@ -123,8 +120,7 @@ public class PhoneStateListener { /** * Listen for changes to the device call state. * {@more} - * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE - * READ_PHONE_STATE} + * * @see #onCallStateChanged */ public static final int LISTEN_CALL_STATE = 0x00000020; @@ -140,8 +136,6 @@ public class PhoneStateListener { * Listen for changes to the direction of data traffic on the data * connection (cellular). * {@more} - * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE - * READ_PHONE_STATE} * Example: The status bar uses this to display the appropriate * data-traffic icon. * @@ -222,6 +216,15 @@ public class PhoneStateListener { */ public static final int LISTEN_OEM_HOOK_RAW_EVENT = 0x00008000; + /** + * Listen for carrier network changes indicated by a carrier app. + * + * @see #onCarrierNetworkRequest + * @see TelephonyManager#notifyCarrierNetworkChange(boolean) + * @hide + */ + public static final int LISTEN_CARRIER_NETWORK_CHANGE = 0x00010000; + /* * Subscription used to listen to the phone state changes * @hide @@ -324,6 +327,9 @@ public class PhoneStateListener { case LISTEN_OEM_HOOK_RAW_EVENT: PhoneStateListener.this.onOemHookRawEvent((byte[])msg.obj); break; + case LISTEN_CARRIER_NETWORK_CHANGE: + PhoneStateListener.this.onCarrierNetworkChange((boolean)msg.obj); + break; } } @@ -379,6 +385,10 @@ public class PhoneStateListener { /** * Callback invoked when device call state changes. + * @param state call state + * @param incomingNumber incoming call phone number. If application does not have + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} permission, an empty + * string will be passed as an argument. * * @see TelephonyManager#CALL_STATE_IDLE * @see TelephonyManager#CALL_STATE_RINGING @@ -503,6 +513,22 @@ public class PhoneStateListener { } /** + * Callback invoked when telephony has received notice from a carrier + * app that a network action that could result in connectivity loss + * has been requested by an app using + * {@link android.telephony.TelephonyManager#notifyCarrierNetworkChange(boolean)} + * + * @param active Whether the carrier network change is or shortly + * will be active. This value is true to indicate + * showing alternative UI and false to stop. + * + * @hide + */ + public void onCarrierNetworkChange(boolean active) { + // default implementation empty + } + + /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. */ @@ -578,6 +604,10 @@ public class PhoneStateListener { public void onOemHookRawEvent(byte[] rawData) { Message.obtain(mHandler, LISTEN_OEM_HOOK_RAW_EVENT, 0, 0, rawData).sendToTarget(); } + + public void onCarrierNetworkChange(boolean active) { + Message.obtain(mHandler, LISTEN_CARRIER_NETWORK_CHANGE, 0, 0, active).sendToTarget(); + } }; private void log(String s) { diff --git a/telephony/java/android/telephony/PreciseCallState.java b/telephony/java/android/telephony/PreciseCallState.java index a85df15..f246416 100644 --- a/telephony/java/android/telephony/PreciseCallState.java +++ b/telephony/java/android/telephony/PreciseCallState.java @@ -16,10 +16,8 @@ package android.telephony; -import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; -import android.telephony.Rlog; import android.telephony.DisconnectCause; import android.telephony.PreciseDisconnectCause; diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java index 87529fe..31c9a9e 100644 --- a/telephony/java/android/telephony/PreciseDataConnectionState.java +++ b/telephony/java/android/telephony/PreciseDataConnectionState.java @@ -16,10 +16,8 @@ package android.telephony; -import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; -import android.telephony.Rlog; import android.telephony.TelephonyManager; import android.net.LinkProperties; diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java index d10a7ea..0c5c557 100644 --- a/telephony/java/android/telephony/RadioAccessFamily.java +++ b/telephony/java/android/telephony/RadioAccessFamily.java @@ -48,6 +48,13 @@ public class RadioAccessFamily implements Parcelable { public static final int RAF_GSM = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM); public static final int RAF_TD_SCDMA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA); + // Grouping of RAFs + private static final int GSM = RAF_GSM | RAF_GPRS | RAF_EDGE; + private static final int HS = RAF_HSUPA | RAF_HSDPA | RAF_HSPA | RAF_HSPAP; + private static final int CDMA = RAF_IS95A | RAF_IS95B | RAF_1xRTT; + private static final int EVDO = RAF_EVDO_0 | RAF_EVDO_A | RAF_EVDO_B | RAF_EHRPD; + private static final int WCDMA = HS | RAF_UMTS; + /* Phone ID of phone */ private int mPhoneId; @@ -136,12 +143,6 @@ public class RadioAccessFamily implements Parcelable { }; public static int getRafFromNetworkType(int type) { - final int GSM = RAF_GSM | RAF_GPRS | RAF_EDGE; - final int HS = RAF_HSUPA | RAF_HSDPA | RAF_HSPA | RAF_HSPAP; - final int CDMA = RAF_IS95A | RAF_IS95B | RAF_1xRTT; - final int EVDO = RAF_EVDO_0 | RAF_EVDO_A | RAF_EVDO_B; - final int WCDMA = HS | RAF_UMTS; - int raf; switch (type) { @@ -158,7 +159,7 @@ public class RadioAccessFamily implements Parcelable { raf = GSM | WCDMA; break; case RILConstants.NETWORK_MODE_CDMA: - raf = CDMA; + raf = CDMA | EVDO; break; case RILConstants.NETWORK_MODE_LTE_CDMA_EVDO: raf = RAF_LTE | CDMA | EVDO; @@ -188,7 +189,109 @@ public class RadioAccessFamily implements Parcelable { raf = RAF_UNKNOWN; break; } + return raf; } -} + /** + * if the raf includes ANY bit set for a group + * adjust it to contain ALL the bits for that group + */ + private static int getAdjustedRaf(int raf) { + raf = ((GSM & raf) > 0) ? (GSM | raf) : raf; + raf = ((WCDMA & raf) > 0) ? (WCDMA | raf) : raf; + raf = ((CDMA & raf) > 0) ? (CDMA | raf) : raf; + raf = ((EVDO & raf) > 0) ? (EVDO | raf) : raf; + + return raf; + } + + public static int getNetworkTypeFromRaf(int raf) { + int type; + + raf = getAdjustedRaf(raf); + + switch (raf) { + case (GSM | WCDMA): + type = RILConstants.NETWORK_MODE_WCDMA_PREF; + break; + case GSM: + type = RILConstants.NETWORK_MODE_GSM_ONLY; + break; + case WCDMA: + type = RILConstants.NETWORK_MODE_WCDMA_ONLY; + break; + case (CDMA | EVDO): + type = RILConstants.NETWORK_MODE_CDMA; + break; + case (RAF_LTE | CDMA | EVDO): + type = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO; + break; + case (RAF_LTE | GSM | WCDMA): + type = RILConstants.NETWORK_MODE_LTE_GSM_WCDMA; + break; + case (RAF_LTE | CDMA | EVDO | GSM | WCDMA): + type = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA; + break; + case RAF_LTE: + type = RILConstants.NETWORK_MODE_LTE_ONLY; + break; + case (RAF_LTE | WCDMA): + type = RILConstants.NETWORK_MODE_LTE_WCDMA; + break; + case CDMA: + type = RILConstants.NETWORK_MODE_CDMA_NO_EVDO; + break; + case EVDO: + type = RILConstants.NETWORK_MODE_EVDO_NO_CDMA; + break; + case (GSM | WCDMA | CDMA | EVDO): + type = RILConstants.NETWORK_MODE_GLOBAL; + break; + default: + type = RILConstants.PREFERRED_NETWORK_MODE ; + break; + } + + return type; + } + + public static int singleRafTypeFromString(String rafString) { + switch (rafString) { + case "GPRS": return RAF_GPRS; + case "EDGE": return RAF_EDGE; + case "UMTS": return RAF_UMTS; + case "IS95A": return RAF_IS95A; + case "IS95B": return RAF_IS95B; + case "1XRTT": return RAF_1xRTT; + case "EVDO_0": return RAF_EVDO_0; + case "EVDO_A": return RAF_EVDO_A; + case "HSDPA": return RAF_HSDPA; + case "HSUPA": return RAF_HSUPA; + case "HSPA": return RAF_HSPA; + case "EVDO_B": return RAF_EVDO_B; + case "EHRPD": return RAF_EHRPD; + case "LTE": return RAF_LTE; + case "HSPAP": return RAF_HSPAP; + case "GSM": return RAF_GSM; + case "TD_SCDMA":return RAF_TD_SCDMA; + case "HS": return HS; + case "CDMA": return CDMA; + case "EVDO": return EVDO; + case "WCDMA": return WCDMA; + default: return RAF_UNKNOWN; + } + } + + public static int rafTypeFromString(String rafList) { + rafList = rafList.toUpperCase(); + String[] rafs = rafList.split("\\|"); + int result = 0; + for(String raf : rafs) { + int rafType = singleRafTypeFromString(raf.trim()); + if (rafType == RAF_UNKNOWN) return rafType; + result |= rafType; + } + return result; + } +} diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 559a58c..303a492 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -148,7 +148,11 @@ public class ServiceState implements Parcelable { public static final int RIL_RADIO_TECHNOLOGY_GSM = 16; /** @hide */ public static final int RIL_RADIO_TECHNOLOGY_TD_SCDMA = 17; - + /** + * IWLAN + * @hide + */ + public static final int RIL_RADIO_TECHNOLOGY_IWLAN = 18; /** * Available registration states for GSM, UMTS and CDMA. */ @@ -697,6 +701,9 @@ public class ServiceState implements Parcelable { case RIL_RADIO_TECHNOLOGY_GSM: rtString = "GSM"; break; + case RIL_RADIO_TECHNOLOGY_IWLAN: + rtString = "IWLAN"; + break; default: rtString = "Unexpected"; Rlog.w(LOG_TAG, "Unexpected radioTechnology=" + rt); @@ -1030,6 +1037,8 @@ public class ServiceState implements Parcelable { return TelephonyManager.NETWORK_TYPE_HSPAP; case ServiceState.RIL_RADIO_TECHNOLOGY_GSM: return TelephonyManager.NETWORK_TYPE_GSM; + case ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN: + return TelephonyManager.NETWORK_TYPE_IWLAN; default: return TelephonyManager.NETWORK_TYPE_UNKNOWN; } @@ -1080,7 +1089,8 @@ public class ServiceState implements Parcelable { || radioTechnology == RIL_RADIO_TECHNOLOGY_LTE || radioTechnology == RIL_RADIO_TECHNOLOGY_HSPAP || radioTechnology == RIL_RADIO_TECHNOLOGY_GSM - || radioTechnology == RIL_RADIO_TECHNOLOGY_TD_SCDMA; + || radioTechnology == RIL_RADIO_TECHNOLOGY_TD_SCDMA + || radioTechnology == RIL_RADIO_TECHNOLOGY_IWLAN; } /** @hide */ @@ -1094,6 +1104,58 @@ public class ServiceState implements Parcelable { || radioTechnology == RIL_RADIO_TECHNOLOGY_EHRPD; } + /** @hide */ + public static boolean hasCdma(int radioTechnologyBitmask) { + int cdmaBitmask = (RIL_RADIO_TECHNOLOGY_IS95A + | RIL_RADIO_TECHNOLOGY_IS95B + | RIL_RADIO_TECHNOLOGY_1xRTT + | RIL_RADIO_TECHNOLOGY_EVDO_0 + | RIL_RADIO_TECHNOLOGY_EVDO_A + | RIL_RADIO_TECHNOLOGY_EVDO_B + | RIL_RADIO_TECHNOLOGY_EHRPD); + + return ((radioTechnologyBitmask & cdmaBitmask) != 0); + } + + /** @hide */ + public static boolean bitmaskHasTech(int bearerBitmask, int radioTech) { + if (bearerBitmask == 0) { + return true; + } else if (radioTech >= 1) { + return ((bearerBitmask & (1 << (radioTech - 1))) != 0); + } + return false; + } + + /** @hide */ + public static int getBitmaskForTech(int radioTech) { + if (radioTech >= 1) { + return (1 << (radioTech - 1)); + } + return 0; + } + + /** @hide */ + public static int getBitmaskFromString(String bearerList) { + String[] bearers = bearerList.split("\\|"); + int bearerBitmask = 0; + for (String bearer : bearers) { + int bearerInt = 0; + try { + bearerInt = Integer.parseInt(bearer.trim()); + } catch (NumberFormatException nfe) { + return 0; + } + + if (bearerInt == 0) { + return 0; + } + + bearerBitmask |= getBitmaskForTech(bearerInt); + } + return bearerBitmask; + } + /** * Returns a merged ServiceState consisting of the base SS with voice settings from the * voice SS. The voice SS is only used if it is IN_SERVICE (otherwise the base SS is returned). diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java index 17db3fb..f02d109 100644 --- a/telephony/java/android/telephony/SignalStrength.java +++ b/telephony/java/android/telephony/SignalStrength.java @@ -469,9 +469,12 @@ public class SignalStrength implements Parcelable { } /** - * Get signal level as an int from 0..4 + * Retrieve an abstract level value for the overall signal strength. * - * @hide + * @return a single integer from 0 to 4 representing the general signal quality. + * This may take into account many different radio technology inputs. + * 0 represents very poor signal strength + * while 4 represents a very strong signal strength. */ public int getLevel() { int level; diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index aca94e9..f4a6064 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -32,8 +32,6 @@ import com.android.internal.telephony.ISub; import com.android.internal.telephony.IOnSubscriptionsChangedListener; import com.android.internal.telephony.ITelephonyRegistry; import com.android.internal.telephony.PhoneConstants; -import com.android.internal.telephony.TelephonyProperties; - import java.util.ArrayList; import java.util.List; @@ -274,10 +272,6 @@ public class SubscriptionManager { * for #onSubscriptionsChanged to be invoked. */ public static class OnSubscriptionsChangedListener { - /** @hide */ - public static final String PERMISSION_ON_SUBSCRIPTIONS_CHANGED = - android.Manifest.permission.READ_PHONE_STATE; - private final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { @@ -341,7 +335,7 @@ public class SubscriptionManager { * onSubscriptionsChanged overridden. */ public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) { - String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>"; + String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>"; if (DBG) { logd("register OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug + " listener=" + listener); @@ -367,7 +361,7 @@ public class SubscriptionManager { * @param listener that is to be unregistered. */ public void removeOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) { - String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>"; + String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>"; if (DBG) { logd("unregister OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug + " listener=" + listener); @@ -393,7 +387,9 @@ public class SubscriptionManager { public SubscriptionInfo getActiveSubscriptionInfo(int subId) { if (VDBG) logd("[getActiveSubscriptionInfo]+ subId=" + subId); if (!isValidSubscriptionId(subId)) { - logd("[getActiveSubscriptionInfo]- invalid subId"); + if (DBG) { + logd("[getActiveSubscriptionInfo]- invalid subId"); + } return null; } @@ -402,7 +398,7 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - subInfo = iSub.getActiveSubscriptionInfo(subId); + subInfo = iSub.getActiveSubscriptionInfo(subId, mContext.getOpPackageName()); } } catch (RemoteException ex) { // ignore it @@ -430,7 +426,7 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getActiveSubscriptionInfoForIccId(iccId); + result = iSub.getActiveSubscriptionInfoForIccId(iccId, mContext.getOpPackageName()); } } catch (RemoteException ex) { // ignore it @@ -456,7 +452,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getActiveSubscriptionInfoForSimSlotIndex(slotIdx); + result = iSub.getActiveSubscriptionInfoForSimSlotIndex(slotIdx, + mContext.getOpPackageName()); } } catch (RemoteException ex) { // ignore it @@ -478,7 +475,7 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getAllSubInfoList(); + result = iSub.getAllSubInfoList(mContext.getOpPackageName()); } } catch (RemoteException ex) { // ignore it @@ -516,7 +513,7 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getActiveSubscriptionInfoList(); + result = iSub.getActiveSubscriptionInfoList(mContext.getOpPackageName()); } } catch (RemoteException ex) { // ignore it @@ -537,7 +534,7 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getAllSubInfoCount(); + result = iSub.getAllSubInfoCount(mContext.getOpPackageName()); } } catch (RemoteException ex) { // ignore it @@ -557,7 +554,7 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getActiveSubInfoCount(); + result = iSub.getActiveSubInfoCount(mContext.getOpPackageName()); } } catch (RemoteException ex) { // ignore it @@ -755,7 +752,9 @@ public class SubscriptionManager { */ public static int getSlotId(int subId) { if (!isValidSubscriptionId(subId)) { - logd("[getSlotId]- fail"); + if (DBG) { + logd("[getSlotId]- fail"); + } } int result = INVALID_SIM_SLOT_INDEX; @@ -797,7 +796,9 @@ public class SubscriptionManager { /** @hide */ public static int getPhoneId(int subId) { if (!isValidSubscriptionId(subId)) { - logd("[getPhoneId]- fail"); + if (DBG) { + logd("[getPhoneId]- fail"); + } return INVALID_PHONE_INDEX; } @@ -1105,9 +1106,9 @@ public class SubscriptionManager { } /** - * Returns a constant indicating the state of sim for the subscription. + * Returns a constant indicating the state of sim for the slot idx. * - * @param subId + * @param slotIdx * * {@See TelephonyManager#SIM_STATE_UNKNOWN} * {@See TelephonyManager#SIM_STATE_ABSENT} @@ -1121,17 +1122,33 @@ public class SubscriptionManager { * * {@hide} */ - public static int getSimStateForSubscriber(int subId) { - int simState; + public static int getSimStateForSlotIdx(int slotIdx) { + int simState = TelephonyManager.SIM_STATE_UNKNOWN; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); - simState = iSub.getSimStateForSubscriber(subId); + if (iSub != null) { + simState = iSub.getSimStateForSlotIdx(slotIdx); + } } catch (RemoteException ex) { - simState = TelephonyManager.SIM_STATE_UNKNOWN; } - logd("getSimStateForSubscriber: simState=" + simState + " subId=" + subId); + logd("getSimStateForSubscriber: simState=" + simState + " slotIdx=" + slotIdx); return simState; } -} + /** + * @return true if the sub ID is active. i.e. The sub ID corresponds to a known subscription + * and the SIM providing the subscription is present in a slot and in "LOADED" state. + * @hide + */ + public boolean isActiveSubId(int subId) { + try { + ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); + if (iSub != null) { + return iSub.isActiveSubId(subId); + } + } catch (RemoteException ex) { + } + return false; + } +} diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index dbd4f92..e74344c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -20,6 +20,7 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.app.ActivityThread; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -29,21 +30,22 @@ import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; +import android.telecom.PhoneAccount; import android.util.Log; import com.android.internal.telecom.ITelecomService; +import com.android.internal.telephony.CellNetworkScanResult; import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.ITelephonyRegistry; +import com.android.internal.telephony.OperatorInfo; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.TelephonyProperties; import java.io.FileInputStream; import java.io.IOException; -import java.util.Arrays; import java.util.List; -import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -132,6 +134,16 @@ public class TelephonyManager { return sInstance; } + private String getOpPackageName() { + // For legacy reasons the TelephonyManager has API for getting + // a static instance with no context set preventing us from + // getting the op package name. As a workaround we do a best + // effort and get the context from the current activity thread. + if (mContext != null) { + return mContext.getOpPackageName(); + } + return ActivityThread.currentOpPackageName(); + } /** * Returns the multi SIM variant @@ -161,7 +173,6 @@ public class TelephonyManager { * Returns 1 for Single standby mode (Single SIM functionality) * Returns 2 for Dual standby mode.(Dual SIM functionality) */ - /** {@hide} */ public int getPhoneCount() { int phoneCount = 1; switch (getMultiSimConfiguration()) { @@ -195,7 +206,7 @@ public class TelephonyManager { // /** - * Broadcast intent action indicating that the call state (cellular) + * Broadcast intent action indicating that the call state * on the device has changed. * * <p> @@ -259,11 +270,33 @@ public class TelephonyManager { * <p> * Output: nothing. */ - @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + @SdkConstant(SdkConstantType.SERVICE_ACTION) public static final String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE"; /** + * The emergency dialer may choose to present activities with intent filters for this + * action as emergency assistance buttons that launch the activity when clicked. + * + * @hide + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_EMERGENCY_ASSISTANCE = + "android.telephony.action.EMERGENCY_ASSISTANCE"; + + /** + * Open the voicemail settings activity to make changes to voicemail configuration. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_CONFIGURE_VOICEMAIL = + "android.telephony.action.CONFIGURE_VOICEMAIL"; + + /** + * @hide + */ + public static final boolean EMERGENCY_ASSISTANCE_ENABLED = false; + + /** * The lookup key used with the {@link #ACTION_PHONE_STATE_CHANGED} broadcast * for a String containing the new call state. * @@ -568,6 +601,49 @@ public class TelephonyManager { */ public static final String EXTRA_DATA_FAILURE_CAUSE = PhoneConstants.DATA_FAILURE_CAUSE_KEY; + /** + * Response codes for sim activation. Activation completed successfully. + * @hide + */ + @SystemApi + public static final int SIM_ACTIVATION_RESULT_COMPLETE = 0; + /** + * Response codes for sim activation. Activation not supported (device has no SIM). + * @hide + */ + @SystemApi + public static final int SIM_ACTIVATION_RESULT_NOT_SUPPORTED = 1; + /** + * Response codes for sim activation. Activation is in progress. + * @hide + */ + @SystemApi + public static final int SIM_ACTIVATION_RESULT_IN_PROGRESS = 2; + /** + * Response codes for sim activation. Activation failed to complete. + * @hide + */ + @SystemApi + public static final int SIM_ACTIVATION_RESULT_FAILED = 3; + /** + * Response codes for sim activation. Activation canceled by user. + * @hide + */ + @SystemApi + public static final int SIM_ACTIVATION_RESULT_CANCELED = 4; + + /* Visual voicemail protocols */ + + /** + * The OMTP protocol. + */ + public static final String VVM_TYPE_OMTP = "vvm_type_omtp"; + + /** + * A flavor of OMTP protocol with a different mobile originated (MO) format + */ + public static final String VVM_TYPE_CVVM = "vvm_type_cvvm"; + // // // Device Info @@ -607,7 +683,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getDeviceSvnUsingSubId(subId[0]); + return info.getDeviceSvnUsingSubId(subId[0], mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -627,7 +703,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; - return telephony.getDeviceId(); + return telephony.getDeviceId(mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -644,7 +720,6 @@ public class TelephonyManager { * * @param slotId of which deviceID is returned */ - /** {@hide} */ public String getDeviceId(int slotId) { // FIXME this assumes phoneId == slotId try { @@ -685,7 +760,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getImeiForSubscriber(subId[0]); + return info.getImeiForSubscriber(subId[0], mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -714,7 +789,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - String nai = info.getNaiForSubscriber(subId[0]); + String nai = info.getNaiForSubscriber(subId[0], mContext.getOpPackageName()); if (Log.isLoggable(TAG, Log.VERBOSE)) { Rlog.v(TAG, "Nai = " + nai); } @@ -744,17 +819,26 @@ public class TelephonyManager { public CellLocation getCellLocation() { try { ITelephony telephony = getITelephony(); - if (telephony == null) + if (telephony == null) { + Rlog.d(TAG, "getCellLocation returning null because telephony is null"); return null; - Bundle bundle = telephony.getCellLocation(); - if (bundle.isEmpty()) return null; + } + Bundle bundle = telephony.getCellLocation(mContext.getOpPackageName()); + if (bundle.isEmpty()) { + Rlog.d(TAG, "getCellLocation returning null because bundle is empty"); + return null; + } CellLocation cl = CellLocation.newFromBundle(bundle); - if (cl.isEmpty()) + if (cl.isEmpty()) { + Rlog.d(TAG, "getCellLocation returning null because CellLocation is empty"); return null; + } return cl; } catch (RemoteException ex) { + Rlog.d(TAG, "getCellLocation returning null due to RemoteException " + ex); return null; } catch (NullPointerException ex) { + Rlog.d(TAG, "getCellLocation returning null due to NullPointerException " + ex); return null; } } @@ -818,16 +902,17 @@ public class TelephonyManager { } /** - * Returns the neighboring cell information of the device. The getAllCellInfo is preferred - * and use this only if getAllCellInfo return nulls or an empty list. - *<p> - * In the future this call will be deprecated. - *<p> + * Returns the neighboring cell information of the device. + * * @return List of NeighboringCellInfo or null if info unavailable. * * <p>Requires Permission: * (@link android.Manifest.permission#ACCESS_COARSE_UPDATES} + * + * @deprecated Use (@link getAllCellInfo} which returns a superset of the information + * from NeighboringCellInfo. */ + @Deprecated public List<NeighboringCellInfo> getNeighboringCellInfo() { try { ITelephony telephony = getITelephony(); @@ -878,10 +963,17 @@ public class TelephonyManager { /** {@hide} */ @SystemApi public int getCurrentPhoneType(int subId) { - int phoneId = SubscriptionManager.getPhoneId(subId); + int phoneId; + if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) { + // if we don't have any sims, we don't have subscriptions, but we + // still may want to know what type of phone we've got. + phoneId = 0; + } else { + phoneId = SubscriptionManager.getPhoneId(subId); + } try{ ITelephony telephony = getITelephony(); - if (telephony != null) { + if (telephony != null && subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { return telephony.getActivePhoneTypeForSubscriber(subId); } else { // This can happen when the ITelephony interface is not up yet. @@ -1238,6 +1330,10 @@ public class TelephonyManager { public static final int NETWORK_TYPE_HSPAP = 15; /** Current network is GSM {@hide} */ public static final int NETWORK_TYPE_GSM = 16; + /** Current network is TD_SCDMA {@hide} */ + public static final int NETWORK_TYPE_TD_SCDMA = 17; + /** Current network is IWLAN {@hide} */ + public static final int NETWORK_TYPE_IWLAN = 18; /** * @return the NETWORK_TYPE_xxxx for current data connection. @@ -1275,7 +1371,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getNetworkTypeForSubscriber(subId); + return telephony.getNetworkTypeForSubscriber(subId, getOpPackageName()); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; @@ -1329,7 +1425,7 @@ public class TelephonyManager { try{ ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getDataNetworkTypeForSubscriber(subId); + return telephony.getDataNetworkTypeForSubscriber(subId, getOpPackageName()); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; @@ -1408,8 +1504,10 @@ public class TelephonyManager { case NETWORK_TYPE_EVDO_B: case NETWORK_TYPE_EHRPD: case NETWORK_TYPE_HSPAP: + case NETWORK_TYPE_TD_SCDMA: return NETWORK_CLASS_3_G; case NETWORK_TYPE_LTE: + case NETWORK_TYPE_IWLAN: return NETWORK_CLASS_4_G; default: return NETWORK_CLASS_UNKNOWN; @@ -1469,6 +1567,10 @@ public class TelephonyManager { return "HSPA+"; case NETWORK_TYPE_GSM: return "GSM"; + case NETWORK_TYPE_TD_SCDMA: + return "TD_SCDMA"; + case NETWORK_TYPE_IWLAN: + return "IWLAN"; default: return "UNKNOWN"; } @@ -1556,7 +1658,25 @@ public class TelephonyManager { * @see #SIM_STATE_CARD_IO_ERROR */ public int getSimState() { - return getSimState(getDefaultSim()); + int slotIdx = getDefaultSim(); + // slotIdx may be invalid due to sim being absent. In that case query all slots to get + // sim state + if (slotIdx < 0) { + // query for all slots and return absent if all sim states are absent, otherwise + // return unknown + for (int i = 0; i < getPhoneCount(); i++) { + int simState = getSimState(i); + if (simState != SIM_STATE_ABSENT) { + Rlog.d(TAG, "getSimState: default sim:" + slotIdx + ", sim state for " + + "slotIdx=" + i + " is " + simState + ", return state as unknown"); + return SIM_STATE_UNKNOWN; + } + } + Rlog.d(TAG, "getSimState: default sim:" + slotIdx + ", all SIMs absent, return " + + "state as absent"); + return SIM_STATE_ABSENT; + } + return getSimState(slotIdx); } /** @@ -1576,13 +1696,7 @@ public class TelephonyManager { */ /** {@hide} */ public int getSimState(int slotIdx) { - int[] subId = SubscriptionManager.getSubId(slotIdx); - if (subId == null || subId.length == 0) { - Rlog.d(TAG, "getSimState:- empty subId return SIM_STATE_ABSENT"); - return SIM_STATE_UNKNOWN; - } - int simState = SubscriptionManager.getSimStateForSubscriber(subId[0]); - Rlog.d(TAG, "getSimState: simState=" + simState + " slotIdx=" + slotIdx); + int simState = SubscriptionManager.getSimStateForSlotIdx(slotIdx); return simState; } @@ -1633,7 +1747,6 @@ public class TelephonyManager { } } } - Rlog.d(TAG, "getSimOperatorNumeric(): default subId=" + subId); return getSimOperatorNumericForSubscription(subId); } @@ -1767,7 +1880,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getIccSerialNumberForSubscriber(subId); + return info.getIccSerialNumberForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1806,7 +1919,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return PhoneConstants.LTE_ON_CDMA_UNKNOWN; - return telephony.getLteOnCdmaModeForSubscriber(subId); + return telephony.getLteOnCdmaModeForSubscriber(subId, getOpPackageName()); } catch (RemoteException ex) { // Assume no ICC card if remote exception which shouldn't happen return PhoneConstants.LTE_ON_CDMA_UNKNOWN; @@ -1849,7 +1962,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getSubscriberIdForSubscriber(subId); + return info.getSubscriberIdForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1870,7 +1983,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getGroupIdLevel1(); + return info.getGroupIdLevel1(mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1894,7 +2007,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getGroupIdLevel1ForSubscriber(subId); + return info.getGroupIdLevel1ForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1909,6 +2022,8 @@ public class TelephonyManager { * <p> * Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * <p> + * The default SMS app can also use this. */ public String getLine1Number() { return getLine1NumberForSubscriber(getDefaultSubscription()); @@ -1920,6 +2035,8 @@ public class TelephonyManager { * <p> * Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * <p> + * The default SMS app can also use this. * * @param subId whose phone number for line 1 is returned */ @@ -1929,7 +2046,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - number = telephony.getLine1NumberForDisplay(subId); + number = telephony.getLine1NumberForDisplay(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -1940,7 +2057,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getLine1NumberForSubscriber(subId); + return info.getLine1NumberForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2021,7 +2138,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - alphaTag = telephony.getLine1AlphaTagForDisplay(subId); + alphaTag = telephony.getLine1AlphaTagForDisplay(subId, + getOpPackageName()); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -2032,7 +2150,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getLine1AlphaTagForSubscriber(subId); + return info.getLine1AlphaTagForSubscriber(subId, getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2053,7 +2171,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.getMergedSubscriberIds(); + return telephony.getMergedSubscriberIds(getOpPackageName()); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -2088,7 +2206,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getMsisdnForSubscriber(subId); + return info.getMsisdnForSubscriber(subId, getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2121,7 +2239,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getVoiceMailNumberForSubscriber(subId); + return info.getVoiceMailNumberForSubscriber(subId, getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2201,7 +2319,8 @@ public class TelephonyManager { } /** - * Returns the voice mail count. Return 0 if unavailable. + * Returns the voice mail count. Return 0 if unavailable, -1 if there are unread voice messages + * but the count is unknown. * <p> * Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} @@ -2259,7 +2378,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getVoiceMailAlphaTagForSubscriber(subId); + return info.getVoiceMailAlphaTagForSubscriber(subId, getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2346,10 +2465,23 @@ public class TelephonyManager { public static final int CALL_STATE_OFFHOOK = 2; /** - * Returns a constant indicating the call state (cellular) on the device. + * Returns one of the following constants that represents the current state of all + * phone calls. + * + * {@link TelephonyManager#CALL_STATE_RINGING} + * {@link TelephonyManager#CALL_STATE_OFFHOOK} + * {@link TelephonyManager#CALL_STATE_IDLE} */ public int getCallState() { - return getCallState(getDefaultSubscription()); + try { + ITelecomService telecom = getTelecomService(); + if (telecom != null) { + return telecom.getCallState(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecomService#getCallState", e); + } + return CALL_STATE_IDLE; } /** @@ -2495,10 +2627,11 @@ public class TelephonyManager { * LISTEN_ flags. */ public void listen(PhoneStateListener listener, int events) { - String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>"; + if (mContext == null) return; try { Boolean notifyNow = (getITelephony() != null); - sRegistry.listenForSubscriber(listener.mSubId, pkgForDebug, listener.callback, events, notifyNow); + sRegistry.listenForSubscriber(listener.mSubId, getOpPackageName(), + listener.callback, events, notifyNow); } catch (RemoteException ex) { // system process dead } catch (NullPointerException ex) { @@ -2524,7 +2657,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return -1; - return telephony.getCdmaEriIconIndexForSubscriber(subId); + return telephony.getCdmaEriIconIndexForSubscriber(subId, getOpPackageName()); } catch (RemoteException ex) { // the phone process is restarting. return -1; @@ -2555,7 +2688,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return -1; - return telephony.getCdmaEriIconModeForSubscriber(subId); + return telephony.getCdmaEriIconModeForSubscriber(subId, getOpPackageName()); } catch (RemoteException ex) { // the phone process is restarting. return -1; @@ -2583,7 +2716,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; - return telephony.getCdmaEriTextForSubscriber(subId); + return telephony.getCdmaEriTextForSubscriber(subId, getOpPackageName()); } catch (RemoteException ex) { // the phone process is restarting. return null; @@ -2635,7 +2768,7 @@ public class TelephonyManager { * The list can include one or more of {@link android.telephony.CellInfoGsm CellInfoGsm}, * {@link android.telephony.CellInfoCdma CellInfoCdma}, * {@link android.telephony.CellInfoLte CellInfoLte} and - * {@link android.telephony.CellInfoWcdma CellInfoCdma} in any combination. + * {@link android.telephony.CellInfoWcdma CellInfoWcdma} in any combination. * Specifically on devices with multiple radios it is typical to see instances of * one or more of any these in the list. In addition 0, 1 or more CellInfo * objects may return isRegistered() true. @@ -2653,7 +2786,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; - return telephony.getAllCellInfo(); + return telephony.getAllCellInfo(getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -3144,8 +3277,6 @@ public class TelephonyManager { propVal = values[phoneId]; } } - Rlog.d(TAG, "getTelephonyProperty: return propVal='" + propVal + "' phoneId=" + phoneId - + " property='" + property + "' defaultVal='" + defaultVal + "' prop=" + prop); return propVal == null ? defaultVal : propVal; } @@ -3267,7 +3398,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return new String[0]; - return telephony.getPcscfAddress(apnType); + return telephony.getPcscfAddress(apnType, getOpPackageName()); } catch (RemoteException e) { return new String[0]; } @@ -3299,11 +3430,11 @@ public class TelephonyManager { * @return the preferred network type, defined in RILConstants.java. * @hide */ - public int getPreferredNetworkType() { + public int getPreferredNetworkType(int subId) { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.getPreferredNetworkType(); + return telephony.getPreferredNetworkType(subId); } catch (RemoteException ex) { Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex); } catch (NullPointerException ex) { @@ -3313,6 +3444,76 @@ public class TelephonyManager { } /** + * Sets the network selection mode to automatic. + * <p> + * Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges + * + * @hide + */ + public void setNetworkSelectionModeAutomatic(int subId) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) + telephony.setNetworkSelectionModeAutomatic(subId); + } catch (RemoteException ex) { + Rlog.e(TAG, "setNetworkSelectionModeAutomatic RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "setNetworkSelectionModeAutomatic NPE", ex); + } + } + + /** + * Perform a radio scan and return the list of avialble networks. + * + * The return value is a list of the OperatorInfo of the networks found. Note that this + * scan can take a long time (sometimes minutes) to happen. + * + * <p> + * Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges + * + * @hide + */ + public CellNetworkScanResult getCellNetworkScanResults(int subId) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) + return telephony.getCellNetworkScanResults(subId); + } catch (RemoteException ex) { + Rlog.e(TAG, "getCellNetworkScanResults RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "getCellNetworkScanResults NPE", ex); + } + return null; + } + + /** + * Ask the radio to connect to the input network and change selection mode to manual. + * + * <p> + * Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges + * + * @hide + */ + public boolean setNetworkSelectionModeManual(int subId, OperatorInfo operator) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) + return telephony.setNetworkSelectionModeManual(subId, operator); + } catch (RemoteException ex) { + Rlog.e(TAG, "setNetworkSelectionModeManual RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "setNetworkSelectionModeManual NPE", ex); + } + return false; + } + + /** * Set the preferred network type. * Used for device configuration by some CDMA operators. * <p> @@ -3320,15 +3521,16 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * Or the calling app has carrier privileges. @see #hasCarrierPrivileges * + * @param subId the id of the subscription to set the preferred network type for. * @param networkType the preferred network type, defined in RILConstants.java. * @return true on success; false on any failure. * @hide */ - public boolean setPreferredNetworkType(int networkType) { + public boolean setPreferredNetworkType(int subId, int networkType) { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.setPreferredNetworkType(networkType); + return telephony.setPreferredNetworkType(subId, networkType); } catch (RemoteException ex) { Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex); } catch (NullPointerException ex) { @@ -3347,7 +3549,8 @@ public class TelephonyManager { * @return true on success; false on any failure. */ public boolean setPreferredNetworkTypeToGlobal() { - return setPreferredNetworkType(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA); + return setPreferredNetworkType(getDefaultSubscription(), + RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA); } /** @@ -3375,13 +3578,13 @@ public class TelephonyManager { /** * Values used to return status for hasCarrierPrivileges call. */ - /** @hide */ + /** @hide */ @SystemApi public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; - /** @hide */ + /** @hide */ @SystemApi public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; - /** @hide */ + /** @hide */ @SystemApi public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; - /** @hide */ + /** @hide */ @SystemApi public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; /** @@ -3516,11 +3719,11 @@ public class TelephonyManager { /** @hide */ @SystemApi - public int checkCarrierPrivilegesForPackage(String pkgname) { + public int checkCarrierPrivilegesForPackage(String pkgName) { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.checkCarrierPrivilegesForPackage(pkgname); + return telephony.checkCarrierPrivilegesForPackage(pkgName); } catch (RemoteException ex) { Rlog.e(TAG, "checkCarrierPrivilegesForPackage RemoteException", ex); } catch (NullPointerException ex) { @@ -3531,15 +3734,36 @@ public class TelephonyManager { /** @hide */ @SystemApi + public int checkCarrierPrivilegesForPackageAnyPhone(String pkgName) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) + return telephony.checkCarrierPrivilegesForPackageAnyPhone(pkgName); + } catch (RemoteException ex) { + Rlog.e(TAG, "checkCarrierPrivilegesForPackageAnyPhone RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "checkCarrierPrivilegesForPackageAnyPhone NPE", ex); + } + return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; + } + + /** @hide */ + @SystemApi public List<String> getCarrierPackageNamesForIntent(Intent intent) { + return getCarrierPackageNamesForIntentAndPhone(intent, getDefaultPhone()); + } + + /** @hide */ + @SystemApi + public List<String> getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId) { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.getCarrierPackageNamesForIntent(intent); + return telephony.getCarrierPackageNamesForIntentAndPhone(intent, phoneId); } catch (RemoteException ex) { - Rlog.e(TAG, "getCarrierPackageNamesForIntent RemoteException", ex); + Rlog.e(TAG, "getCarrierPackageNamesForIntentAndPhone RemoteException", ex); } catch (NullPointerException ex) { - Rlog.e(TAG, "getCarrierPackageNamesForIntent NPE", ex); + Rlog.e(TAG, "getCarrierPackageNamesForIntentAndPhone NPE", ex); } return null; } @@ -3597,7 +3821,7 @@ public class TelephonyManager { @SystemApi public void silenceRinger() { try { - getTelecomService().silenceRinger(); + getTelecomService().silenceRinger(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#silenceRinger", e); } @@ -3609,7 +3833,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.isOffhook(); + return telephony.isOffhook(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isOffhook", e); } @@ -3622,7 +3846,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.isRinging(); + return telephony.isRinging(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isRinging", e); } @@ -3635,7 +3859,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.isIdle(); + return telephony.isIdle(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isIdle", e); } @@ -3648,7 +3872,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.isRadioOn(); + return telephony.isRadioOn(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isRadioOn", e); } @@ -3661,7 +3885,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.isSimPinEnabled(); + return telephony.isSimPinEnabled(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isSimPinEnabled", e); } @@ -3928,7 +4152,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.isVideoCallingEnabled(); + return telephony.isVideoCallingEnabled(getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isVideoCallingEnabled", e); } @@ -3936,12 +4160,74 @@ public class TelephonyManager { } /** - * This function retrieves value for setting "name+subId", and if that is not found - * retrieves value for setting "name", and if that is not found uses def as default + * Whether the device supports configuring the DTMF tone length. * - * @hide */ - public static int getIntWithSubId(ContentResolver cr, String name, int subId, int def) { - return Settings.Global.getInt(cr, name + subId, Settings.Global.getInt(cr, name, def)); + * @return {@code true} if the DTMF tone length can be changed, and {@code false} otherwise. + */ + public boolean canChangeDtmfToneLength() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.canChangeDtmfToneLength(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#canChangeDtmfToneLength", e); + } catch (SecurityException e) { + Log.w(TAG, "Permission error calling ITelephony#canChangeDtmfToneLength", e); + } + return false; + } + + /** + * Whether the device is a world phone. + * + * @return {@code true} if the device is a world phone, and {@code false} otherwise. + */ + public boolean isWorldPhone() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.isWorldPhone(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#isWorldPhone", e); + } + return false; + } + + /** + * Whether the phone supports TTY mode. + * + * @return {@code true} if the device supports TTY mode, and {@code false} otherwise. + */ + public boolean isTtyModeSupported() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.isTtyModeSupported(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#isTtyModeSupported", e); + } + return false; + } + + /** + * Whether the phone supports hearing aid compatibility. + * + * @return {@code true} if the device supports hearing aid compatibility, and {@code false} + * otherwise. + */ + public boolean isHearingAidCompatibilitySupported() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.isHearingAidCompatibilitySupported(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#isHearingAidCompatibilitySupported", e); + } + return false; } /** @@ -3984,7 +4270,7 @@ public class TelephonyManager { /** * Returns the IMS Registration Status - *@hide + * @hide */ public boolean isImsRegistered() { try { @@ -4000,6 +4286,34 @@ public class TelephonyManager { } /** + * Returns the Status of Volte + *@hide + */ + public boolean isVolteEnabled() { + try { + return getITelephony().isVolteEnabled(); + } catch (RemoteException ex) { + return false; + } catch (NullPointerException ex) { + return false; + } + } + + /** + * Returns the Status of Wi-Fi Calling + *@hide + */ + public boolean isWifiCallingEnabled() { + try { + return getITelephony().isWifiCallingEnabled(); + } catch (RemoteException ex) { + return false; + } catch (NullPointerException ex) { + return false; + } + } + + /** * Set TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC for the default phone. * * @hide @@ -4338,4 +4652,65 @@ public class TelephonyManager { ServiceState.rilRadioTechnologyToString(type)); } } + + /** + * Returns the subscription ID for the given phone account. + * @hide + */ + public int getSubIdForPhoneAccount(PhoneAccount phoneAccount) { + int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID; + try { + ITelephony service = getITelephony(); + if (service != null) { + retval = service.getSubIdForPhoneAccount(phoneAccount); + } + } catch (RemoteException e) { + } + + return retval; + } + + /** + * Resets telephony manager settings back to factory defaults. + * + * @hide + */ + public void factoryReset(int subId) { + try { + Log.d(TAG, "factoryReset: subId=" + subId); + ITelephony telephony = getITelephony(); + if (telephony != null) + telephony.factoryReset(subId); + } catch (RemoteException e) { + } + } + + + /** @hide */ + public String getLocaleFromDefaultSim() { + try { + final ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getLocaleFromDefaultSim(); + } + } catch (RemoteException ex) { + } + return null; + } + + /** + * Returns the modem activity info. + * @hide + */ + public ModemActivityInfo getModemActivityInfo() { + try { + ITelephony service = getITelephony(); + if (service != null) { + return service.getModemActivityInfo(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#getModemActivityInfo", e); + } + return null; + } } diff --git a/telephony/java/com/android/ims/ImsCallProfile.java b/telephony/java/com/android/ims/ImsCallProfile.java index 8740e19..2c4354b 100644 --- a/telephony/java/com/android/ims/ImsCallProfile.java +++ b/telephony/java/com/android/ims/ImsCallProfile.java @@ -143,6 +143,8 @@ public class ImsCallProfile implements Parcelable { public static final int OIR_DEFAULT = 0; // "user subscription default value" public static final int OIR_PRESENTATION_RESTRICTED = 1; public static final int OIR_PRESENTATION_NOT_RESTRICTED = 2; + public static final int OIR_PRESENTATION_UNKNOWN = 3; + public static final int OIR_PRESENTATION_PAYPHONE = 4; /** * Values for EXTRA_DIALSTRING @@ -270,7 +272,6 @@ public class ImsCallProfile implements Parcelable { return "{ serviceType=" + mServiceType + ", callType=" + mCallType + ", restrictCause=" + mRestrictCause + - ", callExtras=" + mCallExtras.toString() + ", mediaProfile=" + mMediaProfile.toString() + " }"; } @@ -313,22 +314,31 @@ public class ImsCallProfile implements Parcelable { * @param callType The call type. * @return The video state. */ - public static int getVideoStateFromCallType(int callType) { - switch (callType) { - case CALL_TYPE_VT_NODIR: - return VideoProfile.VideoState.PAUSED | - VideoProfile.VideoState.BIDIRECTIONAL; + public static int getVideoStateFromImsCallProfile(ImsCallProfile callProfile) { + int videostate = VideoProfile.STATE_AUDIO_ONLY; + switch (callProfile.mCallType) { case CALL_TYPE_VT_TX: - return VideoProfile.VideoState.TX_ENABLED; + videostate = VideoProfile.STATE_TX_ENABLED; + break; case CALL_TYPE_VT_RX: - return VideoProfile.VideoState.RX_ENABLED; + videostate = VideoProfile.STATE_RX_ENABLED; + break; case CALL_TYPE_VT: - return VideoProfile.VideoState.BIDIRECTIONAL; + videostate = VideoProfile.STATE_BIDIRECTIONAL; + break; case CALL_TYPE_VOICE: - return VideoProfile.VideoState.AUDIO_ONLY; + videostate = VideoProfile.STATE_AUDIO_ONLY; + break; default: - return VideoProfile.VideoState.AUDIO_ONLY; + videostate = VideoProfile.STATE_AUDIO_ONLY; + break; } + if (callProfile.isVideoPaused() && !VideoProfile.isAudioOnly(videostate)) { + videostate |= VideoProfile.STATE_PAUSED; + } else { + videostate &= ~VideoProfile.STATE_PAUSED; + } + return videostate; } /** @@ -339,9 +349,9 @@ public class ImsCallProfile implements Parcelable { * @return The call type. */ public static int getCallTypeFromVideoState(int videoState) { - boolean videoTx = isVideoStateSet(videoState, VideoProfile.VideoState.TX_ENABLED); - boolean videoRx = isVideoStateSet(videoState, VideoProfile.VideoState.RX_ENABLED); - boolean isPaused = isVideoStateSet(videoState, VideoProfile.VideoState.PAUSED); + boolean videoTx = isVideoStateSet(videoState, VideoProfile.STATE_TX_ENABLED); + boolean videoRx = isVideoStateSet(videoState, VideoProfile.STATE_RX_ENABLED); + boolean isPaused = isVideoStateSet(videoState, VideoProfile.STATE_PAUSED); if (isPaused) { return ImsCallProfile.CALL_TYPE_VT_NODIR; } else if (videoTx && !videoRx) { @@ -365,6 +375,10 @@ public class ImsCallProfile implements Parcelable { return ImsCallProfile.OIR_PRESENTATION_RESTRICTED; case PhoneConstants.PRESENTATION_ALLOWED: return ImsCallProfile.OIR_PRESENTATION_NOT_RESTRICTED; + case PhoneConstants.PRESENTATION_PAYPHONE: + return ImsCallProfile.OIR_PRESENTATION_PAYPHONE; + case PhoneConstants.PRESENTATION_UNKNOWN: + return ImsCallProfile.OIR_PRESENTATION_UNKNOWN; default: return ImsCallProfile.OIR_DEFAULT; } @@ -381,12 +395,24 @@ public class ImsCallProfile implements Parcelable { return PhoneConstants.PRESENTATION_RESTRICTED; case ImsCallProfile.OIR_PRESENTATION_NOT_RESTRICTED: return PhoneConstants.PRESENTATION_ALLOWED; + case ImsCallProfile.OIR_PRESENTATION_PAYPHONE: + return PhoneConstants.PRESENTATION_PAYPHONE; + case ImsCallProfile.OIR_PRESENTATION_UNKNOWN: + return PhoneConstants.PRESENTATION_UNKNOWN; default: return PhoneConstants.PRESENTATION_UNKNOWN; } } /** + * Checks if video call is paused + * @return true if call is video paused + */ + public boolean isVideoPaused() { + return mMediaProfile.mVideoDirection == ImsStreamMediaProfile.DIRECTION_INACTIVE; + } + + /** * Determines if a video state is set in a video state bit-mask. * * @param videoState The video state bit mask. diff --git a/telephony/java/com/android/ims/ImsConfigListener.aidl b/telephony/java/com/android/ims/ImsConfigListener.aidl index e827774..64a5015 100644 --- a/telephony/java/com/android/ims/ImsConfigListener.aidl +++ b/telephony/java/com/android/ims/ImsConfigListener.aidl @@ -48,4 +48,26 @@ oneway interface ImsConfigListener { * @return void. */ void onSetFeatureResponse(int feature, int network, int value, int status); -}
\ No newline at end of file + + /** + * Notifies client the value of the get operation result on the video quality item. + * + * @param status. as defined in com.android.ims.ImsConfig#OperationStatusConstants. + * @param quality. as defined in com.android.ims.ImsConfig#OperationValuesConstants. + * @return void + * + * @throws ImsException if calling the IMS service results in an error. + */ + void onGetVideoQuality(int status, int quality); + + /** + * Notifies client the set value operation result for video quality item. + * Used by clients that need to be notified the set operation result. + * + * @param status. as defined in com.android.ims.ImsConfig#OperationStatusConstants. + * @return void + * + * @throws ImsException if calling the IMS service results in an error. + */ + void onSetVideoQuality(int status); +} diff --git a/telephony/java/com/android/ims/ImsReasonInfo.java b/telephony/java/com/android/ims/ImsReasonInfo.java index 0b1246b..9628915 100644 --- a/telephony/java/com/android/ims/ImsReasonInfo.java +++ b/telephony/java/com/android/ims/ImsReasonInfo.java @@ -25,26 +25,6 @@ import android.os.Parcelable; * @hide */ public class ImsReasonInfo implements Parcelable { - - /** - * Reason types, defines the error category. - * UNSPECIFIED - unknown error reason - * LOCAL - indicates the local/device error reason - * LOCAL_TIMEOUT - indicates the local error reason when a specific timer is expired - * STATUSCODE - indicates the interworking error reason by SIP status code received - * from the network - * MEDIA - indicates the media error reason (local resource, SDP parameter, etc.) - * USER - indicates the error reason by the local or remote user - * UT - indicates the error reason for the supplementary service configuration - */ - public static final int TYPE_UNSPECIFIED = 0; - public static final int TYPE_LOCAL = 1; - public static final int TYPE_TIMEOUT = 2; - public static final int TYPE_STATUSCODE = 3; - public static final int TYPE_MEDIA = 4; - public static final int TYPE_USER = 5; - public static final int TYPE_UT = 8; - /** * Specific code of each types */ @@ -229,23 +209,37 @@ public class ImsReasonInfo implements Parcelable { public static final int CODE_ECBM_NOT_SUPPORTED = 901; /** + * Ims Registration error code + */ + public static final int CODE_REGISTRATION_ERROR = 1000; + + /** + * CALL DROP error codes (Call could drop because of many reasons like Network not available, + * handover, failed, etc) + */ + + /** + * CALL DROP error code for the case when a device is ePDG capable and when the user is on an + * active wifi call and at the edge of coverage and there is no qualified LTE network available + * to handover the call to. We get a handover NOT_TRIGERRED message from the modem. This error + * code is received as part of the handover message. + */ + public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100; + + /** * Network string error messages. * mExtraMessage may have these values. */ public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED = "Forbidden. Not Authorized for Service"; - // For reason type - public int mReasonType; // For main reason code public int mCode; // For the extra code value; it depends on the code value. public int mExtraCode; // For the additional message of the reason info. public String mExtraMessage; - public ImsReasonInfo() { - mReasonType = TYPE_UNSPECIFIED; mCode = CODE_UNSPECIFIED; mExtraCode = CODE_UNSPECIFIED; mExtraMessage = null; @@ -256,14 +250,12 @@ public class ImsReasonInfo implements Parcelable { } public ImsReasonInfo(int code, int extraCode) { - mReasonType = (int) (code / 100); mCode = code; mExtraCode = extraCode; mExtraMessage = null; } public ImsReasonInfo(int code, int extraCode, String extraMessage) { - mReasonType = (int) (code / 100); mCode = code; mExtraCode = extraCode; mExtraMessage = extraMessage; @@ -291,20 +283,12 @@ public class ImsReasonInfo implements Parcelable { } /** - * - */ - public int getReasonType() { - return mReasonType; - } - - /** * Returns the string format of {@link ImsReasonInfo} * * @return the string format of {@link ImsReasonInfo} */ public String toString() { - return "ImsReasonInfo :: {" + mReasonType + ", " - + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}"; + return "ImsReasonInfo :: {" + mCode + ", " + mExtraCode + ", " + mExtraMessage + "}"; } @Override @@ -314,14 +298,12 @@ public class ImsReasonInfo implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { - out.writeInt(mReasonType); out.writeInt(mCode); out.writeInt(mExtraCode); out.writeString(mExtraMessage); } private void readFromParcel(Parcel in) { - mReasonType = in.readInt(); mCode = in.readInt(); mExtraCode = in.readInt(); mExtraMessage = in.readString(); diff --git a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl index 84d1c545..0443c3e 100644 --- a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl +++ b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl @@ -115,4 +115,12 @@ interface IImsCallSessionListener { * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} */ void callSessionTtyModeReceived(in IImsCallSession session, in int mode); + + /** + * Notifies of a change to the multiparty state for this {@code ImsCallSession}. + * + * @param session The call session. + * @param isMultiParty {@code true} if the session became multiparty, {@code false} otherwise. + */ + void callSessionMultipartyStateChanged(in IImsCallSession session, in boolean isMultiParty); } diff --git a/telephony/java/com/android/ims/internal/IImsConfig.aidl b/telephony/java/com/android/ims/internal/IImsConfig.aidl index c17637c..7324814 100644 --- a/telephony/java/com/android/ims/internal/IImsConfig.aidl +++ b/telephony/java/com/android/ims/internal/IImsConfig.aidl @@ -20,31 +20,11 @@ package com.android.ims.internal; import com.android.ims.ImsConfigListener; /** - * Provides APIs to get/set the IMS service capability/parameters. - * The parameters can be configured by operator and/or user. - * We define 4 storage locations for the IMS config items: - * 1) Default config:For factory out device or device after factory data reset, - * the default config is used to build the initial state of the master config value. - * 2) Provisioned value: as the parameters provisioned by operator need to be preserved - * across FDR(factory data reset)/BOTA(over the air software upgrade), the operator - * provisioned items should be stored in memory location preserved across FDR/BOTA. - * 3) Master value: as the provisioned value can override the user setting, - * and the master config are used by IMS stack. They should be stored in the - * storage based on IMS vendor implementations. - * 4) User setting: For items can be changed by both user/operator, the user - * setting should take effect in some cases. So the user setting should be stored in - * database like setting.db. + * Provides APIs to get/set the IMS service feature/capability/parameters. + * The config items include: + * 1) Items provisioned by the operator. + * 2) Items configured by user. Mainly service feature class. * - * Priority consideration if both operator/user can config the same item: - * 1) For feature config items, the master value is obtained from the provisioned value - * masks with the user setting. Specifically the provisioned values overrides - * the user setting if feature is provisioned off. Otherwise, user setting takes - * effect. - * 2) For non-feature config item: to be implemented based on cases. - * Special cases considered as below: - * 1) Factory out device, the master configuration is built from default config. - * 2) For Factory data reset/SW upgrade device, the master config is built by - * taking provisioned value overriding default config. * {@hide} */ interface IImsConfig { @@ -120,4 +100,24 @@ interface IImsConfig { * @return void */ boolean getVolteProvisioned(); + + /** + * + * Gets the value for ims fature item video quality. + * + * @param listener. Video quality value returned asynchronously through listener. + * @return void + */ + oneway void getVideoQuality(ImsConfigListener listener); + + /** + * Sets the value for IMS feature item video quality. + * + * @param quality, defines the value of video quality. + * @param listener, provided if caller needs to be notified for set result. + * @return void + * + * @throws ImsException if calling the IMS service results in an error. + */ + oneway void setVideoQuality(int quality, ImsConfigListener listener); } diff --git a/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl b/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl index 1413e58..c910600 100644 --- a/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl +++ b/telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl @@ -16,6 +16,7 @@ package com.android.ims.internal; +import com.android.ims.ImsReasonInfo; /** * A listener type for receiving notifications about the changes to * the IMS connection(registration). @@ -29,9 +30,14 @@ interface IImsRegistrationListener { void registrationConnected(); /** + * Notifies the application when the device is trying to connect the IMS network. + */ + void registrationProgressing(); + + /** * Notifies the application when the device is disconnected from the IMS network. */ - void registrationDisconnected(); + void registrationDisconnected(in ImsReasonInfo imsReasonInfo); /** * Notifies the application when its suspended IMS connection is resumed, diff --git a/telephony/java/com/android/ims/internal/IImsUt.aidl b/telephony/java/com/android/ims/internal/IImsUt.aidl index 50a0169..c531ea5 100644 --- a/telephony/java/com/android/ims/internal/IImsUt.aidl +++ b/telephony/java/com/android/ims/internal/IImsUt.aidl @@ -79,12 +79,13 @@ interface IImsUt { /** * Updates the configuration of the call forward. */ - int updateCallForward(int action, int condition, String number, int timeSeconds); + int updateCallForward(int action, int condition, String number, + int serviceClass, int timeSeconds); /** * Updates the configuration of the call waiting. */ - int updateCallWaiting(boolean enable); + int updateCallWaiting(boolean enable, int serviceClass); /** * Updates the configuration of the CLIR supplementary service. diff --git a/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl b/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl index f867fcb..9499c9f 100644 --- a/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl +++ b/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl @@ -16,7 +16,6 @@ package com.android.ims.internal; -import android.telecom.CameraCapabilities; import android.telecom.VideoProfile; /** @@ -41,7 +40,9 @@ oneway interface IImsVideoCallCallback { void changePeerDimensions(int width, int height); - void changeCallDataUsage(int dataUsage); + void changeCallDataUsage(long dataUsage); - void changeCameraCapabilities(in CameraCapabilities cameraCapabilities); + void changeCameraCapabilities(in VideoProfile.CameraCapabilities cameraCapabilities); + + void changeVideoQuality(int videoQuality); } diff --git a/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl b/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl index 1fd88e7..39e83c6 100644 --- a/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl +++ b/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl @@ -16,6 +16,7 @@ package com.android.ims.internal; +import android.net.Uri; import android.view.Surface; import android.telecom.VideoProfile; @@ -52,7 +53,7 @@ oneway interface IImsVideoCallProvider { void setZoom(float value); - void sendSessionModifyRequest(in VideoProfile reqProfile); + void sendSessionModifyRequest(in VideoProfile fromProfile, in VideoProfile toProfile); void sendSessionModifyResponse(in VideoProfile responseProfile); @@ -60,5 +61,5 @@ oneway interface IImsVideoCallProvider { void requestCallDataUsage(); - void setPauseImage(String uri); + void setPauseImage(in Uri uri); } diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java index aae7617..c754068 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java +++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java @@ -34,7 +34,6 @@ import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.telephony.Rlog; import android.telephony.SubscriptionManager; -import android.util.Log; /** * Helper class to make it easier to run asynchronous caller-id lookup queries. diff --git a/telephony/java/com/android/internal/telephony/CellNetworkScanResult.aidl b/telephony/java/com/android/internal/telephony/CellNetworkScanResult.aidl new file mode 100644 index 0000000..7917a81 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CellNetworkScanResult.aidl @@ -0,0 +1,19 @@ +/* +** Copyright 2015, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package com.android.internal.telephony; + +parcelable CellNetworkScanResult; diff --git a/telephony/java/com/android/internal/telephony/CellNetworkScanResult.java b/telephony/java/com/android/internal/telephony/CellNetworkScanResult.java new file mode 100644 index 0000000..5a6bd1d --- /dev/null +++ b/telephony/java/com/android/internal/telephony/CellNetworkScanResult.java @@ -0,0 +1,126 @@ +/* +** Copyright 2015, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package com.android.internal.telephony; + +import android.os.Parcel; +import android.os.Parcelable; +import java.util.ArrayList; +import java.util.List; + +/** + * Response for querying available cellular networks. + * + * @hide + */ +public class CellNetworkScanResult implements Parcelable { + + /** + * Possible status values. + */ + public static final int STATUS_SUCCESS = 1; + public static final int STATUS_RADIO_NOT_AVAILABLE = 2; + public static final int STATUS_RADIO_GENERIC_FAILURE = 3; + public static final int STATUS_UNKNOWN_ERROR = 4; + + private final int mStatus; + private final List<OperatorInfo> mOperators; + + /** + * Constructor. + * + * @hide + */ + public CellNetworkScanResult(int status, List<OperatorInfo> operators) { + mStatus = status; + mOperators = operators; + } + + /** + * Construct a CellNetworkScanResult from a given parcel. + */ + private CellNetworkScanResult(Parcel in) { + mStatus = in.readInt(); + int len = in.readInt(); + if (len > 0) { + mOperators = new ArrayList(); + for (int i = 0; i < len; ++i) { + mOperators.add(OperatorInfo.CREATOR.createFromParcel(in)); + } + } else { + mOperators = null; + } + } + + /** + * @return the status of the command. + */ + public int getStatus() { + return mStatus; + } + + /** + * @return the operators. + */ + public List<OperatorInfo> getOperators() { + return mOperators; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeInt(mStatus); + if (mOperators != null && mOperators.size() > 0) { + out.writeInt(mOperators.size()); + for (OperatorInfo network : mOperators) { + network.writeToParcel(out, flags); + } + } else { + out.writeInt(0); + } + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("CellNetworkScanResult: {"); + sb.append(" status:").append(mStatus); + if (mOperators != null) { + for (OperatorInfo network : mOperators) { + sb.append(" network:").append(network); + } + } + sb.append("}"); + return sb.toString(); + } + + public static final Parcelable.Creator<CellNetworkScanResult> CREATOR + = new Parcelable.Creator<CellNetworkScanResult>() { + + @Override + public CellNetworkScanResult createFromParcel(Parcel in) { + return new CellNetworkScanResult(in); + } + + public CellNetworkScanResult[] newArray(int size) { + return new CellNetworkScanResult[size]; + } + }; +} diff --git a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl new file mode 100644 index 0000000..d77b27f --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import android.os.PersistableBundle; + +/** + * Interface used to interact with the CarrierConfigLoader + */ +interface ICarrierConfigLoader { + + PersistableBundle getConfigForSubId(int subId); + + void notifyConfigChangedForSubId(int subId); + + void updateConfigForPhoneId(int phoneId, String simState); +} diff --git a/telephony/java/com/android/internal/telephony/IMms.aidl b/telephony/java/com/android/internal/telephony/IMms.aidl index 49ac400..fa5073e 100644 --- a/telephony/java/com/android/internal/telephony/IMms.aidl +++ b/telephony/java/com/android/internal/telephony/IMms.aidl @@ -34,8 +34,7 @@ interface IMms { * PDU format * @param locationUrl the optional location url for where this message should be sent to * @param configOverrides the carrier-specific messaging configuration values to override for - * sending the message. See {@link android.telephony.MessagingConfigurationManager} for the - * value names and types. + * sending the message. See {@link android.telephony.SmsManager} for the value names and types. * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed */ @@ -51,8 +50,8 @@ interface IMms { * from the MMS WAP push notification * @param contentUri a contentUri to which the downloaded MMS message will be written * @param configOverrides the carrier-specific messaging configuration values to override for - * downloading the message. See {@link android.telephony.MessagingConfigurationManager} for the - * value names and types. + * downloading the message. See {@link android.telephony.SmsManager} for the value names and + * types. * @param downloadedIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is downloaded, or the download is failed */ @@ -165,8 +164,7 @@ interface IMms { * @param callingPkg the package name of the calling app * @param messageUri the URI of the stored message * @param configOverrides the carrier-specific messaging configuration values to override for - * sending the message. See {@link android.telephony.MessagingConfigurationManager} for the - * value names and types. + * sending the message. See {@link android.telephony.SmsManager} for the value names and types. * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed */ diff --git a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl index cea62ba..cbedb95 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl @@ -44,5 +44,6 @@ oneway interface IPhoneStateListener { void onDataConnectionRealTimeInfoChanged(in DataConnectionRealTimeInfo dcRtInfo); void onVoLteServiceStateChanged(in VoLteServiceState lteState); void onOemHookRawEvent(in byte[] rawData); + void onCarrierNetworkChange(in boolean active); } diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index c91a59c..ed85392 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -25,12 +25,12 @@ interface IPhoneSubInfo { /** * Retrieves the unique device ID, e.g., IMEI for GSM phones. */ - String getDeviceId(); + String getDeviceId(String callingPackage); /** * Retrieves the unique Network Access ID */ - String getNaiForSubscriber(int subId); + String getNaiForSubscriber(int subId, String callingPackage); /** * Retrieves the unique device ID of a phone for the device, e.g., IMEI @@ -41,91 +41,91 @@ interface IPhoneSubInfo { /** * Retrieves the IMEI. */ - String getImeiForSubscriber(int subId); + String getImeiForSubscriber(int subId, String callingPackage); /** * Retrieves the software version number for the device, e.g., IMEI/SV * for GSM phones. */ - String getDeviceSvn(); + String getDeviceSvn(String callingPackage); /** * Retrieves the software version number of a subId for the device, e.g., IMEI/SV * for GSM phones. */ - String getDeviceSvnUsingSubId(int subId); + String getDeviceSvnUsingSubId(int subId, String callingPackage); /** * Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones. */ - String getSubscriberId(); + String getSubscriberId(String callingPackage); /** * Retrieves the unique subscriber ID of a given subId, e.g., IMSI for GSM phones. */ - String getSubscriberIdForSubscriber(int subId); + String getSubscriberIdForSubscriber(int subId, String callingPackage); /** * Retrieves the Group Identifier Level1 for GSM phones. */ - String getGroupIdLevel1(); + String getGroupIdLevel1(String callingPackage); /** * Retrieves the Group Identifier Level1 for GSM phones of a subId. */ - String getGroupIdLevel1ForSubscriber(int subId); + String getGroupIdLevel1ForSubscriber(int subId, String callingPackage); /** * Retrieves the serial number of the ICC, if applicable. */ - String getIccSerialNumber(); + String getIccSerialNumber(String callingPackage); /** * Retrieves the serial number of a given subId. */ - String getIccSerialNumberForSubscriber(int subId); + String getIccSerialNumberForSubscriber(int subId, String callingPackage); /** * Retrieves the phone number string for line 1. */ - String getLine1Number(); + String getLine1Number(String callingPackage); /** * Retrieves the phone number string for line 1 of a subcription. */ - String getLine1NumberForSubscriber(int subId); + String getLine1NumberForSubscriber(int subId, String callingPackage); /** * Retrieves the alpha identifier for line 1. */ - String getLine1AlphaTag(); + String getLine1AlphaTag(String callingPackage); /** * Retrieves the alpha identifier for line 1 of a subId. */ - String getLine1AlphaTagForSubscriber(int subId); + String getLine1AlphaTagForSubscriber(int subId, String callingPackage); /** * Retrieves MSISDN Number. */ - String getMsisdn(); + String getMsisdn(String callingPackage); /** * Retrieves the Msisdn of a subId. */ - String getMsisdnForSubscriber(int subId); + String getMsisdnForSubscriber(int subId, String callingPackage); /** * Retrieves the voice mail number. */ - String getVoiceMailNumber(); + String getVoiceMailNumber(String callingPackage); /** * Retrieves the voice mail number of a given subId. */ - String getVoiceMailNumberForSubscriber(int subId); + String getVoiceMailNumberForSubscriber(int subId, String callingPackage); /** * Retrieves the complete voice mail number. @@ -140,13 +140,13 @@ interface IPhoneSubInfo { /** * Retrieves the alpha identifier associated with the voice mail number. */ - String getVoiceMailAlphaTag(); + String getVoiceMailAlphaTag(String callingPackage); /** * Retrieves the alpha identifier associated with the voice mail number * of a subId. */ - String getVoiceMailAlphaTagForSubscriber(int subId); + String getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage); /** * Returns the IMS private user identity (IMPI) that was loaded from the ISIM. diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl index 70ac268..21c94c2 100644 --- a/telephony/java/com/android/internal/telephony/ISms.aidl +++ b/telephony/java/com/android/internal/telephony/ISms.aidl @@ -37,13 +37,6 @@ import com.android.internal.telephony.SmsRawData; interface ISms { /** * Retrieves all messages currently stored on ICC. - * - * @return list of SmsRawData of all sms on ICC - */ - List<SmsRawData> getAllMessagesFromIccEf(String callingPkg); - - /** - * Retrieves all messages currently stored on ICC. * @param subId the subId id. * @return list of SmsRawData of all sms on ICC */ @@ -57,20 +50,6 @@ interface ISms { * STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT, * STATUS_ON_ICC_UNSENT, STATUS_ON_ICC_FREE) * @param pdu the raw PDU to store - * @return success or not - * - */ - boolean updateMessageOnIccEf(String callingPkg, int messageIndex, int newStatus, - in byte[] pdu); - - /** - * Update the specified message on the ICC. - * - * @param messageIndex record index of message to update - * @param newStatus new message status (STATUS_ON_ICC_READ, - * STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT, - * STATUS_ON_ICC_UNSENT, STATUS_ON_ICC_FREE) - * @param pdu the raw PDU to store * @param subId the subId id. * @return success or not * @@ -84,17 +63,6 @@ interface ISms { * @param pdu the raw PDU to store * @param status message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD, * STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT) - * @return success or not - * - */ - boolean copyMessageToIccEf(String callingPkg, int status, in byte[] pdu, in byte[] smsc); - - /** - * Copy a raw SMS PDU to the ICC. - * - * @param pdu the raw PDU to store - * @param status message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD, - * STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT) * @param subId the subId id. * @return success or not * @@ -124,12 +92,14 @@ interface ISms { * @param deliveryIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is delivered to the recipient. The * raw pdu of the status report is in the extended data ("pdu"). + * @param subId the subId id. */ - void sendData(String callingPkg, in String destAddr, in String scAddr, in int destPort, - in byte[] data, in PendingIntent sentIntent, in PendingIntent deliveryIntent); + void sendDataForSubscriber(int subId, String callingPkg, in String destAddr, + in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent, + in PendingIntent deliveryIntent); /** - * Send a data SMS. + * Send a data SMS. Only for use internally. * * @param smsc the SMSC to send the message through, or NULL for the * default SMSC @@ -152,7 +122,7 @@ interface ISms { * raw pdu of the status report is in the extended data ("pdu"). * @param subId the subId id. */ - void sendDataForSubscriber(int subId, String callingPkg, in String destAddr, + void sendDataForSubscriberWithSelfPermissions(int subId, String callingPkg, in String destAddr, in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent, in PendingIntent deliveryIntent); @@ -178,12 +148,14 @@ interface ISms { * @param deliveryIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is delivered to the recipient. The * raw pdu of the status report is in the extended data ("pdu"). + * @param subId the subId on which the SMS has to be sent. */ - void sendText(String callingPkg, in String destAddr, in String scAddr, in String text, - in PendingIntent sentIntent, in PendingIntent deliveryIntent); + void sendTextForSubscriber(in int subId, String callingPkg, in String destAddr, + in String scAddr, in String text, in PendingIntent sentIntent, + in PendingIntent deliveryIntent); /** - * Send an SMS. + * Send an SMS. Internal use only. * * @param smsc the SMSC to send the message through, or NULL for the * default SMSC @@ -206,13 +178,14 @@ interface ISms { * raw pdu of the status report is in the extended data ("pdu"). * @param subId the subId on which the SMS has to be sent. */ - void sendTextForSubscriber(in int subId, String callingPkg, in String destAddr, - in String scAddr, in String text, in PendingIntent sentIntent, + void sendTextForSubscriberWithSelfPermissions(in int subId, String callingPkg, + in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent, in PendingIntent deliveryIntent); /** * Inject an SMS PDU into the android platform. * + * @param subId the subId on which the SMS has to be injected. * @param pdu is the byte array of pdu to be injected into android application framework * @param format is the format of SMS pdu (android.telephony.SmsMessage.FORMAT_3GPP or * android.telephony.SmsMessage.FORMAT_3GPP2) @@ -221,33 +194,8 @@ interface ISms { * android application framework. This intent is broadcasted at * the same time an SMS received from radio is acknowledged back. */ - void injectSmsPdu(in byte[] pdu, String format, in PendingIntent receivedIntent); - - /** - * Send a multi-part text based SMS. - * - * @param destinationAddress the address to send the message to - * @param scAddress is the service center address or null to use - * the current default SMSC - * @param parts an <code>ArrayList</code> of strings that, in order, - * comprise the original message - * @param sentIntents if not null, an <code>ArrayList</code> of - * <code>PendingIntent</code>s (one for each message part) that is - * broadcast when the corresponding message part has been sent. - * The result code will be <code>Activity.RESULT_OK<code> for success, - * or one of these errors: - * <code>RESULT_ERROR_GENERIC_FAILURE</code> - * <code>RESULT_ERROR_RADIO_OFF</code> - * <code>RESULT_ERROR_NULL_PDU</code>. - * @param deliveryIntents if not null, an <code>ArrayList</code> of - * <code>PendingIntent</code>s (one for each message part) that is - * broadcast when the corresponding message part has been delivered - * to the recipient. The raw pdu of the status report is in the - * extended data ("pdu"). - */ - void sendMultipartText(String callingPkg, in String destinationAddress, in String scAddress, - in List<String> parts, in List<PendingIntent> sentIntents, - in List<PendingIntent> deliveryIntents); + void injectSmsPduForSubscriber( + int subId, in byte[] pdu, String format, in PendingIntent receivedIntent); /** * Send a multi-part text based SMS. @@ -286,31 +234,13 @@ interface ISms { * * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) - * @param ranType as defined in class SmsManager, the value can be one of these: - * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM - * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA - * @return true if successful, false otherwise - * - * @see #disableCellBroadcast(int, int) - */ - boolean enableCellBroadcast(int messageIdentifier, int ranType); - - /** - * Enable reception of cell broadcast (SMS-CB) messages with the given - * message identifier and RAN type. The RAN type specify this message ID - * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients - * enable the same message identifier, they must both disable it for the - * device to stop receiving those messages. - * - * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or - * C.R1001-G (3GPP2) * @param subId for which the broadcast has to be enabled * @param ranType as defined in class SmsManager, the value can be one of these: * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #disableCellBroadcast(int, int) + * @see #disableCellBroadcastForSubscriber(int, int, int) */ boolean enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType); @@ -323,56 +253,18 @@ interface ISms { * * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) - * @param ranType as defined in class SmsManager, the value can be one of these: - * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM - * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA - * @return true if successful, false otherwise - * - * @see #enableCellBroadcast(int, int) - */ - boolean disableCellBroadcast(int messageIdentifier, int ranType); - - /** - * Disable reception of cell broadcast (SMS-CB) messages with the given - * message identifier and RAN type. The RAN type specify this message ID - * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients - * enable the same message identifier, they must both disable it for the - * device to stop receiving those messages. - * - * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or - * C.R1001-G (3GPP2) * @param subId for which the broadcast has to be disabled * @param ranType as defined in class SmsManager, the value can be one of these: * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #enableCellBroadcast(int, int) + * @see #enableCellBroadcastForSubscriber(int, int, int) */ boolean disableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType); /* * Enable reception of cell broadcast (SMS-CB) messages with the given - * message identifier range and RAN type. The RAN type specify this message - * ID range belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different - * clients enable a message identifier range, they must both disable it for - * the device to stop receiving those messages. - * - * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or - * C.R1001-G (3GPP2) - * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or - * C.R1001-G (3GPP2) - * @param ranType as defined in class SmsManager, the value can be one of these: - * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM - * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA - * @return true if successful, false otherwise - * - * @see #disableCellBroadcastRange(int, int, int) - */ - boolean enableCellBroadcastRange(int startMessageId, int endMessageId, int ranType); - - /* - * Enable reception of cell broadcast (SMS-CB) messages with the given * message identifier range and RAN type. The RAN type specify this message ID range * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable * a message identifier range, they must both disable it for the device @@ -388,7 +280,7 @@ interface ISms { * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #disableCellBroadcastRange(int, int, int) + * @see #disableCellBroadcastRangeForSubscriber(int, int, int, int) */ boolean enableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, int ranType); @@ -404,33 +296,13 @@ interface ISms { * C.R1001-G (3GPP2) * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) - * @param ranType as defined in class SmsManager, the value can be one of these: - * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM - * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA - * @return true if successful, false otherwise - * - * @see #enableCellBroadcastRange(int, int, int) - */ - boolean disableCellBroadcastRange(int startMessageId, int endMessageId, int ranType); - - /** - * Disable reception of cell broadcast (SMS-CB) messages with the given - * message identifier range and RAN type. The RAN type specify this message ID range - * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable - * a message identifier range, they must both disable it for the device - * to stop receiving those messages. - * - * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or - * C.R1001-G (3GPP2) - * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or - * C.R1001-G (3GPP2) * @param subId for which the broadcast has to be disabled * @param ranType as defined in class SmsManager, the value can be one of these: * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #enableCellBroadcastRange(int, int, int, int) + * @see #enableCellBroadcastRangeForSubscriber(int, int, int, int) */ boolean disableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, int ranType); @@ -462,20 +334,10 @@ interface ISms { /** * SMS over IMS is supported if IMS is registered and SMS is supported * on IMS. - * - * @return true if SMS over IMS is supported, false otherwise - * - * @see #getImsSmsFormat() - */ - boolean isImsSmsSupported(); - - /** - * SMS over IMS is supported if IMS is registered and SMS is supported - * on IMS. * @param subId for subId which isImsSmsSupported is queried * @return true if SMS over IMS is supported, false otherwise * - * @see #getImsSmsFormat() + * @see #getImsSmsFormatForSubscriber(int) */ boolean isImsSmsSupportedForSubscriber(int subId); @@ -496,24 +358,12 @@ interface ISms { /** * Gets SMS format supported on IMS. SMS over IMS format is * either 3GPP or 3GPP2. - * - * @return android.telephony.SmsMessage.FORMAT_3GPP, - * android.telephony.SmsMessage.FORMAT_3GPP2 - * or android.telephony.SmsMessage.FORMAT_UNKNOWN - * - * @see #isImsSmsSupported() - */ - String getImsSmsFormat(); - - /** - * Gets SMS format supported on IMS. SMS over IMS format is - * either 3GPP or 3GPP2. * @param subId for subId which getImsSmsFormat is queried * @return android.telephony.SmsMessage.FORMAT_3GPP, * android.telephony.SmsMessage.FORMAT_3GPP2 * or android.telephony.SmsMessage.FORMAT_UNKNOWN * - * @see #isImsSmsSupported() + * @see #isImsSmsSupportedForSubscriber(int) */ String getImsSmsFormatForSubscriber(int subId); diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index acbc0aa..0555121 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -22,42 +22,48 @@ import com.android.internal.telephony.ISubscriptionListener; interface ISub { /** + * @param callingPackage The package maing the call. * @return a list of all subscriptions in the database, this includes * all subscriptions that have been seen. */ - List<SubscriptionInfo> getAllSubInfoList(); + List<SubscriptionInfo> getAllSubInfoList(String callingPackage); /** + * @param callingPackage The package maing the call. * @return the count of all subscriptions in the database, this includes * all subscriptions that have been seen. */ - int getAllSubInfoCount(); + int getAllSubInfoCount(String callingPackage); /** * Get the active SubscriptionInfo with the subId key * @param subId The unique SubscriptionInfo key in database + * @param callingPackage The package maing the call. * @return SubscriptionInfo, maybe null if its not active */ - SubscriptionInfo getActiveSubscriptionInfo(int subId); + SubscriptionInfo getActiveSubscriptionInfo(int subId, String callingPackage); /** * Get the active SubscriptionInfo associated with the iccId * @param iccId the IccId of SIM card + * @param callingPackage The package maing the call. * @return SubscriptionInfo, maybe null if its not active */ - SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId); + SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage); /** * Get the active SubscriptionInfo associated with the slotIdx * @param slotIdx the slot which the subscription is inserted + * @param callingPackage The package maing the call. * @return SubscriptionInfo, maybe null if its not active */ - SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx); + SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx, String callingPackage); /** * Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}. * + * @param callingPackage The package maing the call. * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device. * <ul> * <li> @@ -74,12 +80,13 @@ interface ISub { * </li> * </ul> */ - List<SubscriptionInfo> getActiveSubscriptionInfoList(); + List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage); /** + * @param callingPackage The package making the call. * @return the number of active subscriptions */ - int getActiveSubInfoCount(); + int getActiveSubInfoCount(String callingPackage); /** * @return the maximum number of subscriptions this device will support at any one time. @@ -166,9 +173,10 @@ interface ISub { int[] getActiveSubIdList(); /** - * Get the SIM state for the subscriber + * Get the SIM state for the slot idx * @return SIM state as the ordinal of IccCardConstants.State */ - int getSimStateForSubscriber(int subId); + int getSimStateForSlotIdx(int slotIdx); + boolean isActiveSubId(int subId); } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index bf3ee09..6db88a7 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -18,10 +18,14 @@ package com.android.internal.telephony; import android.content.Intent; import android.os.Bundle; +import android.telecom.PhoneAccount; import android.telephony.CellInfo; import android.telephony.IccOpenLogicalChannelResponse; import android.telephony.NeighboringCellInfo; import android.telephony.RadioAccessFamily; +import android.telephony.ModemActivityInfo; +import com.android.internal.telephony.CellNetworkScanResult; +import com.android.internal.telephony.OperatorInfo; import java.util.List; @@ -44,6 +48,7 @@ interface ITelephony { /** * Place a call to the specified number. + * @param callingPackage The package making the call. * @param number the number to be called. */ void call(String callingPackage, String number); @@ -111,65 +116,74 @@ interface ITelephony { /** * Check if we are in either an active or holding call + * @param callingPackage the name of the package making the call. * @return true if the phone state is OFFHOOK. */ - boolean isOffhook(); + boolean isOffhook(String callingPackage); /** * Check if a particular subId has an active or holding call * * @param subId user preferred subId. + * @param callingPackage the name of the package making the call. * @return true if the phone state is OFFHOOK. */ - boolean isOffhookForSubscriber(int subId); + boolean isOffhookForSubscriber(int subId, String callingPackage); /** * Check if an incoming phone call is ringing or call waiting * on a particular subId. * * @param subId user preferred subId. + * @param callingPackage the name of the package making the call. * @return true if the phone state is RINGING. */ - boolean isRingingForSubscriber(int subId); + boolean isRingingForSubscriber(int subId, String callingPackage); /** * Check if an incoming phone call is ringing or call waiting. + * @param callingPackage the name of the package making the call. * @return true if the phone state is RINGING. */ - boolean isRinging(); + boolean isRinging(String callingPackage); /** * Check if the phone is idle. + * @param callingPackage the name of the package making the call. * @return true if the phone state is IDLE. */ - boolean isIdle(); + boolean isIdle(String callingPackage); /** * Check if the phone is idle on a particular subId. * * @param subId user preferred subId. + * @param callingPackage the name of the package making the call. * @return true if the phone state is IDLE. */ - boolean isIdleForSubscriber(int subId); + boolean isIdleForSubscriber(int subId, String callingPackage); /** * Check to see if the radio is on or not. + * @param callingPackage the name of the package making the call. * @return returns true if the radio is on. */ - boolean isRadioOn(); + boolean isRadioOn(String callingPackage); /** * Check to see if the radio is on or not on particular subId. * @param subId user preferred subId. + * @param callingPackage the name of the package making the call. * @return returns true if the radio is on. */ - boolean isRadioOnForSubscriber(int subId); + boolean isRadioOnForSubscriber(int subId, String callingPackage); /** * Check if the SIM pin lock is enabled. * @return true if the SIM pin lock is enabled. + * @param callingPackage The package making the call. */ - boolean isSimPinEnabled(); + boolean isSimPinEnabled(String callingPackage); /** * Supply a pin to unlock the SIM. Blocks until a result is determined. @@ -340,7 +354,7 @@ interface ITelephony { */ boolean isDataConnectivityPossible(); - Bundle getCellLocation(); + Bundle getCellLocation(String callingPkg); /** * Returns the neighboring cell information of the device. @@ -374,40 +388,46 @@ interface ITelephony { /** * Returns the CDMA ERI icon index to display + * @param callingPackage package making the call. */ - int getCdmaEriIconIndex(); + int getCdmaEriIconIndex(String callingPackage); /** * Returns the CDMA ERI icon index to display on particular subId. * @param subId user preferred subId. + * @param callingPackage package making the call. */ - int getCdmaEriIconIndexForSubscriber(int subId); + int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage); /** * Returns the CDMA ERI icon mode, * 0 - ON * 1 - FLASHING + * @param callingPackage package making the call. */ - int getCdmaEriIconMode(); + int getCdmaEriIconMode(String callingPackage); /** * Returns the CDMA ERI icon mode on particular subId, * 0 - ON * 1 - FLASHING * @param subId user preferred subId. + * @param callingPackage package making the call. */ - int getCdmaEriIconModeForSubscriber(int subId); + int getCdmaEriIconModeForSubscriber(int subId, String callingPackage); /** * Returns the CDMA ERI text, + * @param callingPackage package making the call. */ - String getCdmaEriText(); + String getCdmaEriText(String callingPackage); /** * Returns the CDMA ERI text for particular subId, * @param subId user preferred subId. + * @param callingPackage package making the call. */ - String getCdmaEriTextForSubscriber(int subId); + String getCdmaEriTextForSubscriber(int subId, String callingPackage); /** * Returns true if OTA service provisioning needs to run. @@ -434,28 +454,30 @@ interface ITelephony { int getVoiceMessageCountForSubscriber(int subId); /** - * Returns the network type for data transmission - */ - int getNetworkType(); + * Returns the network type for data transmission + * @param callingPackage package making the call. + */ + int getNetworkType(String callingPackage); /** * Returns the network type of a subId. * @param subId user preferred subId. - * Returns the network type + * @param callingPackage package making the call. */ - int getNetworkTypeForSubscriber(int subId); + int getNetworkTypeForSubscriber(int subId, String callingPackage); /** - * Returns the network type for data transmission - */ - int getDataNetworkType(); + * Returns the network type for data transmission + * @param callingPackage package making the call. + */ + int getDataNetworkType(String callingPackage); /** - * Returns the data network type of a subId - * @param subId user preferred subId. - * Returns the network type - */ - int getDataNetworkTypeForSubscriber(int subId); + * Returns the data network type of a subId + * @param subId user preferred subId. + * @param callingPackage package making the call. + */ + int getDataNetworkTypeForSubscriber(int subId, String callingPackage); /** * Returns the network type for voice @@ -486,25 +508,27 @@ interface ITelephony { * is a tri-state return value as for a period of time * the mode may be unknown. * + * @param callingPackage the name of the calling package * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} * or {@link PHone#LTE_ON_CDMA_TRUE} */ - int getLteOnCdmaMode(); + int getLteOnCdmaMode(String callingPackage); /** * Return if the current radio is LTE on CDMA. This * is a tri-state return value as for a period of time * the mode may be unknown. * + * @param callingPackage the name of the calling package * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} * or {@link PHone#LTE_ON_CDMA_TRUE} */ - int getLteOnCdmaModeForSubscriber(int subId); + int getLteOnCdmaModeForSubscriber(int subId, String callingPackage); /** * Returns the all observed cell information of the device. */ - List<CellInfo> getAllCellInfo(); + List<CellInfo> getAllCellInfo(String callingPkg); /** * Sets minimum time in milli-seconds between onCellInfoChanged @@ -643,18 +667,20 @@ interface ITelephony { /* * Get the calculated preferred network type. * Used for device configuration by some CDMA operators. + * @param callingPackage The package making the call. * * @return the calculated preferred network type, defined in RILConstants.java. */ - int getCalculatedPreferredNetworkType(); + int getCalculatedPreferredNetworkType(String callingPackage); /* * Get the preferred network type. * Used for device configuration by some CDMA operators. * + * @param subId the id of the subscription to query. * @return the preferred network type, defined in RILConstants.java. */ - int getPreferredNetworkType(); + int getPreferredNetworkType(int subId); /** * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning @@ -666,13 +692,38 @@ interface ITelephony { int getTetherApnRequired(); /** + * Set the network selection mode to automatic. + * + * @param subId the id of the subscription to update. + */ + void setNetworkSelectionModeAutomatic(int subId); + + /** + * Perform a radio scan and return the list of avialble networks. + * + * @param subId the id of the subscription. + * @return CellNetworkScanResult containing status of scan and networks. + */ + CellNetworkScanResult getCellNetworkScanResults(int subId); + + /** + * Ask the radio to connect to the input network and change selection mode to manual. + * + * @param subId the id of the subscription. + * @param operatorInfo the operator to attach to. + * @return true if the request suceeded. + */ + boolean setNetworkSelectionModeManual(int subId, in OperatorInfo operator); + + /** * Set the preferred network type. * Used for device configuration by some CDMA operators. * + * @param subId the id of the subscription to update. * @param networkType the preferred network type, defined in RILConstants.java. * @return true on success; false on any failure. */ - boolean setPreferredNetworkType(int networkType); + boolean setPreferredNetworkType(int subId, int networkType); /** * User enable/disable Mobile Data. @@ -691,8 +742,9 @@ interface ITelephony { /** * Get P-CSCF address from PCO after data connection is established or modified. * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN + * @param callingPackage The package making the call. */ - String[] getPcscfAddress(String apnType); + String[] getPcscfAddress(String apnType, String callingPackage); /** * Set IMS registration state @@ -725,20 +777,26 @@ interface ITelephony { int getCarrierPrivilegeStatus(); /** - * Similar to above, but check for pkg whose name is pkgname. + * Similar to above, but check for the package whose name is pkgName. */ - int checkCarrierPrivilegesForPackage(String pkgname); + int checkCarrierPrivilegesForPackage(String pkgName); /** - * Returns the package name of the carrier apps that should handle the input intent. + * Similar to above, but check across all phones. + */ + int checkCarrierPrivilegesForPackageAnyPhone(String pkgName); + + /** + * Returns list of the package names of the carrier apps that should handle the input intent + * and have carrier privileges for the given phoneId. * - * @param packageManager PackageManager for getting receivers. * @param intent Intent that will be sent. - * @return list of carrier app package names that can handle the intent. + * @param phoneId The phoneId on which the carrier app has carrier privileges. + * @return list of carrier app package names that can handle the intent on phoneId. * Returns null if there is an error and an empty list if there * are no matching packages. */ - List<String> getCarrierPackageNamesForIntent(in Intent intent); + List<String> getCarrierPackageNamesForIntentAndPhone(in Intent intent, int phoneId); /** * Set the line 1 phone number string and its alphatag for the current ICCID @@ -758,21 +816,23 @@ interface ITelephony { * {@link #setLine1NumberForDisplay}. Otherwise returns null. * * @param subId whose dialing number for line 1 is returned. + * @param callingPackage The package making the call. * @return the displayed dialing number if set, or null if not set. */ - String getLine1NumberForDisplay(int subId); + String getLine1NumberForDisplay(int subId, String callingPackage); /** * Returns the displayed alphatag of the dialing number if it was set * previously via {@link #setLine1NumberForDisplay}. Otherwise returns null. * * @param subId whose alphatag associated with line 1 is returned. + * @param callingPackage The package making the call. * @return the displayed alphatag of the dialing number if set, or null if * not set. */ - String getLine1AlphaTagForDisplay(int subId); + String getLine1AlphaTagForDisplay(int subId, String callingPackage); - String[] getMergedSubscriberIds(); + String[] getMergedSubscriberIds(String callingPackage); /** * Override the operator branding for the current ICCID. @@ -848,9 +908,10 @@ interface ITelephony { * Get phone radio type and access technology. * * @param phoneId which phone you want to get + * @param callingPackage the name of the package making the call * @return phone radio type and access technology */ - int getRadioAccessFamily(in int phoneId); + int getRadioAccessFamily(in int phoneId, String callingPackage); /** * Enables or disables video calling. @@ -862,21 +923,83 @@ interface ITelephony { /** * Whether video calling has been enabled by the user. * - * @return {@code True} if the user has enabled video calling, {@code false} otherwise. + * @param callingPackage The package making the call. + * @return {@code true} if the user has enabled video calling, {@code false} otherwise. + */ + boolean isVideoCallingEnabled(String callingPackage); + + /** + * Whether the DTMF tone length can be changed. + * + * @return {@code true} if the DTMF tone length can be changed. */ - boolean isVideoCallingEnabled(); + boolean canChangeDtmfToneLength(); /** + * Whether the device is a world phone. + * + * @return {@code true} if the devices is a world phone. + */ + boolean isWorldPhone(); + + /** + * Whether the phone supports TTY mode. + * + * @return {@code true} if the device supports TTY mode. + */ + boolean isTtyModeSupported(); + + /** + * Whether the phone supports hearing aid compatibility. + * + * @return {@code true} if the device supports hearing aid compatibility. + */ + boolean isHearingAidCompatibilitySupported(); + /** * Get IMS Registration Status */ boolean isImsRegistered(); /** + * Returns the Status of Wi-Fi Calling + *@hide + */ + boolean isWifiCallingEnabled(); + + /** + * Returns the Status of Volte + *@hide + */ + boolean isVolteEnabled(); + + /** * Returns the unique device ID of phone, for example, the IMEI for * GSM and the MEID for CDMA phones. Return null if device ID is not available. * + * @param callingPackage The package making the call. * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ - String getDeviceId(); + String getDeviceId(String callingPackage); + + /** + * Returns the subscription ID associated with the specified PhoneAccount. + */ + int getSubIdForPhoneAccount(in PhoneAccount phoneAccount); + + void factoryReset(int subId); + + /** + * An estimate of the users's current locale based on the default SIM. + * + * The returned string will be a well formed BCP-47 language tag, or {@code null} + * if no locale could be derived. + */ + String getLocaleFromDefaultSim(); + + /** + * Return the modem activity info. + *@hide + */ + ModemActivityInfo getModemActivityInfo(); } diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index 7d8a8d6..76b69ce 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -69,4 +69,5 @@ interface ITelephonyRegistry { void notifyVoLteServiceStateChanged(in VoLteServiceState lteState); void notifyOemHookRawEventForSubscriber(in int subId, in byte[] rawData); void notifySubscriptionInfoChanged(); + void notifyCarrierNetworkChange(in boolean active); } diff --git a/telephony/java/com/android/internal/telephony/OperatorInfo.java b/telephony/java/com/android/internal/telephony/OperatorInfo.java new file mode 100644 index 0000000..a29d7c1 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/OperatorInfo.java @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * {@hide} + */ +public class OperatorInfo implements Parcelable { + public enum State { + UNKNOWN, + AVAILABLE, + CURRENT, + FORBIDDEN; + } + + private String mOperatorAlphaLong; + private String mOperatorAlphaShort; + private String mOperatorNumeric; + + private State mState = State.UNKNOWN; + + + public String + getOperatorAlphaLong() { + return mOperatorAlphaLong; + } + + public String + getOperatorAlphaShort() { + return mOperatorAlphaShort; + } + + public String + getOperatorNumeric() { + return mOperatorNumeric; + } + + public State + getState() { + return mState; + } + + OperatorInfo(String operatorAlphaLong, + String operatorAlphaShort, + String operatorNumeric, + State state) { + + mOperatorAlphaLong = operatorAlphaLong; + mOperatorAlphaShort = operatorAlphaShort; + mOperatorNumeric = operatorNumeric; + + mState = state; + } + + + public OperatorInfo(String operatorAlphaLong, + String operatorAlphaShort, + String operatorNumeric, + String stateString) { + this (operatorAlphaLong, operatorAlphaShort, + operatorNumeric, rilStateToState(stateString)); + } + + public OperatorInfo(String operatorAlphaLong, + String operatorAlphaShort, + String operatorNumeric) { + this(operatorAlphaLong, operatorAlphaShort, operatorNumeric, State.UNKNOWN); + } + + /** + * See state strings defined in ril.h RIL_REQUEST_QUERY_AVAILABLE_NETWORKS + */ + private static State rilStateToState(String s) { + if (s.equals("unknown")) { + return State.UNKNOWN; + } else if (s.equals("available")) { + return State.AVAILABLE; + } else if (s.equals("current")) { + return State.CURRENT; + } else if (s.equals("forbidden")) { + return State.FORBIDDEN; + } else { + throw new RuntimeException( + "RIL impl error: Invalid network state '" + s + "'"); + } + } + + + @Override + public String toString() { + return "OperatorInfo " + mOperatorAlphaLong + + "/" + mOperatorAlphaShort + + "/" + mOperatorNumeric + + "/" + mState; + } + + /** + * Parcelable interface implemented below. + * This is a simple effort to make OperatorInfo parcelable rather than + * trying to make the conventional containing object (AsyncResult), + * implement parcelable. This functionality is needed for the + * NetworkQueryService to fix 1128695. + */ + + @Override + public int describeContents() { + return 0; + } + + /** + * Implement the Parcelable interface. + * Method to serialize a OperatorInfo object. + */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(mOperatorAlphaLong); + dest.writeString(mOperatorAlphaShort); + dest.writeString(mOperatorNumeric); + dest.writeSerializable(mState); + } + + /** + * Implement the Parcelable interface + * Method to deserialize a OperatorInfo object, or an array thereof. + */ + public static final Creator<OperatorInfo> CREATOR = + new Creator<OperatorInfo>() { + @Override + public OperatorInfo createFromParcel(Parcel in) { + OperatorInfo opInfo = new OperatorInfo( + in.readString(), /*operatorAlphaLong*/ + in.readString(), /*operatorAlphaShort*/ + in.readString(), /*operatorNumeric*/ + (State) in.readSerializable()); /*state*/ + return opInfo; + } + + @Override + public OperatorInfo[] newArray(int size) { + return new OperatorInfo[size]; + } + }; +} diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index b8e8064..2a4032c 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -150,6 +150,10 @@ public class PhoneConstants { public static final String SLOT_KEY = "slot"; + /** Fired when a subscriptions phone state changes. */ + public static final String ACTION_SUBSCRIPTION_PHONE_STATE_CHANGED = + "android.intent.action.SUBSCRIPTION_PHONE_STATE"; + // FIXME: This is used to pass a subId via intents, we need to look at its usage, which is // FIXME: extensive, and see if this should be an array of all active subId's or ...? public static final String SUBSCRIPTION_KEY = "subscription"; @@ -186,4 +190,11 @@ public class PhoneConstants { //FIXME maybe this shouldn't be here - sprout only public static final int CAPABILITY_3G = 1; + + /** + * Values for the adb property "persist.radio.videocall.audio.output" + */ + public static final int AUDIO_OUTPUT_ENABLE_SPEAKER = 0; + public static final int AUDIO_OUTPUT_DISABLE_SPEAKER = 1; + public static final int AUDIO_OUTPUT_DEFAULT = AUDIO_OUTPUT_ENABLE_SPEAKER; } diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 082e8bb..8d48c86 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -69,6 +69,14 @@ public interface RILConstants { int SS_MODIFIED_TO_USSD = 25; /* SS request modified to USSD */ int SUBSCRIPTION_NOT_SUPPORTED = 26; /* Subscription not supported */ int SS_MODIFIED_TO_SS = 27; /* SS request modified to different SS request */ + int SIM_ALREADY_POWERED_OFF = 29; /* SAP: 0x03, Error card aleready powered off */ + int SIM_ALREADY_POWERED_ON = 30; /* SAP: 0x05, Error card already powered on */ + int SIM_DATA_NOT_AVAILABLE = 31; /* SAP: 0x06, Error data not available */ + int SIM_SAP_CONNECT_FAILURE = 32; + int SIM_SAP_MSG_SIZE_TOO_LARGE = 33; + int SIM_SAP_MSG_SIZE_TOO_SMALL = 34; + int SIM_SAP_CONNECT_OK_CALL_ONGOING = 35; + int LCE_NOT_SUPPORTED = 36; /* Link Capacity Estimation (LCE) not supported */ /* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */ @@ -135,6 +143,11 @@ public interface RILConstants { int NV_CONFIG_ERASE_RESET = 2; int NV_CONFIG_FACTORY_RESET = 3; + /* LCE service related constants. */ + int LCE_NOT_AVAILABLE = -1; + int LCE_STOPPED = 0; + int LCE_ACTIVE = 1; + /* cat include/telephony/ril.h | \ egrep '^#define' | \ @@ -307,6 +320,10 @@ cat include/telephony/ril.h | \ int RIL_REQUEST_SHUTDOWN = 129; int RIL_REQUEST_GET_RADIO_CAPABILITY = 130; int RIL_REQUEST_SET_RADIO_CAPABILITY = 131; + int RIL_REQUEST_START_LCE = 132; + int RIL_REQUEST_STOP_LCE = 133; + int RIL_REQUEST_PULL_LCEDATA = 134; + int RIL_REQUEST_GET_ACTIVITY_INFO = 135; int RIL_UNSOL_RESPONSE_BASE = 1000; int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000; @@ -354,4 +371,5 @@ cat include/telephony/ril.h | \ int RIL_UNSOL_RADIO_CAPABILITY = 1042; int RIL_UNSOL_ON_SS = 1043; int RIL_UNSOL_STK_CC_ALPHA_NOTIFY = 1044; + int RIL_UNSOL_LCEDATA_RECV = 1045; } diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java index 92cd468..f563839 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java +++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java @@ -16,8 +16,6 @@ package com.android.internal.telephony; -import android.content.Intent; - /** * The intents that the telephony services broadcast. * @@ -319,6 +317,7 @@ public class TelephonyIntents { public static final String EXTRA_PLMN = "plmn"; public static final String EXTRA_SHOW_SPN = "showSpn"; public static final String EXTRA_SPN = "spn"; + public static final String EXTRA_DATA_SPN = "spnData"; /** * <p>Broadcast Action: It indicates one column of a subinfo record has been changed diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java index c89208d..645c3a1 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java +++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java @@ -209,4 +209,12 @@ public interface TelephonyProperties * Set to the sim count. */ static final String PROPERTY_SIM_COUNT = "ro.telephony.sim.count"; + + /** + * Controls audio route for video calls. + * 0 - Use the default audio routing strategy. + * 1 - Disable the speaker. Route the audio to Headset or Bluetooth + * or Earpiece, based on the default audio routing strategy. + */ + static final String PROPERTY_VIDEOCALL_AUDIO_OUTPUT = "persist.radio.call.audio.output"; } |