Merge commit 'f9ca318a3d2aceaf5c9e54610073a9017442be9b' into HEAD

This commit is contained in:
The Android Open Source Project
2013-12-05 12:38:23 -08:00
88 changed files with 534 additions and 383 deletions

View File

@@ -1343,7 +1343,6 @@
</activity>
<activity android:name="Settings$WifiDisplaySettingsActivity"
android:uiOptions="splitActionBarWhenNarrow"
android:label="@string/wifi_display_settings_title"
android:taskAffinity=""
android:excludeFromRecents="true">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1001 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 706 B

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 785 B

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -196,6 +196,12 @@
style="@style/wifi_item_content"
android:prompt="@string/proxy_settings_title"
android:entries="@array/wifi_proxy_settings" />
<TextView android:id="@+id/proxy_pac_info"
style="@style/wifi_item_content"
android:textStyle="bold"
android:textAlignment="viewStart"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout android:id="@+id/proxy_warning_limited_support"

View File

@@ -32,4 +32,7 @@
<!-- Whether to show a preference item for regulatory information in About phone -->
<bool name="config_show_regulatory_info">false</bool>
<!-- Whether to show a preference item for mobile plan -->
<bool name="config_show_mobile_plan">true</bool>
</resources>

View File

@@ -50,7 +50,7 @@
<!-- Size of icons in the top-level of settings -->
<dimen name="header_icon_width">28dp</dimen>
<dimen name="appwidget_min_width">260dip</dimen>
<dimen name="appwidget_min_width">280dip</dimen>
<dimen name="appwidget_min_height">40dip</dimen>
<dimen name="pager_tabs_padding">0dp</dimen>

View File

@@ -436,6 +436,9 @@
<!-- HTTP proxy settings. Warning message about limited application support [CHAR LIMIT=100]-->
<string name="proxy_warning_limited_support">The HTTP proxy is used by the browser but may not be used by the other apps.</string>
<!-- HTTP proxy settings. Title for Proxy-Auto Config URL. [CHAR LIMIT=NONE]-->
<string name="proxy_url">"PAC URL: "</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_signal_location_label">Location:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
@@ -1223,37 +1226,22 @@
<string name="bluetooth_dock_settings_remember">Remember settings</string>
<!-- Wifi Display settings. The title of the screen. [CHAR LIMIT=40] -->
<string name="wifi_display_settings_title">Wireless display</string>
<!-- Wifi Display settings. Text displayed when Wifi display is off and device list is empty [CHAR LIMIT=80]-->
<string name="wifi_display_settings_empty_list_wifi_display_off">To see devices, turn wireless display on.</string>
<!-- Wifi Display settings. Text displayed when Wifi Display is off and device list is empty [CHAR LIMIT=80]-->
<string name="wifi_display_settings_empty_list_wifi_display_disabled">Wireless display is disabled because Wi\u2011Fi is off.</string>
<!-- Wifi Display settings. The title of the action button that initiates a search for nearby devices [CHAR LIMIT=20] -->
<string name="wifi_display_search_for_devices">Search for displays</string>
<!-- Wifi Display settings. The title of the action button while a search for nearby devices is in progress [CHAR LIMIT=20] -->
<string name="wifi_display_searching_for_devices">Searching\u2026</string>
<string name="wifi_display_settings_title">Cast screen</string>
<!-- Wifi Display settings. The title of a menu item to enable wireless display [CHAR LIMIT=40] -->
<string name="wifi_display_enable_menu_item">Enable wireless display</string>
<!-- Wifi Display settings. Text that appears when scanning for devices is finished and no nearby device was found [CHAR LIMIT=40]-->
<string name="wifi_display_no_devices_found">No nearby wireless displays were found.</string>
<!-- Wifi Display settings. The sub heading for devices which have already been paired with this device. [CHAR LIMIT=40] -->
<string name="wifi_display_paired_devices">Paired displays</string>
<!-- Wifi Display settings. The sub heading for available devices during and after scanning. [CHAR LIMIT=40] -->
<string name="wifi_display_available_devices">Available devices</string>
<string name="wifi_display_no_devices_found">No nearby devices were found.</string>
<!-- Wifi Display settings. The status summary for connecting devices. [CHAR LIMIT=40] -->
<string name="wifi_display_status_connecting">Connecting</string>
<!-- Wifi Display settings. The status summary for connected devices. [CHAR LIMIT=40] -->
<string name="wifi_display_status_connected">Connected</string>
<!-- Wifi Display settings. The status summary for available devices. [CHAR LIMIT=40] -->
<string name="wifi_display_status_available">Available</string>
<!-- Wifi Display settings. The status summary for devices that's already in use. [CHAR LIMIT=40] -->
<string name="wifi_display_status_in_use">In use</string>
<!-- Wifi Display settings. The status summary for devices that's not available. [CHAR LIMIT=40] -->
<string name="wifi_display_status_not_available">Unavailable</string>
<!-- Wifi Display settings. Image description for device details button. This opens the screen to rename, unpair, etc. a single device. -->
<string name="wifi_display_details">Display settings</string>
<!-- Wifi Display settings. Disconnect dialog. The title of the dialog. [CHAR LIMIT=40] -->
<string name="wifi_display_disconnect_title">Disconnect?</string>
<!-- Wifi Display settings. Disconnect dialog. Message for disconnecting from the display. [CHAR LIMIT=NONE] -->
<string name="wifi_display_disconnect_text">This will end your connection with:&lt;br>&lt;b><xliff:g id="device_name">%1$s</xliff:g>&lt;/b></string>
<!-- Wifi Display settings. Options dialog. The title of the dialog. [CHAR LIMIT=40] -->
<string name="wifi_display_options_title">Wireless display options</string>
<!-- Wifi Display settings. Options dialog. The forget button text. [CHAR LIMIT=20] -->
@@ -1263,13 +1251,6 @@
<!-- Wifi Display settings. Options dialog. The name label used when prompting the user to rename the display. [CHAR LIMIT=20] -->
<string name="wifi_display_options_name">Name</string>
<!-- Wifi Display settings. Summary shown in Display settings. Text used for 'On' state. [CHAR LIMIT=40] -->
<string name="wifi_display_summary_on">On</string>
<!-- Wifi Display settings. Summary shown in Display settings. Text used for 'Off' state. [CHAR LIMIT=40] -->
<string name="wifi_display_summary_off">Off</string>
<!-- Wifi Display settings. Summary shown in Display settings. Text used for 'Disabled' state. [CHAR LIMIT=40] -->
<string name="wifi_display_summary_disabled">Disabled</string>
<!-- Wifi Display settings. The sub heading for wireless display certification options. [CHAR LIMIT=40] -->
<string name="wifi_display_certification_heading" translatable="false">Certification</string>
<!-- Wifi Display settings. The section title for wireless display session info. [CHAR LIMIT=40] -->
@@ -1948,6 +1929,19 @@
<!-- SIM card lock settings screen, SIM PIN dialog button labels: -->
<string name="sim_enter_cancel">Cancel</string>
<!-- Instructions telling the user that they entered the wrong SIM PIN for the last time.
Displayed in a dialog box. -->
<string name="wrong_pin_code_pukked">Incorrect SIM PIN code you must now contact your carrier to unlock your device.</string>
<!-- Instructions telling the user that they entered the wrong SIM PIN while trying
to unlock the keyguard. Displayed in a dialog box. -->
<plurals name="wrong_pin_code">
<item quantity="one">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempt before you must contact your carrier to unlock your device.</item>
<item quantity="other">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempts.</item>
</plurals>
<!-- Instructions telling the user that the operation to unlock the keyguard
with SIM PIN failed. Displayed in one line in a large font. -->
<string name="pin_failed">SIM PIN operation failed!</string>
<!-- Advanced (used for diagnostics) device info activity title -->
<string name="device_info_settings" product="tablet">Tablet status</string>
<!-- Advanced (used for diagnostics) device info activity title -->
@@ -2426,11 +2420,11 @@
<!-- [CHAR LIMIT=30] Location mode screen, screen title -->
<string name="location_mode_screen_title">Location mode</string>
<!-- [CHAR LIMIT=130] Location mode screen, description for high accuracy mode -->
<string name="location_mode_high_accuracy_description">Use GPS, Wi\u2011Fi and mobile networks to estimate location </string>
<string name="location_mode_high_accuracy_description">Use GPS, Wi\u2011Fi, and mobile networks to determine location </string>
<!-- [CHAR LIMIT=130] Location mode screen, description for battery saving mode -->
<string name="location_mode_battery_saving_description">Use Wi\u2011Fi and mobile networks to estimate location</string>
<string name="location_mode_battery_saving_description">Use Wi\u2011Fi and mobile networks to determine location</string>
<!-- [CHAR LIMIT=130] Location mode screen, description for sensors only mode -->
<string name="location_mode_sensors_only_description">Use GPS to pinpoint your location</string>
<string name="location_mode_sensors_only_description">Use GPS to determine your location</string>
<!-- [CHAR LIMIT=130] Location mode screen, temporary value to show as the status of a location
setting injected by an external app while the app is being queried for the actual value -->
<string name="location_loading_injected_setting">Retrieving…</string>
@@ -3478,6 +3472,9 @@
<!-- Template for the label of the state for a ongoing print job. [CHAR LIMIT=25] -->
<string name="print_printing_state_title_template">Printing <xliff:g id="print_job_name" example="foo.jpg">%1$s</xliff:g></string>
<!-- Template for the label for a cancelling print job. [CHAR LIMIT=25] -->
<string name="print_cancelling_state_title_template" >Cancelling <xliff:g id="print_job_name" example="foo.jpg">%1$s</xliff:g></string>
<!-- Template for the label of the state for a failed print job. [CHAR LIMIT=25] -->
<string name="print_failed_state_title_template">Printer error <xliff:g id="print_job_name" example="foo.jpg">%1$s</xliff:g></string>
@@ -4674,7 +4671,7 @@
<!-- Text of message to show to users whose administrator has installed a SSL CA Cert. [CHAR LIMIT=NONE] -->
<string name="ssl_ca_cert_info_message">This device is managed by:\n<xliff:g id="managing_domain">%s</xliff:g>\n\nYour administrator is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nFor more information, contact your administrator.</string>
<!-- Text of warning to show to users that have a SSL CA Cert installed. [CHAR LIMIT=NONE] -->
<string name="ssl_ca_cert_warning_message">A third party is capable of monitoring your network\nactivity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible.</string>
<string name="ssl_ca_cert_warning_message">A third party is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible.</string>
<!-- Label on button that will take the user to the Trusted Credentials settings page. [CHAR LIMIT=NONE]-->
<string name="ssl_ca_cert_settings_button">Check trusted credentials</string>

View File

@@ -43,6 +43,7 @@ import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.view.View.OnTouchListener;
@@ -557,6 +558,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
// Notify the user in 120 seconds that we are waiting for him to enter the password.
mHandler.removeMessages(MESSAGE_NOTIFY);
mHandler.sendEmptyMessageDelayed(MESSAGE_NOTIFY, 120 * 1000);
// Dismiss keyguard while this screen is showing.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
}
/**

View File

@@ -21,16 +21,10 @@ import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
import android.app.ActivityManagerNative;
import android.app.Dialog;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.hardware.display.DisplayManager;
import android.hardware.display.WifiDisplay;
import android.hardware.display.WifiDisplayStatus;
import android.os.Bundle;
import android.os.RemoteException;
import android.preference.CheckBoxPreference;
@@ -40,7 +34,6 @@ import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.util.AttributeSet;
import android.util.Log;
import com.android.internal.view.RotationPolicy;
@@ -60,12 +53,9 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
private static final String KEY_FONT_SIZE = "font_size";
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
private static final String KEY_SCREEN_SAVER = "screensaver";
private static final String KEY_WIFI_DISPLAY = "wifi_display";
private static final int DLG_GLOBAL_CHANGE_WARNING = 1;
private DisplayManager mDisplayManager;
private CheckBoxPreference mAccelerometer;
private WarnedListPreference mFontSizePref;
private CheckBoxPreference mNotificationPulse;
@@ -75,9 +65,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
private ListPreference mScreenTimeoutPreference;
private Preference mScreenSaverPreference;
private WifiDisplayStatus mWifiDisplayStatus;
private Preference mWifiDisplayPreference;
private final RotationPolicy.RotationPolicyListener mRotationPolicyListener =
new RotationPolicy.RotationPolicyListener() {
@Override
@@ -135,16 +122,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found");
}
}
mDisplayManager = (DisplayManager)getActivity().getSystemService(
Context.DISPLAY_SERVICE);
mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus();
mWifiDisplayPreference = (Preference)findPreference(KEY_WIFI_DISPLAY);
if (mWifiDisplayStatus.getFeatureState()
== WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
getPreferenceScreen().removePreference(mWifiDisplayPreference);
mWifiDisplayPreference = null;
}
}
private void updateTimeoutPreferenceDescription(long currentTimeout) {
@@ -252,12 +229,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
RotationPolicy.registerRotationPolicyListener(getActivity(),
mRotationPolicyListener);
if (mWifiDisplayPreference != null) {
getActivity().registerReceiver(mReceiver, new IntentFilter(
DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED));
mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus();
}
updateState();
}
@@ -267,10 +238,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
RotationPolicy.unregisterRotationPolicyListener(getActivity(),
mRotationPolicyListener);
if (mWifiDisplayPreference != null) {
getActivity().unregisterReceiver(mReceiver);
}
}
@Override
@@ -291,7 +258,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
updateAccelerometerRotationCheckbox();
readFontSizePreference(mFontSizePref);
updateScreenSaverSummary();
updateWifiDisplaySummary();
}
private void updateScreenSaverSummary() {
@@ -301,23 +267,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
}
}
private void updateWifiDisplaySummary() {
if (mWifiDisplayPreference != null) {
switch (mWifiDisplayStatus.getFeatureState()) {
case WifiDisplayStatus.FEATURE_STATE_OFF:
mWifiDisplayPreference.setSummary(R.string.wifi_display_summary_off);
break;
case WifiDisplayStatus.FEATURE_STATE_ON:
mWifiDisplayPreference.setSummary(R.string.wifi_display_summary_on);
break;
case WifiDisplayStatus.FEATURE_STATE_DISABLED:
default:
mWifiDisplayPreference.setSummary(R.string.wifi_display_summary_disabled);
break;
}
}
}
private void updateAccelerometerRotationCheckbox() {
if (getActivity() == null) return;
@@ -347,6 +296,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
@Override
public boolean onPreferenceChange(Preference preference, Object objValue) {
final String key = preference.getKey();
if (KEY_SCREEN_TIMEOUT.equals(key)) {
@@ -365,17 +315,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
return true;
}
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED)) {
mWifiDisplayStatus = (WifiDisplayStatus)intent.getParcelableExtra(
DisplayManager.EXTRA_WIFI_DISPLAY_STATUS);
updateWifiDisplaySummary();
}
}
};
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == mFontSizePref) {

View File

@@ -29,6 +29,7 @@ import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.util.Log;
import android.widget.Toast;
import com.android.internal.telephony.Phone;
@@ -46,6 +47,8 @@ import com.android.internal.telephony.TelephonyIntents;
*/
public class IccLockSettings extends PreferenceActivity
implements EditPinPreference.OnPinEnteredListener {
private static final String TAG = "IccLockSettings";
private static final boolean DBG = true;
private static final int OFF_MODE = 0;
// State when enabling/disabling ICC lock
@@ -101,10 +104,10 @@ public class IccLockSettings extends PreferenceActivity
AsyncResult ar = (AsyncResult) msg.obj;
switch (msg.what) {
case MSG_ENABLE_ICC_PIN_COMPLETE:
iccLockChanged(ar.exception == null);
iccLockChanged(ar.exception == null, msg.arg1);
break;
case MSG_CHANGE_ICC_PIN_COMPLETE:
iccPinChanged(ar.exception == null);
iccPinChanged(ar.exception == null, msg.arg1);
break;
case MSG_SIM_STATE_CHANGED:
updatePreferences();
@@ -352,21 +355,21 @@ public class IccLockSettings extends PreferenceActivity
mPinToggle.setEnabled(false);
}
private void iccLockChanged(boolean success) {
private void iccLockChanged(boolean success, int attemptsRemaining) {
if (success) {
mPinToggle.setChecked(mToState);
} else {
Toast.makeText(this, mRes.getString(R.string.sim_lock_failed), Toast.LENGTH_SHORT)
Toast.makeText(this, getPinPasswordErrorMessage(attemptsRemaining), Toast.LENGTH_LONG)
.show();
}
mPinToggle.setEnabled(true);
resetDialogState();
}
private void iccPinChanged(boolean success) {
private void iccPinChanged(boolean success, int attemptsRemaining) {
if (!success) {
Toast.makeText(this, mRes.getString(R.string.sim_change_failed),
Toast.LENGTH_SHORT)
Toast.makeText(this, getPinPasswordErrorMessage(attemptsRemaining),
Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(this, mRes.getString(R.string.sim_change_succeeded),
@@ -383,6 +386,23 @@ public class IccLockSettings extends PreferenceActivity
mNewPin, callback);
}
private String getPinPasswordErrorMessage(int attemptsRemaining) {
String displayMessage;
if (attemptsRemaining == 0) {
displayMessage = mRes.getString(R.string.wrong_pin_code_pukked);
} else if (attemptsRemaining > 0) {
displayMessage = mRes
.getQuantityString(R.plurals.wrong_pin_code, attemptsRemaining,
attemptsRemaining);
} else {
displayMessage = mRes.getString(R.string.pin_failed);
}
if (DBG) Log.d(TAG, "getPinPasswordErrorMessage:"
+ " attemptsRemaining=" + attemptsRemaining + " displayMessage=" + displayMessage);
return displayMessage;
}
private boolean reasonablePin(String pin) {
if (pin == null || pin.length() < MIN_PIN_LENGTH || pin.length() > MAX_PIN_LENGTH) {
return false;

View File

@@ -46,6 +46,7 @@ import android.view.IWindowManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
@@ -89,6 +90,8 @@ public class KeyguardAppWidgetPickActivity extends Activity
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().addPrivateFlags(
WindowManager.LayoutParams.PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR);
setContentView(R.layout.keyguard_appwidget_picker_layout);
super.onCreate(savedInstanceState);

View File

@@ -245,7 +245,8 @@ public class SecuritySettings extends RestrictedSettingsFragment
// Enable or disable keyguard widget checkbox based on DPM state
mEnableKeyguardWidgets = (CheckBoxPreference) root.findPreference(KEY_ENABLE_WIDGETS);
if (mEnableKeyguardWidgets != null) {
if (ActivityManager.isLowRamDeviceStatic()) {
if (ActivityManager.isLowRamDeviceStatic()
|| mLockPatternUtils.isLockScreenDisabled()) {
// Widgets take a lot of RAM, so disable them on low-memory devices
PreferenceGroup securityCategory
= (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY);

View File

@@ -506,7 +506,6 @@ public class Settings extends PreferenceActivity
// uiOptions for fragments also defined as activities in manifest.
if (WifiSettings.class.getName().equals(fragmentName) ||
WifiP2pSettings.class.getName().equals(fragmentName) ||
WifiDisplaySettings.class.getName().equals(fragmentName) ||
BluetoothSettings.class.getName().equals(fragmentName) ||
DreamSettings.class.getName().equals(fragmentName) ||
LocationSettings.class.getName().equals(fragmentName) ||

View File

@@ -333,6 +333,16 @@ public class WirelessSettings extends RestrictedSettingsFragment
removePreference(KEY_MOBILE_NETWORK_SETTINGS);
removePreference(KEY_MANAGE_MOBILE_PLAN);
}
// Remove Mobile Network Settings and Manage Mobile Plan
// if config_show_mobile_plan sets false.
boolean isMobilePlanEnabled = this.getResources().getBoolean(
R.bool.config_show_mobile_plan);
if (!isMobilePlanEnabled) {
Preference pref = findPreference(KEY_MANAGE_MOBILE_PLAN);
if (pref != null) {
removePreference(KEY_MANAGE_MOBILE_PLAN);
}
}
protectByRestrictions(KEY_MOBILE_NETWORK_SETTINGS);
protectByRestrictions(KEY_MANAGE_MOBILE_PLAN);

View File

@@ -55,11 +55,15 @@ import java.util.HashSet;
/** Manages settings for Google Account. */
public class ManageAccountsSettings extends AccountPreferenceBase
implements OnAccountsUpdateListener {
private static final String ACCOUNT_KEY = "account"; // to pass to auth settings
public static final String KEY_ACCOUNT_TYPE = "account_type";
public static final String KEY_ACCOUNT_LABEL = "account_label";
// Action name for the broadcast intent when the Google account preferences page is launching
// the location settings.
private static final String LAUNCHING_LOCATION_SETTINGS =
"com.android.settings.accounts.LAUNCHING_LOCATION_SETTINGS";
private static final int MENU_SYNC_NOW_ID = Menu.FIRST;
private static final int MENU_SYNC_CANCEL_ID = Menu.FIRST + 1;
@@ -366,6 +370,13 @@ public class ManageAccountsSettings extends AccountPreferenceBase
public boolean onPreferenceClick(Preference preference) {
((PreferenceActivity) getActivity()).startPreferencePanel(
mClass, null, mTitleRes, null, null, 0);
// Hack: announce that the Google account preferences page is launching the location
// settings
if (mClass.equals(LocationSettings.class.getName())) {
Intent intent = new Intent(LAUNCHING_LOCATION_SETTINGS);
getActivity().sendBroadcast(
intent, android.Manifest.permission.WRITE_SECURE_SETTINGS);
}
return true;
}
}

View File

@@ -68,6 +68,9 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
private int mMessagePermissionChoice;
private int mPhonebookRejectedTimes;
private int mMessageRejectedTimes;
private final Collection<Callback> mCallbacks = new ArrayList<Callback>();
@@ -79,9 +82,13 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
// User has rejected the connection and let Settings app remember the decision
final static int ACCESS_REJECTED = 2;
// how many times did User reject the connection to make the rejected persist.
final static int PERSIST_REJECTED_TIMES_LIMIT = 2;
private final static String PHONEBOOK_PREFS_NAME = "bluetooth_phonebook_permission";
private final static String MESSAGE_PREFS_NAME = "bluetooth_message_permission";
private final static String PHONEBOOK_REJECT_TIMES = "bluetooth_phonebook_reject";
private final static String MESSAGE_REJECT_TIMES = "bluetooth_message_reject";
/**
* When we connect to multiple profiles, we only want to display a single
@@ -130,23 +137,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
return;
}
mProfileConnectionState.put(profile, newProfileState);
if (newProfileState == BluetoothProfile.STATE_DISCONNECTED) {
// check whether we are disconnected with this device completely
boolean isDisconnected = true;
for (LocalBluetoothProfile pf: mProfileConnectionState.keySet()) {
if (mProfileConnectionState.get(pf) != BluetoothProfile.STATE_DISCONNECTED) {
isDisconnected = false;
break;
}
}
// if disconnected, restore permission choice.
// So ACCESS_REJECTED will take effect until we are disconnected with this device.
if (isDisconnected) {
fetchPhonebookPermissionChoice();
fetchMessagePermissionChoice();
}
}
if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
if (!mProfiles.contains(profile)) {
mRemovedProfiles.remove(profile);
@@ -159,7 +149,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
}
if (profile instanceof MapProfile) {
profile.setPreferred(mDevice, true);
refresh();
}
} else if (profile instanceof MapProfile &&
newProfileState == BluetoothProfile.STATE_DISCONNECTED) {
@@ -168,7 +157,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
mProfiles.remove(profile);
}
profile.setPreferred(mDevice, false);
refresh();
} else if (mLocalNapRoleConnected && profile instanceof PanProfile &&
((PanProfile) profile).isLocalRoleNap(mDevice) &&
newProfileState == BluetoothProfile.STATE_DISCONNECTED) {
@@ -375,8 +363,6 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
for (LocalBluetoothProfile profile :getProfiles()) {
mProfileConnectionState.put(profile, BluetoothProfile.STATE_DISCONNECTED);
}
fetchPhonebookPermissionChoice();
fetchMessagePermissionChoice();
}
// TODO: do any of these need to run async on a background thread?
@@ -386,6 +372,8 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
updateProfiles();
fetchPhonebookPermissionChoice();
fetchMessagePermissionChoice();
fetchPhonebookRejectTimes();
fetchMessageRejectTimes();
mVisible = false;
dispatchAttributesChanged();
@@ -499,7 +487,8 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
ParcelUuid[] localUuids = mLocalAdapter.getUuids();
if (localUuids == null) return false;
mProfileManager.updateProfiles(uuids, localUuids, mProfiles, mRemovedProfiles, mLocalNapRoleConnected);
mProfileManager.updateProfiles(uuids, localUuids, mProfiles, mRemovedProfiles,
mLocalNapRoleConnected, mDevice);
if (DEBUG) {
Log.e(TAG, "updating profiles for " + mDevice.getAliasName());
@@ -552,6 +541,10 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
mConnectAfterPairing = false; // cancel auto-connect
setPhonebookPermissionChoice(ACCESS_UNKNOWN);
setMessagePermissionChoice(ACCESS_UNKNOWN);
mPhonebookRejectedTimes = 0;
savePhonebookRejectTimes();
mMessageRejectedTimes = 0;
saveMessageRejectTimes();
}
refresh();
@@ -668,10 +661,16 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
}
void setPhonebookPermissionChoice(int permissionChoice) {
mPhonebookPermissionChoice = permissionChoice;
// if user reject it, only save it when reject exceed limit.
if (permissionChoice == ACCESS_REJECTED) {
mPhonebookRejectedTimes++;
savePhonebookRejectTimes();
if (mPhonebookRejectedTimes < PERSIST_REJECTED_TIMES_LIMIT) {
return;
}
}
// if user reject it, don't save it to editor.
if (permissionChoice == ACCESS_REJECTED) return;
mPhonebookPermissionChoice = permissionChoice;
SharedPreferences.Editor editor =
mContext.getSharedPreferences(PHONEBOOK_PREFS_NAME, Context.MODE_PRIVATE).edit();
@@ -690,16 +689,39 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
ACCESS_UNKNOWN);
}
private void fetchPhonebookRejectTimes() {
SharedPreferences preference = mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES,
Context.MODE_PRIVATE);
mPhonebookRejectedTimes = preference.getInt(mDevice.getAddress(), 0);
}
private void savePhonebookRejectTimes() {
SharedPreferences.Editor editor =
mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES,
Context.MODE_PRIVATE).edit();
if (mPhonebookRejectedTimes == 0) {
editor.remove(mDevice.getAddress());
} else {
editor.putInt(mDevice.getAddress(), mPhonebookRejectedTimes);
}
editor.commit();
}
int getMessagePermissionChoice() {
return mMessagePermissionChoice;
}
void setMessagePermissionChoice(int permissionChoice) {
mMessagePermissionChoice = permissionChoice;
// if user reject it, only save it when reject exceed limit.
if (permissionChoice == ACCESS_REJECTED) {
mMessageRejectedTimes++;
saveMessageRejectTimes();
if (mMessageRejectedTimes < PERSIST_REJECTED_TIMES_LIMIT) {
return;
}
}
// if user reject it, don't save it to editor.
if (permissionChoice == ACCESS_REJECTED) return;
mMessagePermissionChoice = permissionChoice;
SharedPreferences.Editor editor =
mContext.getSharedPreferences(MESSAGE_PREFS_NAME, Context.MODE_PRIVATE).edit();
@@ -718,4 +740,21 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
ACCESS_UNKNOWN);
}
private void fetchMessageRejectTimes() {
SharedPreferences preference = mContext.getSharedPreferences(MESSAGE_REJECT_TIMES,
Context.MODE_PRIVATE);
mMessageRejectedTimes = preference.getInt(mDevice.getAddress(), 0);
}
private void saveMessageRejectTimes() {
SharedPreferences.Editor editor =
mContext.getSharedPreferences(MESSAGE_REJECT_TIMES, Context.MODE_PRIVATE).edit();
if (mMessageRejectedTimes == 0) {
editor.remove(mDevice.getAddress());
} else {
editor.putInt(mDevice.getAddress(), mMessageRejectedTimes);
}
editor.commit();
}
}

View File

@@ -321,7 +321,7 @@ final class LocalBluetoothProfileManager {
synchronized void updateProfiles(ParcelUuid[] uuids, ParcelUuid[] localUuids,
Collection<LocalBluetoothProfile> profiles,
Collection<LocalBluetoothProfile> removedProfiles,
boolean isPanNapConnected) {
boolean isPanNapConnected, BluetoothDevice device) {
// Copy previous profile list into removedProfiles
removedProfiles.clear();
removedProfiles.addAll(profiles);
@@ -367,6 +367,13 @@ final class LocalBluetoothProfileManager {
profiles.add(mPanProfile);
removedProfiles.remove(mPanProfile);
}
if ((mMapProfile != null) &&
(mMapProfile.getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED)) {
profiles.add(mMapProfile);
removedProfiles.remove(mMapProfile);
mMapProfile.setPreferred(device, true);
}
}
}

View File

@@ -205,9 +205,7 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory {
addPreference(mMountTogglePreference);
}
// Only allow formatting of primary physical storage
// TODO: enable for non-primary volumes once MTP is fixed
final boolean allowFormat = mVolume != null ? mVolume.isPrimary() : false;
final boolean allowFormat = mVolume != null;
if (allowFormat) {
mFormatPreference = new Preference(context);
mFormatPreference.setTitle(R.string.sd_format);

View File

@@ -490,6 +490,15 @@ public class BatteryStatsHelper {
* mPowerProfile.getAveragePower(PowerProfile.POWER_WIFI_SCAN)) / 1000;
power += p;
if (DEBUG && p != 0) Log.i(TAG, String.format("wifi scanning power=%.2f", p));
for (int bin = 0; bin < BatteryStats.Uid.NUM_WIFI_BATCHED_SCAN_BINS; bin++) {
long batchScanTimeMs = u.getWifiBatchedScanTime(bin, uSecTime, which) / 1000;
p = (batchScanTimeMs
* mPowerProfile.getAveragePower(PowerProfile.POWER_WIFI_BATCHED_SCAN, bin));
power += p;
if (DEBUG && p != 0) {
Log.i(TAG, String.format("wifi batched scanning lvl %d = %.2f", bin, p));
}
}
// Process Sensor usage
Map<Integer, ? extends BatteryStats.Uid.Sensor> sensorStats = u.getSensorStats();

View File

@@ -166,25 +166,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
mKeyboardSettingsCategory.addPreference(currentIme);
}
synchronized (mInputMethodPreferenceList) {
mInputMethodPreferenceList.clear();
final List<InputMethodInfo> imis = mInputMethodSettingValues.getInputMethodList();
final int N = (imis == null ? 0 : imis.size());
for (int i = 0; i < N; ++i) {
final InputMethodInfo imi = imis.get(i);
final InputMethodPreference pref = getInputMethodPreference(imi);
pref.setOnImePreferenceChangeListener(mOnImePreferenceChangedListener);
mInputMethodPreferenceList.add(pref);
}
if (!mInputMethodPreferenceList.isEmpty()) {
Collections.sort(mInputMethodPreferenceList);
for (int i = 0; i < N; ++i) {
mKeyboardSettingsCategory.addPreference(mInputMethodPreferenceList.get(i));
}
}
}
// Build hard keyboard and game controller preference categories.
mIm = (InputManager)getActivity().getSystemService(Context.INPUT_SERVICE);
updateInputDevices();
@@ -311,10 +292,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
// Refresh internal states in mInputMethodSettingValues to keep the latest
// "InputMethodInfo"s and "InputMethodSubtype"s
mInputMethodSettingValues.refreshAllInputMethodAndSubtypes();
// TODO: Consolidate the logic to InputMethodSettingsWrapper
InputMethodAndSubtypeUtil.loadInputMethodSubtypeList(
this, getContentResolver(),
mInputMethodSettingValues.getInputMethodList(), null);
updateInputMethodPreferenceViews();
}
@@ -427,6 +404,28 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
private void updateInputMethodPreferenceViews() {
synchronized (mInputMethodPreferenceList) {
// Clear existing "InputMethodPreference"s
for (final InputMethodPreference imp : mInputMethodPreferenceList) {
mKeyboardSettingsCategory.removePreference(imp);
}
mInputMethodPreferenceList.clear();
final List<InputMethodInfo> imis = mInputMethodSettingValues.getInputMethodList();
final int N = (imis == null ? 0 : imis.size());
for (int i = 0; i < N; ++i) {
final InputMethodInfo imi = imis.get(i);
final InputMethodPreference pref = getInputMethodPreference(imi);
pref.setOnImePreferenceChangeListener(mOnImePreferenceChangedListener);
mInputMethodPreferenceList.add(pref);
}
if (!mInputMethodPreferenceList.isEmpty()) {
Collections.sort(mInputMethodPreferenceList);
for (int i = 0; i < N; ++i) {
mKeyboardSettingsCategory.addPreference(mInputMethodPreferenceList.get(i));
}
}
// update views status
for (Preference pref : mInputMethodPreferenceList) {
if (pref instanceof InputMethodPreference) {
((InputMethodPreference) pref).updatePreferenceViews();
@@ -434,6 +433,13 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
}
}
updateCurrentImeName();
// TODO: Consolidate the logic with InputMethodSettingsWrapper
// CAVEAT: The preference class here does not know about the default value - that is
// managed by the Input Method Manager Service, so in this case it could save the wrong
// value. Hence we must update the checkboxes here.
InputMethodAndSubtypeUtil.loadInputMethodSubtypeList(
this, getContentResolver(),
mInputMethodSettingValues.getInputMethodList(), null);
}
private void updateCurrentImeName() {

View File

@@ -19,7 +19,6 @@ package com.android.settings.print;
import android.app.ActivityManager;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.print.PrintJob;
@@ -113,9 +112,11 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
MenuItem cancel = menu.add(0, MENU_ITEM_ID_CANCEL, Menu.NONE,
getString(R.string.print_cancel));
cancel.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
if (!mPrintJob.getInfo().isCancelling()) {
MenuItem cancel = menu.add(0, MENU_ITEM_ID_CANCEL, Menu.NONE,
getString(R.string.print_cancel));
cancel.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
if (mPrintJob.isFailed()) {
MenuItem restart = menu.add(0, MENU_ITEM_ID_RESTART, Menu.NONE,
@@ -169,8 +170,13 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
switch (info.getState()) {
case PrintJobInfo.STATE_QUEUED:
case PrintJobInfo.STATE_STARTED: {
mPrintJobPreference.setTitle(getString(
R.string.print_printing_state_title_template, info.getLabel()));
if (!mPrintJob.getInfo().isCancelling()) {
mPrintJobPreference.setTitle(getString(
R.string.print_printing_state_title_template, info.getLabel()));
} else {
mPrintJobPreference.setTitle(getString(
R.string.print_cancelling_state_title_template, info.getLabel()));
}
} break;
case PrintJobInfo.STATE_FAILED: {
@@ -179,8 +185,13 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
} break;
case PrintJobInfo.STATE_BLOCKED: {
mPrintJobPreference.setTitle(getString(
R.string.print_blocked_state_title_template, info.getLabel()));
if (!mPrintJob.getInfo().isCancelling()) {
mPrintJobPreference.setTitle(getString(
R.string.print_blocked_state_title_template, info.getLabel()));
} else {
mPrintJobPreference.setTitle(getString(
R.string.print_cancelling_state_title_template, info.getLabel()));
}
} break;
}

View File

@@ -376,9 +376,15 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
switch (printJob.getState()) {
case PrintJobInfo.STATE_QUEUED:
case PrintJobInfo.STATE_STARTED: {
preference.setTitle(getString(
R.string.print_printing_state_title_template,
printJob.getLabel()));
if (!printJob.isCancelling()) {
preference.setTitle(getString(
R.string.print_printing_state_title_template,
printJob.getLabel()));
} else {
preference.setTitle(getString(
R.string.print_cancelling_state_title_template,
printJob.getLabel()));
}
} break;
case PrintJobInfo.STATE_FAILED: {
@@ -388,9 +394,15 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
} break;
case PrintJobInfo.STATE_BLOCKED: {
preference.setTitle(getString(
R.string.print_blocked_state_title_template,
printJob.getLabel()));
if (!printJob.isCancelling()) {
preference.setTitle(getString(
R.string.print_blocked_state_title_template,
printJob.getLabel()));
} else {
preference.setTitle(getString(
R.string.print_cancelling_state_title_template,
printJob.getLabel()));
}
} break;
}

View File

@@ -29,6 +29,8 @@ import android.database.ContentObserver;
import android.hardware.display.DisplayManager;
import android.hardware.display.WifiDisplay;
import android.hardware.display.WifiDisplayStatus;
import android.media.MediaRouter;
import android.media.MediaRouter.RouteInfo;
import android.net.Uri;
import android.net.wifi.p2p.WifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager.ActionListener;
@@ -63,31 +65,48 @@ import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;
import com.android.internal.app.MediaRouteDialogPresenter;
import com.android.settings.ProgressCategory;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
/**
* The Settings screen for WifiDisplay configuration and connection management.
*
* The wifi display routes are integrated together with other remote display routes
* from the media router. It may happen that wifi display isn't actually available
* on the system. In that case, the enable option will not be shown but other
* remote display routes will continue to be made available.
*/
public final class WifiDisplaySettings extends SettingsPreferenceFragment {
private static final String TAG = "WifiDisplaySettings";
private static final boolean DEBUG = false;
private static final int MENU_ID_SCAN = Menu.FIRST;
private static final int MENU_ID_ENABLE_WIFI_DISPLAY = Menu.FIRST;
private static final int CHANGE_SETTINGS = 1 << 0;
private static final int CHANGE_ROUTES = 1 << 1;
private static final int CHANGE_WIFI_DISPLAY_STATUS = 1 << 2;
private static final int CHANGE_ALL = -1;
private static final int ORDER_CERTIFICATION = 1;
private static final int ORDER_CONNECTED = 2;
private static final int ORDER_AVAILABLE = 3;
private static final int ORDER_UNAVAILABLE = 4;
private final Handler mHandler;
private MediaRouter mRouter;
private DisplayManager mDisplayManager;
private boolean mStarted;
private int mPendingChanges;
private boolean mWifiDisplayOnSetting;
private WifiDisplayStatus mWifiDisplayStatus;
private PreferenceGroup mPairedDevicesCategory;
private ProgressCategory mAvailableDevicesCategory;
private TextView mEmptyView;
private Switch mActionBarSwitch;
/* certification */
private boolean mWifiDisplayCertificationOn;
private WifiP2pManager mWifiP2pManager;
@@ -100,15 +119,18 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
private int mOperatingChannel;
public WifiDisplaySettings() {
mHandler = new Handler();
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mDisplayManager = (DisplayManager)getActivity().getSystemService(Context.DISPLAY_SERVICE);
mWifiP2pManager = (WifiP2pManager)getActivity().getSystemService(Context.WIFI_P2P_SERVICE);
mWifiP2pChannel = mWifiP2pManager.initialize(getActivity(), Looper.getMainLooper(), null);
final Context context = getActivity();
mRouter = (MediaRouter)context.getSystemService(Context.MEDIA_ROUTER_SERVICE);
mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE);
mWifiP2pManager = (WifiP2pManager)context.getSystemService(Context.WIFI_P2P_SERVICE);
mWifiP2pChannel = mWifiP2pManager.initialize(context, Looper.getMainLooper(), null);
addPreferencesFromResource(R.xml.wifi_display_settings);
setHasOptionsMenu(true);
@@ -118,42 +140,17 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Activity activity = getActivity();
mActionBarSwitch = new Switch(activity);
mActionBarSwitch.setOnCheckedChangeListener(mSwitchOnCheckedChangedListener);
final int padding = activity.getResources().getDimensionPixelSize(
R.dimen.action_bar_switch_padding);
mActionBarSwitch.setPaddingRelative(0, 0, padding, 0);
activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
ActionBar.DISPLAY_SHOW_CUSTOM);
activity.getActionBar().setCustomView(mActionBarSwitch,
new ActionBar.LayoutParams(
ActionBar.LayoutParams.WRAP_CONTENT,
ActionBar.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_VERTICAL | Gravity.END));
mEmptyView = (TextView) getView().findViewById(android.R.id.empty);
mEmptyView.setText(R.string.wifi_display_no_devices_found);
getListView().setEmptyView(mEmptyView);
update();
if (mWifiDisplayStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
activity.finish();
}
}
@Override
public void onDestroyView() {
getActivity().getActionBar().setCustomView(null);
super.onDestroyView();
}
public void onStart() {
super.onStart();
mStarted = true;
@Override
public void onResume() {
super.onResume();
Context context = getActivity();
final Context context = getActivity();
IntentFilter filter = new IntentFilter();
filter.addAction(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED);
context.registerReceiver(mReceiver, filter);
@@ -163,136 +160,156 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
getContentResolver().registerContentObserver(Settings.Global.getUriFor(
Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON), false, mSettingsObserver);
getContentResolver().registerContentObserver(Settings.Global.getUriFor(
Settings.Global.WIFI_DISPLAY_WPS_CONFIG), false, mSettingsObserver);
Settings.Global.WIFI_DISPLAY_WPS_CONFIG), false, mSettingsObserver);
mDisplayManager.scanWifiDisplays();
mRouter.addCallback(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY, mRouterCallback,
MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN);
update();
update(CHANGE_ALL);
}
@Override
public void onPause() {
super.onPause();
public void onStop() {
super.onStop();
mStarted = false;
Context context = getActivity();
final Context context = getActivity();
context.unregisterReceiver(mReceiver);
getContentResolver().unregisterContentObserver(mSettingsObserver);
mRouter.removeCallback(mRouterCallback);
unscheduleUpdate();
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuItem item = menu.add(Menu.NONE, MENU_ID_SCAN, 0,
mWifiDisplayStatus.getScanState() == WifiDisplayStatus.SCAN_STATE_SCANNING ?
R.string.wifi_display_searching_for_devices :
R.string.wifi_display_search_for_devices);
item.setEnabled(mWifiDisplayStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON
&& mWifiDisplayStatus.getScanState() == WifiDisplayStatus.SCAN_STATE_NOT_SCANNING);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
if (mWifiDisplayStatus != null && mWifiDisplayStatus.getFeatureState()
!= WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
MenuItem item = menu.add(Menu.NONE, MENU_ID_ENABLE_WIFI_DISPLAY, 0,
R.string.wifi_display_enable_menu_item);
item.setCheckable(true);
item.setChecked(mWifiDisplayOnSetting);
}
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_ID_SCAN:
if (mWifiDisplayStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON) {
mDisplayManager.scanWifiDisplays();
}
case MENU_ID_ENABLE_WIFI_DISPLAY:
mWifiDisplayOnSetting = !item.isChecked();
item.setChecked(mWifiDisplayOnSetting);
Settings.Global.putInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_ON, mWifiDisplayOnSetting ? 1 : 0);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
Preference preference) {
if (preference instanceof WifiDisplayPreference) {
WifiDisplayPreference p = (WifiDisplayPreference)preference;
WifiDisplay display = p.getDisplay();
if (display.equals(mWifiDisplayStatus.getActiveDisplay())) {
showDisconnectDialog(display);
} else if (display.canConnect()){
mDisplayManager.connectWifiDisplay(display.getDeviceAddress());
private void scheduleUpdate(int changes) {
if (mStarted) {
if (mPendingChanges == 0) {
mHandler.post(mUpdateRunnable);
}
mPendingChanges |= changes;
}
}
private void unscheduleUpdate() {
if (mPendingChanges != 0) {
mPendingChanges = 0;
mHandler.removeCallbacks(mUpdateRunnable);
}
}
private void update(int changes) {
boolean invalidateOptions = false;
// Update settings.
if ((changes & CHANGE_SETTINGS) != 0) {
mWifiDisplayOnSetting = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_ON, 0) != 0;
mWifiDisplayCertificationOn = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0;
mWpsConfig = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID);
// The wifi display enabled setting may have changed.
invalidateOptions = true;
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
// Update wifi display state.
if ((changes & CHANGE_WIFI_DISPLAY_STATUS) != 0) {
mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus();
private void update() {
mWifiDisplayOnSetting = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_ON, 0) != 0;
mWifiDisplayCertificationOn = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0;
mWpsConfig = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID);
mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus();
applyState();
}
private void applyState() {
final int featureState = mWifiDisplayStatus.getFeatureState();
mActionBarSwitch.setEnabled(featureState != WifiDisplayStatus.FEATURE_STATE_DISABLED);
mActionBarSwitch.setChecked(mWifiDisplayOnSetting);
// The wifi display feature state may have changed.
invalidateOptions = true;
}
// Rebuild the routes.
final PreferenceScreen preferenceScreen = getPreferenceScreen();
preferenceScreen.removeAll();
if (featureState == WifiDisplayStatus.FEATURE_STATE_ON) {
final WifiDisplay[] displays = mWifiDisplayStatus.getDisplays();
// Add all known remote display routes.
final int routeCount = mRouter.getRouteCount();
for (int i = 0; i < routeCount; i++) {
MediaRouter.RouteInfo route = mRouter.getRouteAt(i);
if (route.matchesTypes(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY)) {
preferenceScreen.addPreference(createRoutePreference(route));
}
}
// Additional features for wifi display routes.
if (mWifiDisplayStatus != null
&& mWifiDisplayStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON) {
// Add all unpaired wifi displays.
for (WifiDisplay display : mWifiDisplayStatus.getDisplays()) {
if (!display.isRemembered() && display.isAvailable()
&& !display.equals(mWifiDisplayStatus.getActiveDisplay())) {
preferenceScreen.addPreference(new UnpairedWifiDisplayPreference(
getActivity(), display));
}
}
// Add the certification menu if enabled in developer options.
if (mWifiDisplayCertificationOn) {
buildCertificationMenu(preferenceScreen);
}
if (mPairedDevicesCategory == null) {
mPairedDevicesCategory = new PreferenceCategory(getActivity());
mPairedDevicesCategory.setTitle(R.string.wifi_display_paired_devices);
} else {
mPairedDevicesCategory.removeAll();
}
preferenceScreen.addPreference(mPairedDevicesCategory);
if (mAvailableDevicesCategory == null) {
mAvailableDevicesCategory = new ProgressCategory(getActivity(), null,
R.string.wifi_display_no_devices_found);
mAvailableDevicesCategory.setTitle(R.string.wifi_display_available_devices);
} else {
mAvailableDevicesCategory.removeAll();
}
preferenceScreen.addPreference(mAvailableDevicesCategory);
for (WifiDisplay d : displays) {
if (d.isRemembered()) {
mPairedDevicesCategory.addPreference(createWifiDisplayPreference(d));
} else if (d.isAvailable()){
mAvailableDevicesCategory.addPreference(createWifiDisplayPreference(d));
}
}
if (mPairedDevicesCategory.getPreferenceCount() == 0) {
preferenceScreen.removePreference(mPairedDevicesCategory);
}
if (mWifiDisplayStatus.getScanState() == WifiDisplayStatus.SCAN_STATE_SCANNING) {
mAvailableDevicesCategory.setProgress(true);
} else {
mAvailableDevicesCategory.setProgress(false);
}
} else {
mEmptyView.setText(featureState == WifiDisplayStatus.FEATURE_STATE_OFF ?
R.string.wifi_display_settings_empty_list_wifi_display_off :
R.string.wifi_display_settings_empty_list_wifi_display_disabled);
}
getActivity().invalidateOptionsMenu();
// Invalidate menu options if needed.
if (invalidateOptions) {
getActivity().invalidateOptionsMenu();
}
}
private RoutePreference createRoutePreference(MediaRouter.RouteInfo route) {
WifiDisplay display = findWifiDisplay(route.getDeviceAddress());
if (display != null) {
return new WifiDisplayRoutePreference(getActivity(), route, display);
} else {
return new RoutePreference(getActivity(), route);
}
}
private WifiDisplay findWifiDisplay(String deviceAddress) {
if (mWifiDisplayStatus != null && deviceAddress != null) {
for (WifiDisplay display : mWifiDisplayStatus.getDisplays()) {
if (display.getDeviceAddress().equals(deviceAddress)) {
return display;
}
}
}
return null;
}
private void buildCertificationMenu(final PreferenceScreen preferenceScreen) {
if (mCertCategory == null) {
mCertCategory = new PreferenceCategory(getActivity());
mCertCategory.setTitle(R.string.wifi_display_certification_heading);
mCertCategory.setOrder(ORDER_CERTIFICATION);
} else {
mCertCategory.removeAll();
}
@@ -526,53 +543,22 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
});
}
private Preference createWifiDisplayPreference(final WifiDisplay d) {
WifiDisplayPreference p = new WifiDisplayPreference(getActivity(), d);
if (d.equals(mWifiDisplayStatus.getActiveDisplay())) {
switch (mWifiDisplayStatus.getActiveDisplayState()) {
case WifiDisplayStatus.DISPLAY_STATE_CONNECTED:
p.setSummary(R.string.wifi_display_status_connected);
break;
case WifiDisplayStatus.DISPLAY_STATE_CONNECTING:
p.setSummary(R.string.wifi_display_status_connecting);
break;
}
} else if (d.isAvailable()) {
if (!d.canConnect()) {
p.setSummary(R.string.wifi_display_status_in_use);
p.setEnabled(false);
} else if (d.isRemembered()) {
p.setSummary(R.string.wifi_display_status_available);
}
private void toggleRoute(MediaRouter.RouteInfo route) {
if (route.isSelected()) {
MediaRouteDialogPresenter.showDialogFragment(getActivity(),
MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY, null);
} else {
route.select();
}
if (d.isRemembered()) {
p.setWidgetLayoutResource(R.layout.wifi_display_preference);
}
return p;
}
private void showDisconnectDialog(final WifiDisplay display) {
DialogInterface.OnClickListener ok = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (display.equals(mWifiDisplayStatus.getActiveDisplay())) {
mDisplayManager.disconnectWifiDisplay();
}
}
};
AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setCancelable(true)
.setTitle(R.string.wifi_display_disconnect_title)
.setMessage(Html.fromHtml(getResources().getString(
R.string.wifi_display_disconnect_text, display.getFriendlyDisplayName())))
.setPositiveButton(android.R.string.ok, ok)
.setNegativeButton(android.R.string.cancel, null)
.create();
dialog.show();
private void pairWifiDisplay(WifiDisplay display) {
if (display.canConnect()) {
mDisplayManager.connectWifiDisplay(display.getDeviceAddress());
}
}
private void showOptionsDialog(final WifiDisplay display) {
private void showWifiDisplayOptionsDialog(final WifiDisplay display) {
View view = getActivity().getLayoutInflater().inflate(R.layout.wifi_display_options, null);
final EditText nameEditText = (EditText)view.findViewById(R.id.name);
nameEditText.setText(display.getFriendlyDisplayName());
@@ -604,22 +590,12 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
dialog.show();
}
private static boolean contains(WifiDisplay[] displays, String address) {
for (WifiDisplay d : displays) {
if (d.getDeviceAddress().equals(address)) {
return true;
}
}
return false;
}
private final CompoundButton.OnCheckedChangeListener mSwitchOnCheckedChangedListener =
new CompoundButton.OnCheckedChangeListener() {
private final Runnable mUpdateRunnable = new Runnable() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mWifiDisplayOnSetting = isChecked;
Settings.Global.putInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_ON, isChecked ? 1 : 0);
public void run() {
final int changes = mPendingChanges;
mPendingChanges = 0;
update(changes);
}
};
@@ -628,10 +604,7 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED)) {
WifiDisplayStatus status = (WifiDisplayStatus)intent.getParcelableExtra(
DisplayManager.EXTRA_WIFI_DISPLAY_STATUS);
mWifiDisplayStatus = status;
applyState();
scheduleUpdate(CHANGE_WIFI_DISPLAY_STATUS);
}
}
};
@@ -639,23 +612,87 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
private final ContentObserver mSettingsObserver = new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange, Uri uri) {
update();
scheduleUpdate(CHANGE_SETTINGS);
}
};
private final class WifiDisplayPreference extends Preference
private final MediaRouter.Callback mRouterCallback = new MediaRouter.SimpleCallback() {
@Override
public void onRouteAdded(MediaRouter router, RouteInfo info) {
scheduleUpdate(CHANGE_ROUTES);
}
@Override
public void onRouteChanged(MediaRouter router, RouteInfo info) {
scheduleUpdate(CHANGE_ROUTES);
}
@Override
public void onRouteRemoved(MediaRouter router, RouteInfo info) {
scheduleUpdate(CHANGE_ROUTES);
}
@Override
public void onRouteSelected(MediaRouter router, int type, RouteInfo info) {
scheduleUpdate(CHANGE_ROUTES);
}
@Override
public void onRouteUnselected(MediaRouter router, int type, RouteInfo info) {
scheduleUpdate(CHANGE_ROUTES);
}
};
private class RoutePreference extends Preference
implements Preference.OnPreferenceClickListener {
private final MediaRouter.RouteInfo mRoute;
public RoutePreference(Context context, MediaRouter.RouteInfo route) {
super(context);
mRoute = route;
setTitle(route.getName());
setSummary(route.getDescription());
setEnabled(route.isEnabled());
if (route.isSelected()) {
setOrder(ORDER_CONNECTED);
if (route.isConnecting()) {
setSummary(R.string.wifi_display_status_connecting);
} else {
setSummary(R.string.wifi_display_status_connected);
}
} else {
if (isEnabled()) {
setOrder(ORDER_AVAILABLE);
} else {
setOrder(ORDER_UNAVAILABLE);
if (route.getStatusCode() == MediaRouter.RouteInfo.STATUS_IN_USE) {
setSummary(R.string.wifi_display_status_in_use);
} else {
setSummary(R.string.wifi_display_status_not_available);
}
}
}
setOnPreferenceClickListener(this);
}
@Override
public boolean onPreferenceClick(Preference preference) {
toggleRoute(mRoute);
return true;
}
}
private class WifiDisplayRoutePreference extends RoutePreference
implements View.OnClickListener {
private final WifiDisplay mDisplay;
public WifiDisplayPreference(Context context, WifiDisplay display) {
super(context);
public WifiDisplayRoutePreference(Context context, MediaRouter.RouteInfo route,
WifiDisplay display) {
super(context, route);
mDisplay = display;
setTitle(display.getFriendlyDisplayName());
}
public WifiDisplay getDisplay() {
return mDisplay;
setWidgetLayoutResource(R.layout.wifi_display_preference);
}
@Override
@@ -665,19 +702,46 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment {
ImageView deviceDetails = (ImageView) view.findViewById(R.id.deviceDetails);
if (deviceDetails != null) {
deviceDetails.setOnClickListener(this);
if (!isEnabled()) {
TypedValue value = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.disabledAlpha,
value, true);
deviceDetails.setImageAlpha((int)(value.getFloat() * 255));
deviceDetails.setEnabled(true); // always allow button to be pressed
}
}
}
@Override
public void onClick(View v) {
showOptionsDialog(mDisplay);
showWifiDisplayOptionsDialog(mDisplay);
}
}
private class UnpairedWifiDisplayPreference extends Preference
implements Preference.OnPreferenceClickListener {
private final WifiDisplay mDisplay;
public UnpairedWifiDisplayPreference(Context context, WifiDisplay display) {
super(context);
mDisplay = display;
setTitle(display.getFriendlyDisplayName());
setSummary(com.android.internal.R.string.wireless_display_route_description);
setEnabled(display.canConnect());
if (isEnabled()) {
setOrder(ORDER_AVAILABLE);
} else {
setOrder(ORDER_UNAVAILABLE);
setSummary(R.string.wifi_display_status_in_use);
}
setOnPreferenceClickListener(this);
}
@Override
public boolean onPreferenceClick(Preference preference) {
pairWifiDisplay(mDisplay);
return true;
}
}
}

View File

@@ -509,27 +509,33 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider {
* Subclass of StateTracker for location state.
*/
private static final class LocationStateTracker extends StateTracker {
private int mCurrentLocationMode = Settings.Secure.LOCATION_MODE_OFF;
public int getContainerId() { return R.id.btn_location; }
public int getButtonId() { return R.id.img_location; }
public int getIndicatorId() { return R.id.ind_location; }
public int getButtonDescription() { return R.string.gadget_location; }
public int getButtonImageId(boolean on) {
return on ? R.drawable.ic_appwidget_settings_location_on_holo
: R.drawable.ic_appwidget_settings_location_off_holo;
if (on) {
switch (mCurrentLocationMode) {
case Settings.Secure.LOCATION_MODE_HIGH_ACCURACY:
case Settings.Secure.LOCATION_MODE_SENSORS_ONLY:
return R.drawable.ic_appwidget_settings_location_on_holo;
default:
return R.drawable.ic_appwidget_settings_location_saving_holo;
}
}
return R.drawable.ic_appwidget_settings_location_off_holo;
}
@Override
public int getActualState(Context context) {
ContentResolver resolver = context.getContentResolver();
int currentLocationMode = Settings.Secure.getInt(resolver,
mCurrentLocationMode = Settings.Secure.getInt(resolver,
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF);
switch (currentLocationMode) {
case Settings.Secure.LOCATION_MODE_BATTERY_SAVING:
case Settings.Secure.LOCATION_MODE_OFF:
return STATE_DISABLED;
}
return STATE_ENABLED;
return (mCurrentLocationMode == Settings.Secure.LOCATION_MODE_OFF)
? STATE_DISABLED : STATE_ENABLED;
}
@Override
@@ -566,7 +572,7 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider {
break;
}
Settings.Secure.putInt(resolver, Settings.Secure.LOCATION_MODE, mode);
return desiredState;
return mode != Settings.Secure.LOCATION_MODE_OFF;
}
return getActualState(context) == STATE_ENABLED;

View File

@@ -239,6 +239,13 @@ public class WifiConfigController implements TextWatcher,
if (config.proxySettings == ProxySettings.STATIC) {
mProxySettingsSpinner.setSelection(PROXY_STATIC);
showAdvancedFields = true;
} else if (config.proxySettings == ProxySettings.PAC) {
mProxySettingsSpinner.setVisibility(View.GONE);
TextView textView = (TextView)mView.findViewById(R.id.proxy_pac_info);
textView.setVisibility(View.VISIBLE);
textView.setText(context.getString(R.string.proxy_url) +
config.linkProperties.getHttpProxy().getPacFileUrl());
showAdvancedFields = true;
} else {
mProxySettingsSpinner.setSelection(PROXY_NONE);
}