Merge change 1791 into donut

* changes:
  Add a method to get the PhoneType in CellLocation.
This commit is contained in:
Android (Google) Code Review
2009-05-19 17:19:21 -07:00
8 changed files with 236 additions and 204 deletions

View File

@@ -148,7 +148,7 @@ public final class Settings {
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_WIFI_SETTINGS = public static final String ACTION_WIFI_SETTINGS =
"android.settings.WIFI_SETTINGS"; "android.settings.WIFI_SETTINGS";
/** /**
* Activity Action: Show settings to allow configuration of a static IP * Activity Action: Show settings to allow configuration of a static IP
* address for Wi-Fi. * address for Wi-Fi.
@@ -305,7 +305,7 @@ public final class Settings {
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_QUICK_LAUNCH_SETTINGS = public static final String ACTION_QUICK_LAUNCH_SETTINGS =
"android.settings.QUICK_LAUNCH_SETTINGS"; "android.settings.QUICK_LAUNCH_SETTINGS";
/** /**
* Activity Action: Show settings to manage installed applications. * Activity Action: Show settings to manage installed applications.
* <p> * <p>
@@ -319,7 +319,7 @@ public final class Settings {
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS = public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
"android.settings.MANAGE_APPLICATIONS_SETTINGS"; "android.settings.MANAGE_APPLICATIONS_SETTINGS";
/** /**
* Activity Action: Show settings for system update functionality. * Activity Action: Show settings for system update functionality.
* <p> * <p>
@@ -329,7 +329,7 @@ public final class Settings {
* Input: Nothing. * Input: Nothing.
* <p> * <p>
* Output: Nothing. * Output: Nothing.
* *
* @hide * @hide
*/ */
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
@@ -349,7 +349,7 @@ public final class Settings {
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SYNC_SETTINGS = public static final String ACTION_SYNC_SETTINGS =
"android.settings.SYNC_SETTINGS"; "android.settings.SYNC_SETTINGS";
/** /**
* Activity Action: Show settings for selecting the network operator. * Activity Action: Show settings for selecting the network operator.
* <p> * <p>
@@ -404,7 +404,7 @@ public final class Settings {
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_MEMORY_CARD_SETTINGS = public static final String ACTION_MEMORY_CARD_SETTINGS =
"android.settings.MEMORY_CARD_SETTINGS"; "android.settings.MEMORY_CARD_SETTINGS";
// End of Intent actions for Settings // End of Intent actions for Settings
private static final String JID_RESOURCE_PREFIX = "android"; private static final String JID_RESOURCE_PREFIX = "android";
@@ -495,7 +495,7 @@ public final class Settings {
public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version"; public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
private static volatile NameValueCache mNameValueCache = null; private static volatile NameValueCache mNameValueCache = null;
private static final HashSet<String> MOVED_TO_SECURE; private static final HashSet<String> MOVED_TO_SECURE;
static { static {
MOVED_TO_SECURE = new HashSet<String>(30); MOVED_TO_SECURE = new HashSet<String>(30);
@@ -901,12 +901,12 @@ public final class Settings {
* plugged in. * plugged in.
*/ */
public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
/** /**
* Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep. * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
*/ */
public static final int WIFI_SLEEP_POLICY_NEVER = 2; public static final int WIFI_SLEEP_POLICY_NEVER = 2;
/** /**
* Whether to use static IP and other static network attributes. * Whether to use static IP and other static network attributes.
* <p> * <p>
@@ -1115,12 +1115,12 @@ public final class Settings {
* Note: This is a one-off setting that will be removed in the future * Note: This is a one-off setting that will be removed in the future
* when there is profile support. For this reason, it is kept hidden * when there is profile support. For this reason, it is kept hidden
* from the public APIs. * from the public APIs.
* *
* @hide * @hide
*/ */
public static final String NOTIFICATIONS_USE_RING_VOLUME = public static final String NOTIFICATIONS_USE_RING_VOLUME =
"notifications_use_ring_volume"; "notifications_use_ring_volume";
/** /**
* The mapping of stream type (integer) to its setting. * The mapping of stream type (integer) to its setting.
*/ */
@@ -1188,7 +1188,7 @@ public final class Settings {
* feature converts two spaces to a "." and space. * feature converts two spaces to a "." and space.
*/ */
public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
/** /**
* Setting to showing password characters in text editors. 1 = On, 0 = Off * Setting to showing password characters in text editors. 1 = On, 0 = Off
*/ */
@@ -1270,13 +1270,13 @@ public final class Settings {
* boolean (1 or 0). * boolean (1 or 0).
*/ */
public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
/** /**
* Whether the haptic feedback (long presses, ...) are enabled. The value is * Whether the haptic feedback (long presses, ...) are enabled. The value is
* boolean (1 or 0). * boolean (1 or 0).
*/ */
public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled"; public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
// Settings moved to Settings.Secure // Settings moved to Settings.Secure
/** /**
@@ -1321,7 +1321,7 @@ public final class Settings {
*/ */
@Deprecated @Deprecated
public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
/** /**
* @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
* instead * instead
@@ -1334,7 +1334,7 @@ public final class Settings {
*/ */
@Deprecated @Deprecated
public static final String LOGGING_ID = Secure.LOGGING_ID; public static final String LOGGING_ID = Secure.LOGGING_ID;
/** /**
* @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
*/ */
@@ -1374,7 +1374,7 @@ public final class Settings {
*/ */
@Deprecated @Deprecated
public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED; public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
/** /**
* @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
*/ */
@@ -1412,7 +1412,7 @@ public final class Settings {
@Deprecated @Deprecated
public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
/** /**
* @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT} * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
* instead * instead
@@ -1448,7 +1448,7 @@ public final class Settings {
@Deprecated @Deprecated
public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
/** /**
* @deprecated Use * @deprecated Use
* {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
@@ -1824,19 +1824,19 @@ public final class Settings {
* Whether the device has been provisioned (0 = false, 1 = true) * Whether the device has been provisioned (0 = false, 1 = true)
*/ */
public static final String DEVICE_PROVISIONED = "device_provisioned"; public static final String DEVICE_PROVISIONED = "device_provisioned";
/** /**
* List of input methods that are currently enabled. This is a string * List of input methods that are currently enabled. This is a string
* containing the IDs of all enabled input methods, each ID separated * containing the IDs of all enabled input methods, each ID separated
* by ':'. * by ':'.
*/ */
public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
/** /**
* Host name and port for a user-selected proxy. * Host name and port for a user-selected proxy.
*/ */
public static final String HTTP_PROXY = "http_proxy"; public static final String HTTP_PROXY = "http_proxy";
/** /**
* Whether the package installer should allow installation of apps downloaded from * Whether the package installer should allow installation of apps downloaded from
* sources other than the Android Market (vending machine). * sources other than the Android Market (vending machine).
@@ -1845,12 +1845,12 @@ public final class Settings {
* 0 = only allow installing from the Android Market * 0 = only allow installing from the Android Market
*/ */
public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
/** /**
* Comma-separated list of location providers that activities may access. * Comma-separated list of location providers that activities may access.
*/ */
public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
/** /**
* The Logging ID (a unique 64-bit value) as a hex string. * The Logging ID (a unique 64-bit value) as a hex string.
* Used as a pseudonymous identifier for logging. * Used as a pseudonymous identifier for logging.
@@ -1872,19 +1872,19 @@ public final class Settings {
* connectivity service should touch this. * connectivity service should touch this.
*/ */
public static final String NETWORK_PREFERENCE = "network_preference"; public static final String NETWORK_PREFERENCE = "network_preference";
/** /**
*/ */
public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
/** /**
*/ */
public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
/** /**
*/ */
public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
/** /**
* Settings classname to launch when Settings is clicked from All * Settings classname to launch when Settings is clicked from All
* Applications. Needed because of user testing between the old * Applications. Needed because of user testing between the old
@@ -1892,18 +1892,18 @@ public final class Settings {
*/ */
// TODO: 881807 // TODO: 881807
public static final String SETTINGS_CLASSNAME = "settings_classname"; public static final String SETTINGS_CLASSNAME = "settings_classname";
/** /**
* USB Mass Storage Enabled * USB Mass Storage Enabled
*/ */
public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
/** /**
* If this setting is set (to anything), then all references * If this setting is set (to anything), then all references
* to Gmail on the device must change to Google Mail. * to Gmail on the device must change to Google Mail.
*/ */
public static final String USE_GOOGLE_MAIL = "use_google_mail"; public static final String USE_GOOGLE_MAIL = "use_google_mail";
/** /**
* If accessibility is enabled. * If accessibility is enabled.
*/ */
@@ -1926,64 +1926,64 @@ public final class Settings {
*/ */
public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
"wifi_networks_available_notification_on"; "wifi_networks_available_notification_on";
/** /**
* Delay (in seconds) before repeating the Wi-Fi networks available notification. * Delay (in seconds) before repeating the Wi-Fi networks available notification.
* Connecting to a network will reset the timer. * Connecting to a network will reset the timer.
*/ */
public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
"wifi_networks_available_repeat_delay"; "wifi_networks_available_repeat_delay";
/** /**
* The number of radio channels that are allowed in the local * The number of radio channels that are allowed in the local
* 802.11 regulatory domain. * 802.11 regulatory domain.
* @hide * @hide
*/ */
public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels"; public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
/** /**
* When the number of open networks exceeds this number, the * When the number of open networks exceeds this number, the
* least-recently-used excess networks will be removed. * least-recently-used excess networks will be removed.
*/ */
public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
/** /**
* Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
*/ */
public static final String WIFI_ON = "wifi_on"; public static final String WIFI_ON = "wifi_on";
/** /**
* The acceptable packet loss percentage (range 0 - 100) before trying * The acceptable packet loss percentage (range 0 - 100) before trying
* another AP on the same network. * another AP on the same network.
*/ */
public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
"wifi_watchdog_acceptable_packet_loss_percentage"; "wifi_watchdog_acceptable_packet_loss_percentage";
/** /**
* The number of access points required for a network in order for the * The number of access points required for a network in order for the
* watchdog to monitor it. * watchdog to monitor it.
*/ */
public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
/** /**
* The delay between background checks. * The delay between background checks.
*/ */
public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
"wifi_watchdog_background_check_delay_ms"; "wifi_watchdog_background_check_delay_ms";
/** /**
* Whether the Wi-Fi watchdog is enabled for background checking even * Whether the Wi-Fi watchdog is enabled for background checking even
* after it thinks the user has connected to a good access point. * after it thinks the user has connected to a good access point.
*/ */
public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
"wifi_watchdog_background_check_enabled"; "wifi_watchdog_background_check_enabled";
/** /**
* The timeout for a background ping * The timeout for a background ping
*/ */
public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
"wifi_watchdog_background_check_timeout_ms"; "wifi_watchdog_background_check_timeout_ms";
/** /**
* The number of initial pings to perform that *may* be ignored if they * The number of initial pings to perform that *may* be ignored if they
* fail. Again, if these fail, they will *not* be used in packet loss * fail. Again, if these fail, they will *not* be used in packet loss
@@ -1992,7 +1992,7 @@ public final class Settings {
*/ */
public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
"wifi_watchdog_initial_ignored_ping_count"; "wifi_watchdog_initial_ignored_ping_count";
/** /**
* The maximum number of access points (per network) to attempt to test. * The maximum number of access points (per network) to attempt to test.
* If this number is reached, the watchdog will no longer monitor the * If this number is reached, the watchdog will no longer monitor the
@@ -2000,7 +2000,7 @@ public final class Settings {
* networks containing multiple APs whose DNS does not respond to pings. * networks containing multiple APs whose DNS does not respond to pings.
*/ */
public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
/** /**
* Whether the Wi-Fi watchdog is enabled. * Whether the Wi-Fi watchdog is enabled.
*/ */
@@ -2015,24 +2015,24 @@ public final class Settings {
* The number of pings to test if an access point is a good connection. * The number of pings to test if an access point is a good connection.
*/ */
public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
/** /**
* The delay between pings. * The delay between pings.
*/ */
public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
/** /**
* The timeout per ping. * The timeout per ping.
*/ */
public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
/** /**
* The maximum number of times we will retry a connection to an access * The maximum number of times we will retry a connection to an access
* point for which we have failed in acquiring an IP address from DHCP. * point for which we have failed in acquiring an IP address from DHCP.
* A value of N means that we will make N+1 connection attempts in all. * A value of N means that we will make N+1 connection attempts in all.
*/ */
public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
/** /**
* Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
* data connectivity to be established after a disconnect from Wi-Fi. * data connectivity to be established after a disconnect from Wi-Fi.
@@ -2062,21 +2062,14 @@ public final class Settings {
public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode"; public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
/** /**
* represents current active phone class * The preferred network mode 7 = Global
* 1 = GSM-Phone, 0 = CDMA-Phone * 6 = EvDo only
* @hide * 5 = CDMA w/o EvDo
*/ * 4 = CDMA / EvDo auto
public static final String CURRENT_ACTIVE_PHONE = "current_active_phone"; * 3 = GSM / WCDMA auto
* 2 = WCDMA only
/** * 1 = GSM only
* The preferred network mode 7 = Global * 0 = GSM / WCDMA preferred
* 6 = EvDo only
* 5 = CDMA w/o EvDo
* 4 = CDMA / EvDo auto
* 3 = GSM / WCDMA auto
* 2 = WCDMA only
* 1 = GSM only
* 0 = GSM / WCDMA preferred
* @hide * @hide
*/ */
public static final String PREFERRED_NETWORK_MODE = public static final String PREFERRED_NETWORK_MODE =
@@ -2142,7 +2135,7 @@ public final class Settings {
allowedProviders.startsWith(provider + ",") || allowedProviders.startsWith(provider + ",") ||
allowedProviders.endsWith("," + provider)); allowedProviders.endsWith("," + provider));
} }
return false; return false;
} }
/** /**
@@ -2166,7 +2159,7 @@ public final class Settings {
putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider); putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
} }
} }
/** /**
* Gservices settings, containing the network names for Google's * Gservices settings, containing the network names for Google's
* various services. This table holds simple name/addr pairs. * various services. This table holds simple name/addr pairs.
@@ -2294,7 +2287,7 @@ public final class Settings {
* Event tags from the kernel event log to upload during checkin. * Event tags from the kernel event log to upload during checkin.
*/ */
public static final String CHECKIN_EVENTS = "checkin_events"; public static final String CHECKIN_EVENTS = "checkin_events";
/** /**
* Event tags for list of services to upload during checkin. * Event tags for list of services to upload during checkin.
*/ */
@@ -2984,7 +2977,7 @@ public final class Settings {
public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD = public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
"battery_discharge_duration_threshold"; "battery_discharge_duration_threshold";
public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold"; public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
/** /**
* An email address that anr bugreports should be sent to. * An email address that anr bugreports should be sent to.
*/ */
@@ -3128,7 +3121,7 @@ public final class Settings {
/** /**
* Add a new bookmark to the system. * Add a new bookmark to the system.
* *
* @param cr The ContentResolver to query. * @param cr The ContentResolver to query.
* @param intent The desired target of the bookmark. * @param intent The desired target of the bookmark.
* @param title Bookmark title that is shown to the user; null if none * @param title Bookmark title that is shown to the user; null if none
@@ -3193,7 +3186,7 @@ public final class Settings {
/** /**
* Return the title as it should be displayed to the user. This takes * Return the title as it should be displayed to the user. This takes
* care of localizing bookmarks that point to activities. * care of localizing bookmarks that point to activities.
* *
* @param context A context. * @param context A context.
* @param cursor A cursor pointing to the row whose title should be * @param cursor A cursor pointing to the row whose title should be
* returned. The cursor must contain at least the {@link #TITLE} * returned. The cursor must contain at least the {@link #TITLE}
@@ -3208,24 +3201,24 @@ public final class Settings {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"The cursor must contain the TITLE and INTENT columns."); "The cursor must contain the TITLE and INTENT columns.");
} }
String title = cursor.getString(titleColumn); String title = cursor.getString(titleColumn);
if (!TextUtils.isEmpty(title)) { if (!TextUtils.isEmpty(title)) {
return title; return title;
} }
String intentUri = cursor.getString(intentColumn); String intentUri = cursor.getString(intentColumn);
if (TextUtils.isEmpty(intentUri)) { if (TextUtils.isEmpty(intentUri)) {
return ""; return "";
} }
Intent intent; Intent intent;
try { try {
intent = Intent.getIntent(intentUri); intent = Intent.getIntent(intentUri);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
return ""; return "";
} }
PackageManager packageManager = context.getPackageManager(); PackageManager packageManager = context.getPackageManager();
ResolveInfo info = packageManager.resolveActivity(intent, 0); ResolveInfo info = packageManager.resolveActivity(intent, 0);
return info != null ? info.loadLabel(packageManager) : ""; return info != null ? info.loadLabel(packageManager) : "";

View File

@@ -65,7 +65,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
private static final String TAG = "SettingsProvider"; private static final String TAG = "SettingsProvider";
private static final String DATABASE_NAME = "settings.db"; private static final String DATABASE_NAME = "settings.db";
private static final int DATABASE_VERSION = 34; private static final int DATABASE_VERSION = 34;
private Context mContext; private Context mContext;
public DatabaseHelper(Context context) { public DatabaseHelper(Context context) {
@@ -81,7 +81,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
");"); ");");
db.execSQL("CREATE INDEX secureIndex1 ON secure (name);"); db.execSQL("CREATE INDEX secureIndex1 ON secure (name);");
} }
@Override @Override
public void onCreate(SQLiteDatabase db) { public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE system (" + db.execSQL("CREATE TABLE system (" +
@@ -134,7 +134,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) { public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) {
Log.w(TAG, "Upgrading settings database from version " + oldVersion + " to " Log.w(TAG, "Upgrading settings database from version " + oldVersion + " to "
+ currentVersion); + currentVersion);
int upgradeVersion = oldVersion; int upgradeVersion = oldVersion;
// Pattern for upgrade blocks: // Pattern for upgrade blocks:
@@ -143,7 +143,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
// .. your upgrade logic.. // .. your upgrade logic..
// upgradeVersion = [the DATABASE_VERSION you set] // upgradeVersion = [the DATABASE_VERSION you set]
// } // }
if (upgradeVersion == 20) { if (upgradeVersion == 20) {
/* /*
* Version 21 is part of the volume control refresh. There is no * Version 21 is part of the volume control refresh. There is no
@@ -156,7 +156,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
upgradeVersion = 21; upgradeVersion = 21;
} }
if (upgradeVersion < 22) { if (upgradeVersion < 22) {
upgradeVersion = 22; upgradeVersion = 22;
// Upgrade the lock gesture storage location and format // Upgrade the lock gesture storage location and format
@@ -186,7 +186,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
} }
upgradeVersion = 24; upgradeVersion = 24;
} }
if (upgradeVersion == 24) { if (upgradeVersion == 24) {
db.beginTransaction(); db.beginTransaction();
try { try {
@@ -213,7 +213,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
} }
upgradeVersion = 26; upgradeVersion = 26;
} }
if (upgradeVersion == 26) { if (upgradeVersion == 26) {
// This introduces the new secure settings table. // This introduces the new secure settings table.
db.beginTransaction(); db.beginTransaction();
@@ -225,12 +225,12 @@ class DatabaseHelper extends SQLiteOpenHelper {
} }
upgradeVersion = 27; upgradeVersion = 27;
} }
if (upgradeVersion == 27) { if (upgradeVersion == 27) {
// Copy settings values from 'system' to 'secure' and delete them from 'system' // Copy settings values from 'system' to 'secure' and delete them from 'system'
SQLiteStatement insertStmt = null; SQLiteStatement insertStmt = null;
SQLiteStatement deleteStmt = null; SQLiteStatement deleteStmt = null;
db.beginTransaction(); db.beginTransaction();
try { try {
insertStmt = insertStmt =
@@ -271,11 +271,11 @@ class DatabaseHelper extends SQLiteOpenHelper {
Settings.Secure.WIFI_WATCHDOG_PING_DELAY_MS, Settings.Secure.WIFI_WATCHDOG_PING_DELAY_MS,
Settings.Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS, Settings.Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS,
}; };
for (String setting : settingsToMove) { for (String setting : settingsToMove) {
insertStmt.bindString(1, setting); insertStmt.bindString(1, setting);
insertStmt.execute(); insertStmt.execute();
deleteStmt.bindString(1, setting); deleteStmt.bindString(1, setting);
deleteStmt.execute(); deleteStmt.execute();
} }
@@ -291,7 +291,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
} }
upgradeVersion = 28; upgradeVersion = 28;
} }
if (upgradeVersion == 28 || upgradeVersion == 29) { if (upgradeVersion == 28 || upgradeVersion == 29) {
// Note: The upgrade to 28 was flawed since it didn't delete the old // Note: The upgrade to 28 was flawed since it didn't delete the old
// setting first before inserting. Combining 28 and 29 with the // setting first before inserting. Combining 28 and 29 with the
@@ -313,10 +313,10 @@ class DatabaseHelper extends SQLiteOpenHelper {
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }
upgradeVersion = 30; upgradeVersion = 30;
} }
if (upgradeVersion == 30) { if (upgradeVersion == 30) {
/* /*
* Upgrade 31 clears the title for all quick launch shortcuts so the * Upgrade 31 clears the title for all quick launch shortcuts so the
@@ -373,7 +373,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
} }
upgradeVersion = 33; upgradeVersion = 33;
} }
if (upgradeVersion == 33) { if (upgradeVersion == 33) {
// Set the default zoom controls to: tap-twice to bring up +/- // Set the default zoom controls to: tap-twice to bring up +/-
db.beginTransaction(); db.beginTransaction();
@@ -405,7 +405,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
} }
private void upgradeLockPatternLocation(SQLiteDatabase db) { private void upgradeLockPatternLocation(SQLiteDatabase db) {
Cursor c = db.query("system", new String[] {"_id", "value"}, "name='lock_pattern'", Cursor c = db.query("system", new String[] {"_id", "value"}, "name='lock_pattern'",
null, null, null, null); null, null, null, null);
if (c.getCount() > 0) { if (c.getCount() > 0) {
c.moveToFirst(); c.moveToFirst();
@@ -414,7 +414,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
// Convert lock pattern // Convert lock pattern
try { try {
LockPatternUtils lpu = new LockPatternUtils(mContext.getContentResolver()); LockPatternUtils lpu = new LockPatternUtils(mContext.getContentResolver());
List<LockPatternView.Cell> cellPattern = List<LockPatternView.Cell> cellPattern =
LockPatternUtils.stringToPattern(lockPattern); LockPatternUtils.stringToPattern(lockPattern);
lpu.saveLockPattern(cellPattern); lpu.saveLockPattern(cellPattern);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
@@ -542,12 +542,12 @@ class DatabaseHelper extends SQLiteOpenHelper {
AudioManager.RINGER_MODE_NORMAL); AudioManager.RINGER_MODE_NORMAL);
loadVibrateSetting(db, false); loadVibrateSetting(db, false);
// By default, only the ring/notification and system streams are affected // By default, only the ring/notification and system streams are affected
loadSetting(stmt, Settings.System.MODE_RINGER_STREAMS_AFFECTED, loadSetting(stmt, Settings.System.MODE_RINGER_STREAMS_AFFECTED,
(1 << AudioManager.STREAM_RING) | (1 << AudioManager.STREAM_NOTIFICATION) | (1 << AudioManager.STREAM_RING) | (1 << AudioManager.STREAM_NOTIFICATION) |
(1 << AudioManager.STREAM_SYSTEM)); (1 << AudioManager.STREAM_SYSTEM));
loadSetting(stmt, Settings.System.MUTE_STREAMS_AFFECTED, loadSetting(stmt, Settings.System.MUTE_STREAMS_AFFECTED,
((1 << AudioManager.STREAM_MUSIC) | ((1 << AudioManager.STREAM_MUSIC) |
(1 << AudioManager.STREAM_RING) | (1 << AudioManager.STREAM_RING) |
@@ -561,7 +561,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
if (deleteOld) { if (deleteOld) {
db.execSQL("DELETE FROM system WHERE name='" + Settings.System.VIBRATE_ON + "'"); db.execSQL("DELETE FROM system WHERE name='" + Settings.System.VIBRATE_ON + "'");
} }
SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)"
+ " VALUES(?,?);"); + " VALUES(?,?);");
@@ -576,79 +576,78 @@ class DatabaseHelper extends SQLiteOpenHelper {
private void loadSettings(SQLiteDatabase db) { private void loadSettings(SQLiteDatabase db) {
loadSystemSettings(db); loadSystemSettings(db);
loadSecureSettings(db); loadSecureSettings(db);
} }
private void loadSystemSettings(SQLiteDatabase db) { private void loadSystemSettings(SQLiteDatabase db) {
SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)"
+ " VALUES(?,?);"); + " VALUES(?,?);");
Resources r = mContext.getResources(); Resources r = mContext.getResources();
loadSetting(stmt, Settings.Secure.CURRENT_ACTIVE_PHONE,
RILConstants.CDMA_PHONE);
loadBooleanSetting(stmt, Settings.System.DIM_SCREEN, loadBooleanSetting(stmt, Settings.System.DIM_SCREEN,
R.bool.def_dim_screen); R.bool.def_dim_screen);
loadSetting(stmt, Settings.System.STAY_ON_WHILE_PLUGGED_IN, loadSetting(stmt, Settings.System.STAY_ON_WHILE_PLUGGED_IN,
"1".equals(SystemProperties.get("ro.kernel.qemu")) ? 1 : 0); "1".equals(SystemProperties.get("ro.kernel.qemu")) ? 1 : 0);
loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT, loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT,
R.integer.def_screen_off_timeout); R.integer.def_screen_off_timeout);
loadBooleanSetting(stmt, Settings.System.AIRPLANE_MODE_ON, loadBooleanSetting(stmt, Settings.System.AIRPLANE_MODE_ON,
R.bool.def_airplane_mode_on); R.bool.def_airplane_mode_on);
loadStringSetting(stmt, Settings.System.AIRPLANE_MODE_RADIOS, loadStringSetting(stmt, Settings.System.AIRPLANE_MODE_RADIOS,
R.string.def_airplane_mode_radios); R.string.def_airplane_mode_radios);
loadBooleanSetting(stmt, Settings.System.AUTO_TIME, loadBooleanSetting(stmt, Settings.System.AUTO_TIME,
R.bool.def_auto_time); // Sync time to NITZ R.bool.def_auto_time); // Sync time to NITZ
loadIntegerSetting(stmt, Settings.System.SCREEN_BRIGHTNESS, loadIntegerSetting(stmt, Settings.System.SCREEN_BRIGHTNESS,
R.integer.def_screen_brightness); R.integer.def_screen_brightness);
loadDefaultAnimationSettings(stmt); loadDefaultAnimationSettings(stmt);
loadBooleanSetting(stmt, Settings.System.ACCELEROMETER_ROTATION, loadBooleanSetting(stmt, Settings.System.ACCELEROMETER_ROTATION,
R.bool.def_accelerometer_rotation); R.bool.def_accelerometer_rotation);
// Default date format based on build // Default date format based on build
loadSetting(stmt, Settings.System.DATE_FORMAT, loadSetting(stmt, Settings.System.DATE_FORMAT,
SystemProperties.get("ro.com.android.dateformat", SystemProperties.get("ro.com.android.dateformat",
"MM-dd-yyyy")); "MM-dd-yyyy"));
stmt.close(); stmt.close();
} }
private void loadDefaultAnimationSettings(SQLiteStatement stmt) { private void loadDefaultAnimationSettings(SQLiteStatement stmt) {
loadFractionSetting(stmt, Settings.System.WINDOW_ANIMATION_SCALE, loadFractionSetting(stmt, Settings.System.WINDOW_ANIMATION_SCALE,
R.fraction.def_window_animation_scale, 1); R.fraction.def_window_animation_scale, 1);
loadFractionSetting(stmt, Settings.System.TRANSITION_ANIMATION_SCALE, loadFractionSetting(stmt, Settings.System.TRANSITION_ANIMATION_SCALE,
R.fraction.def_window_transition_scale, 1); R.fraction.def_window_transition_scale, 1);
} }
private void loadSecureSettings(SQLiteDatabase db) { private void loadSecureSettings(SQLiteDatabase db) {
SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
+ " VALUES(?,?);"); + " VALUES(?,?);");
loadBooleanSetting(stmt, Settings.Secure.BLUETOOTH_ON, loadBooleanSetting(stmt, Settings.Secure.BLUETOOTH_ON,
R.bool.def_bluetooth_on); R.bool.def_bluetooth_on);
// Data roaming default, based on build // Data roaming default, based on build
loadSetting(stmt, Settings.Secure.DATA_ROAMING, loadSetting(stmt, Settings.Secure.DATA_ROAMING,
"true".equalsIgnoreCase( "true".equalsIgnoreCase(
SystemProperties.get("ro.com.android.dataroaming", SystemProperties.get("ro.com.android.dataroaming",
"false")) ? 1 : 0); "false")) ? 1 : 0);
loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS,
R.bool.def_install_non_market_apps); R.bool.def_install_non_market_apps);
loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
R.string.def_location_providers_allowed); R.string.def_location_providers_allowed);
loadIntegerSetting(stmt, Settings.Secure.NETWORK_PREFERENCE, loadIntegerSetting(stmt, Settings.Secure.NETWORK_PREFERENCE,
R.integer.def_network_preference); R.integer.def_network_preference);
loadBooleanSetting(stmt, Settings.Secure.USB_MASS_STORAGE_ENABLED, loadBooleanSetting(stmt, Settings.Secure.USB_MASS_STORAGE_ENABLED,
R.bool.def_usb_mass_storage_enabled); R.bool.def_usb_mass_storage_enabled);
loadBooleanSetting(stmt, Settings.Secure.WIFI_ON, loadBooleanSetting(stmt, Settings.Secure.WIFI_ON,
R.bool.def_wifi_on); R.bool.def_wifi_on);
loadBooleanSetting(stmt, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, loadBooleanSetting(stmt, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
@@ -660,7 +659,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
} }
// Set the preferred network mode to 0 = Global, CDMA default // Set the preferred network mode to 0 = Global, CDMA default
loadSetting(stmt, Settings.Secure.PREFERRED_NETWORK_MODE, loadSetting(stmt, Settings.Secure.PREFERRED_NETWORK_MODE,
RILConstants.PREFERRED_NETWORK_MODE); RILConstants.PREFERRED_NETWORK_MODE);
// Enable or disable Cell Broadcast SMS // Enable or disable Cell Broadcast SMS
@@ -668,17 +667,17 @@ class DatabaseHelper extends SQLiteOpenHelper {
RILConstants.CDMA_CELL_BROADCAST_SMS_DISABLED); RILConstants.CDMA_CELL_BROADCAST_SMS_DISABLED);
// Set the preferred cdma subscription to 0 = Subscription from RUIM, when available // Set the preferred cdma subscription to 0 = Subscription from RUIM, when available
loadSetting(stmt, Settings.Secure.PREFERRED_CDMA_SUBSCRIPTION, loadSetting(stmt, Settings.Secure.PREFERRED_CDMA_SUBSCRIPTION,
RILConstants.PREFERRED_CDMA_SUBSCRIPTION); RILConstants.PREFERRED_CDMA_SUBSCRIPTION);
// Don't do this. The SystemServer will initialize ADB_ENABLED from a // Don't do this. The SystemServer will initialize ADB_ENABLED from a
// persistent system property instead. // persistent system property instead.
//loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0); //loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0);
// Allow mock locations default, based on build // Allow mock locations default, based on build
loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION, loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION,
"1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0); "1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0);
stmt.close(); stmt.close();
} }
@@ -687,21 +686,21 @@ class DatabaseHelper extends SQLiteOpenHelper {
stmt.bindString(2, value.toString()); stmt.bindString(2, value.toString());
stmt.execute(); stmt.execute();
} }
private void loadStringSetting(SQLiteStatement stmt, String key, int resid) { private void loadStringSetting(SQLiteStatement stmt, String key, int resid) {
loadSetting(stmt, key, mContext.getResources().getString(resid)); loadSetting(stmt, key, mContext.getResources().getString(resid));
} }
private void loadBooleanSetting(SQLiteStatement stmt, String key, int resid) { private void loadBooleanSetting(SQLiteStatement stmt, String key, int resid) {
loadSetting(stmt, key, loadSetting(stmt, key,
mContext.getResources().getBoolean(resid) ? "1" : "0"); mContext.getResources().getBoolean(resid) ? "1" : "0");
} }
private void loadIntegerSetting(SQLiteStatement stmt, String key, int resid) { private void loadIntegerSetting(SQLiteStatement stmt, String key, int resid) {
loadSetting(stmt, key, loadSetting(stmt, key,
Integer.toString(mContext.getResources().getInteger(resid))); Integer.toString(mContext.getResources().getInteger(resid)));
} }
private void loadFractionSetting(SQLiteStatement stmt, String key, int resid, int base) { private void loadFractionSetting(SQLiteStatement stmt, String key, int resid, int base) {
loadSetting(stmt, key, loadSetting(stmt, key,
Float.toString(mContext.getResources().getFraction(resid, base, base))); Float.toString(mContext.getResources().getFraction(resid, base, base)));

View File

@@ -62,13 +62,10 @@ public abstract class CellLocation {
* @hide * @hide
*/ */
public static CellLocation newFromBundle(Bundle bundle) { public static CellLocation newFromBundle(Bundle bundle) {
// TODO: My need to be use: Settings.Secure.getInt(mContext, Settings.Secure.CURRENT_ACTIVE_PHONE, 0)) // TelephonyManager.getDefault().getPhoneType() handles the case when
// instead of SystemProperties??? // ITelephony interface is not up yet.
int type = TelephonyManager.getDefault().getPhoneType();
// NOTE here TelephonyManager.getDefault().getPhoneType() cannot be used since at startup if (type == RILConstants.CDMA_PHONE) {
// ITelephony have not been created
if (RILConstants.CDMA_PHONE == SystemProperties.getInt(
Settings.Secure.CURRENT_ACTIVE_PHONE, RILConstants.CDMA_PHONE)) {
return new CdmaCellLocation(bundle); return new CdmaCellLocation(bundle);
} else { } else {
return new GsmCellLocation(bundle); return new GsmCellLocation(bundle);
@@ -85,13 +82,10 @@ public abstract class CellLocation {
* *
*/ */
public static CellLocation getEmpty() { public static CellLocation getEmpty() {
// TODO: My need to be use: Settings.Secure.getInt(mContext, Settings.Secure.CURRENT_ACTIVE_PHONE, 0)) // TelephonyManager.getDefault().getPhoneType() handles the case when
// instead of SystemProperties??? // ITelephony interface is not up yet.
int type = TelephonyManager.getDefault().getPhoneType();
// NOTE here TelephonyManager.getDefault().getPhoneType() cannot be used since at startup if (type == RILConstants.CDMA_PHONE) {
// ITelephony have not been created
if (RILConstants.CDMA_PHONE == SystemProperties.getInt(
Settings.Secure.CURRENT_ACTIVE_PHONE, RILConstants.CDMA_PHONE)) {
return new CdmaCellLocation(); return new CdmaCellLocation();
} else { } else {
return new GsmCellLocation(); return new GsmCellLocation();

View File

@@ -16,26 +16,24 @@
package android.telephony; package android.telephony;
import com.android.internal.telephony.*;
import java.util.ArrayList;
import java.util.List;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SdkConstant; import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.telephony.CellLocation;
import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.IPhoneSubInfo;
import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.ITelephonyRegistry; import com.android.internal.telephony.ITelephonyRegistry;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.TelephonyProperties; import com.android.internal.telephony.TelephonyProperties;
import java.util.List;
/** /**
* Provides access to information about the telephony services on * Provides access to information about the telephony services on
* the device. Applications can use the methods in this class to * the device. Applications can use the methods in this class to
@@ -239,10 +237,10 @@ public class TelephonyManager {
/** /**
* Returns the neighboring cell information of the device. * Returns the neighboring cell information of the device.
* *
* @return List of NeighboringCellInfo or null if info unavailable. * @return List of NeighboringCellInfo or null if info unavailable.
* *
* <p>Requires Permission: * <p>Requires Permission:
* (@link android.Manifest.permission#ACCESS_COARSE_UPDATES} * (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}
*/ */
public List<NeighboringCellInfo> getNeighboringCellInfo() { public List<NeighboringCellInfo> getNeighboringCellInfo() {
@@ -251,24 +249,25 @@ public class TelephonyManager {
} catch (RemoteException ex) { } catch (RemoteException ex) {
} }
return null; return null;
} }
/** /**
* No phone module * No phone module
*
*/ */
public static final int PHONE_TYPE_NONE = 0; public static final int PHONE_TYPE_NONE = 0;
/** /**
* GSM phone * GSM phone
*/ */
public static final int PHONE_TYPE_GSM = 1; public static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE;
/** /**
* CDMA phone * CDMA phone
* @hide * @hide
*/ */
public static final int PHONE_TYPE_CDMA = 2; public static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE;
/** /**
* Returns a constant indicating the device phone type. * Returns a constant indicating the device phone type.
@@ -279,16 +278,41 @@ public class TelephonyManager {
*/ */
public int getPhoneType() { public int getPhoneType() {
try{ try{
if(getITelephony().getActivePhoneType() == RILConstants.CDMA_PHONE) { ITelephony telephony = getITelephony();
return PHONE_TYPE_CDMA; if (telephony != null) {
if(telephony.getActivePhoneType() == RILConstants.CDMA_PHONE) {
return PHONE_TYPE_CDMA;
} else {
return PHONE_TYPE_GSM;
}
} else { } else {
return PHONE_TYPE_GSM; // This can happen when the ITelephony interface is not up yet.
return getPhoneTypeFromProperty();
} }
}catch(RemoteException ex){ } catch(RemoteException ex){
return PHONE_TYPE_NONE; // This shouldn't happen in the normal case, as a backup we
// read from the system property.
return getPhoneTypeFromProperty();
} }
} }
private int getPhoneTypeFromProperty() {
int type =
SystemProperties.getInt(TelephonyProperties.CURRENT_ACTIVE_PHONE,
getPhoneTypeFromNetworkType());
return type;
}
private int getPhoneTypeFromNetworkType() {
// When the system property CURRENT_ACTIVE_PHONE, has not been set,
// use the system property for default network type.
// This is a fail safe, and can only happen at first boot.
int mode = SystemProperties.getInt("ro.telephony.default_network", -1);
if (mode == -1)
return PHONE_TYPE_NONE;
return PhoneFactory.getPhoneType(mode);
}
// //
// //
// Current Network // Current Network
@@ -640,8 +664,10 @@ public class TelephonyManager {
/** Data connection activity: Currently both sending and receiving /** Data connection activity: Currently both sending and receiving
* IP PPP traffic. */ * IP PPP traffic. */
public static final int DATA_ACTIVITY_INOUT = DATA_ACTIVITY_IN | DATA_ACTIVITY_OUT; public static final int DATA_ACTIVITY_INOUT = DATA_ACTIVITY_IN | DATA_ACTIVITY_OUT;
/** Data connection is active, but physical link is down */ /**
/** @hide */ * Data connection is active, but physical link is down
* @hide
*/
public static final int DATA_ACTIVITY_DORMANT = 0x00000004; public static final int DATA_ACTIVITY_DORMANT = 0x00000004;
/** /**

View File

@@ -107,33 +107,49 @@ public class PhoneFactory {
//reads the system properties and makes commandsinterface //reads the system properties and makes commandsinterface
sCommandsInterface = new RIL(context, networkMode, cdmaSubscription); sCommandsInterface = new RIL(context, networkMode, cdmaSubscription);
switch(networkMode) { int phoneType = getPhoneType(networkMode);
case RILConstants.NETWORK_MODE_WCDMA_PREF: if (phoneType == RILConstants.GSM_PHONE) {
case RILConstants.NETWORK_MODE_GSM_ONLY: sProxyPhone = new PhoneProxy(new GSMPhone(context,
case RILConstants.NETWORK_MODE_WCDMA_ONLY: sCommandsInterface, sPhoneNotifier));
case RILConstants.NETWORK_MODE_GSM_UMTS: Log.i(LOG_TAG, "Creating GSMPhone");
sProxyPhone = new PhoneProxy(new GSMPhone(context, } else if (phoneType == RILConstants.CDMA_PHONE) {
sCommandsInterface, sPhoneNotifier)); sProxyPhone = new PhoneProxy(new CDMAPhone(context,
Log.i(LOG_TAG, "Creating GSMPhone"); sCommandsInterface, sPhoneNotifier));
break; Log.i(LOG_TAG, "Creating CDMAPhone");
case RILConstants.NETWORK_MODE_CDMA:
case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
sProxyPhone = new PhoneProxy(new CDMAPhone(context,
sCommandsInterface, sPhoneNotifier));
Log.i(LOG_TAG, "Creating CDMAPhone");
break;
case RILConstants.NETWORK_MODE_GLOBAL:
default:
sProxyPhone = new PhoneProxy(new CDMAPhone(context,
sCommandsInterface, sPhoneNotifier));
Log.i(LOG_TAG, "Creating CDMAPhone");
} }
sMadeDefaults = true; sMadeDefaults = true;
} }
} }
} }
/*
* This function returns the type of the phone, depending
* on the network mode.
*
* @param network mode
* @return Phone Type
*/
public static int getPhoneType(int networkMode) {
switch(networkMode) {
case RILConstants.NETWORK_MODE_CDMA:
case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
return RILConstants.CDMA_PHONE;
case RILConstants.NETWORK_MODE_WCDMA_PREF:
case RILConstants.NETWORK_MODE_GSM_ONLY:
case RILConstants.NETWORK_MODE_WCDMA_ONLY:
case RILConstants.NETWORK_MODE_GSM_UMTS:
return RILConstants.GSM_PHONE;
case RILConstants.NETWORK_MODE_GLOBAL:
return RILConstants.CDMA_PHONE;
default:
return RILConstants.GSM_PHONE;
}
}
public static Phone getDefaultPhone() { public static Phone getDefaultPhone() {
if (sLooper != Looper.myLooper()) { if (sLooper != Looper.myLooper()) {
throw new RuntimeException( throw new RuntimeException(

View File

@@ -69,6 +69,8 @@ public interface TelephonyProperties
*/ */
static final String PROPERTY_OPERATOR_ISO_COUNTRY = "gsm.operator.iso-country"; static final String PROPERTY_OPERATOR_ISO_COUNTRY = "gsm.operator.iso-country";
static final String CURRENT_ACTIVE_PHONE = "gsm.current.phone-type";
//****** SIM Card //****** SIM Card
/** /**
* One of <code>"UNKNOWN"</code> <code>"ABSENT"</code> <code>"PIN_REQUIRED"</code> * One of <code>"UNKNOWN"</code> <code>"ABSENT"</code> <code>"PIN_REQUIRED"</code>

View File

@@ -52,6 +52,7 @@ import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.PhoneSubInfo; import com.android.internal.telephony.PhoneSubInfo;
import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -126,8 +127,8 @@ public class CDMAPhone extends PhoneBase {
//Change the system setting //Change the system setting
Settings.Secure.putInt(mContext.getContentResolver(), SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
Settings.Secure.CURRENT_ACTIVE_PHONE, RILConstants.CDMA_PHONE); new Integer(RILConstants.CDMA_PHONE).toString());
} }
public void dispose() { public void dispose() {

View File

@@ -68,6 +68,7 @@ import com.android.internal.telephony.PhoneNotifier;
import com.android.internal.telephony.PhoneProxy; import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.PhoneSubInfo; import com.android.internal.telephony.PhoneSubInfo;
import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.gsm.stk.StkService; import com.android.internal.telephony.gsm.stk.StkService;
import com.android.internal.telephony.test.SimulatedRadioControl; import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.IccVmNotSupportedException; import com.android.internal.telephony.IccVmNotSupportedException;
@@ -204,9 +205,9 @@ public class GSMPhone extends PhoneBase {
} }
} }
//Change the system setting //Change the system property
Settings.Secure.putInt(mContext.getContentResolver(), SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
Settings.Secure.CURRENT_ACTIVE_PHONE, RILConstants.GSM_PHONE); new Integer(RILConstants.GSM_PHONE).toString());
} }
public void dispose() { public void dispose() {
@@ -837,21 +838,21 @@ public class GSMPhone extends PhoneBase {
private void storeVoiceMailNumber(String number) { private void storeVoiceMailNumber(String number) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = sp.edit(); SharedPreferences.Editor editor = sp.edit();
editor.putString(VM_NUMBER, number); editor.putString(VM_NUMBER, number);
editor.commit(); editor.commit();
setVmSimImsi(getSubscriberId()); setVmSimImsi(getSubscriberId());
} }
public String getVoiceMailNumber() { public String getVoiceMailNumber() {
// Read from the SIM. If its null, try reading from the shared preference area. // Read from the SIM. If its null, try reading from the shared preference area.
String number = mSIMRecords.getVoiceMailNumber(); String number = mSIMRecords.getVoiceMailNumber();
if (TextUtils.isEmpty(number)) { if (TextUtils.isEmpty(number)) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
number = sp.getString(VM_NUMBER, null); number = sp.getString(VM_NUMBER, null);
} }
return number; return number;
} }
private String getVmSimImsi() { private String getVmSimImsi() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
return sp.getString(VM_SIM_IMSI, null); return sp.getString(VM_SIM_IMSI, null);
@@ -863,7 +864,7 @@ public class GSMPhone extends PhoneBase {
editor.putString(VM_SIM_IMSI, imsi); editor.putString(VM_SIM_IMSI, imsi);
editor.commit(); editor.commit();
} }
public String getVoiceMailAlphaTag() { public String getVoiceMailAlphaTag() {
String ret; String ret;
@@ -932,13 +933,13 @@ public class GSMPhone extends PhoneBase {
public void setVoiceMailNumber(String alphaTag, public void setVoiceMailNumber(String alphaTag,
String voiceMailNumber, String voiceMailNumber,
Message onComplete) { Message onComplete) {
Message resp; Message resp;
mVmNumber = voiceMailNumber; mVmNumber = voiceMailNumber;
resp = h.obtainMessage(EVENT_SET_VM_NUMBER_DONE, 0, 0, onComplete); resp = h.obtainMessage(EVENT_SET_VM_NUMBER_DONE, 0, 0, onComplete);
mSIMRecords.setVoiceMailNumber(alphaTag, mVmNumber, resp); mSIMRecords.setVoiceMailNumber(alphaTag, mVmNumber, resp);
} }
private boolean isValidCommandInterfaceCFReason (int commandInterfaceCFReason) { private boolean isValidCommandInterfaceCFReason (int commandInterfaceCFReason) {
switch (commandInterfaceCFReason) { switch (commandInterfaceCFReason) {
case CF_REASON_UNCONDITIONAL: case CF_REASON_UNCONDITIONAL:
@@ -1317,11 +1318,11 @@ public class GSMPhone extends PhoneBase {
case EVENT_SIM_RECORDS_LOADED: case EVENT_SIM_RECORDS_LOADED:
updateCurrentCarrierInProvider(); updateCurrentCarrierInProvider();
// Check if this is a different SIM than the previous one. If so unset the // Check if this is a different SIM than the previous one. If so unset the
// voice mail number. // voice mail number.
String imsi = getVmSimImsi(); String imsi = getVmSimImsi();
if (imsi != null && !getSubscriberId().equals(imsi)) { if (imsi != null && !getSubscriberId().equals(imsi)) {
storeVoiceMailNumber(null); storeVoiceMailNumber(null);
setVmSimImsi(null); setVmSimImsi(null);
} }
@@ -1403,7 +1404,7 @@ public class GSMPhone extends PhoneBase {
onComplete.sendToTarget(); onComplete.sendToTarget();
} }
break; break;
case EVENT_SET_VM_NUMBER_DONE: case EVENT_SET_VM_NUMBER_DONE:
ar = (AsyncResult)msg.obj; ar = (AsyncResult)msg.obj;
if (IccVmNotSupportedException.class.isInstance(ar.exception)) { if (IccVmNotSupportedException.class.isInstance(ar.exception)) {
@@ -1417,7 +1418,7 @@ public class GSMPhone extends PhoneBase {
} }
break; break;
case EVENT_GET_CALL_FORWARD_DONE: case EVENT_GET_CALL_FORWARD_DONE:
ar = (AsyncResult)msg.obj; ar = (AsyncResult)msg.obj;
if (ar.exception == null) { if (ar.exception == null) {
@@ -1460,7 +1461,7 @@ public class GSMPhone extends PhoneBase {
/** /**
* Sets the "current" field in the telephony provider according to the SIM's operator * Sets the "current" field in the telephony provider according to the SIM's operator
* *
* @return true for success; false otherwise. * @return true for success; false otherwise.
*/ */
boolean updateCurrentCarrierInProvider() { boolean updateCurrentCarrierInProvider() {