Merge "Remove device name and display debug setting"
diff --git a/res/layout-land/crypt_keeper_progress.xml b/res/layout-land/crypt_keeper_progress.xml
index 62fb297..3361603 100644
--- a/res/layout-land/crypt_keeper_progress.xml
+++ b/res/layout-land/crypt_keeper_progress.xml
@@ -30,7 +30,7 @@
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:textSize="30dip"
- android:textColor="#ff99cc00"
+ android:textColor="@color/title_color"
android:text="@string/crypt_keeper_setup_title"
android:gravity="bottom"
/>
diff --git a/res/layout-sw600dp-land/wifi_settings_for_setup_wizard_xl.xml b/res/layout-sw600dp-land/wifi_settings_for_setup_wizard_xl.xml
index 7c5b274..8094b74 100644
--- a/res/layout-sw600dp-land/wifi_settings_for_setup_wizard_xl.xml
+++ b/res/layout-sw600dp-land/wifi_settings_for_setup_wizard_xl.xml
@@ -47,7 +47,7 @@
android:layout_marginLeft="16dip"
android:layout_below="@id/top_padding_layout"
android:textSize="32dip"
- android:textColor="#ff99cc00"
+ android:textColor="@color/title_color"
android:text="@string/wifi_setup_title"
android:gravity="bottom"/>
diff --git a/res/layout-sw600dp/crypt_keeper_password_entry.xml b/res/layout-sw600dp/crypt_keeper_password_entry.xml
index bc2b353..ad8205a 100644
--- a/res/layout-sw600dp/crypt_keeper_password_entry.xml
+++ b/res/layout-sw600dp/crypt_keeper_password_entry.xml
@@ -20,6 +20,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
>
+ <include layout="@layout/crypt_keeper_status" />
+
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -38,6 +40,7 @@
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/encroid"
android:layout_marginTop="37dip"
+ android:paddingLeft="17dip"
android:paddingRight="17dip"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
diff --git a/res/layout-sw600dp/crypt_keeper_progress.xml b/res/layout-sw600dp/crypt_keeper_progress.xml
index b55781a..f958f00 100644
--- a/res/layout-sw600dp/crypt_keeper_progress.xml
+++ b/res/layout-sw600dp/crypt_keeper_progress.xml
@@ -23,6 +23,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
+ android:padding="64dip"
>
<ImageView
android:id="@+id/encroid"
@@ -42,8 +43,9 @@
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
android:textSize="30dip"
- android:textColor="#ff99cc00"
+ android:textColor="@color/title_color"
android:text="@string/crypt_keeper_setup_title"
android:gravity="bottom"
/>
@@ -68,8 +70,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/top_divider"
- android:paddingLeft="152dip"
android:paddingTop="21dip"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
@@ -78,7 +81,6 @@
android:id="@+id/bottom_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingLeft="152dip"
android:layout_above="@+id/factory_reset"
android:visibility="gone"
>
@@ -96,6 +98,7 @@
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="80dip"
+ android:layout_marginRight="16dip"
android:text="@string/master_clear_button_text"
android:visibility="gone"
/>
diff --git a/res/layout-sw600dp/wifi_settings_for_setup_wizard_xl.xml b/res/layout-sw600dp/wifi_settings_for_setup_wizard_xl.xml
index 9260702..20f5784 100644
--- a/res/layout-sw600dp/wifi_settings_for_setup_wizard_xl.xml
+++ b/res/layout-sw600dp/wifi_settings_for_setup_wizard_xl.xml
@@ -47,7 +47,7 @@
android:layout_marginLeft="16dip"
android:layout_below="@id/top_padding_layout"
android:textSize="32dip"
- android:textColor="#ff99cc00"
+ android:textColor="@color/title_color"
android:text="@string/wifi_setup_title"
android:gravity="bottom"/>
diff --git a/res/layout-sw720dp/date_time_settings_setupwizard.xml b/res/layout-sw720dp/date_time_settings_setupwizard.xml
index 1fc25da..b484472 100644
--- a/res/layout-sw720dp/date_time_settings_setupwizard.xml
+++ b/res/layout-sw720dp/date_time_settings_setupwizard.xml
@@ -34,7 +34,7 @@
android:layout_marginLeft="16dip"
android:layout_alignParentTop="true"
android:textSize="32dip"
- android:textColor="#FF99cc00"
+ android:textColor="@color/title_color"
android:text="@string/date_and_time_settings_title_setup_wizard"
android:gravity="bottom" />
diff --git a/res/layout/crypt_keeper_progress.xml b/res/layout/crypt_keeper_progress.xml
index 9677c3d..35760cf 100644
--- a/res/layout/crypt_keeper_progress.xml
+++ b/res/layout/crypt_keeper_progress.xml
@@ -30,7 +30,7 @@
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:textSize="30dip"
- android:textColor="#ff99cc00"
+ android:textColor="@color/title_color"
android:text="@string/crypt_keeper_setup_title"
android:gravity="bottom"
/>
diff --git a/res/layout/crypt_keeper_status.xml b/res/layout/crypt_keeper_status.xml
index 59d2365..b9c8288 100644
--- a/res/layout/crypt_keeper_status.xml
+++ b/res/layout/crypt_keeper_status.xml
@@ -19,10 +19,10 @@
<!-- Status to show on the left side of lock screen -->
<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
>
<com.android.internal.widget.DigitalClock android:id="@+id/time"
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
- android:textSize="120sp"
+ android:textSize="@dimen/crypt_clock_size"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/crypt_keeper_clock_background"
android:layout_marginBottom="6dip"
@@ -52,7 +52,7 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
- android:textSize="120sp"
+ android:textSize="@dimen/crypt_clock_size"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/crypt_keeper_clock_foreground"
android:layout_alignLeft="@*android:id/timeDisplayBackground"
diff --git a/res/layout/device_admin_add.xml b/res/layout/device_admin_add.xml
index ac30ed9..b1ad72c 100644
--- a/res/layout/device_admin_add.xml
+++ b/res/layout/device_admin_add.xml
@@ -120,13 +120,6 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone" />
- <Button android:id="@+id/action_button"
- android:layout_width="0dip"
- android:layout_gravity="left"
- android:layout_weight="1"
- android:maxLines="2"
- style="?android:attr/buttonBarButtonStyle"
- android:layout_height="wrap_content" />
<Button android:id="@+id/cancel_button"
android:layout_width="0dip"
android:layout_gravity="right"
@@ -135,6 +128,13 @@
android:text="@string/cancel"
style="?android:attr/buttonBarButtonStyle"
android:layout_height="wrap_content" />
+ <Button android:id="@+id/action_button"
+ android:layout_width="0dip"
+ android:layout_gravity="left"
+ android:layout_weight="1"
+ android:maxLines="2"
+ style="?android:attr/buttonBarButtonStyle"
+ android:layout_height="wrap_content" />
<LinearLayout android:id="@+id/rightSpacer"
android:layout_width="0dip"
android:layout_weight="0.25"
diff --git a/res/layout/text_description_preference.xml b/res/layout/text_description_preference.xml
index c5084034..eeaa81b 100644
--- a/res/layout/text_description_preference.xml
+++ b/res/layout/text_description_preference.xml
@@ -15,6 +15,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/message_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 9469a99..1fb7e59 100755
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -24,4 +24,5 @@
<dimen name="title_height">48dip</dimen>
<dimen name="content_margin_left">16dip</dimen>
<dimen name="description_margin_top">26dip</dimen>
+ <dimen name="crypt_clock_size">120sp</dimen>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 09f2ca2..2bba937 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -4,9 +4,9 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,12 +25,11 @@
<color name="memory_dcim">#793A7F</color>
<color name="memory_music">#8E562A</color>
<color name="memory_misc">#7C3030</color>
-
+
<color name="crypt_keeper_clock_background">#ff9a9a9a</color>
<color name="crypt_keeper_clock_foreground">#ff666666</color>
<color name="crypt_keeper_clock_am_pm">#ff9a9a9a</color>
<color name="divider_color">#20ffffff</color>
- <color name="title_color">#ff99cc00</color>
-</resources>
-
+ <color name="title_color">@android:color/holo_blue_light</color>
+</resources>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index dbe4c32..ffdec52 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -32,4 +32,6 @@
<dimen name="data_usage_chart_optimalWidth">440dip</dimen>
<dimen name="volume_seekbar_side_margin">8dip</dimen>
+
+ <dimen name="crypt_clock_size">100sp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2079700..e39da52 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2546,9 +2546,7 @@
<!-- User dictionary settings. The title of the context menu item to delete the current word -->
<string name="user_dict_settings_context_menu_delete_title">Delete</string>
<!-- User dictionary settings. The text to show when there are no user-defined words in the dictionary [CHAR LIMIT=200] -->
- <string name="user_dict_settings_empty_text" product="tablet">You do not have any words in the user dictionary. You can add a word by touching the Add ( + ) button.</string>
- <!-- User dictionary settings. The text to show when there are no user-defined words in the dictionary [CHAR LIMIT=200] -->
- <string name="user_dict_settings_empty_text" product="default">You do not have any words in the user dictionary. You can add a word through the menu.</string>
+ <string name="user_dict_settings_empty_text">You do not have any words in the user dictionary. You can add a word by touching the Add ( + ) button.</string>
<!-- User dictionary settings. The text to show to describe the dictionary common to all languages -->
<string name="user_dict_settings_all_languages">All languages</string>
@@ -2718,38 +2716,49 @@
<!-- Summary for the allowed state of script injection. [CHAR LIMIT=15] -->
<string name="accessibility_script_injection_allowed">Allowed</string>
<!-- Summary for the disallowed state of script injection. [CHAR LIMIT=15] -->
- <string name="accessibility_script_injection_disallowed">Disallowed</string>
+ <string name="accessibility_script_injection_disallowed">Not allowed</string>
<!-- Title for the dialog button to allow script injection. [CHAR LIMIT=15] -->
<string name="accessibility_script_injection_button_allow">Allow</string>
<!-- Title for the dialog button to disallow script injection. [CHAR LIMIT=15] -->
<string name="accessibility_script_injection_button_disallow">Don\'t Allow</string>
- <!-- Warning message about security implications of enabling an accessibility service,
+ <!-- Title for a warning message about security implications of enabling an accessibility service,
displayed as a dialog message when the user selects to enable an accessibility service (tablet). [CHAR LIMIT=NONE] -->
- <string name="accessibility_service_security_warning">
+ <string name="accessibility_service_security_warning_title">Use
+ <xliff:g id="service" example="TalkBack">%1$s</xliff:g>?</string>
+ <!-- Summary for a warning message about security implications of enabling an accessibility service,
+ displayed as a dialog message when the user selects to enable an accessibility service (tablet). [CHAR LIMIT=NONE] -->
+ <string name="accessibility_service_security_warning_summary">
<xliff:g id="accessibility_service_name">%1$s</xliff:g> can
collect all of the text you type, except passwords. This includes personal data such as credit card
numbers. It can also collect data about your interactions with the device.</string>
- <!-- Title for a warning about disabling accessibility displayed as a dialog message when the user
- selects to disable accessibility. This avoids accidental disabling. [CHAR LIMIT=30] -->
- <string name="accessibility_disable_warning_title">Turn accessibility off?</string>
- <!-- Summary for a warning about disabling accessibility displayed as a dialog message when the user
- selects to disable accessibility. This avoids accidental disabling. [CHAR LIMIT=NONE] -->
- <string name="accessibility_disable_warning_summary">Touching OK will stop spoken
- descriptions and all other accessibility features you\'ve been using.</string>
+
+ <!-- Title for a warning about disabling an accessibility service displayed as a dialog message when the user
+ selects to disable that service. This avoids accidental disabling. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_service_disable_warning_title">Stop
+ <xliff:g id="service" example="TalkBack">%1$s</xliff:g>?</string>
+ <!-- Summary for a warning about disabling accessibility service displayed as a dialog message when the user
+ selects to disable that service. This avoids accidental disabling. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_service_disable_warning_summary">Touching OK will
+ stop <xliff:g id="service" example="TalkBack">%1$s</xliff:g>.</string>
+
<!-- Title for the prompt that lets users know that they have no accessibility related apps
installed and that they can install TalkBack from Market. [CHAR LIMIT=50] -->
- <string name="accessibility_service_no_apps_title">No accessibility applications
- </string>
+ <string name="accessibility_service_no_apps_title">No accessibility applications</string>
<!-- Message for the prompt that lets users know that they have no accessibility related apps
installed and that they can install TalkBack from Market. [CHAR LIMIT=NONE] -->
<string name="accessibility_service_no_apps_message">You don\'t have accessibility
applications installed. Do you want to download a screen reader from the Android Market?</string>
+
+ <!-- Title for a warning about downloading accessibility scripts displayed as a dialog message
+ when the user selects to enable script downloading. [CHAR LIMIT=40] -->
+ <string name="accessibility_script_injection_security_warning_title">Install accessibility scripts?</string>
<!-- Warning message about security implications of downloading accessibility scripts,
displayed as a dialog message when the user selects to enable script downloading. [CHAR LIMIT=NONE] -->
- <string name="accessibility_script_injection_security_warning">Do you want applications to install
+ <string name="accessibility_script_injection_security_warning_summary">Do you want applications to install
scripts from Google that will make their content more accessible?</string>
+
<!-- Warning message that the interaction model changes on enabling touch exploration. [CHAR LIMIT=NONE] -->
<string name="accessibility_touch_exploration_warning">This feature changes the
way your device responds to touch. Turn on?</string>
@@ -2757,6 +2766,7 @@
<string name="accessibility_service_default_description">This accessibility service has no
description.\n\nAccessibility services provide various types of feedback when you interact
with the device. </string>
+
<!-- Accessibility settings: button for lauching settings for an accessibility service -->
<string name="settings_button">Settings</string>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 4dbca6d..bd054ad 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -30,13 +30,17 @@
<CheckBoxPreference
android:key="toggle_large_text_preference"
android:title="@string/accessibility_toggle_large_text_title"
- android:persistent="true"/>
+ android:persistent="false"/>
<CheckBoxPreference
android:key="toggle_power_button_ends_call_preference"
android:title="@string/accessibility_power_button_ends_call_title"
- android:persistent="true">
- </CheckBoxPreference>
+ android:persistent="false"/>
+
+ <CheckBoxPreference
+ android:key="toggle_auto_rotate_screen_preference"
+ android:title="@string/accelerometer_title"
+ android:persistent="false"/>
<PreferenceScreen
android:key="toggle_touch_exploration_preference"
@@ -44,7 +48,8 @@
android:fragment="com.android.settings.AccessibilitySettings$ToggleTouchExplorationFragment" >
<extra android:name="title" android:value="@string/accessibility_touch_exploration_title" />
<extra android:name="summary" android:value="@string/accessibility_touch_exploration_summary" />
- <extra android:name="warning_message" android:value="@string/accessibility_touch_exploration_warning" />
+ <extra android:name="enable_warning_title" android:value="@android:string/dialog_alert_title" />
+ <extra android:name="enable_warning_message" android:value="@string/accessibility_touch_exploration_warning" />
<extra android:name="settings_title" android:value="@string/accessibility_menu_item_tutorial" />
<extra android:name="settings_component_name" android:value="com.android.settings/com.android.settings.AccessibilityTutorialActivity" />
</PreferenceScreen>
@@ -53,17 +58,17 @@
android:title="@string/accessibility_long_press_timeout_title"
android:entries="@array/long_press_timeout_selector_titles"
android:entryValues="@array/long_press_timeout_selector_values"
- android:persistent="true" />
+ android:persistent="false"/>
<com.android.settings.AccessibilityEnableScriptInjectionPreference
android:key="toggle_script_injection_preference"
android:title="@string/accessibility_script_injection_title"
- android:dialogTitle="@android:string/dialog_alert_title"
+ android:dialogTitle="@string/accessibility_script_injection_security_warning_title"
android:dialogIcon="@android:drawable/ic_dialog_alert"
- android:dialogMessage="@string/accessibility_script_injection_security_warning"
+ android:dialogMessage="@string/accessibility_script_injection_security_warning_summary"
android:positiveButtonText="@string/accessibility_script_injection_button_allow"
android:negativeButtonText="@string/accessibility_script_injection_button_disallow"
- android:persistent="true" />
+ android:persistent="false"/>
</PreferenceCategory>
diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java
index e1b44e7..e87b3e8 100644
--- a/src/com/android/settings/AccessibilitySettings.java
+++ b/src/com/android/settings/AccessibilitySettings.java
@@ -53,6 +53,7 @@
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
+import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;
@@ -99,6 +100,8 @@
private static final String TOGGLE_LARGE_TEXT_PREFERENCE = "toggle_large_text_preference";
private static final String TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE =
"toggle_power_button_ends_call_preference";
+ private static final String TOGGLE_AUTO_ROTATE_SCREEN_PREFERENCE =
+ "toggle_auto_rotate_screen_preference";
private static final String TOGGLE_TOUCH_EXPLORATION_PREFERENCE =
"toggle_touch_exploration_preference";
private static final String SELECT_LONG_PRESS_TIMEOUT_PREFERENCE =
@@ -111,13 +114,15 @@
private static final String EXTRA_CHECKED = "checked";
private static final String EXTRA_TITLE = "title";
private static final String EXTRA_SUMMARY = "summary";
- private static final String EXTRA_WARNING_MESSAGE = "warning_message";
+ private static final String EXTRA_ENABLE_WARNING_TITLE = "enable_warning_title";
+ private static final String EXTRA_ENABLE_WARNING_MESSAGE = "enable_warning_message";
+ private static final String EXTRA_DISABLE_WARNING_TITLE = "disable_warning_title";
+ private static final String EXTRA_DISABLE_WARNING_MESSAGE = "disable_warning_message";
private static final String EXTRA_SETTINGS_TITLE = "settings_title";
private static final String EXTRA_SETTINGS_COMPONENT_NAME = "settings_component_name";
// Dialog IDs.
- private static final int DIALOG_ID_DISABLE_ACCESSIBILITY = 1;
- private static final int DIALOG_ID_NO_ACCESSIBILITY_SERVICES = 2;
+ private static final int DIALOG_ID_NO_ACCESSIBILITY_SERVICES = 1;
// Auxiliary members.
private final SimpleStringSplitter mStringColonSplitter =
@@ -134,18 +139,17 @@
@Override
public void dispatchMessage(Message msg) {
super.dispatchMessage(msg);
- updateServicesPreferences(mToggleAccessibilitySwitch.isChecked());
+ updateServicesPreferences();
}
};
// Preference controls.
- private ToggleSwitch mToggleAccessibilitySwitch;
-
private PreferenceCategory mServicesCategory;
private PreferenceCategory mSystemsCategory;
private CheckBoxPreference mToggleLargeTextPreference;
private CheckBoxPreference mTogglePowerButtonEndsCallPreference;
+ private CheckBoxPreference mToggleAutoRotateScreenPreference;
private Preference mToggleTouchExplorationPreference;
private ListPreference mSelectLongPressTimeoutPreference;
private AccessibilityEnableScriptInjectionPreference mToggleScriptInjectionPreference;
@@ -162,9 +166,8 @@
@Override
public void onResume() {
super.onResume();
- final boolean accessibilityEnabled = mToggleAccessibilitySwitch.isChecked();
- updateAllPreferences(accessibilityEnabled);
- if (accessibilityEnabled) {
+ updateAllPreferences();
+ if (mServicesCategory.getPreference(0) == mNoServicesMessagePreference) {
offerInstallAccessibilitySerivceOnce();
}
mSettingsPackageMonitor.register(getActivity(), false);
@@ -176,18 +179,6 @@
super.onPause();
}
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- addToggleAccessibilitySwitch();
- super.onViewCreated(view, savedInstanceState);
- }
-
- @Override
- public void onDestroyView() {
- removeToggleAccessibilitySwitch();
- super.onDestroyView();
- }
-
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mSelectLongPressTimeoutPreference) {
String stringValue = (String) newValue;
@@ -202,13 +193,15 @@
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- final String key = preference.getKey();
if (mToggleLargeTextPreference == preference) {
handleToggleLargeTextPreferenceClick();
return true;
} else if (mTogglePowerButtonEndsCallPreference == preference) {
handleTogglePowerButtonEndsCallPreferenceClick();
return true;
+ } else if (mToggleAutoRotateScreenPreference == preference) {
+ handleToggleAutoRotateScreenPreferenceClick();
+ return true;
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
@@ -230,88 +223,34 @@
: Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF));
}
- private void addToggleAccessibilitySwitch() {
- mToggleAccessibilitySwitch = createAndAddActionBarToggleSwitch(getActivity());
- final boolean checked = (Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.ACCESSIBILITY_ENABLED, 0) == 1);
- mToggleAccessibilitySwitch.setChecked(checked);
- mToggleAccessibilitySwitch.setOnBeforeCheckedChangeListener(
- new OnBeforeCheckedChangeListener() {
- @Override
- public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
- if (!checked) {
- toggleSwitch.setCheckedInternal(true);
- showDialog(DIALOG_ID_DISABLE_ACCESSIBILITY);
- return true;
- }
- Settings.Secure.putInt(getContentResolver(),
- Settings.Secure.ACCESSIBILITY_ENABLED, 1);
- updateAllPreferences(true);
- offerInstallAccessibilitySerivceOnce();
- return false;
- }
- });
- }
-
- public void removeToggleAccessibilitySwitch() {
- mToggleAccessibilitySwitch.setOnBeforeCheckedChangeListener(null);
- getActivity().getActionBar().setCustomView(null);
+ private void handleToggleAutoRotateScreenPreferenceClick() {
+ Settings.System.putInt(getContentResolver(),
+ Settings.System.ACCELEROMETER_ROTATION,
+ (mToggleAutoRotateScreenPreference.isChecked() ? 1 : 0));
}
private void initializeAllPreferences() {
- // The basic logic here is if accessibility is not enabled all accessibility
- // settings will have no effect but still their selected state should be kept
- // unchanged, so the user can see what settings will be enabled when turning
- // on accessibility.
-
- final boolean accessibilityEnabled = (Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.ACCESSIBILITY_ENABLED, 0) == 1);
-
mServicesCategory = (PreferenceCategory) findPreference(SERVICES_CATEGORY);
mSystemsCategory = (PreferenceCategory) findPreference(SYSTEM_CATEGORY);
// Large text.
mToggleLargeTextPreference =
(CheckBoxPreference) findPreference(TOGGLE_LARGE_TEXT_PREFERENCE);
- if (accessibilityEnabled) {
- try {
- mCurConfig.updateFrom(ActivityManagerNative.getDefault().getConfiguration());
- } catch (RemoteException re) {
- /* ignore */
- }
- mToggleLargeTextPreference.setChecked(mCurConfig.fontScale == LARGE_FONT_SCALE);
- }
// Power button ends calls.
mTogglePowerButtonEndsCallPreference =
(CheckBoxPreference) findPreference(TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE);
- if (KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER)
- && Utils.isVoiceCapable(getActivity())) {
- if (accessibilityEnabled) {
- final int incallPowerBehavior = Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
- Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT);
- final boolean powerButtonEndsCall =
- (incallPowerBehavior == Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_HANGUP);
- mTogglePowerButtonEndsCallPreference.setChecked(powerButtonEndsCall);
- }
- } else {
+ if (!KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER)
+ || !Utils.isVoiceCapable(getActivity())) {
mSystemsCategory.removePreference(mTogglePowerButtonEndsCallPreference);
}
+ // Auto-rotate screen
+ mToggleAutoRotateScreenPreference =
+ (CheckBoxPreference) findPreference(TOGGLE_AUTO_ROTATE_SCREEN_PREFERENCE);
+
// Touch exploration enabled.
mToggleTouchExplorationPreference = findPreference(TOGGLE_TOUCH_EXPLORATION_PREFERENCE);
- final boolean touchExplorationEnabled = (Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.TOUCH_EXPLORATION_ENABLED, 0) == 1);
- if (touchExplorationEnabled) {
- mToggleTouchExplorationPreference.setSummary(
- getString(R.string.accessibility_service_state_on));
- mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, true);
- } else {
- mToggleTouchExplorationPreference.setSummary(
- getString(R.string.accessibility_service_state_off));
- mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, false);
- }
// Long press timeout.
mSelectLongPressTimeoutPreference =
@@ -328,34 +267,18 @@
mLongPressTimeoutValuetoTitleMap.put(timeoutValues[i], timeoutTitles[i]);
}
}
- if (accessibilityEnabled) {
- final int longPressTimeout = Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.LONG_PRESS_TIMEOUT, mLongPressTimeoutDefault);
- String value = String.valueOf(longPressTimeout);
- mSelectLongPressTimeoutPreference.setValue(value);
- mSelectLongPressTimeoutPreference.setSummary(
- mLongPressTimeoutValuetoTitleMap.get(value));
- } else {
- Settings.Secure.putInt(getContentResolver(), Settings.Secure.LONG_PRESS_TIMEOUT,
- mLongPressTimeoutDefault);
- }
// Script injection.
mToggleScriptInjectionPreference = (AccessibilityEnableScriptInjectionPreference)
findPreference(TOGGLE_SCRIPT_INJECTION_PREFERENCE);
- if (accessibilityEnabled) {
- final boolean scriptInjectionAllowed = (Settings.Secure.getInt(getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION, 0) == 1);
- mToggleScriptInjectionPreference.setInjectionAllowed(scriptInjectionAllowed);
- }
}
- private void updateAllPreferences(boolean accessibilityEnabled) {
- updateServicesPreferences(accessibilityEnabled);
- updateSystemPreferences(accessibilityEnabled);
+ private void updateAllPreferences() {
+ updateServicesPreferences();
+ updateSystemPreferences();
}
- private void updateServicesPreferences(boolean accessibilityEnabled) {
+ private void updateServicesPreferences() {
// Since services category is auto generated we have to do a pass
// to generate it since services can come and go and then based on
// the global accessibility state to decided whether it is enabled.
@@ -381,7 +304,6 @@
for (int i = 0, count = installedServices.size(); i < count; ++i) {
AccessibilityServiceInfo info = installedServices.get(i);
- String key = info.getId();
PreferenceScreen preference = getPreferenceManager().createPreferenceScreen(
getActivity());
@@ -416,9 +338,19 @@
}
extras.putString(EXTRA_SUMMARY, description);
- extras.putString(EXTRA_WARNING_MESSAGE, getString(
- R.string.accessibility_service_security_warning,
- info.getResolveInfo().loadLabel(getPackageManager())));
+ CharSequence applicationLabel = info.getResolveInfo().loadLabel(getPackageManager());
+
+ extras.putString(EXTRA_ENABLE_WARNING_TITLE, getString(
+ R.string.accessibility_service_security_warning_title, applicationLabel));
+ extras.putString(EXTRA_ENABLE_WARNING_MESSAGE, getString(
+ R.string.accessibility_service_security_warning_summary, applicationLabel));
+
+ extras.putString(EXTRA_DISABLE_WARNING_TITLE, getString(
+ R.string.accessibility_service_disable_warning_title,
+ applicationLabel));
+ extras.putString(EXTRA_DISABLE_WARNING_MESSAGE, getString(
+ R.string.accessibility_service_disable_warning_summary,
+ applicationLabel));
String settingsClassName = info.getSettingsActivityName();
if (!TextUtils.isEmpty(settingsClassName)) {
@@ -432,48 +364,59 @@
mServicesCategory.addPreference(preference);
}
- // Update enabled state.
- mServicesCategory.setEnabled(accessibilityEnabled);
+ if (mServicesCategory.getPreferenceCount() == 0) {
+ if (mNoServicesMessagePreference == null) {
+ mNoServicesMessagePreference = new Preference(getActivity()) {
+ @Override
+ protected void onBindView(View view) {
+ super.onBindView(view);
+
+ LinearLayout containerView =
+ (LinearLayout) view.findViewById(R.id.message_container);
+ containerView.setGravity(Gravity.CENTER);
+
+ TextView summaryView = (TextView) view.findViewById(R.id.summary);
+ String title = getString(R.string.accessibility_service_no_apps_title);
+ summaryView.setText(title);
+ }
+ };
+ mNoServicesMessagePreference.setPersistent(false);
+ mNoServicesMessagePreference.setLayoutResource(
+ R.layout.text_description_preference);
+ mNoServicesMessagePreference.setSelectable(false);
+ }
+ mServicesCategory.addPreference(mNoServicesMessagePreference);
+ }
}
- private void updateSystemPreferences(boolean accessibilityEnabled) {
- // The basic logic here is if accessibility is not enabled all accessibility
- // settings will have no effect but still their selected state should be kept
- // unchanged, so the user can see what settings will be enabled when turning
- // on accessibility.
+ private Preference mNoServicesMessagePreference;
+ private void updateSystemPreferences() {
// Large text.
- mToggleLargeTextPreference.setEnabled(accessibilityEnabled);
- if (accessibilityEnabled) {
- mCurConfig.fontScale =
- mToggleLargeTextPreference.isChecked() ? LARGE_FONT_SCALE : 1;
- } else {
- mCurConfig.fontScale = 1;
- }
try {
- ActivityManagerNative.getDefault().updatePersistentConfiguration(mCurConfig);
+ mCurConfig.updateFrom(ActivityManagerNative.getDefault().getConfiguration());
} catch (RemoteException re) {
/* ignore */
}
+ mToggleLargeTextPreference.setChecked(mCurConfig.fontScale == LARGE_FONT_SCALE);
// Power button ends calls.
- if (mTogglePowerButtonEndsCallPreference != null) {
- mTogglePowerButtonEndsCallPreference.setEnabled(accessibilityEnabled);
- final int powerButtonEndsCall;
- if (accessibilityEnabled) {
- powerButtonEndsCall = mTogglePowerButtonEndsCallPreference.isChecked()
- ? Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_HANGUP
- : Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
- } else {
- powerButtonEndsCall = Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
- }
- Settings.Secure.putInt(getContentResolver(),
+ if (KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER)
+ && Utils.isVoiceCapable(getActivity())) {
+ final int incallPowerBehavior = Settings.Secure.getInt(getContentResolver(),
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
- powerButtonEndsCall);
+ Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT);
+ final boolean powerButtonEndsCall =
+ (incallPowerBehavior == Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_HANGUP);
+ mTogglePowerButtonEndsCallPreference.setChecked(powerButtonEndsCall);
}
+ // Auto-rotate screen
+ final boolean autoRotationEnabled = Settings.System.getInt(getContentResolver(),
+ Settings.System.ACCELEROMETER_ROTATION, 0) != 0;
+ mToggleAutoRotateScreenPreference.setChecked(autoRotationEnabled);
+
// Touch exploration enabled.
- mToggleTouchExplorationPreference.setEnabled(accessibilityEnabled);
final boolean touchExplorationEnabled = (Settings.Secure.getInt(getContentResolver(),
Settings.Secure.TOUCH_EXPLORATION_ENABLED, 0) == 1);
if (touchExplorationEnabled) {
@@ -487,29 +430,16 @@
}
// Long press timeout.
- mSelectLongPressTimeoutPreference.setEnabled(accessibilityEnabled);
- final int longPressTimeout;
- if (accessibilityEnabled) {
- String value = mSelectLongPressTimeoutPreference.getValue();
- longPressTimeout = (value != null) ? Integer.parseInt(value) : mLongPressTimeoutDefault;
- } else {
- longPressTimeout = mLongPressTimeoutDefault;
- }
- Settings.Secure.putInt(getContentResolver(), Settings.Secure.LONG_PRESS_TIMEOUT,
- longPressTimeout);
- String value = mSelectLongPressTimeoutPreference.getValue();
+ final int longPressTimeout = Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.LONG_PRESS_TIMEOUT, mLongPressTimeoutDefault);
+ String value = String.valueOf(longPressTimeout);
+ mSelectLongPressTimeoutPreference.setValue(value);
mSelectLongPressTimeoutPreference.setSummary(mLongPressTimeoutValuetoTitleMap.get(value));
// Script injection.
- mToggleScriptInjectionPreference.setEnabled(accessibilityEnabled);
- final boolean scriptInjectionAllowed;
- if (accessibilityEnabled) {
- scriptInjectionAllowed = mToggleScriptInjectionPreference.isInjectionAllowed();
- } else {
- scriptInjectionAllowed = false;
- }
- Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION,
- scriptInjectionAllowed ? 1 : 0);
+ final boolean scriptInjectionAllowed = (Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION, 0) == 1);
+ mToggleScriptInjectionPreference.setInjectionAllowed(scriptInjectionAllowed);
}
private void offerInstallAccessibilitySerivceOnce() {
@@ -531,31 +461,6 @@
@Override
public Dialog onCreateDialog(int dialogId) {
switch (dialogId) {
- case DIALOG_ID_DISABLE_ACCESSIBILITY:
- return (new AlertDialog.Builder(getActivity()))
- .setTitle(R.string.accessibility_disable_warning_title)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setMessage(getResources().
- getString(R.string.accessibility_disable_warning_summary))
- .setCancelable(true)
- .setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Settings.Secure.putInt(getContentResolver(),
- Settings.Secure.ACCESSIBILITY_ENABLED, 0);
- mToggleAccessibilitySwitch.setCheckedInternal(
- false);
- updateAllPreferences(false);
- }
- })
- .setNegativeButton(android.R.string.cancel,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- mToggleAccessibilitySwitch.setCheckedInternal(
- true);
- }
- })
- .create();
case DIALOG_ID_NO_ACCESSIBILITY_SERVICES:
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.accessibility_service_no_apps_title)
@@ -670,6 +575,10 @@
enabledServices += preferenceKey;
Settings.Secure.putString(getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, enabledServices);
+ // Enabling the first service enables accessibility.
+ Settings.Secure.putInt(getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_ENABLED, 1);
+
} else if (length > 0) {
enabledServices += ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR + preferenceKey;
Settings.Secure.putString(getContentResolver(),
@@ -681,6 +590,9 @@
enabledServices = enabledServices.replace(preferenceKey, "");
Settings.Secure.putString(getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, enabledServices);
+ // Disabling the last service disables accessibility).
+ Settings.Secure.putInt(getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_ENABLED, 0);
} else if (index > 0) {
enabledServices = enabledServices.replace(
ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR + preferenceKey, "");
@@ -713,18 +625,24 @@
private abstract static class TogglePreferenceFragment extends SettingsPreferenceFragment
implements DialogInterface.OnClickListener {
- private static final int DIALOG_ID_WARNING = 1;
+ private static final int DIALOG_ID_ENABLE_WARNING = 1;
+ private static final int DIALOG_ID_DISABLE_WARNING = 2;
private String mPreferenceKey;
private ToggleSwitch mToggleSwitch;
- private CharSequence mWarningMessage;
+ private CharSequence mEnableWarningTitle;
+ private CharSequence mEnableWarningMessage;
+ private CharSequence mDisableWarningTitle;
+ private CharSequence mDisableWarningMessage;
private Preference mSummaryPreference;
private CharSequence mSettingsTitle;
private Intent mSettingsIntent;
+ private int mShownDialogId;
+
// TODO: Showing sub-sub fragment does not handle the activity title
// so we do it but this is wrong. Do a real fix when there is time.
private CharSequence mOldActivityTitle;
@@ -789,37 +707,51 @@
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
MenuItem menuItem = menu.add(mSettingsTitle);
- menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
menuItem.setIntent(mSettingsIntent);
}
@Override
public Dialog onCreateDialog(int dialogId) {
+ CharSequence title = null;
+ CharSequence message = null;
switch (dialogId) {
- case DIALOG_ID_WARNING:
- return new AlertDialog.Builder(getActivity())
- .setTitle(android.R.string.dialog_alert_title)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setMessage(mWarningMessage)
- .setCancelable(true)
- .setPositiveButton(android.R.string.ok, this)
- .setNegativeButton(android.R.string.cancel, this)
- .create();
+ case DIALOG_ID_ENABLE_WARNING:
+ mShownDialogId = DIALOG_ID_ENABLE_WARNING;
+ title = mEnableWarningTitle;
+ message = mEnableWarningMessage;
+ break;
+ case DIALOG_ID_DISABLE_WARNING:
+ mShownDialogId = DIALOG_ID_DISABLE_WARNING;
+ title = mDisableWarningTitle;
+ message = mDisableWarningMessage;
+ break;
default:
throw new IllegalArgumentException();
}
+ return new AlertDialog.Builder(getActivity())
+ .setTitle(title)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setMessage(message)
+ .setCancelable(true)
+ .setPositiveButton(android.R.string.ok, this)
+ .setNegativeButton(android.R.string.cancel, this)
+ .create();
}
@Override
public void onClick(DialogInterface dialog, int which) {
+ final boolean checked;
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
- // OK, we got the user consent so set checked.
- mToggleSwitch.setCheckedInternal(true);
- onPreferenceToggled(mPreferenceKey, true);
+ checked = (mShownDialogId == DIALOG_ID_ENABLE_WARNING);
+ mToggleSwitch.setCheckedInternal(checked);
+ onPreferenceToggled(mPreferenceKey, checked);
break;
case DialogInterface.BUTTON_NEGATIVE:
- onPreferenceToggled(mPreferenceKey, false);
+ checked = (mShownDialogId == DIALOG_ID_DISABLE_WARNING);
+ mToggleSwitch.setCheckedInternal(checked);
+ onPreferenceToggled(mPreferenceKey, checked);
break;
default:
throw new IllegalArgumentException();
@@ -832,13 +764,18 @@
@Override
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
if (checked) {
- if (!TextUtils.isEmpty(mWarningMessage)) {
+ if (!TextUtils.isEmpty(mEnableWarningMessage)) {
toggleSwitch.setCheckedInternal(false);
- showDialog(DIALOG_ID_WARNING);
+ showDialog(DIALOG_ID_ENABLE_WARNING);
return true;
}
onPreferenceToggled(mPreferenceKey, true);
} else {
+ if (!TextUtils.isEmpty(mDisableWarningMessage)) {
+ toggleSwitch.setCheckedInternal(true);
+ showDialog(DIALOG_ID_DISABLE_WARNING);
+ return true;
+ }
onPreferenceToggled(mPreferenceKey, false);
}
return false;
@@ -861,7 +798,7 @@
if (!activity.onIsMultiPane() || activity.onIsHidingHeaders()) {
mOldActivityTitle = getActivity().getTitle();
String title = arguments.getString(EXTRA_TITLE);
- getActivity().getActionBar().setTitle(arguments.getCharSequence(EXTRA_TITLE));
+ getActivity().getActionBar().setTitle(title);
}
// Summary.
@@ -881,9 +818,21 @@
}
}
- // Waring message.
- mWarningMessage = arguments.getCharSequence(
- AccessibilitySettings.EXTRA_WARNING_MESSAGE);
+ // Enable warning title.
+ mEnableWarningTitle = arguments.getCharSequence(
+ AccessibilitySettings.EXTRA_ENABLE_WARNING_TITLE);
+
+ // Enable warning message.
+ mEnableWarningMessage = arguments.getCharSequence(
+ AccessibilitySettings.EXTRA_ENABLE_WARNING_MESSAGE);
+
+ // Disable warning title.
+ mDisableWarningTitle = arguments.getString(
+ AccessibilitySettings.EXTRA_DISABLE_WARNING_TITLE);
+
+ // Disable warning message.
+ mDisableWarningMessage = arguments.getString(
+ AccessibilitySettings.EXTRA_DISABLE_WARNING_MESSAGE);
}
}
}
diff --git a/src/com/android/settings/RingerVolumePreference.java b/src/com/android/settings/RingerVolumePreference.java
index a626903..22c05ca 100644
--- a/src/com/android/settings/RingerVolumePreference.java
+++ b/src/com/android/settings/RingerVolumePreference.java
@@ -58,7 +58,6 @@
private static final int MSG_RINGER_MODE_CHANGED = 101;
private SeekBarVolumizer [] mSeekBarVolumizer;
- private boolean mIgnoreVolumeKeys;
// These arrays must all match in length and order
private static final int[] SEEKBAR_ID = new int[] {
@@ -145,7 +144,6 @@
//setDialogIcon(R.drawable.ic_settings_sound);
mSeekBarVolumizer = new SeekBarVolumizer[SEEKBAR_ID.length];
- mIgnoreVolumeKeys = !Utils.isVoiceCapable(context);
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
}
@@ -242,11 +240,7 @@
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_MUTE:
- if (mIgnoreVolumeKeys) {
- return true;
- } else {
- return super.onKey(v, keyCode, event);
- }
+ return true;
default:
return false;
}