Merge "Enhanced notification details." into nyc-dev
diff --git a/res/layout/encryption_interstitial.xml b/res/layout/encryption_interstitial.xml
deleted file mode 100644
index 162ad0e..0000000
--- a/res/layout/encryption_interstitial.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 2014 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingStart="?attr/side_margin"
- android:paddingEnd="?attr/side_margin">
-
- <TextView
- android:id="@+id/encryption_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
- android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <RadioGroup
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
- android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
- android:checkedButton="@+id/encrypt_require_password">
-
- <RadioButton
- android:id="@+id/encrypt_require_password"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp" />
-
- <RadioButton
- android:id="@+id/encrypt_dont_require_password"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp" />
-
- </RadioGroup>
-
-</LinearLayout>
diff --git a/res/layout/encryption_interstitial_header.xml b/res/layout/encryption_interstitial_header.xml
new file mode 100644
index 0000000..8d36432
--- /dev/null
+++ b/res/layout/encryption_interstitial_header.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:minHeight="56dp"
+ android:paddingTop="16dp"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingBottom="16dp"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
diff --git a/res/layout/preference_wallpaper_type b/res/layout/preference_wallpaper_type
index 48bfffd..ee1fd30 100644
--- a/res/layout/preference_wallpaper_type
+++ b/res/layout/preference_wallpaper_type
@@ -16,7 +16,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
diff --git a/res/layout/setup_encryption_interstitial.xml b/res/layout/setup_encryption_interstitial.xml
deleted file mode 100644
index 8a36e30..0000000
--- a/res/layout/setup_encryption_interstitial.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License
--->
-
-<com.android.setupwizardlib.SetupWizardLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:id="@+id/setup_wizard_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- settings:suwBackgroundTile="@drawable/setup_illustration_tile"
- settings:suwHeaderText="@string/encryption_interstitial_header"
- settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile"
- settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen">
-
- <LinearLayout
- style="@style/SuwContentFrame"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <TextView
- android:id="@+id/encryption_message"
- style="@style/SuwDescription"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <RadioGroup
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:checkedButton="@+id/encrypt_require_password">
-
- <RadioButton
- android:id="@+id/encrypt_require_password"
- style="@style/SuwRadioButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <RadioButton
- android:id="@+id/encrypt_dont_require_password"
- style="@style/SuwRadioButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- </RadioGroup>
-
- </LinearLayout>
-
-</com.android.setupwizardlib.SetupWizardLayout>
diff --git a/res/layout/setup_encryption_interstitial_header.xml b/res/layout/setup_encryption_interstitial_header.xml
new file mode 100644
index 0000000..82344bb
--- /dev/null
+++ b/res/layout/setup_encryption_interstitial_header.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:minHeight="56dp"
+ android:paddingBottom="@dimen/suw_description_margin_bottom"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingTop="@dimen/suw_description_margin_top"
+ android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:textAppearance="?android:attr/textAppearanceListItem" />
diff --git a/res/layout/suw_item_link_description.xml b/res/layout/suw_item_link_description.xml
new file mode 100644
index 0000000..5396de1e
--- /dev/null
+++ b/res/layout/suw_item_link_description.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ style="@style/SuwItemContainer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingTop="@dimen/suw_description_margin_top"
+ android:paddingBottom="@dimen/suw_description_margin_bottom_lists">
+
+ <FrameLayout
+ android:id="@+id/suw_items_icon_container"
+ android:layout_width="@dimen/suw_items_icon_container_width"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:gravity="start">
+
+ <ImageView
+ android:id="@+id/suw_items_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ tools:ignore="ContentDescription" />
+
+ </FrameLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <com.android.settings.widget.LinkTextView
+ android:id="@+id/suw_items_title"
+ style="@style/SuwItemTitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="start"
+ android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:textAlignment="viewStart"
+ android:textAppearance="@style/TextAppearance.SuwDescription"
+ tools:ignore="UnusedAttribute" />
+
+ <com.android.settings.widget.LinkTextView
+ android:id="@+id/suw_items_summary"
+ style="@style/SuwItemSummary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="start"
+ android:textAlignment="viewStart"
+ android:visibility="gone"
+ tools:ignore="UnusedAttribute" />
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f053836..19a4218 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -740,9 +740,7 @@
<!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature[CHAR LIMIT=29] -->
<string name="security_settings_fingerprint_enroll_introduction_title">Unlock with fingerprint</string>
<!-- Introduction detail message shown in fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
- <string name="security_settings_fingerprint_enroll_introduction_message">Just touch the fingerprint sensor to unlock your phone, authorize purchases, or sign in to apps. \n\n Be careful whose fingerprints you add - any fingerprints added will be able to do these things.</string>
- <!-- Introduction detail message shown in fingerprint enrollment dialog to warn the user [CHAR LIMIT=NONE]-->
- <string name="security_settings_fingerprint_enroll_introduction_message_warning">Note: Your fingerprint may be less secure than a strong pattern or PIN. <annotation id="url">Learn more</annotation></string>
+ <string name="security_settings_fingerprint_enroll_introduction_message">Just touch the fingerprint sensor to unlock your phone, authorize purchases, or sign in to apps. Be careful whose fingerprints you add. Even one added print can do any of these things.\n\nNote: Your fingerprint may be less secure than a strong pattern or PIN. <annotation id="url">Learn more</annotation></string>
<!-- Button text to cancel enrollment from the introduction [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_enroll_introduction_cancel">Cancel</string>
<!-- Button text to continue to the next screen from the introduction [CHAR LIMIT=22] -->
@@ -3825,7 +3823,7 @@
<!-- Summary for the preference screen to enable the global geture that turns on accessibility (off state). [CHAR LIMIT=35] -->
<string name="accessibility_global_gesture_preference_summary_off">Off</string>
<!-- Description for the preference screen to enable the global geture taht turns on accessibility. [CHAR LIMIT=none] -->
- <string name="accessibility_global_gesture_preference_description">When this feature is turned on, you can quickly activate accessibility features in two steps:\n\nStep 1: Press and hold the power button until you hear a sound or feel a vibration.\n\nStep 2: Tap & hold two fingers until you hear audio confirmation.\n\nIf the device has multiple users, using this shortcut on the lock screen temporarily enables accessibility until the device is unlocked.</string>
+ <string name="accessibility_global_gesture_preference_description">When this feature is turned on, you can quickly activate accessibility features in two steps:\n\nStep 1: Press and hold the power button until you hear a sound or feel a vibration.\n\nStep 2: Touch and hold two fingers until you hear audio confirmation.\n\nIf the device has multiple users, using this shortcut on the lock screen temporarily enables accessibility until the device is unlocked.</string>
<!-- Title for the accessibility preference to high contrast text. [CHAR LIMIT=35] -->
<string name="accessibility_toggle_high_text_contrast_preference_title">High contrast text</string>
<!-- Title for the accessibility preference to auto update screen magnification. [CHAR LIMIT=35] -->
@@ -5710,7 +5708,6 @@
<string name="keywords_display">screen, touchscreen</string>
<string name="keywords_display_brightness_level">dim screen, touchscreen, battery</string>
<string name="keywords_display_auto_brightness">dim screen, touchscreen, battery</string>
- <string name="keywords_display_night_mode">dark theme, night mode, dim screen, invert brightness</string>
<string name="keywords_display_wallpaper">background, personalize, customize display</string>
<string name="keywords_display_font_size">text size</string>
<string name="keywords_display_cast_screen">project, cast</string>
@@ -6478,7 +6475,7 @@
<string name="domain_urls_summary_one">Open <xliff:g id="domain" example="mail.google.com">%s</xliff:g></string>
<!-- Summary of number of App that can open several domain URLs [CHAR LIMIT=45] -->
- <string name="domain_urls_summary_some">Open <xliff:g id="domain" example="mail.google.com">%s</xliff:g> and related URLs</string>
+ <string name="domain_urls_summary_some">Open <xliff:g id="domain" example="mail.google.com">%s</xliff:g> and other URLs</string>
<!-- Description of settings item that leads to list of all apps with Domain URLs [CHAR LIMIT=NONE] -->
<plurals name="domain_urls_apps_summary">
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 53ac1bb..93b9eb1 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -60,13 +60,6 @@
android:summary="@string/runningservices_settings_summary"
android:fragment="com.android.settings.applications.RunningServices" />
- <DropDownPreference
- android:key="night_mode"
- android:title="@string/night_mode_title"
- android:summary="%s"
- android:entries="@array/night_mode_entries"
- android:entryValues="@array/night_mode_values" />
-
<PreferenceScreen
android:key="convert_to_file_encryption"
android:title="@string/convert_to_file_encryption"
@@ -370,11 +363,6 @@
android:key="force_resizable_activities"
android:title="@string/force_resizable_activities"
android:summary="@string/force_resizable_activities_summary"/>
-
- <SwitchPreference
- android:key="enable_freeform_support"
- android:title="@string/enable_freeform_support"
- android:summary="@string/enable_freeform_support_summary"/>
</PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/fingerprint_enroll_introduction_items.xml b/res/xml/fingerprint_enroll_introduction_items.xml
index 3368843..4cb18a6 100644
--- a/res/xml/fingerprint_enroll_introduction_items.xml
+++ b/res/xml/fingerprint_enroll_introduction_items.xml
@@ -19,13 +19,8 @@
<Item
android:enabled="false"
- android:layout="@layout/suw_items_description"
- android:title="@string/security_settings_fingerprint_enroll_introduction_message" />
-
- <Item
- android:enabled="false"
- android:id="@+id/fingerprint_introduction_message_warning"
- android:layout="@layout/suw_items_description" />
+ android:id="@+id/fingerprint_introduction_message"
+ android:layout="@layout/suw_item_link_description"/>
<Item
android:id="@+id/next_button"
diff --git a/res/xml/security_settings_encryption_interstitial.xml b/res/xml/security_settings_encryption_interstitial.xml
new file mode 100644
index 0000000..6ee6bdd
--- /dev/null
+++ b/res/xml/security_settings_encryption_interstitial.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/lock_settings_picker_title"
+ android:key="lock_settings_picker">
+
+ <Preference
+ android:key="encrypt_require_password"
+ android:persistent="false"/>
+
+ <Preference
+ android:key="encrypt_dont_require_password"
+ android:persistent="false"/>
+
+</PreferenceScreen>
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 943a4e6..79ea0cb 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -178,7 +178,6 @@
private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
private static final String KEY_COLOR_MODE = "color_mode";
private static final String FORCE_RESIZABLE_KEY = "force_resizable_activities";
- private static final String ENABLE_FREEFORM_SUPPORT_KEY = "enable_freeform_support";
private static final String COLOR_TEMPERATURE_KEY = "color_temperature";
private static final String BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY =
@@ -202,7 +201,6 @@
private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
- private static final String KEY_NIGHT_MODE = "night_mode";
private static final String KEY_CONVERT_FBE = "convert_to_file_encryption";
private static final String OTA_DISABLE_AUTOMATIC_UPDATE_KEY = "ota_disable_automatic_update";
@@ -292,14 +290,10 @@
private SwitchPreference mShowAllANRs;
- private DropDownPreference mNightModePreference;
-
private ColorModePreference mColorModePreference;
private SwitchPreference mForceResizable;
- private SwitchPreference mEnableFreeformSupport;
-
private SwitchPreference mColorTemperaturePreference;
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
@@ -440,7 +434,6 @@
mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
mUSBAudio = findAndInitSwitchPref(USB_AUDIO_KEY);
mForceResizable = findAndInitSwitchPref(FORCE_RESIZABLE_KEY);
- mEnableFreeformSupport = findAndInitSwitchPref(ENABLE_FREEFORM_SUPPORT_KEY);
mImmediatelyDestroyActivities = (SwitchPreference) findPreference(
IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
@@ -479,27 +472,6 @@
mOtaDisableAutomaticUpdate = findAndInitSwitchPref(OTA_DISABLE_AUTOMATIC_UPDATE_KEY);
- mNightModePreference = (DropDownPreference) findPreference(KEY_NIGHT_MODE);
- final UiModeManager uiManager = (UiModeManager) getSystemService(
- Context.UI_MODE_SERVICE);
- final int currentNightMode = uiManager.getNightMode();
- mNightModePreference.setValue(String.valueOf(currentNightMode));
- mNightModePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- try {
- final int value = Integer.parseInt((String) newValue);
- final UiModeManager uiManager = (UiModeManager) getSystemService(
- Context.UI_MODE_SERVICE);
- uiManager.setNightMode(value);
- return true;
- } catch (NumberFormatException e) {
- Log.e(TAG, "could not persist night mode setting", e);
- return false;
- }
- }
- });
-
mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
mColorModePreference.updateCurrentAndSupported();
if (mColorModePreference.getTransformsCount() < 2) {
@@ -723,7 +695,6 @@
updateSimulateColorSpace();
updateUSBAudioOptions();
updateForceResizableOptions();
- updateEnableFreeformWindowsSupportOptions();
updateWebViewMultiprocessOptions();
updateWebViewProviderOptions();
updateOemUnlockOptions();
@@ -1377,17 +1348,6 @@
mForceResizable.isChecked() ? 1 : 0);
}
- private void updateEnableFreeformWindowsSupportOptions() {
- updateSwitchPreference(mEnableFreeformSupport, Settings.Global.getInt(getContentResolver(),
- Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, 0) != 0);
- }
-
- private void writeEnableFreeformWindowsSupportOptions() {
- Settings.Global.putInt(getContentResolver(),
- Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT,
- mEnableFreeformSupport.isChecked() ? 1 : 0);
- }
-
private void updateForceRtlOptions() {
updateSwitchPreference(mForceRtlLayout,
Settings.Global.getInt(getActivity().getContentResolver(),
@@ -1932,8 +1892,6 @@
writeUSBAudioOptions();
} else if (preference == mForceResizable) {
writeForceResizableOptions();
- } else if (preference == mEnableFreeformSupport){
- writeEnableFreeformWindowsSupportOptions();
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
startInactiveAppsFragment();
} else if (BACKGROUND_CHECK_KEY.equals(preference.getKey())) {
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index b237813..16c5a55 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -22,17 +22,14 @@
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
+import android.support.v7.preference.Preference;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
-import android.widget.Button;
-import android.widget.RadioButton;
import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
@@ -63,10 +60,6 @@
public static Intent createStartIntent(Context ctx, int quality,
boolean requirePasswordDefault, Intent unlockMethodIntent) {
return new Intent(ctx, EncryptionInterstitial.class)
- .putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, true)
- .putExtra(EXTRA_PREFS_SET_BACK_TEXT, (String) null)
- .putExtra(EXTRA_PREFS_SET_NEXT_TEXT, ctx.getString(
- R.string.encryption_continue_button))
.putExtra(EXTRA_PASSWORD_QUALITY, quality)
.putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.encryption_interstitial_header)
.putExtra(EXTRA_REQUIRE_PASSWORD, requirePasswordDefault)
@@ -74,12 +67,15 @@
}
public static class EncryptionInterstitialFragment extends SettingsPreferenceFragment
- implements View.OnClickListener, OnClickListener {
+ implements DialogInterface.OnClickListener {
private static final int ACCESSIBILITY_WARNING_DIALOG = 1;
- private RadioButton mRequirePasswordToDecryptButton;
- private RadioButton mDontRequirePasswordToDecryptButton;
- private TextView mEncryptionMessage;
+ private static final String KEY_ENCRYPT_REQUIRE_PASSWORD = "encrypt_require_password";
+ private static final String KEY_ENCRYPT_DONT_REQUIRE_PASSWORD =
+ "encrypt_dont_require_password";
+
+ private Preference mRequirePasswordToDecrypt;
+ private Preference mDontRequirePasswordToDecrypt;
private boolean mPasswordRequired;
private Intent mUnlockMethodIntent;
@@ -89,20 +85,13 @@
}
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- return inflater.inflate(R.layout.encryption_interstitial, container, false);
- }
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
- mRequirePasswordToDecryptButton =
- (RadioButton) view.findViewById(R.id.encrypt_require_password);
- mDontRequirePasswordToDecryptButton =
- (RadioButton) view.findViewById(R.id.encrypt_dont_require_password);
- mEncryptionMessage =
- (TextView) view.findViewById(R.id.encryption_message);
+ addPreferencesFromResource(R.xml.security_settings_encryption_interstitial);
+
+ mRequirePasswordToDecrypt = findPreference(KEY_ENCRYPT_REQUIRE_PASSWORD);
+ mDontRequirePasswordToDecrypt = findPreference(KEY_ENCRYPT_DONT_REQUIRE_PASSWORD);
boolean forFingerprint = getActivity().getIntent().getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
Intent intent = getActivity().getIntent();
@@ -135,26 +124,22 @@
disableId = R.string.encrypt_dont_require_password;
break;
}
- mEncryptionMessage.setText(msgId);
+ TextView message = createHeaderView();
+ message.setText(msgId);
+ setHeaderView(message);
- mRequirePasswordToDecryptButton.setOnClickListener(this);
- mRequirePasswordToDecryptButton.setText(enableId);
+ mRequirePasswordToDecrypt.setTitle(enableId);
- mDontRequirePasswordToDecryptButton.setOnClickListener(this);
- mDontRequirePasswordToDecryptButton.setText(disableId);
+ mDontRequirePasswordToDecrypt.setTitle(disableId);
setRequirePasswordState(getActivity().getIntent().getBooleanExtra(
EXTRA_REQUIRE_PASSWORD, true));
+ }
- Button nextButton = getNextButton();
- if (nextButton != null) {
- nextButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- startLockIntent();
- }
- });
- }
+ protected TextView createHeaderView() {
+ TextView message = (TextView) LayoutInflater.from(getActivity()).inflate(
+ R.layout.encryption_interstitial_header, null, false);
+ return message;
}
protected void startLockIntent() {
@@ -177,18 +162,22 @@
}
@Override
- public void onClick(View v) {
- if (v == mRequirePasswordToDecryptButton) {
+ public boolean onPreferenceTreeClick(Preference preference) {
+ final String key = preference.getKey();
+ if (key.equals(KEY_ENCRYPT_REQUIRE_PASSWORD)) {
final boolean accEn = AccessibilityManager.getInstance(getActivity()).isEnabled();
if (accEn && !mPasswordRequired) {
setRequirePasswordState(false); // clear the UI state
showDialog(ACCESSIBILITY_WARNING_DIALOG);
} else {
setRequirePasswordState(true);
+ startLockIntent();
}
} else {
setRequirePasswordState(false);
+ startLockIntent();
}
+ return true;
}
@Override
@@ -242,14 +231,13 @@
private void setRequirePasswordState(boolean required) {
mPasswordRequired = required;
- mRequirePasswordToDecryptButton.setChecked(required);
- mDontRequirePasswordToDecryptButton.setChecked(!required);
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
setRequirePasswordState(true);
+ startLockIntent();
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
setRequirePasswordState(false);
}
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 49d72b4..e871c82 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -242,9 +242,18 @@
protected void setHeaderView(int resource) {
mHeader = new LayoutPreference(getPrefContext(), resource);
- mHeader.setOrder(ORDER_FIRST);
+ addPreferenceToTop(mHeader);
+ }
+
+ protected void setHeaderView(View view) {
+ mHeader = new LayoutPreference(getPrefContext(), view);
+ addPreferenceToTop(mHeader);
+ }
+
+ private void addPreferenceToTop(LayoutPreference preference) {
+ preference.setOrder(ORDER_FIRST);
if (getPreferenceScreen() != null) {
- getPreferenceScreen().addPreference(mHeader);
+ getPreferenceScreen().addPreference(preference);
}
}
diff --git a/src/com/android/settings/SetupChooseLockPattern.java b/src/com/android/settings/SetupChooseLockPattern.java
index 69e60be..3a548bc 100644
--- a/src/com/android/settings/SetupChooseLockPattern.java
+++ b/src/com/android/settings/SetupChooseLockPattern.java
@@ -136,6 +136,20 @@
super.updateStage(stage);
// Only enable the button for retry
mRetryButton.setEnabled(stage == Stage.FirstChoiceValid);
+
+ switch (stage) {
+ case Introduction:
+ case HelpScreen:
+ case ChoiceTooShort:
+ case FirstChoiceValid:
+ mRetryButton.setVisibility(View.VISIBLE);
+ break;
+ case NeedToConfirm:
+ case ConfirmWrong:
+ case ChoiceConfirmed:
+ mRetryButton.setVisibility(View.INVISIBLE);
+ break;
+ }
}
@Override
diff --git a/src/com/android/settings/SetupEncryptionInterstitial.java b/src/com/android/settings/SetupEncryptionInterstitial.java
index 8d061ec..dfb32a6 100644
--- a/src/com/android/settings/SetupEncryptionInterstitial.java
+++ b/src/com/android/settings/SetupEncryptionInterstitial.java
@@ -21,11 +21,15 @@
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
+import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
import com.android.setupwizardlib.SetupWizardLayout;
+import com.android.setupwizardlib.SetupWizardPreferenceLayout;
import com.android.setupwizardlib.view.NavigationBar;
/**
@@ -70,26 +74,44 @@
implements NavigationBar.NavigationBarListener {
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- return inflater.inflate(R.layout.setup_encryption_interstitial, container, false);
- }
-
- @Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- final SetupWizardLayout layout =
- (SetupWizardLayout) view.findViewById(R.id.setup_wizard_layout);
+ final SetupWizardPreferenceLayout layout = (SetupWizardPreferenceLayout) view;
+ layout.setDividerInset(getContext().getResources().getDimensionPixelSize(
+ R.dimen.suw_items_text_divider_inset));
+ layout.setIllustration(R.drawable.setup_illustration_lock_screen,
+ R.drawable.setup_illustration_horizontal_tile);
final NavigationBar navigationBar = layout.getNavigationBar();
navigationBar.setNavigationBarListener(this);
+ Button nextButton = navigationBar.getNextButton();
+ nextButton.setText(null);
+ nextButton.setEnabled(false);
+ layout.setHeaderText(R.string.encryption_interstitial_header);
Activity activity = getActivity();
if (activity != null) {
- activity.setTitle(R.string.encryption_interstitial_header);
SetupWizardUtils.setImmersiveMode(activity);
}
+
+ // Use the dividers in SetupWizardRecyclerLayout. Suppress the dividers in
+ // PreferenceFragment.
+ setDivider(null);
+ }
+
+ @Override
+ protected TextView createHeaderView() {
+ TextView message = (TextView) LayoutInflater.from(getActivity()).inflate(
+ R.layout.setup_encryption_interstitial_header, null, false);
+ return message;
+ }
+
+ @Override
+ public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
+ Bundle savedInstanceState) {
+ SetupWizardPreferenceLayout layout = (SetupWizardPreferenceLayout) parent;
+ return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
}
@Override
@@ -102,7 +124,7 @@
@Override
public void onNavigateNext() {
- startLockIntent();
+ // next is handled via the onPreferenceTreeClick method in EncryptionInterstitial
}
}
}
diff --git a/src/com/android/settings/datausage/BillingCyclePreference.java b/src/com/android/settings/datausage/BillingCyclePreference.java
index 84eaabb..44312b7 100644
--- a/src/com/android/settings/datausage/BillingCyclePreference.java
+++ b/src/com/android/settings/datausage/BillingCyclePreference.java
@@ -14,10 +14,8 @@
package com.android.settings.datausage;
-import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import android.content.IntentFilter;
import android.net.NetworkPolicy;
import android.net.NetworkTemplate;
import android.os.Bundle;
@@ -26,6 +24,7 @@
import android.util.AttributeSet;
import com.android.settings.R;
import com.android.settings.Utils;
+import com.android.settings.datausage.CellDataPreference.DataStateListener;
public class BillingCyclePreference extends Preference implements TemplatePreference {
@@ -41,13 +40,12 @@
@Override
public void onAttached() {
super.onAttached();
- getContext().registerReceiver(mReceiver, new IntentFilter(
- CellDataPreference.ACTION_DATA_ENABLED_CHANGED));
+ mListener.setListener(true, mSubId, getContext());
}
@Override
public void onDetached() {
- getContext().unregisterReceiver(mReceiver);
+ mListener.setListener(false, mSubId, getContext());
super.onDetached();
}
@@ -81,9 +79,9 @@
args, null, 0, getTitle(), false);
}
- private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ private final DataStateListener mListener = new DataStateListener() {
@Override
- public void onReceive(Context context, Intent intent) {
+ public void onChange(boolean selfChange) {
updateEnabled();
}
};
diff --git a/src/com/android/settings/datausage/CellDataPreference.java b/src/com/android/settings/datausage/CellDataPreference.java
index d64bef4..5e651e4 100644
--- a/src/com/android/settings/datausage/CellDataPreference.java
+++ b/src/com/android/settings/datausage/CellDataPreference.java
@@ -15,14 +15,16 @@
package com.android.settings.datausage;
import android.app.AlertDialog;
-import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
+import android.database.ContentObserver;
import android.net.NetworkTemplate;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
import android.os.Parcel;
import android.os.Parcelable;
+import android.provider.Settings.Global;
import android.support.v7.preference.PreferenceViewHolder;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -31,7 +33,6 @@
import android.util.Log;
import android.view.View;
import android.widget.Checkable;
-
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.CustomDialogPreference;
@@ -42,10 +43,6 @@
public class CellDataPreference extends CustomDialogPreference implements TemplatePreference {
- // TODO: Get Telephony to broadcast when this changes, and remove this.
- static final String ACTION_DATA_ENABLED_CHANGED =
- "com.android.settings.action.DATA_ENABLED_CHANGED";
-
private static final String TAG = "CellDataPreference";
public int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -84,12 +81,12 @@
@Override
public void onAttached() {
super.onAttached();
- getContext().registerReceiver(mReceiver, new IntentFilter(ACTION_DATA_ENABLED_CHANGED));
+ mListener.setListener(true, mSubId, getContext());
}
@Override
public void onDetached() {
- getContext().unregisterReceiver(mReceiver);
+ mListener.setListener(false, mSubId, getContext());
super.onDetached();
}
@@ -98,6 +95,7 @@
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
throw new IllegalArgumentException("CellDataPreference needs a SubscriptionInfo");
}
+ mSubscriptionManager = SubscriptionManager.from(getContext());
mTelephonyManager = TelephonyManager.from(getContext());
if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
mSubId = subId;
@@ -114,6 +112,22 @@
protected void performClick(View view) {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_CELL_DATA_TOGGLE, !mChecked);
if (mChecked) {
+ final SubscriptionInfo currentSir = mSubscriptionManager.getActiveSubscriptionInfo(
+ mSubId);
+ final SubscriptionInfo nextSir = mSubscriptionManager.getDefaultDataSubscriptionInfo();
+
+ // If the device is single SIM or is enabling data on the active data SIM then forgo
+ // the pop-up.
+ if (!Utils.showSimCardTile(getContext()) ||
+ (nextSir != null && currentSir != null &&
+ currentSir.getSubscriptionId() == nextSir.getSubscriptionId())) {
+ setMobileDataEnabled(true);
+ if (nextSir != null && currentSir != null &&
+ currentSir.getSubscriptionId() == nextSir.getSubscriptionId()) {
+ disableDataForOtherSubscriptions(mSubId);
+ }
+ return;
+ }
// disabling data; show confirmation dialog which eventually
// calls setMobileDataEnabled() once user confirms.
mMultiSimDialog = false;
@@ -130,10 +144,10 @@
}
private void setMobileDataEnabled(boolean enabled) {
- if (DataUsageSummary.LOGD) Log.d(TAG, "setMobileDataEnabled()");
+ if (DataUsageSummary.LOGD) Log.d(TAG, "setMobileDataEnabled(" + enabled + ","
+ + mSubId + ")");
mTelephonyManager.setDataEnabled(mSubId, enabled);
setChecked(enabled);
- getContext().sendBroadcast(new Intent(ACTION_DATA_ENABLED_CHANGED));
}
private void setChecked(boolean checked) {
@@ -170,24 +184,9 @@
private void showMultiSimDialog(AlertDialog.Builder builder,
DialogInterface.OnClickListener listener) {
- mSubscriptionManager = SubscriptionManager.from(getContext());
final SubscriptionInfo currentSir = mSubscriptionManager.getActiveSubscriptionInfo(mSubId);
-
final SubscriptionInfo nextSir = mSubscriptionManager.getDefaultDataSubscriptionInfo();
- // If the device is single SIM or is enabling data on the active data SIM then forgo
- // the pop-up.
- if (!Utils.showSimCardTile(getContext()) ||
- (nextSir != null && currentSir != null &&
- currentSir.getSubscriptionId() == nextSir.getSubscriptionId())) {
- setMobileDataEnabled(true);
- if (nextSir != null && currentSir != null &&
- currentSir.getSubscriptionId() == nextSir.getSubscriptionId()) {
- disableDataForOtherSubscriptions(mSubId);
- }
- return;
- }
-
final String previousName = (nextSir == null)
? getContext().getResources().getString(R.string.sim_selection_required_pref)
: nextSir.getDisplayName().toString();
@@ -197,17 +196,8 @@
String.valueOf(currentSir != null ? currentSir.getDisplayName() : null),
previousName));
- builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- mSubscriptionManager.setDefaultDataSubId(mSubId);
- setMobileDataEnabled(true);
- disableDataForOtherSubscriptions(mSubId);
- }
- });
+ builder.setPositiveButton(R.string.okay, listener);
builder.setNegativeButton(R.string.cancel, null);
-
- builder.create().show();
}
private void disableDataForOtherSubscriptions(int subId) {
@@ -219,7 +209,6 @@
}
}
}
- getContext().sendBroadcast(new Intent(ACTION_DATA_ENABLED_CHANGED));
}
@Override
@@ -228,19 +217,40 @@
return;
}
if (mMultiSimDialog) {
+ mSubscriptionManager.setDefaultDataSubId(mSubId);
+ setMobileDataEnabled(true);
+ disableDataForOtherSubscriptions(mSubId);
} else {
// TODO: extend to modify policy enabled flag.
setMobileDataEnabled(false);
}
}
- private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ private final DataStateListener mListener = new DataStateListener() {
@Override
- public void onReceive(Context context, Intent intent) {
+ public void onChange(boolean selfChange) {
updateChecked();
}
};
+ public abstract static class DataStateListener extends ContentObserver {
+ public DataStateListener() {
+ super(new Handler(Looper.getMainLooper()));
+ }
+
+ public void setListener(boolean listening, int subId, Context context) {
+ if (listening) {
+ Uri uri = Global.getUriFor(Global.MOBILE_DATA);
+ if (TelephonyManager.getDefault().getSimCount() != 1) {
+ uri = Global.getUriFor(Global.MOBILE_DATA + subId);
+ }
+ context.getContentResolver().registerContentObserver(uri, false, this);
+ } else {
+ context.getContentResolver().unregisterContentObserver(this);
+ }
+ }
+ }
+
public static class CellDataState extends BaseSavedState {
public int mSubId;
public boolean mChecked;
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
index bedeb30..2fe255e 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
@@ -66,9 +66,9 @@
(SetupWizardItemsLayout) findViewById(R.id.setup_wizard_layout);
layout.getListView().setOnItemClickListener(this);
final ItemAdapter adapter = (ItemAdapter) layout.getAdapter();
- Item item = (Item) adapter.findItemById(R.id.fingerprint_introduction_message_warning);
+ Item item = (Item) adapter.findItemById(R.id.fingerprint_introduction_message);
item.setTitle(LearnMoreSpan.linkify(
- getText(R.string.security_settings_fingerprint_enroll_introduction_message_warning),
+ getText(R.string.security_settings_fingerprint_enroll_introduction_message),
getString(R.string.help_url_fingerprint)));
updatePasswordQuality();
}