Merge "Apps tabs align to title on 2-pane settings." into jb-dev
diff --git a/res/layout/user_dictionary_add_word.xml b/res/layout/user_dictionary_add_word.xml
index 7df97b7..4089299 100644
--- a/res/layout/user_dictionary_add_word.xml
+++ b/res/layout/user_dictionary_add_word.xml
@@ -37,62 +37,18 @@
android:background="@android:color/holo_blue_light" />
</LinearLayout>
- <GridLayout android:id="@+id/user_dictionary_add_word_grid"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginLeft="8dip"
- android:layout_marginRight="8dip"
- android:columnCount="2">
- <TextView android:id="@+id/user_dictionary_add_word_label"
- style="?android:attr/textAppearanceSmall"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left|center_vertical"
- android:text="@string/user_dict_settings_add_word_option_name"
- android:visibility="gone" />
- <EditText android:id="@+id/user_dictionary_add_word_text"
- android:maxLength="@integer/maximum_user_dictionary_word_length"
- android:layout_width="wrap_content"
- android:layout_gravity="fill_horizontal|center_vertical"
- android:layout_marginLeft="8dip"
- android:layout_marginBottom="8dip"
- android:layout_marginTop="8dip"
- android:inputType="textNoSuggestions"
- android:imeOptions="flagNoFullscreen">
- <requestFocus />
- </EditText>
- <TextView android:id="@+id/user_dictionary_add_shortcut_label"
- style="?android:attr/textAppearanceSmall"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left|center_vertical"
- android:text="@string/user_dict_settings_add_shortcut_option_name"
- android:visibility="gone" />
- <EditText android:id="@+id/user_dictionary_settings_add_dialog_shortcut"
- android:maxLength="@integer/maximum_user_dictionary_word_length"
- android:layout_width="wrap_content"
- android:layout_gravity="fill_horizontal|center_vertical"
- android:layout_marginLeft="8dip"
- android:layout_marginBottom="8dip"
- android:layout_marginTop="8dip"
- android:inputType="textNoSuggestions"
- android:imeOptions="flagNoFullscreen"
- android:visibility="gone" />
- <TextView android:id="@+id/user_dictionary_add_locale_label"
- style="?android:attr/textAppearanceSmall"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left|center_vertical"
- android:text="@string/user_dict_settings_add_locale_option_name"
- android:visibility="gone" />
- <Spinner android:id="@+id/user_dictionary_settings_add_dialog_locale"
- android:layout_marginLeft="8dip"
- android:layout_marginBottom="8dip"
- android:layout_marginTop="8dip"
- android:layout_width="wrap_content"
- android:layout_gravity="fill_horizontal|center_vertical"
- android:visibility="gone" />
- </GridLayout>
+ <EditText android:id="@+id/user_dictionary_add_word_text"
+ android:maxLength="@integer/maximum_user_dictionary_word_length"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:layout_gravity="fill_horizontal|center_vertical"
+ android:layout_marginLeft="8dip"
+ android:layout_marginBottom="8dip"
+ android:layout_marginTop="8dip"
+ android:inputType="textNoSuggestions"
+ android:imeOptions="flagNoFullscreen">
+ <requestFocus />
+ </EditText>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -114,27 +70,6 @@
android:text="@string/cancel"
android:layout_height="wrap_content"
android:onClick="onClickCancel" />
- <Button android:id="@+id/user_dictionary_settings_add_dialog_more_options"
- android:layout_width="0dip"
- android:layout_gravity="center_horizontal"
- android:layout_weight="1"
- android:maxLines="2"
- style="?android:attr/buttonBarButtonStyle"
- android:textSize="14sp"
- android:text="@string/user_dict_settings_add_dialog_more_options"
- android:layout_height="wrap_content"
- android:onClick="onClickMoreOptions" />
- <Button android:id="@+id/user_dictionary_settings_add_dialog_less_options"
- android:layout_width="0dip"
- android:layout_gravity="center_horizontal"
- android:layout_weight="1"
- android:maxLines="2"
- style="?android:attr/buttonBarButtonStyle"
- android:textSize="14sp"
- android:text="@string/user_dict_settings_add_dialog_less_options"
- android:layout_height="wrap_content"
- android:visibility="gone"
- android:onClick="onClickLessOptions" />
<Button android:layout_width="0dip"
android:layout_gravity="right"
android:layout_weight="1"
diff --git a/res/layout/user_dictionary_add_word_fullscreen.xml b/res/layout/user_dictionary_add_word_fullscreen.xml
index 9e2617b..c0f3f53 100644
--- a/res/layout/user_dictionary_add_word_fullscreen.xml
+++ b/res/layout/user_dictionary_add_word_fullscreen.xml
@@ -49,7 +49,7 @@
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:text="@string/user_dict_settings_add_shortcut_option_name" />
- <EditText android:id="@+id/user_dictionary_settings_add_dialog_shortcut"
+ <EditText android:id="@+id/user_dictionary_add_shortcut"
android:maxLength="@integer/maximum_user_dictionary_word_length"
android:layout_width="wrap_content"
android:layout_gravity="fill_horizontal|center_vertical"
@@ -64,7 +64,7 @@
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:text="@string/user_dict_settings_add_locale_option_name" />
- <Spinner android:id="@+id/user_dictionary_settings_add_dialog_locale"
+ <Spinner android:id="@+id/user_dictionary_add_locale"
android:layout_marginLeft="8dip"
android:layout_marginBottom="8dip"
android:layout_marginTop="8dip"
diff --git a/res/layout/user_dictionary_item.xml b/res/layout/user_dictionary_item.xml
index aaf3cbd..749986e 100644
--- a/res/layout/user_dictionary_item.xml
+++ b/res/layout/user_dictionary_item.xml
@@ -15,36 +15,38 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:gravity="center_vertical"
+ android:paddingRight="?android:attr/scrollbarSize"
+ android:background="?android:attr/selectableItemBackground" >
- <TextView
- android:id="@android:id/text1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:gravity="center_vertical"
- android:paddingLeft="16dip"
- android:minHeight="?android:attr/listPreferredItemHeight"/>
+ <RelativeLayout android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="15dip"
+ android:layout_marginRight="6dip"
+ android:layout_marginTop="6dip"
+ android:layout_marginBottom="6dip"
+ android:layout_weight="1">
- <ImageView
- android:id="@+id/divider"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:layout_marginLeft="8dip"
- android:src="@drawable/nav_divider"
- />
+ <TextView android:id="@+android:id/text1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal" />
- <ImageView
- android:id="@+id/delete_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:padding="8dip"
- android:src="@drawable/ic_item_delete"
- android:background="?android:attr/selectableItemBackground"
- />
+ <TextView android:id="@+android:id/text2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/text1"
+ android:layout_alignLeft="@android:id/text1"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="1" />
+
+ </RelativeLayout>
+
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 92a3a9d..1380386 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1591,6 +1591,9 @@
<string name="volume_notification_description">Notifications</string>
<!-- Volume description for alarm volume -->
<string name="volume_alarm_description">Alarms</string>
+ <!-- Sound settings screen, setting option name checkbox. About vibration setting
+ during incoming calls. [CHAR LIMIT=30] -->
+ <string name="vibrate_when_ringing_title">Vibrate when ringing</string>
<!-- Dock settings title, top level -->
<string name="dock_settings">Dock</string>
@@ -2768,12 +2771,6 @@
<string name="enable_adb">USB debugging</string>
<!-- Setting checkbox summary for Whether to enable USB debugging support on the phone -->
<string name="enable_adb_summary">Debug mode when USB is connected</string>
- <!-- Development settings: title for the field that shows the "App ID" development identifier
- for this device. [CHAR LIMIT=40] -->
- <string name="verifier_device_identifier">Development device ID</string>
- <!-- Development settings: a string to show when the "App ID" development identifier for this
- device cannot be read from internal settings. [CHAR LIMIT=60] -->
- <string name="verifier_device_identifier_not_available">Device information not available</string>
<!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source -->
<string name="keep_screen_on">Stay awake</string>
<!-- setting Checkbox summary whether to keep the screen on when plugged in -->
@@ -3576,8 +3573,14 @@
<string name="wait_for_debugger_summary">Debugged application waits for debugger to
attach before executing</string>
- <!-- Preference category for user interface debugging development settings. [CHAR LIMIT=25] -->
- <string name="debug_ui_category">User interface</string>
+ <!-- Preference category for input debugging development settings. [CHAR LIMIT=25] -->
+ <string name="debug_input_category">Input</string>
+
+ <!-- Preference category for drawing debugging development settings. [CHAR LIMIT=25] -->
+ <string name="debug_drawing_category">Drawing</string>
+
+ <!-- Preference category for monitoring debugging development settings. [CHAR LIMIT=25] -->
+ <string name="debug_monitoring_category">Monitoring</string>
<!-- UI debug setting: always enable strict mode? [CHAR LIMIT=25] -->
<string name="strict_mode">Strict mode enabled</string>
@@ -3595,20 +3598,32 @@
<!-- UI debug setting: show touches location summary [CHAR LIMIT=50] -->
<string name="show_touches_summary">Show visual feedback for touches</string>
- <!-- UI debug setting: show where screen updates happen? [CHAR LIMIT=25] -->
- <string name="show_screen_updates">Show screen updates</string>
- <!-- UI debug setting: show screen updates summary [CHAR LIMIT=50] -->
- <string name="show_screen_updates_summary">Flash areas of screen when they update</string>
+ <!-- UI debug setting: show where surface updates happen? [CHAR LIMIT=25] -->
+ <string name="show_screen_updates">Show surface updates</string>
+ <!-- UI debug setting: show surface updates summary [CHAR LIMIT=50] -->
+ <string name="show_screen_updates_summary">Flash entire window surfaces when they update</string>
- <!-- UI debug setting: show where screen updates happen with GPU rendering? [CHAR LIMIT=25] -->
- <string name="show_hw_screen_updates">Show GPU screen updates</string>
+ <!-- UI debug setting: show where window updates happen with GPU rendering? [CHAR LIMIT=25] -->
+ <string name="show_hw_screen_updates">Show GPU view updates</string>
<!-- UI debug setting: show GPU rendering screen updates summary [CHAR LIMIT=50] -->
- <string name="show_hw_screen_updates_summary">Flash areas of screen when they update with the GPU</string>
+ <string name="show_hw_screen_updates_summary">Flash views inside windows when drawn with the GPU</string>
<!-- UI debug setting: disable use of overlays? [CHAR LIMIT=25] -->
- <string name="disable_overlays">Disable overlays</string>
+ <string name="disable_overlays">Disable HW overlays</string>
<!-- UI debug setting: disable use of overlays summary [CHAR LIMIT=50] -->
- <string name="disable_overlays_summary">Don\'t use overlays for screen compositing</string>
+ <string name="disable_overlays_summary">Always use GPU for screen compositing</string>
+
+ <!-- UI debug setting: enable low-level traces? [CHAR LIMIT=25] -->
+ <string name="enable_traces_title">Enable traces</string>
+ <!-- UI debug setting: title for dialog to enable low-level traces [CHAR LIMIT=25] -->
+ <string name="enable_traces_dialog_title">Select enabled traces</string>
+
+ <!-- UI debug setting: enable low-level traces, none enabled summary [CHAR LIMIT=NONE] -->
+ <string name="enable_traces_summary_none">No traces currently enabled</string>
+ <!-- UI debug setting: enable low-level traces, some number enabled summary [CHAR LIMIT=NONE] -->
+ <string name="enable_traces_summary_num"><xliff:g id="num">%1$d</xliff:g> traces currently enabled</string>
+ <!-- UI debug setting: enable low-level traces, all enabled summary [CHAR LIMIT=NONE] -->
+ <string name="enable_traces_summary_all">All traces currently enabled</string>
<!-- UI debug setting: show layout bounds information [CHAR LIMIT=25] -->
<string name="debug_layout">Show layout bounds</string>
@@ -3623,7 +3638,7 @@
<!-- UI debug setting: force hardware acceleration to render apps [CHAR LIMIT=25] -->
<string name="force_hw_ui">Force GPU rendering</string>
<!-- UI debug setting: force hardware acceleration summary [CHAR LIMIT=50] -->
- <string name="force_hw_ui_summary">Use 2D hardware acceleration in applications</string>
+ <string name="force_hw_ui_summary">Force use of GPU for 2d drawing</string>
<!-- UI debug setting: profile time taken by hardware acceleration to render apps [CHAR LIMIT=25] -->
<string name="track_frame_time">Profile GPU rendering</string>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index ab8aad3..9788864 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -16,14 +16,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/development_settings_title">
-
- <Preference
- android:key="verifier_device_identifier"
- style="?android:attr/preferenceInformationStyle"
- android:title="@string/verifier_device_identifier"
- android:summary="@string/verifier_device_identifier_not_available"
- android:persistent="false" />
-
<PreferenceScreen
android:key="local_backup_password"
android:title="@string/local_backup_password_title"
@@ -70,18 +62,8 @@
</PreferenceCategory>
- <PreferenceCategory android:key="debug_ui_category"
- android:title="@string/debug_ui_category">
-
- <CheckBoxPreference
- android:key="strict_mode"
- android:title="@string/strict_mode"
- android:summary="@string/strict_mode_summary"/>
-
- <CheckBoxPreference
- android:key="pointer_location"
- android:title="@string/pointer_location"
- android:summary="@string/pointer_location_summary"/>
+ <PreferenceCategory android:key="debug_input_category"
+ android:title="@string/debug_input_category">
<CheckBoxPreference
android:key="show_touches"
@@ -89,39 +71,29 @@
android:summary="@string/show_touches_summary"/>
<CheckBoxPreference
+ android:key="pointer_location"
+ android:title="@string/pointer_location"
+ android:summary="@string/pointer_location_summary"/>
+
+ </PreferenceCategory>
+
+ <PreferenceCategory android:key="debug_drawing_category"
+ android:title="@string/debug_drawing_category">
+
+ <CheckBoxPreference
android:key="debug_layout"
android:title="@string/debug_layout"
android:summary="@string/debug_layout_summary"/>
<CheckBoxPreference
- android:key="show_screen_updates"
- android:title="@string/show_screen_updates"
- android:summary="@string/show_screen_updates_summary"/>
-
- <CheckBoxPreference
- android:key="disable_overlays"
- android:title="@string/disable_overlays"
- android:summary="@string/disable_overlays_summary"/>
-
- <CheckBoxPreference
- android:key="show_cpu_usage"
- android:title="@string/show_cpu_usage"
- android:summary="@string/show_cpu_usage_summary"/>
-
- <CheckBoxPreference
- android:key="force_hw_ui"
- android:title="@string/force_hw_ui"
- android:summary="@string/force_hw_ui_summary"/>
-
- <CheckBoxPreference
android:key="show_hw_screen_udpates"
android:title="@string/show_hw_screen_updates"
android:summary="@string/show_hw_screen_updates_summary"/>
<CheckBoxPreference
- android:key="track_frame_time"
- android:title="@string/track_frame_time"
- android:summary="@string/track_frame_time_summary"/>
+ android:key="show_screen_updates"
+ android:title="@string/show_screen_updates"
+ android:summary="@string/show_screen_updates_summary"/>
<ListPreference
android:key="window_animation_scale"
@@ -144,6 +116,41 @@
android:entries="@array/animator_duration_scale_entries"
android:entryValues="@array/animator_duration_scale_values" />
+ <CheckBoxPreference
+ android:key="disable_overlays"
+ android:title="@string/disable_overlays"
+ android:summary="@string/disable_overlays_summary"/>
+
+ <CheckBoxPreference
+ android:key="force_hw_ui"
+ android:title="@string/force_hw_ui"
+ android:summary="@string/force_hw_ui_summary"/>
+
+ </PreferenceCategory>
+
+ <PreferenceCategory android:key="debug_monitoring_category"
+ android:title="@string/debug_monitoring_category">
+
+ <CheckBoxPreference
+ android:key="strict_mode"
+ android:title="@string/strict_mode"
+ android:summary="@string/strict_mode_summary"/>
+
+ <CheckBoxPreference
+ android:key="show_cpu_usage"
+ android:title="@string/show_cpu_usage"
+ android:summary="@string/show_cpu_usage_summary"/>
+
+ <CheckBoxPreference
+ android:key="track_frame_time"
+ android:title="@string/track_frame_time"
+ android:summary="@string/track_frame_time_summary"/>
+
+ <MultiCheckPreference
+ android:key="enable_traces"
+ android:title="@string/enable_traces_title"
+ android:dialogTitle="@string/enable_traces_dialog_title" />
+
</PreferenceCategory>
<PreferenceCategory android:key="debug_applications_category"
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index d7c692f..e9c9a61 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -58,6 +58,11 @@
android:persistent="false"
android:ringtoneType="notification" />
+ <CheckBoxPreference
+ android:key="vibrate_when_ringing"
+ android:title="@string/vibrate_when_ringing_title"
+ android:persistent="false" />
+
<PreferenceCategory
android:title="@string/sound_category_feedback_title"/>
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 10c067d..1cb12f3 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -35,11 +35,16 @@
import android.os.storage.IMountService;
import android.provider.Settings;
import android.telephony.TelephonyManager;
+import android.text.Editable;
import android.text.TextUtils;
+import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
+import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.View.OnKeyListener;
+import android.view.View.OnTouchListener;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
@@ -67,7 +72,8 @@
* -n com.android.settings/.CryptKeeper
* </pre>
*/
-public class CryptKeeper extends Activity implements TextView.OnEditorActionListener {
+public class CryptKeeper extends Activity implements TextView.OnEditorActionListener,
+ OnKeyListener, OnTouchListener, TextWatcher {
private static final String TAG = "CryptKeeper";
private static final String DECRYPT_STATE = "trigger_restart_framework";
@@ -103,6 +109,8 @@
private int mCooldown;
PowerManager.WakeLock mWakeLock;
private EditText mPasswordEntry;
+ /** Number of calls to {@link #notifyUser()} to ignore before notifying. */
+ private int mNotificationCountdown = 0;
/**
* Used to propagate state through configuration changes (e.g. screen rotation)
@@ -236,8 +244,11 @@
* Notify the user that we are awaiting input. Currently this sends an audio alert.
*/
private void notifyUser() {
- Log.d(TAG, "Notifying user that we are waiting for input...");
- if (mAudioManager != null) {
+ if (mNotificationCountdown > 0) {
+ Log.d(TAG, "Counting down to notify user..." + mNotificationCountdown);
+ --mNotificationCountdown;
+ } else if (mAudioManager != null) {
+ Log.d(TAG, "Notifying user that we are waiting for input...");
try {
// Play the standard keypress sound at full volume. This should be available on
// every device. We cannot play a ringtone here because media services aren't
@@ -478,6 +489,10 @@
mPasswordEntry = (EditText) findViewById(R.id.passwordEntry);
mPasswordEntry.setOnEditorActionListener(this);
mPasswordEntry.requestFocus();
+ // Become quiet when the user interacts with the Edit text screen.
+ mPasswordEntry.setOnKeyListener(this);
+ mPasswordEntry.setOnTouchListener(this);
+ mPasswordEntry.addTextChangedListener(this);
// Disable the Emergency call button if the device has no voice telephone capability
final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
@@ -522,9 +537,9 @@
}, 0);
updateEmergencyCallButtonState();
- // Notify the user in 30 seconds that we are waiting for him to enter the password.
+ // Notify the user in 120 seconds that we are waiting for him to enter the password.
mHandler.removeMessages(MESSAGE_NOTIFY);
- mHandler.sendEmptyMessageDelayed(MESSAGE_NOTIFY, 30 * 1000);
+ mHandler.sendEmptyMessageDelayed(MESSAGE_NOTIFY, 120 * 1000);
}
/**
@@ -706,4 +721,39 @@
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(intent);
}
+
+ /**
+ * Listen to key events so we can disable sounds when we get a keyinput in EditText.
+ */
+ private void delayAudioNotification() {
+ Log.d(TAG, "User entering password: delay audio notification");
+ mNotificationCountdown = 20;
+ }
+
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ delayAudioNotification();
+ return false;
+ }
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ delayAudioNotification();
+ return false;
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ return;
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ delayAudioNotification();
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ return;
+ }
}
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index d32cbc7..fc5a0b6 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -30,7 +30,6 @@
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
-import android.content.pm.VerifierDeviceIdentity;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Bundle;
@@ -40,8 +39,10 @@
import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemProperties;
+import android.os.Trace;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
+import android.preference.MultiCheckPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
@@ -63,8 +64,6 @@
OnPreferenceChangeListener, CompoundButton.OnCheckedChangeListener {
private static final String ENABLE_ADB = "enable_adb";
-
- private static final String VERIFIER_DEVICE_IDENTIFIER = "verifier_device_identifier";
private static final String KEEP_SCREEN_ON = "keep_screen_on";
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
private static final String HDCP_CHECKING_KEY = "hdcp_checking";
@@ -88,6 +87,8 @@
private static final String TRANSITION_ANIMATION_SCALE_KEY = "transition_animation_scale";
private static final String ANIMATOR_DURATION_SCALE_KEY = "animator_duration_scale";
+ private static final String ENABLE_TRACES_KEY = "enable_traces";
+
private static final String IMMEDIATELY_DESTROY_ACTIVITIES_KEY
= "immediately_destroy_activities";
private static final String APP_PROCESS_LIMIT_KEY = "app_process_limit";
@@ -101,6 +102,7 @@
private Switch mEnabledSwitch;
private boolean mLastEnabledState;
+ private boolean mHaveDebugSettings;
private CheckBoxPreference mEnableAdb;
private CheckBoxPreference mKeepScreenOn;
@@ -124,6 +126,7 @@
private ListPreference mWindowAnimationScale;
private ListPreference mTransitionAnimationScale;
private ListPreference mAnimatorDurationScale;
+ private MultiCheckPreference mEnableTracesPref;
private CheckBoxPreference mImmediatelyDestroyActivities;
private ListPreference mAppProcessLimit;
@@ -177,6 +180,15 @@
mAnimatorDurationScale = (ListPreference) findPreference(ANIMATOR_DURATION_SCALE_KEY);
mAllPrefs.add(mAnimatorDurationScale);
mAnimatorDurationScale.setOnPreferenceChangeListener(this);
+ mEnableTracesPref = (MultiCheckPreference)findPreference(ENABLE_TRACES_KEY);
+ String[] traceValues = new String[Trace.TRACE_TAGS.length];
+ for (int i=Trace.TRACE_FLAGS_START_BIT; i<traceValues.length; i++) {
+ traceValues[i] = Integer.toString(1<<i);
+ }
+ mEnableTracesPref.setEntries(Trace.TRACE_TAGS);
+ mEnableTracesPref.setEntryValues(traceValues);
+ mAllPrefs.add(mEnableTracesPref);
+ mEnableTracesPref.setOnPreferenceChangeListener(this);
mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
@@ -191,13 +203,6 @@
mAllPrefs.add(mShowAllANRs);
mResetCbPrefs.add(mShowAllANRs);
- final Preference verifierDeviceIdentifier = findPreference(VERIFIER_DEVICE_IDENTIFIER);
- final PackageManager pm = getActivity().getPackageManager();
- final VerifierDeviceIdentity verifierIndentity = pm.getVerifierDeviceIdentity();
- if (verifierIndentity != null) {
- verifierDeviceIdentifier.setSummary(verifierIndentity.toString());
- }
-
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mAllPrefs.add(hdcpChecking);
@@ -275,15 +280,32 @@
Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
mEnabledSwitch.setChecked(mLastEnabledState);
setPrefsEnabledState(mLastEnabledState);
+
+ if (mHaveDebugSettings && !mLastEnabledState) {
+ // Overall debugging is disabled, but there are some debug
+ // settings that are enabled. This is an invalid state. Switch
+ // to debug settings being enabled, so the user knows there is
+ // stuff enabled and can turn it all off if they want.
+ Settings.Secure.putInt(getActivity().getContentResolver(),
+ Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 1);
+ mLastEnabledState = true;
+ setPrefsEnabledState(mLastEnabledState);
+ }
+ }
+
+ void updateCheckBox(CheckBoxPreference checkBox, boolean value) {
+ checkBox.setChecked(value);
+ mHaveDebugSettings |= value;
}
private void updateAllOptions() {
final ContentResolver cr = getActivity().getContentResolver();
- mEnableAdb.setChecked(Settings.Secure.getInt(cr,
+ mHaveDebugSettings = false;
+ updateCheckBox(mEnableAdb, Settings.Secure.getInt(cr,
Settings.Secure.ADB_ENABLED, 0) != 0);
- mKeepScreenOn.setChecked(Settings.System.getInt(cr,
+ updateCheckBox(mKeepScreenOn, Settings.System.getInt(cr,
Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
- mAllowMockLocation.setChecked(Settings.Secure.getInt(cr,
+ updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
updateHdcpValues();
updatePasswordSummary();
@@ -298,6 +320,7 @@
updateShowHwScreenUpdatesOptions();
updateDebugLayoutOptions();
updateAnimationScaleOptions();
+ updateEnableTracesOptions();
updateImmediatelyDestroyActivitiesOptions();
updateAppProcessLimitOptions();
updateShowAllANRsOptions();
@@ -315,7 +338,9 @@
writeAnimationScaleOption(0, mWindowAnimationScale, null);
writeAnimationScaleOption(1, mTransitionAnimationScale, null);
writeAnimationScaleOption(2, mAnimatorDurationScale, null);
+ writeEnableTracesOptions(0);
writeAppProcessLimitOptions(null);
+ mHaveDebugSettings = false;
updateAllOptions();
}
@@ -369,7 +394,7 @@
private void updateDebuggerOptions() {
mDebugApp = Settings.System.getString(
getActivity().getContentResolver(), Settings.System.DEBUG_APP);
- mWaitForDebugger.setChecked(Settings.System.getInt(
+ updateCheckBox(mWaitForDebugger, Settings.System.getInt(
getActivity().getContentResolver(), Settings.System.WAIT_FOR_DEBUGGER, 0) != 0);
if (mDebugApp != null && mDebugApp.length() > 0) {
String label;
@@ -383,6 +408,7 @@
}
mDebugAppPref.setSummary(getResources().getString(R.string.debug_app_set, label));
mWaitForDebugger.setEnabled(true);
+ mHaveDebugSettings = true;
} else {
mDebugAppPref.setSummary(getResources().getString(R.string.debug_app_not_set));
mWaitForDebugger.setEnabled(false);
@@ -411,7 +437,7 @@
}
private void updateStrictModeVisualOptions() {
- mStrictMode.setChecked(currentStrictModeActiveIndex() == 1);
+ updateCheckBox(mStrictMode, currentStrictModeActiveIndex() == 1);
}
private void writePointerLocationOptions() {
@@ -420,7 +446,7 @@
}
private void updatePointerLocationOptions() {
- mPointerLocation.setChecked(Settings.System.getInt(getActivity().getContentResolver(),
+ updateCheckBox(mPointerLocation, Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.POINTER_LOCATION, 0) != 0);
}
@@ -430,7 +456,7 @@
}
private void updateShowTouchesOptions() {
- mShowTouches.setChecked(Settings.System.getInt(getActivity().getContentResolver(),
+ updateCheckBox(mShowTouches, Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.SHOW_TOUCHES, 0) != 0);
}
@@ -448,11 +474,11 @@
@SuppressWarnings("unused")
int enableGL = reply.readInt();
int showUpdates = reply.readInt();
- mShowScreenUpdates.setChecked(showUpdates != 0);
+ updateCheckBox(mShowScreenUpdates, showUpdates != 0);
@SuppressWarnings("unused")
int showBackground = reply.readInt();
int disableOverlays = reply.readInt();
- mDisableOverlays.setChecked(disableOverlays != 0);
+ updateCheckBox(mDisableOverlays, disableOverlays != 0);
reply.recycle();
data.recycle();
}
@@ -495,7 +521,7 @@
}
private void updateHardwareUiOptions() {
- mForceHardwareUi.setChecked(SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
+ updateCheckBox(mForceHardwareUi, SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
}
private void writeHardwareUiOptions() {
@@ -503,7 +529,7 @@
}
private void updateTrackFrameTimeOptions() {
- mTrackFrameTime.setChecked(
+ updateCheckBox(mTrackFrameTime,
SystemProperties.getBoolean(HardwareRenderer.PROFILE_PROPERTY, false));
}
@@ -513,7 +539,7 @@
}
private void updateShowHwScreenUpdatesOptions() {
- mShowHwScreenUpdates.setChecked(
+ updateCheckBox(mShowHwScreenUpdates,
SystemProperties.getBoolean(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false));
}
@@ -523,7 +549,7 @@
}
private void updateDebugLayoutOptions() {
- mDebugLayout.setChecked(
+ updateCheckBox(mDebugLayout,
SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false));
}
@@ -533,7 +559,7 @@
}
private void updateCpuUsageOptions() {
- mShowCpuUsage.setChecked(Settings.System.getInt(getActivity().getContentResolver(),
+ updateCheckBox(mShowCpuUsage, Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.SHOW_PROCESSES, 0) != 0);
}
@@ -559,13 +585,16 @@
}
private void updateImmediatelyDestroyActivitiesOptions() {
- mImmediatelyDestroyActivities.setChecked(Settings.System.getInt(
+ updateCheckBox(mImmediatelyDestroyActivities, Settings.System.getInt(
getActivity().getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0) != 0);
}
private void updateAnimationScaleValue(int which, ListPreference pref) {
try {
float scale = mWindowManager.getAnimationScale(which);
+ if (scale != 1) {
+ mHaveDebugSettings = true;
+ }
CharSequence[] values = pref.getEntryValues();
for (int i=0; i<values.length; i++) {
float val = Float.parseFloat(values[i].toString());
@@ -603,6 +632,9 @@
for (int i=0; i<values.length; i++) {
int val = Integer.parseInt(values[i].toString());
if (val >= limit) {
+ if (i != 0) {
+ mHaveDebugSettings = true;
+ }
mAppProcessLimit.setValueIndex(i);
mAppProcessLimit.setSummary(mAppProcessLimit.getEntries()[i]);
return;
@@ -630,10 +662,51 @@
}
private void updateShowAllANRsOptions() {
- mShowAllANRs.setChecked(Settings.Secure.getInt(
+ updateCheckBox(mShowAllANRs, Settings.Secure.getInt(
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
}
+ private void updateEnableTracesOptions() {
+ String strValue = SystemProperties.get(Trace.PROPERTY_TRACE_TAG_ENABLEFLAGS);
+ long flags = SystemProperties.getLong(Trace.PROPERTY_TRACE_TAG_ENABLEFLAGS, 0);
+ String[] values = mEnableTracesPref.getEntryValues();
+ int numSet = 0;
+ for (int i=Trace.TRACE_FLAGS_START_BIT; i<values.length; i++) {
+ boolean set = (flags&(1<<i)) != 0;
+ mEnableTracesPref.setValue(i-Trace.TRACE_FLAGS_START_BIT, set);
+ if (set) {
+ numSet++;
+ }
+ }
+ if (numSet == 0) {
+ mEnableTracesPref.setSummary(R.string.enable_traces_summary_none);
+ } else if (numSet == values.length) {
+ mHaveDebugSettings = true;
+ mEnableTracesPref.setSummary(R.string.enable_traces_summary_all);
+ } else {
+ mHaveDebugSettings = true;
+ mEnableTracesPref.setSummary(getString(R.string.enable_traces_summary_num, numSet));
+ }
+ }
+
+ private void writeEnableTracesOptions() {
+ long value = 0;
+ String[] values = mEnableTracesPref.getEntryValues();
+ for (int i=Trace.TRACE_FLAGS_START_BIT; i<values.length; i++) {
+ if (mEnableTracesPref.getValue(i-Trace.TRACE_FLAGS_START_BIT)) {
+ value |= 1<<i;
+ }
+ }
+ writeEnableTracesOptions(value);
+ // Make sure summary is updated.
+ updateEnableTracesOptions();
+ }
+
+ private void writeEnableTracesOptions(long value) {
+ SystemProperties.set(Trace.PROPERTY_TRACE_TAG_ENABLEFLAGS,
+ "0x" + Long.toString(value, 16));
+ }
+
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView == mEnabledSwitch) {
@@ -754,6 +827,9 @@
} else if (preference == mAnimatorDurationScale) {
writeAnimationScaleOption(2, mAnimatorDurationScale, newValue);
return true;
+ } else if (preference == mEnableTracesPref) {
+ writeEnableTracesOptions();
+ return true;
} else if (preference == mAppProcessLimit) {
writeAppProcessLimitOptions(newValue);
return true;
diff --git a/src/com/android/settings/RingerVolumePreference.java b/src/com/android/settings/RingerVolumePreference.java
index 5845c8f..c80cd35 100644
--- a/src/com/android/settings/RingerVolumePreference.java
+++ b/src/com/android/settings/RingerVolumePreference.java
@@ -117,7 +117,7 @@
if (mCheckBoxes[i] != null) {
if (streamType == AudioManager.STREAM_RING && muted
- && mAudioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER)) {
+ && !(mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT)) {
mCheckBoxes[i].setImageResource(
com.android.internal.R.drawable.ic_audio_ring_notif_vibrate);
} else {
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 88fac0a..b0daf6c 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -321,7 +321,10 @@
AccountSyncSettings.class.getName().equals(fragmentName) ||
UserDictionarySettings.class.getName().equals(fragmentName) ||
Memory.class.getName().equals(fragmentName) ||
- ManageApplications.class.getName().equals(fragmentName)) {
+ ManageApplications.class.getName().equals(fragmentName) ||
+ WirelessSettings.class.getName().equals(fragmentName) ||
+ SoundSettings.class.getName().equals(fragmentName) ||
+ PrivacySettings.class.getName().equals(fragmentName)) {
intent.putExtra(EXTRA_CLEAR_UI_OPTIONS, true);
}
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
index 59e40df..4b9d975 100644
--- a/src/com/android/settings/SoundSettings.java
+++ b/src/com/android/settings/SoundSettings.java
@@ -56,7 +56,7 @@
private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
private static final String KEY_SILENT_MODE = "silent_mode";
- private static final String KEY_VIBRATE = "vibrate_on_ring";
+ private static final String KEY_VIBRATE = "vibrate_when_ringing";
private static final String KEY_RING_VOLUME = "ring_volume";
private static final String KEY_MUSICFX = "musicfx";
private static final String KEY_DTMF_TONE = "dtmf_tone";
@@ -81,6 +81,7 @@
private static final int MSG_UPDATE_RINGTONE_SUMMARY = 1;
private static final int MSG_UPDATE_NOTIFICATION_SUMMARY = 2;
+ private CheckBoxPreference mVibrateWhenRinging;
private ListPreference mSilentMode;
private CheckBoxPreference mDtmfTone;
private CheckBoxPreference mSoundEffects;
@@ -141,6 +142,11 @@
mSilentMode.setOnPreferenceChangeListener(this);
}
+ mVibrateWhenRinging = (CheckBoxPreference) findPreference(KEY_VIBRATE);
+ mVibrateWhenRinging.setPersistent(false);
+ mVibrateWhenRinging.setChecked(Settings.System.getInt(resolver,
+ Settings.System.VIBRATE_WHEN_RINGING, 0) != 0);
+
mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
mDtmfTone.setPersistent(false);
mDtmfTone.setChecked(Settings.System.getInt(resolver,
@@ -161,7 +167,9 @@
mRingtonePreference = findPreference(KEY_RINGTONE);
mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);
- if (!((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
+ Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
+ if (vibrator == null || !vibrator.hasVibrator()) {
+ getPreferenceScreen().removePreference(mVibrateWhenRinging);
getPreferenceScreen().removePreference(mHapticFeedback);
}
@@ -294,7 +302,10 @@
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- if (preference == mDtmfTone) {
+ if (preference == mVibrateWhenRinging) {
+ Settings.System.putInt(getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING,
+ mVibrateWhenRinging.isChecked() ? 1 : 0);
+ } else if (preference == mDtmfTone) {
Settings.System.putInt(getContentResolver(), Settings.System.DTMF_TONE_WHEN_DIALING,
mDtmfTone.isChecked() ? 1 : 0);
diff --git a/src/com/android/settings/UserDictionarySettings.java b/src/com/android/settings/UserDictionarySettings.java
index 8d4e8b4..822c490 100644
--- a/src/com/android/settings/UserDictionarySettings.java
+++ b/src/com/android/settings/UserDictionarySettings.java
@@ -28,6 +28,7 @@
import android.os.Bundle;
import android.provider.UserDictionary;
import android.text.InputType;
+import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -53,11 +54,11 @@
private static final String TAG = "UserDictionarySettings";
private static final String[] QUERY_PROJECTION = {
- UserDictionary.Words._ID, UserDictionary.Words.WORD
+ UserDictionary.Words._ID, UserDictionary.Words.WORD, UserDictionary.Words.SHORTCUT
};
- private static final int INDEX_ID = 0;
- private static final int INDEX_WORD = 1;
+ // The index of the shortcut in the above array.
+ private static final int INDEX_SHORTCUT = 2;
// Either the locale is empty (means the word is applicable to all locales)
// or the word equals our current locale
@@ -66,7 +67,11 @@
private static final String QUERY_SELECTION_ALL_LOCALES =
UserDictionary.Words.LOCALE + " is null";
- private static final String DELETE_SELECTION = UserDictionary.Words.WORD + "=?";
+ private static final String DELETE_SELECTION_WITH_SHORTCUT = UserDictionary.Words.WORD
+ + "=? AND " + UserDictionary.Words.SHORTCUT + "=?";
+ private static final String DELETE_SELECTION_WITHOUT_SHORTCUT = UserDictionary.Words.WORD
+ + "=? AND " + UserDictionary.Words.SHORTCUT + " is null OR "
+ + UserDictionary.Words.SHORTCUT + "=''";
private static final int OPTIONS_MENU_ADD = Menu.FIRST;
@@ -148,15 +153,16 @@
private ListAdapter createAdapter() {
return new MyAdapter(getActivity(),
R.layout.user_dictionary_item, mCursor,
- new String[] { UserDictionary.Words.WORD, UserDictionary.Words._ID },
- new int[] { android.R.id.text1, R.id.delete_button }, this);
+ new String[] { UserDictionary.Words.WORD, UserDictionary.Words.SHORTCUT },
+ new int[] { android.R.id.text1, android.R.id.text2 }, this);
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
- String word = getWord(position);
+ final String word = getWord(position);
+ final String shortcut = getShortcut(position);
if (word != null) {
- showAddOrEditDialog(word);
+ showAddOrEditDialog(word, shortcut);
}
}
@@ -172,7 +178,7 @@
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == OPTIONS_MENU_ADD) {
- showAddOrEditDialog(null);
+ showAddOrEditDialog(null, null);
return true;
}
return false;
@@ -181,13 +187,15 @@
/**
* Add or edit a word. If editingWord is null, it's an add; otherwise, it's an edit.
* @param editingWord the word to edit, or null if it's an add.
+ * @param editingShortcut the shortcut for this entry, or null if none.
*/
- private void showAddOrEditDialog(final String editingWord) {
+ private void showAddOrEditDialog(final String editingWord, final String editingShortcut) {
final Bundle args = new Bundle();
args.putInt(UserDictionaryAddWordContents.EXTRA_MODE, null == editingWord
? UserDictionaryAddWordContents.MODE_INSERT
: UserDictionaryAddWordContents.MODE_EDIT);
args.putString(UserDictionaryAddWordContents.EXTRA_WORD, editingWord);
+ args.putString(UserDictionaryAddWordContents.EXTRA_SHORTCUT, editingShortcut);
args.putString(UserDictionaryAddWordContents.EXTRA_LOCALE, mLocale);
android.preference.PreferenceActivity pa =
(android.preference.PreferenceActivity)getActivity();
@@ -196,7 +204,7 @@
args, R.string.details_title, null, null, 0);
}
- private String getWord(int position) {
+ private String getWord(final int position) {
if (null == mCursor) return null;
mCursor.moveToPosition(position);
// Handle a possible race-condition
@@ -206,23 +214,45 @@
mCursor.getColumnIndexOrThrow(UserDictionary.Words.WORD));
}
- public static void deleteWord(final String word, final ContentResolver resolver) {
- resolver.delete(
- UserDictionary.Words.CONTENT_URI, DELETE_SELECTION, new String[] { word });
+ private String getShortcut(final int position) {
+ if (null == mCursor) return null;
+ mCursor.moveToPosition(position);
+ // Handle a possible race-condition
+ if (mCursor.isAfterLast()) return null;
+
+ return mCursor.getString(
+ mCursor.getColumnIndexOrThrow(UserDictionary.Words.SHORTCUT));
}
- private static class MyAdapter extends SimpleCursorAdapter implements SectionIndexer,
- View.OnClickListener {
+ public static void deleteWord(final String word, final String shortcut,
+ final ContentResolver resolver) {
+ if (TextUtils.isEmpty(shortcut)) {
+ resolver.delete(
+ UserDictionary.Words.CONTENT_URI, DELETE_SELECTION_WITHOUT_SHORTCUT,
+ new String[] { word });
+ } else {
+ resolver.delete(
+ UserDictionary.Words.CONTENT_URI, DELETE_SELECTION_WITH_SHORTCUT,
+ new String[] { word, shortcut });
+ }
+ }
+
+ private static class MyAdapter extends SimpleCursorAdapter implements SectionIndexer {
private AlphabetIndexer mIndexer;
- private UserDictionarySettings mSettings;
private ViewBinder mViewBinder = new ViewBinder() {
public boolean setViewValue(View v, Cursor c, int columnIndex) {
- if (v instanceof ImageView && columnIndex == INDEX_ID) {
- v.setOnClickListener(MyAdapter.this);
- v.setTag(c.getString(INDEX_WORD));
+ if (columnIndex == INDEX_SHORTCUT) {
+ final String shortcut = c.getString(INDEX_SHORTCUT);
+ if (TextUtils.isEmpty(shortcut)) {
+ v.setVisibility(View.GONE);
+ } else {
+ ((TextView)v).setText(shortcut);
+ v.setVisibility(View.VISIBLE);
+ }
+ v.invalidate();
return true;
}
@@ -234,7 +264,6 @@
UserDictionarySettings settings) {
super(context, layout, c, from, to);
- mSettings = settings;
if (null != c) {
final String alphabet = context.getString(
com.android.internal.R.string.fast_scroll_alphabet);
@@ -255,10 +284,5 @@
public Object[] getSections() {
return null == mIndexer ? null : mIndexer.getSections();
}
-
- public void onClick(View v) {
- UserDictionarySettings.deleteWord((String) v.getTag(),
- mSettings.getActivity().getContentResolver());
- }
}
}
diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java
index 82f9844..4d9f80e 100644
--- a/src/com/android/settings/accounts/AccountSyncSettings.java
+++ b/src/com/android/settings/accounts/AccountSyncSettings.java
@@ -208,11 +208,13 @@
new SyncStateCheckBoxPreference(getActivity(), account, authority);
item.setPersistent(false);
final ProviderInfo providerInfo = getPackageManager().resolveContentProvider(authority, 0);
- CharSequence providerLabel = providerInfo != null
- ? providerInfo.loadLabel(getPackageManager()) : null;
+ if (providerInfo == null) {
+ return;
+ }
+ CharSequence providerLabel = providerInfo.loadLabel(getPackageManager());
if (TextUtils.isEmpty(providerLabel)) {
Log.e(TAG, "Provider needs a label for authority '" + authority + "'");
- providerLabel = authority;
+ return;
}
String title = getString(R.string.sync_item_title, providerLabel);
item.setTitle(title);
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index a28fa33..eee9c43 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -88,8 +88,7 @@
if ((info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) {
canBe = true;
} else {
- if ((info.flags & ApplicationInfo.FLAG_FORWARD_LOCK) == 0 &&
- (info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
+ if ((info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
if (info.installLocation == PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL ||
info.installLocation == PackageInfo.INSTALL_LOCATION_AUTO) {
canBe = true;
@@ -764,6 +763,8 @@
void updateStorageUsage() {
// Fragment view not yet created?
if (mRootView == null) return;
+ // Make sure a callback didn't come at an inopportune time.
+ if (getActivity() == null) return;
if (mCurView == VIEW_RUNNING) {
return;
@@ -945,8 +946,6 @@
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mContainerService = IMediaContainerService.Stub.asInterface(service);
- // Make sure this callback didn't come at an inopportune time.
- if (getActivity() == null) return;
updateStorageUsage();
}
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index cb350b2..6448a97 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -49,7 +49,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.Set;
+import java.util.TreeSet;
public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener, InputManager.InputDeviceListener {
@@ -190,7 +190,7 @@
private void updateUserDictionaryPreference(Preference userDictionaryPreference) {
final Activity activity = getActivity();
- final Set<String> localeList = UserDictionaryList.getUserDictionaryLocalesList(activity);
+ final TreeSet<String> localeList = UserDictionaryList.getUserDictionaryLocalesSet(activity);
if (null == localeList) {
// The locale list is null if and only if the user dictionary service is
// not present or disabled. In this case we need to remove the preference.
@@ -205,9 +205,9 @@
// If the size of localeList is 0, we don't set the locale parameter in the
// extras. This will be interpreted by the UserDictionarySettings class as
// meaning "the current locale".
- // Note that with the current code for UserDictionaryList#getUserDictionaryLocalesList()
+ // Note that with the current code for UserDictionaryList#getUserDictionaryLocalesSet()
// the locale list always has at least one element, since it always includes the current
- // locale explicitly. @see UserDictionaryList.getUserDictionaryLocalesList().
+ // locale explicitly. @see UserDictionaryList.getUserDictionaryLocalesSet().
if (localeList.size() == 1) {
final String locale = (String)localeList.toArray()[0];
userDictionaryPreference.getExtras().putString("locale", locale);
diff --git a/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java b/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
index f741d19..e52ab7a 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
@@ -17,48 +17,21 @@
package com.android.settings.inputmethod;
import com.android.settings.R;
-import com.android.settings.UserDictionarySettings;
-import com.android.settings.Utils;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-
-import android.animation.LayoutTransition;
import android.app.Activity;
-import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.provider.UserDictionary;
-import android.text.TextUtils;
import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
-import android.widget.Spinner;
-public class UserDictionaryAddWordActivity extends Activity
- implements AdapterView.OnItemSelectedListener {
+public class UserDictionaryAddWordActivity extends Activity {
private static final String STATE_KEY_IS_OPEN = "isOpen";
public static final String MODE_EDIT_ACTION = "com.android.settings.USER_DICTIONARY_EDIT";
public static final String MODE_INSERT_ACTION = "com.android.settings.USER_DICTIONARY_INSERT";
- private static final int[] IDS_SHOWN_ONLY_IN_MORE_OPTIONS_MODE = {
- R.id.user_dictionary_add_word_label,
- R.id.user_dictionary_add_shortcut_label,
- R.id.user_dictionary_add_locale_label,
- R.id.user_dictionary_settings_add_dialog_shortcut,
- R.id.user_dictionary_settings_add_dialog_locale,
- };
-
private UserDictionaryAddWordContents mContents;
- private boolean mIsShowingMoreOptions = false;
-
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -82,33 +55,16 @@
args.putInt(UserDictionaryAddWordContents.EXTRA_MODE, mode);
if (null != savedInstanceState) {
- mIsShowingMoreOptions =
- savedInstanceState.getBoolean(STATE_KEY_IS_OPEN, mIsShowingMoreOptions);
// Override options if we have a saved state.
args.putAll(savedInstanceState);
}
mContents = new UserDictionaryAddWordContents(getWindow().getDecorView(), args);
-
- if (mIsShowingMoreOptions) {
- onClickMoreOptions(findViewById(R.id.user_dictionary_settings_add_dialog_more_options));
- }
-
- // TODO: The following code enables layout transition for eye-candy, but there is still
- // a jankiness issue with the window moving on one frame, resizing suddenly on the next,
- // and animation only starting afterwards on children.
- final ViewGroup v = (ViewGroup)findViewById(R.id.user_dictionary_add_word_grid);
- final LayoutTransition transition = new LayoutTransition();
- transition.setStartDelay(LayoutTransition.APPEARING, 0);
- v.setLayoutTransition(transition);
}
@Override
public void onSaveInstanceState(final Bundle outState) {
- outState.putBoolean(STATE_KEY_IS_OPEN, mIsShowingMoreOptions);
- outState.putString(
- UserDictionaryAddWordContents.EXTRA_WORD, mContents.mEditText.getText().toString());
- outState.putString(UserDictionaryAddWordContents.EXTRA_LOCALE, mContents.mLocale);
+ mContents.saveStateIntoBundle(outState);
}
public void onClickCancel(final View v) {
@@ -119,100 +75,4 @@
mContents.apply(this);
finish();
}
-
- private static class LocaleRenderer {
- private final String mLocaleString;
- private final String mDescription;
- // LocaleString may NOT be null.
- public LocaleRenderer(final Context context, final String localeString) {
- mLocaleString = localeString;
- if (null == localeString) {
- mDescription = context.getString(R.string.user_dict_settings_more_languages);
- } else if ("".equals(localeString)) {
- mDescription = context.getString(R.string.user_dict_settings_all_languages);
- } else {
- mDescription = Utils.createLocaleFromString(localeString).getDisplayName();
- }
- }
- @Override
- public String toString() {
- return mDescription;
- }
- public String getLocaleString() {
- return mLocaleString;
- }
- }
-
- private static void addLocaleDisplayNameToList(final Context context,
- final List<LocaleRenderer> list, final String locale) {
- if (null != locale) {
- list.add(new LocaleRenderer(context, locale));
- }
- }
-
- public void onClickMoreOptions(final View v) {
- for (final int idToShow : IDS_SHOWN_ONLY_IN_MORE_OPTIONS_MODE) {
- final View viewToShow = findViewById(idToShow);
- viewToShow.setVisibility(View.VISIBLE);
- }
- findViewById(R.id.user_dictionary_settings_add_dialog_more_options)
- .setVisibility(View.GONE);
- findViewById(R.id.user_dictionary_settings_add_dialog_less_options)
- .setVisibility(View.VISIBLE);
-
- final Set<String> locales = UserDictionaryList.getUserDictionaryLocalesList(this);
- // Remove our locale if it's in, because we're always gonna put it at the top
- locales.remove(mContents.mLocale); // mLocale may not be null
- final String systemLocale = Locale.getDefault().toString();
- // The system locale should be inside. We want it at the 2nd spot.
- locales.remove(systemLocale); // system locale may not be null
- locales.remove(""); // Remove the empty string if it's there
- final ArrayList<LocaleRenderer> localesList = new ArrayList<LocaleRenderer>();
- // Add the passed locale, then the system locale at the top of the list. Add an
- // "all languages" entry at the bottom of the list.
- addLocaleDisplayNameToList(this, localesList, mContents.mLocale);
- if (!systemLocale.equals(mContents.mLocale)) {
- addLocaleDisplayNameToList(this, localesList, systemLocale);
- }
- for (final String l : locales) {
- // TODO: sort in unicode order
- addLocaleDisplayNameToList(this, localesList, l);
- }
- localesList.add(new LocaleRenderer(this, "")); // meaning: all languages
- localesList.add(new LocaleRenderer(this, null)); // meaning: select another locale
- final Spinner localeSpinner =
- (Spinner)findViewById(R.id.user_dictionary_settings_add_dialog_locale);
- final ArrayAdapter<LocaleRenderer> adapter = new ArrayAdapter<LocaleRenderer>(this,
- android.R.layout.simple_spinner_item, localesList);
- adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- localeSpinner.setAdapter(adapter);
- localeSpinner.setOnItemSelectedListener(this);
- mIsShowingMoreOptions = true;
- }
-
- public void onClickLessOptions(final View v) {
- for (final int idToHide : IDS_SHOWN_ONLY_IN_MORE_OPTIONS_MODE) {
- final View viewToHide = findViewById(idToHide);
- viewToHide.setVisibility(View.GONE);
- }
- findViewById(R.id.user_dictionary_settings_add_dialog_more_options)
- .setVisibility(View.VISIBLE);
- findViewById(R.id.user_dictionary_settings_add_dialog_less_options)
- .setVisibility(View.GONE);
- mIsShowingMoreOptions = false;
- }
-
- @Override
- public void onItemSelected(final AdapterView<?> parent, final View view, final int pos,
- final long id) {
- final LocaleRenderer locale = (LocaleRenderer)parent.getItemAtPosition(pos);
- mContents.updateLocale(locale.getLocaleString());
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- // I'm not sure we can come here, but if we do, that's the right thing to do.
- final Intent intent = getIntent();
- mContents.updateLocale(intent.getStringExtra(UserDictionaryAddWordContents.EXTRA_LOCALE));
- }
}
diff --git a/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java b/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
index 5de6f03..1e8bf74 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
@@ -16,6 +16,7 @@
package com.android.settings.inputmethod;
+import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.os.Bundle;
@@ -28,7 +29,9 @@
import com.android.settings.UserDictionarySettings;
import com.android.settings.Utils;
+import java.util.ArrayList;
import java.util.Locale;
+import java.util.TreeSet;
/**
* A container class to factor common code to UserDictionaryAddWordFragment
@@ -37,6 +40,7 @@
public class UserDictionaryAddWordContents {
public static final String EXTRA_MODE = "mode";
public static final String EXTRA_WORD = "word";
+ public static final String EXTRA_SHORTCUT = "shortcut";
public static final String EXTRA_LOCALE = "locale";
public static final int MODE_EDIT = 0;
@@ -44,20 +48,28 @@
private static final int FREQUENCY_FOR_USER_DICTIONARY_ADDS = 250;
- /* package */ final int mMode; // Either MODE_EDIT or MODE_INSERT
- /* package */ final EditText mEditText;
- /* package */ String mLocale;
- /* package */ String mOldWord;
+ private final int mMode; // Either MODE_EDIT or MODE_INSERT
+ private final EditText mWordEditText;
+ private final EditText mShortcutEditText;
+ private String mLocale;
+ private final String mOldWord;
+ private final String mOldShortcut;
/* package */ UserDictionaryAddWordContents(final View view, final Bundle args) {
- mEditText = (EditText)view.findViewById(R.id.user_dictionary_add_word_text);
+ mWordEditText = (EditText)view.findViewById(R.id.user_dictionary_add_word_text);
+ mShortcutEditText = (EditText)view.findViewById(R.id.user_dictionary_add_shortcut);
final String word = args.getString(EXTRA_WORD);
if (null != word) {
- mEditText.setText(word);
- mEditText.setSelection(word.length());
+ mWordEditText.setText(word);
+ mWordEditText.setSelection(word.length());
+ }
+ final String shortcut = args.getString(EXTRA_SHORTCUT);
+ if (null != shortcut && null != mShortcutEditText) {
+ mShortcutEditText.setText(shortcut);
}
mMode = args.getInt(EXTRA_MODE); // default return value for #getInt() is 0 = MODE_EDIT
mOldWord = args.getString(EXTRA_WORD);
+ mOldShortcut = args.getString(EXTRA_SHORTCUT);
updateLocale(args.getString(EXTRA_LOCALE));
}
@@ -67,24 +79,104 @@
mLocale = null == locale ? Locale.getDefault().toString() : locale;
}
+ /* package */ void saveStateIntoBundle(final Bundle outState) {
+ outState.putString(EXTRA_WORD, mWordEditText.getText().toString());
+ if (null != mShortcutEditText) {
+ outState.putString(EXTRA_SHORTCUT, mShortcutEditText.getText().toString());
+ }
+ outState.putString(EXTRA_LOCALE, mLocale);
+ }
+
/* package */ void apply(final Context context) {
final ContentResolver resolver = context.getContentResolver();
if (UserDictionaryAddWordContents.MODE_EDIT == mMode && !TextUtils.isEmpty(mOldWord)) {
- UserDictionarySettings.deleteWord(mOldWord, resolver);
+ // Mode edit: remove the old entry.
+ UserDictionarySettings.deleteWord(mOldWord, mOldShortcut, resolver);
}
- final String newWord = mEditText.getText().toString();
+ final String newWord = mWordEditText.getText().toString();
+ final String newShortcut;
+ if (null == mShortcutEditText) {
+ newShortcut = null;
+ } else {
+ final String tmpShortcut = mShortcutEditText.getText().toString();
+ if (TextUtils.isEmpty(tmpShortcut)) {
+ newShortcut = null;
+ } else {
+ newShortcut = tmpShortcut;
+ }
+ }
if (TextUtils.isEmpty(newWord)) {
// If the word is somehow empty, don't insert it.
return;
}
- // Disallow duplicates.
- // TODO: Redefine the logic when we support shortcuts.
- UserDictionarySettings.deleteWord(newWord, resolver);
+ // Disallow duplicates. If the same word with no shortcut is defined, remove it; if
+ // the same word with the same shortcut is defined, remove it; but we don't mind if
+ // there is the same word with a different, non-empty shortcut.
+ UserDictionarySettings.deleteWord(newWord, null, resolver);
+ if (!TextUtils.isEmpty(newShortcut)) {
+ // If newShortcut is empty we just deleted this, no need to do it again
+ UserDictionarySettings.deleteWord(newWord, newShortcut, resolver);
+ }
// In this class we use the empty string to represent 'all locales' and mLocale cannot
// be null. However the addWord method takes null to mean 'all locales'.
UserDictionary.Words.addWord(context, newWord.toString(),
- FREQUENCY_FOR_USER_DICTIONARY_ADDS, null /* shortcut */,
+ FREQUENCY_FOR_USER_DICTIONARY_ADDS, newShortcut,
TextUtils.isEmpty(mLocale) ? null : Utils.createLocaleFromString(mLocale));
}
+
+ public static class LocaleRenderer {
+ private final String mLocaleString;
+ private final String mDescription;
+ // LocaleString may NOT be null.
+ public LocaleRenderer(final Context context, final String localeString) {
+ mLocaleString = localeString;
+ if (null == localeString) {
+ mDescription = context.getString(R.string.user_dict_settings_more_languages);
+ } else if ("".equals(localeString)) {
+ mDescription = context.getString(R.string.user_dict_settings_all_languages);
+ } else {
+ mDescription = Utils.createLocaleFromString(localeString).getDisplayName();
+ }
+ }
+ @Override
+ public String toString() {
+ return mDescription;
+ }
+ public String getLocaleString() {
+ return mLocaleString;
+ }
+ }
+
+ private static void addLocaleDisplayNameToList(final Context context,
+ final ArrayList<LocaleRenderer> list, final String locale) {
+ if (null != locale) {
+ list.add(new LocaleRenderer(context, locale));
+ }
+ }
+
+ // Helper method to get the list of locales to display for this word
+ public ArrayList<LocaleRenderer> getLocalesList(final Activity activity) {
+ final TreeSet<String> locales = UserDictionaryList.getUserDictionaryLocalesSet(activity);
+ // Remove our locale if it's in, because we're always gonna put it at the top
+ locales.remove(mLocale); // mLocale may not be null
+ final String systemLocale = Locale.getDefault().toString();
+ // The system locale should be inside. We want it at the 2nd spot.
+ locales.remove(systemLocale); // system locale may not be null
+ locales.remove(""); // Remove the empty string if it's there
+ final ArrayList<LocaleRenderer> localesList = new ArrayList<LocaleRenderer>();
+ // Add the passed locale, then the system locale at the top of the list. Add an
+ // "all languages" entry at the bottom of the list.
+ addLocaleDisplayNameToList(activity, localesList, mLocale);
+ if (!systemLocale.equals(mLocale)) {
+ addLocaleDisplayNameToList(activity, localesList, systemLocale);
+ }
+ for (final String l : locales) {
+ // TODO: sort in unicode order
+ addLocaleDisplayNameToList(activity, localesList, l);
+ }
+ localesList.add(new LocaleRenderer(activity, "")); // meaning: all languages
+ localesList.add(new LocaleRenderer(activity, null)); // meaning: select another locale
+ return localesList;
+ }
}
diff --git a/src/com/android/settings/inputmethod/UserDictionaryAddWordFragment.java b/src/com/android/settings/inputmethod/UserDictionaryAddWordFragment.java
index f4a39a2..0a9738f 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryAddWordFragment.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryAddWordFragment.java
@@ -23,8 +23,14 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
import com.android.settings.R;
+import com.android.settings.inputmethod.UserDictionaryAddWordContents.LocaleRenderer;
+
+import java.util.ArrayList;
/**
* Fragment to add a word/shortcut to the user dictionary.
@@ -32,11 +38,13 @@
* As opposed to the UserDictionaryActivity, this is only invoked within Settings
* from the UserDictionarySettings.
*/
-public class UserDictionaryAddWordFragment extends Fragment {
+public class UserDictionaryAddWordFragment extends Fragment
+ implements AdapterView.OnItemSelectedListener {
private static final int OPTIONS_MENU_DELETE = Menu.FIRST;
private UserDictionaryAddWordContents mContents;
+ private View mRootView;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
@@ -46,9 +54,8 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
- final View view = inflater.inflate(R.layout.user_dictionary_add_word_fullscreen, null);
- mContents = new UserDictionaryAddWordContents(view, getArguments());
- return view;
+ mRootView = inflater.inflate(R.layout.user_dictionary_add_word_fullscreen, null);
+ return mRootView;
}
@Override
@@ -63,6 +70,16 @@
public void onResume() {
super.onResume();
// We are being shown: display the word
+ mContents = new UserDictionaryAddWordContents(mRootView, getArguments());
+ final ArrayList<LocaleRenderer> localesList = mContents.getLocalesList(getActivity());
+
+ final Spinner localeSpinner =
+ (Spinner)mRootView.findViewById(R.id.user_dictionary_add_locale);
+ final ArrayAdapter<LocaleRenderer> adapter = new ArrayAdapter<LocaleRenderer>(getActivity(),
+ android.R.layout.simple_spinner_item, localesList);
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ localeSpinner.setAdapter(adapter);
+ localeSpinner.setOnItemSelectedListener(this);
}
@Override
@@ -71,4 +88,18 @@
mContents.apply(getActivity());
// We are being hidden: commit changes to the user dictionary
}
+
+ @Override
+ public void onItemSelected(final AdapterView<?> parent, final View view, final int pos,
+ final long id) {
+ final LocaleRenderer locale = (LocaleRenderer)parent.getItemAtPosition(pos);
+ mContents.updateLocale(locale.getLocaleString());
+ }
+
+ @Override
+ public void onNothingSelected(final AdapterView<?> parent) {
+ // I'm not sure we can come here, but if we do, that's the right thing to do.
+ final Bundle args = getArguments();
+ mContents.updateLocale(args.getString(UserDictionaryAddWordContents.EXTRA_LOCALE));
+ }
}
diff --git a/src/com/android/settings/inputmethod/UserDictionaryList.java b/src/com/android/settings/inputmethod/UserDictionaryList.java
index ff82a30..5390be6 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryList.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryList.java
@@ -29,7 +29,6 @@
import android.provider.UserDictionary;
import java.util.Locale;
-import java.util.Set;
import java.util.TreeSet;
public class UserDictionaryList extends SettingsPreferenceFragment {
@@ -43,12 +42,12 @@
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getActivity()));
}
- static Set<String> getUserDictionaryLocalesList(Activity activity) {
+ static TreeSet<String> getUserDictionaryLocalesSet(Activity activity) {
@SuppressWarnings("deprecation")
final Cursor cursor = activity.managedQuery(UserDictionary.Words.CONTENT_URI,
new String[] { UserDictionary.Words.LOCALE },
null, null, null);
- final Set<String> localeList = new TreeSet<String>();
+ final TreeSet<String> localeList = new TreeSet<String>();
if (null == cursor) {
// The user dictionary service is not present or disabled. Return null.
return null;
@@ -70,7 +69,8 @@
protected void createUserDictSettings(PreferenceGroup userDictGroup) {
final Activity activity = getActivity();
userDictGroup.removeAll();
- final Set<String> localeList = UserDictionaryList.getUserDictionaryLocalesList(activity);
+ final TreeSet<String> localeList =
+ UserDictionaryList.getUserDictionaryLocalesSet(activity);
if (localeList.isEmpty()) {
userDictGroup.addPreference(createUserDictionaryPreference(null, activity));
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 8772f53..5037ad3 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -134,12 +134,19 @@
// this boolean extra specifies whether to disable the Next button when not connected
private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
+ // this boolean extra specifies whether to auto finish when connection is established
+ private static final String EXTRA_AUTO_FINISH_ON_CONNECT = "wifi_auto_finish_on_connect";
+
private static final String EXTRA_WIFI_SHOW_ACTION_BAR = "wifi_show_action_bar";
private static final String EXTRA_WIFI_SHOW_MENUS = "wifi_show_menus";
+ private static final String EXTRA_WIFI_DISABLE_BACK = "wifi_disable_back";
// should Next button only be enabled when we have a connection?
private boolean mEnableNextOnConnection;
+ // should activity finish once we have a connection?
+ private boolean mAutoFinishOnConnection;
+
// Save the dialog details
private boolean mDlgEdit;
private AccessPoint mDlgAccessPoint;
@@ -220,6 +227,24 @@
final Activity activity = getActivity();
final Intent intent = activity.getIntent();
+ // first if we're supposed to finish once we have a connection
+ mAutoFinishOnConnection = intent.getBooleanExtra(EXTRA_AUTO_FINISH_ON_CONNECT, false);
+
+ if (mAutoFinishOnConnection) {
+ // Hide the next button
+ if (hasNextButton()) {
+ getNextButton().setVisibility(View.GONE);
+ }
+
+ final ConnectivityManager connectivity = (ConnectivityManager)
+ getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (connectivity != null
+ && connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) {
+ activity.finish();
+ return;
+ }
+ }
+
// if we're supposed to enable/disable the Next button based on our current connection
// state, start it off in the right state
mEnableNextOnConnection = intent.getBooleanExtra(EXTRA_ENABLE_NEXT_ON_CONNECT, false);
@@ -238,6 +263,11 @@
addPreferencesFromResource(R.xml.wifi_settings);
+ // Back key is disabled if requested
+ if (intent.getBooleanExtra(EXTRA_WIFI_DISABLE_BACK, false)) {
+ getView().setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
+ }
+
// Action bar is hidden for Setup Wizard
final boolean showActionBar = intent.getBooleanExtra(EXTRA_WIFI_SHOW_ACTION_BAR, true);
if (showActionBar) {
@@ -651,6 +681,10 @@
changeNextButtonState(info.isConnected());
updateAccessPoints();
updateConnectionState(info.getDetailedState());
+ if (mAutoFinishOnConnection && info.isConnected()) {
+ getActivity().finish();
+ return;
+ }
} else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) {
updateConnectionState(null);
}