Merge "Make Location Settings multiprofile aware" into lmp-mr1-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 86dada9..89d696d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -352,7 +352,7 @@
</activity>
<activity android:name=".EnableWifiTether"
- android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
+ android:theme="@style/Transparent"
android:excludeFromRecents="true" />
<activity android:name="Settings$TetherSettingsActivity"
@@ -1143,7 +1143,7 @@
<activity android:name="SetupChooseLockGeneric"
android:taskAffinity="com.android.wizard"
android:theme="@style/SetupWizardDisableAppStartingTheme"
- android:label="@string/lockpassword_choose_lock_generic_header">
+ android:label="@string/lock_settings_picker_title">
<intent-filter>
<action android:name="com.android.settings.SETUP_LOCK_SCREEN" />
<category android:name="android.intent.category.DEFAULT" />
@@ -2042,7 +2042,6 @@
android:label="@string/sim_settings_title">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
diff --git a/res/drawable-hdpi/setup_illustration_lock_screen.jpg b/res/drawable-hdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..db697a0
--- /dev/null
+++ b/res/drawable-hdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-hdpi/setup_illustration_wifi.jpg b/res/drawable-hdpi/setup_illustration_wifi.jpg
new file mode 100644
index 0000000..d38551e
--- /dev/null
+++ b/res/drawable-hdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-mdpi/setup_illustration_lock_screen.jpg b/res/drawable-mdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..95e2b8c
--- /dev/null
+++ b/res/drawable-mdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-mdpi/setup_illustration_wifi.jpg b/res/drawable-mdpi/setup_illustration_wifi.jpg
new file mode 100644
index 0000000..a497bf5
--- /dev/null
+++ b/res/drawable-mdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/setup_illustration_lock_screen.jpg b/res/drawable-sw600dp-hdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..03cd9d9
--- /dev/null
+++ b/res/drawable-sw600dp-hdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-hdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-sw600dp-hdpi/setup_illustration_wifi.jpg
similarity index 100%
rename from res/drawable-hdpi/setup_illustration_wifi_wide_image.jpg
rename to res/drawable-sw600dp-hdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/setup_illustration_lock_screen.jpg b/res/drawable-sw600dp-mdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..4a7ab38
--- /dev/null
+++ b/res/drawable-sw600dp-mdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-mdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-sw600dp-mdpi/setup_illustration_wifi.jpg
similarity index 100%
rename from res/drawable-mdpi/setup_illustration_wifi_wide_image.jpg
rename to res/drawable-sw600dp-mdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-xhdpi/setup_illustration_lock_screen.jpg b/res/drawable-sw600dp-xhdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..05f7725
--- /dev/null
+++ b/res/drawable-sw600dp-xhdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-xhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-sw600dp-xhdpi/setup_illustration_wifi.jpg
similarity index 100%
rename from res/drawable-xhdpi/setup_illustration_wifi_wide_image.jpg
rename to res/drawable-sw600dp-xhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-xxhdpi/setup_illustration_lock_screen.jpg b/res/drawable-sw600dp-xxhdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..da3f7d9
--- /dev/null
+++ b/res/drawable-sw600dp-xxhdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-xxhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-sw600dp-xxhdpi/setup_illustration_wifi.jpg
similarity index 100%
rename from res/drawable-xxhdpi/setup_illustration_wifi_wide_image.jpg
rename to res/drawable-sw600dp-xxhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-xxxhdpi/setup_illustration_lock_screen.jpg b/res/drawable-sw600dp-xxxhdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..fd5da99
--- /dev/null
+++ b/res/drawable-sw600dp-xxxhdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-xxxhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-sw600dp-xxxhdpi/setup_illustration_wifi.jpg
similarity index 100%
rename from res/drawable-xxxhdpi/setup_illustration_wifi_wide_image.jpg
rename to res/drawable-sw600dp-xxxhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-sw600dp/setup_illustration.xml b/res/drawable-sw600dp/setup_illustration.xml
new file mode 100644
index 0000000..c0e54e2
--- /dev/null
+++ b/res/drawable-sw600dp/setup_illustration.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+ android:autoMirrored="true">
+
+ <item>
+ <bitmap android:src="@drawable/setup_illustration_horizontal_tile"
+ android:gravity="top"
+ android:tileModeX="repeat"
+ android:tileModeY="disabled" />
+ </item>
+
+ <item android:id="@+id/illustration_image">
+ <bitmap android:src="@drawable/setup_illustration_wifi"
+ android:gravity="top|start" />
+ </item>
+
+</layer-list>
diff --git a/res/drawable-xhdpi/setup_illustration_lock_screen.jpg b/res/drawable-xhdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..b6b856e
--- /dev/null
+++ b/res/drawable-xhdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-xhdpi/setup_illustration_wifi.jpg b/res/drawable-xhdpi/setup_illustration_wifi.jpg
new file mode 100644
index 0000000..a399c19
--- /dev/null
+++ b/res/drawable-xhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-xxhdpi/setup_illustration_lock_screen.jpg b/res/drawable-xxhdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..4cb0c63
--- /dev/null
+++ b/res/drawable-xxhdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-nodpi/setup_illustration_wifi_image.jpg b/res/drawable-xxhdpi/setup_illustration_wifi.jpg
similarity index 100%
rename from res/drawable-nodpi/setup_illustration_wifi_image.jpg
rename to res/drawable-xxhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-xxxhdpi/setup_illustration_lock_screen.jpg b/res/drawable-xxxhdpi/setup_illustration_lock_screen.jpg
new file mode 100644
index 0000000..13821f3
--- /dev/null
+++ b/res/drawable-xxxhdpi/setup_illustration_lock_screen.jpg
Binary files differ
diff --git a/res/drawable-xxxhdpi/setup_illustration_wifi.jpg b/res/drawable-xxxhdpi/setup_illustration_wifi.jpg
new file mode 100644
index 0000000..56c19b6
--- /dev/null
+++ b/res/drawable-xxxhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable/setup_illustration_wifi_wide.xml b/res/drawable/setup_illustration.xml
similarity index 71%
rename from res/drawable/setup_illustration_wifi_wide.xml
rename to res/drawable/setup_illustration.xml
index 33ee2f6..f8d96d5 100644
--- a/res/drawable/setup_illustration_wifi_wide.xml
+++ b/res/drawable/setup_illustration.xml
@@ -18,16 +18,9 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:autoMirrored="true">
- <item>
- <bitmap android:src="@drawable/setup_illustration_horizontal_tile"
- android:gravity="top"
- android:tileModeX="repeat"
- android:tileModeY="disabled" />
- </item>
-
<item android:id="@+id/illustration_image">
- <bitmap android:src="@drawable/setup_illustration_wifi_wide_image"
- android:gravity="top|start" />
+ <bitmap android:src="@drawable/setup_illustration_wifi"
+ android:gravity="fill" />
</item>
-</layer-list>
\ No newline at end of file
+</layer-list>
diff --git a/res/drawable/setup_illustration_wifi.xml b/res/drawable/setup_illustration_wifi.xml
deleted file mode 100644
index 9db2f13..0000000
--- a/res/drawable/setup_illustration_wifi.xml
+++ /dev/null
@@ -1,20 +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.
--->
-
-<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
- android:autoMirrored="true"
- android:src="@drawable/setup_illustration_wifi_image" />
diff --git a/res/layout-sw600dp-land/setup_preference.xml b/res/layout-sw600dp-land/setup_preference.xml
index 431ac29..814bc91 100644
--- a/res/layout-sw600dp-land/setup_preference.xml
+++ b/res/layout-sw600dp-land/setup_preference.xml
@@ -22,10 +22,11 @@
android:orientation="vertical">
<com.android.settings.widget.SetupWizardIllustration
+ android:id="@+id/setup_illustration"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
- android:foreground="@drawable/setup_illustration_wifi_wide"
+ android:foreground="@drawable/setup_illustration"
android:background="@drawable/setup_illustration_bg">
<LinearLayout
diff --git a/res/layout-sw600dp-land/setup_template.xml b/res/layout-sw600dp-land/setup_template.xml
index 33c31a5..a58dd3d 100644
--- a/res/layout-sw600dp-land/setup_template.xml
+++ b/res/layout-sw600dp-land/setup_template.xml
@@ -21,12 +21,12 @@
android:orientation="vertical">
<com.android.settings.widget.SetupWizardIllustration
- android:id="@+id/illustration_tablet"
+ android:id="@+id/setup_illustration"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/setup_illustration_bg"
- android:foreground="@drawable/setup_illustration_wifi_wide">
+ android:foreground="@drawable/setup_illustration">
<LinearLayout
android:layout_width="match_parent"
diff --git a/res/layout-sw600dp/setup_preference.xml b/res/layout-sw600dp/setup_preference.xml
index 1e772d9..ec6d2ac 100644
--- a/res/layout-sw600dp/setup_preference.xml
+++ b/res/layout-sw600dp/setup_preference.xml
@@ -21,12 +21,12 @@
android:orientation="vertical">
<com.android.settings.widget.SetupWizardIllustration
- android:id="@+id/title_area"
+ android:id="@+id/setup_illustration"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/setup_illustration_bg"
- android:foreground="@drawable/setup_illustration_wifi_wide">
+ android:foreground="@drawable/setup_illustration">
<LinearLayout
android:layout_width="match_parent"
diff --git a/res/layout-sw600dp/setup_template.xml b/res/layout-sw600dp/setup_template.xml
index eb210b7..297e9fb 100644
--- a/res/layout-sw600dp/setup_template.xml
+++ b/res/layout-sw600dp/setup_template.xml
@@ -21,12 +21,12 @@
android:orientation="vertical">
<com.android.settings.widget.SetupWizardIllustration
- android:id="@+id/illustration_tablet"
+ android:id="@+id/setup_illustration"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/setup_illustration_bg"
- android:foreground="@drawable/setup_illustration_wifi_wide">
+ android:foreground="@drawable/setup_illustration">
<LinearLayout
android:layout_width="match_parent"
diff --git a/res/layout/setup_choose_lock_password.xml b/res/layout/setup_choose_lock_password.xml
index b1ac02b..59fa523 100644
--- a/res/layout/setup_choose_lock_password.xml
+++ b/res/layout/setup_choose_lock_password.xml
@@ -38,7 +38,7 @@
android:layout_marginEnd="30dip"
android:gravity="center"
android:inputType="textPassword"
- android:imeOptions="actionNext"
+ android:imeOptions="actionNext|flagNoExtractUi"
android:textSize="24sp"
style="@style/TextAppearance.PasswordEntry"/>
@@ -52,6 +52,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
+ android:visibility="gone"
style="@style/SecurityPreferenceButtonContainer">
<!-- left : cancel -->
diff --git a/res/layout/setup_choose_lock_pattern.xml b/res/layout/setup_choose_lock_pattern.xml
index 5992126..a906826 100644
--- a/res/layout/setup_choose_lock_pattern.xml
+++ b/res/layout/setup_choose_lock_pattern.xml
@@ -44,11 +44,22 @@
android:layout_weight="4"
android:background="@color/lock_pattern_background"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal">
+
+ <Button android:id="@+id/retryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lockpattern_retry_button_text"/>
+
<TextView android:id="@+id/footerText"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:gravity="center"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:minHeight="50dp"
android:textSize="14sp"/>
@@ -59,6 +70,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
+ android:visibility="gone"
style="@style/SecurityPreferenceButtonContainer">
<!-- left : cancel, or re-try -->
diff --git a/res/layout/setup_template.xml b/res/layout/setup_template.xml
index 7d8ffc8..0623e25 100644
--- a/res/layout/setup_template.xml
+++ b/res/layout/setup_template.xml
@@ -35,12 +35,12 @@
android:clipChildren="false">
<com.android.settings.widget.SetupWizardIllustration
- android:id="@+id/illustration_phone"
+ android:id="@+id/setup_illustration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="@dimen/setup_wizard_title_area_elevation"
android:background="@drawable/setup_illustration_bg"
- android:foreground="@drawable/setup_illustration_wifi"
+ android:foreground="@drawable/setup_illustration"
android:tag="stickyContainer"
settings:aspectRatio="2.22">
@@ -58,7 +58,7 @@
android:id="@+id/setup_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/illustration_phone"
+ android:layout_below="@id/setup_illustration"
android:clipChildren="false"/>
</RelativeLayout>
diff --git a/res/layout/setup_wizard_header.xml b/res/layout/setup_wizard_header.xml
index c38a68d..b030ad1 100644
--- a/res/layout/setup_wizard_header.xml
+++ b/res/layout/setup_wizard_header.xml
@@ -18,12 +18,12 @@
<com.android.settings.widget.SetupWizardIllustration
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
- android:id="@+id/title_area"
+ android:id="@+id/setup_illustration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/setup_illustration_bg"
android:elevation="@dimen/setup_wizard_title_area_elevation"
- android:foreground="@drawable/setup_illustration_wifi"
+ android:foreground="@drawable/setup_illustration"
android:tag="stickyContainer"
settings:aspectRatio="2.22">
diff --git a/res/values/colors.xml b/res/values/colors.xml
index a5abbbe..70fc4a0 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -40,6 +40,12 @@
<color name="title_color">@android:color/holo_blue_light</color>
<color name="setup_divider_color_dark">#33ffffff</color>
<color name="setup_divider_color_light">#33000000</color>
+ <color name="setup_lock_pattern_view_regular_color_dark">#ffbdbdbd</color>
+ <color name="setup_lock_pattern_view_regular_color_light">@color/lock_pattern_view_regular_color</color>
+ <color name="setup_lock_pattern_view_success_color_dark">#ff84ffff</color>
+ <color name="setup_lock_pattern_view_success_color_light">@color/setup_wizard_color_accent_light</color>
+ <color name="setup_lock_pattern_view_error_color_dark">#fff44336</color>
+ <color name="setup_lock_pattern_view_error_color_light">@color/lock_pattern_view_error_color</color>
<color name="setup_wizard_color_accent_dark">#ff00e4ff</color>
<color name="setup_wizard_color_accent_light">#ff00828e</color>
<color name="setup_wizard_wifi_color_dark">#ff00e4ff</color>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3e115ad..74062ae 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5573,7 +5573,7 @@
<!-- This is a divider in the SIM cards preferences that is the header of various settings where the user chooses which SIM to use for phone calls, data, and SMS messages [CHAR LIMIT=50] -->
<string name="sim_pref_divider">Preferred SIM for</string>
<!-- When a user chooses this "Ask first" preference for the SIM to use for phone calls, they'll be prompted to choose a SIM every time they initiate a call [CHAR LIMIT=50] -->
- <string name="sim_calls_ask_first_prefs_title">Ask everytime</string>
+ <string name="sim_calls_ask_first_prefs_title">Ask every time</string>
<!-- When a SIM preference hasn't been selected yet, this string is displayed as the pref summary until the user chooses a SIM subscription from the preference list [CHAR LIMIT=50] -->
<string name="sim_selection_required_pref">Selection required</string>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index b426c00..f7aeb15 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -46,6 +46,11 @@
<item name="wifi_signal_color">@color/setup_wizard_wifi_color_dark</item>
<item name="wifi_signal">@drawable/wifi_signal_teal</item>
<item name="preferenceBackgroundColor">?android:attr/colorBackground</item>
+
+ <!-- LockPatternView colors -->
+ <item name="@*android:regularColor">@color/setup_lock_pattern_view_regular_color_dark</item>
+ <item name="@*android:successColor">@color/setup_lock_pattern_view_success_color_dark</item>
+ <item name="@*android:errorColor">@color/setup_lock_pattern_view_error_color_dark</item>
</style>
<style name="SetupWizardTheme.Light" parent="android:Theme.Material.Light.NoActionBar">
@@ -65,6 +70,11 @@
<item name="wifi_signal_color">@color/setup_wizard_wifi_color_light</item>
<item name="wifi_signal">@drawable/wifi_signal_teal</item>
<item name="preferenceBackgroundColor">?android:attr/colorBackground</item>
+
+ <!-- LockPatternView colors -->
+ <item name="@*android:regularColor">@color/setup_lock_pattern_view_regular_color_light</item>
+ <item name="@*android:successColor">@color/setup_lock_pattern_view_success_color_light</item>
+ <item name="@*android:errorColor">@color/setup_lock_pattern_view_error_color_light</item>
</style>
<style name="Animation.SetupWizard" parent="@android:style/Animation.Activity">
diff --git a/res/xml/sim_settings.xml b/res/xml/sim_settings.xml
index 45d8225..63e4ba4 100644
--- a/res/xml/sim_settings.xml
+++ b/res/xml/sim_settings.xml
@@ -15,13 +15,10 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="sim_cards"
android:title="@string/sim_settings_title">
<PreferenceCategory
- android:key="sim_cards"
- android:title="@string/sim_settings_title" />
-
- <PreferenceCategory
android:key="sim_activities"
android:title="@string/sim_pref_divider" >
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index f64a9df..b289e7a 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -288,14 +288,30 @@
}
/***
+ * Disables preferences that are less secure than required quality. The actual
+ * implementation is in disableUnusablePreferenceImpl.
+ *
+ * @param quality the requested quality.
+ * @param allowBiometric whether to allow biometic screen lock.
+ */
+ protected void disableUnusablePreferences(final int quality,
+ MutableBoolean allowBiometric) {
+ disableUnusablePreferencesImpl(quality, allowBiometric, false /* hideDisabled */);
+ }
+
+ /***
* Disables preferences that are less secure than required quality.
*
* @param quality the requested quality.
+ * @param allowBiometric whether to allow biometic screen lock.
+ * @param hideDisabled whether to hide disable screen lock options.
*/
- private void disableUnusablePreferences(final int quality, MutableBoolean allowBiometric) {
+ protected void disableUnusablePreferencesImpl(final int quality,
+ MutableBoolean allowBiometric, boolean hideDisabled) {
final PreferenceScreen entries = getPreferenceScreen();
- final boolean onlyShowFallback = getActivity().getIntent()
- .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
+ final Intent intent = getActivity().getIntent();
+ final boolean onlyShowFallback = intent.getBooleanExtra(
+ LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
final boolean weakBiometricAvailable =
mChooseLockSettingsHelper.utils().isBiometricWeakInstalled();
@@ -326,6 +342,9 @@
} else if (KEY_UNLOCK_SET_PASSWORD.equals(key)) {
enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
}
+ if (hideDisabled) {
+ visible = visible && enabled;
+ }
if (!visible || (onlyShowFallback && !allowedForFallback(key))) {
entries.removePreference(pref);
} else if (!enabled) {
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java
index 2c05986..fa1c678 100644
--- a/src/com/android/settings/ChooseLockPassword.java
+++ b/src/com/android/settings/ChooseLockPassword.java
@@ -24,14 +24,12 @@
import android.app.Activity;
import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.inputmethodservice.KeyboardView;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.provider.Settings;
import android.text.Editable;
import android.text.InputType;
import android.text.Selection;
@@ -416,7 +414,7 @@
return null;
}
- private void handleNext() {
+ public void handleNext() {
if (mDone) return;
final String pin = mPasswordEntry.getText().toString();
@@ -460,6 +458,14 @@
}
}
+ protected void setNextEnabled(boolean enabled) {
+ mNextButton.setEnabled(enabled);
+ }
+
+ protected void setNextText(int text) {
+ mNextButton.setText(text);
+ }
+
public void onClick(View v) {
switch (v.getId()) {
case R.id.next_button:
@@ -502,22 +508,22 @@
String msg = getString(mIsAlphaMode ? R.string.lockpassword_password_too_short
: R.string.lockpassword_pin_too_short, mPasswordMinLength);
mHeaderText.setText(msg);
- mNextButton.setEnabled(false);
+ setNextEnabled(false);
} else {
String error = validatePassword(password);
if (error != null) {
mHeaderText.setText(error);
- mNextButton.setEnabled(false);
+ setNextEnabled(false);
} else {
mHeaderText.setText(R.string.lockpassword_press_continue);
- mNextButton.setEnabled(true);
+ setNextEnabled(true);
}
}
} else {
mHeaderText.setText(mIsAlphaMode ? mUiStage.alphaHint : mUiStage.numericHint);
- mNextButton.setEnabled(length > 0);
+ setNextEnabled(length > 0);
}
- mNextButton.setText(mUiStage.buttonText);
+ setNextText(mUiStage.buttonText);
}
public void afterTextChanged(Editable s) {
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index 85694b1..e454ed1 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -150,6 +150,14 @@
}
}
+ protected void setRightButtonEnabled(boolean enabled) {
+ mFooterRightButton.setEnabled(enabled);
+ }
+
+ protected void setRightButtonText(int text) {
+ mFooterRightButton.setText(text);
+ }
+
/**
* The pattern listener that responds according to a user choosing a new
* lock pattern.
@@ -390,43 +398,51 @@
return RedactionInterstitial.createStartIntent(context);
}
+ public void handleLeftButton() {
+ if (mUiStage.leftMode == LeftButtonMode.Retry) {
+ mChosenPattern = null;
+ mLockPatternView.clearPattern();
+ updateStage(Stage.Introduction);
+ } else if (mUiStage.leftMode == LeftButtonMode.Cancel) {
+ // They are canceling the entire wizard
+ getActivity().setResult(RESULT_FINISHED);
+ getActivity().finish();
+ } else {
+ throw new IllegalStateException("left footer button pressed, but stage of " +
+ mUiStage + " doesn't make sense");
+ }
+ }
+
+ public void handleRightButton() {
+ if (mUiStage.rightMode == RightButtonMode.Continue) {
+ if (mUiStage != Stage.FirstChoiceValid) {
+ throw new IllegalStateException("expected ui stage "
+ + Stage.FirstChoiceValid + " when button is "
+ + RightButtonMode.Continue);
+ }
+ updateStage(Stage.NeedToConfirm);
+ } else if (mUiStage.rightMode == RightButtonMode.Confirm) {
+ if (mUiStage != Stage.ChoiceConfirmed) {
+ throw new IllegalStateException("expected ui stage " + Stage.ChoiceConfirmed
+ + " when button is " + RightButtonMode.Confirm);
+ }
+ saveChosenPatternAndFinish();
+ } else if (mUiStage.rightMode == RightButtonMode.Ok) {
+ if (mUiStage != Stage.HelpScreen) {
+ throw new IllegalStateException("Help screen is only mode with ok button, "
+ + "but stage is " + mUiStage);
+ }
+ mLockPatternView.clearPattern();
+ mLockPatternView.setDisplayMode(DisplayMode.Correct);
+ updateStage(Stage.Introduction);
+ }
+ }
+
public void onClick(View v) {
if (v == mFooterLeftButton) {
- if (mUiStage.leftMode == LeftButtonMode.Retry) {
- mChosenPattern = null;
- mLockPatternView.clearPattern();
- updateStage(Stage.Introduction);
- } else if (mUiStage.leftMode == LeftButtonMode.Cancel) {
- // They are canceling the entire wizard
- getActivity().setResult(RESULT_FINISHED);
- getActivity().finish();
- } else {
- throw new IllegalStateException("left footer button pressed, but stage of " +
- mUiStage + " doesn't make sense");
- }
+ handleLeftButton();
} else if (v == mFooterRightButton) {
-
- if (mUiStage.rightMode == RightButtonMode.Continue) {
- if (mUiStage != Stage.FirstChoiceValid) {
- throw new IllegalStateException("expected ui stage " + Stage.FirstChoiceValid
- + " when button is " + RightButtonMode.Continue);
- }
- updateStage(Stage.NeedToConfirm);
- } else if (mUiStage.rightMode == RightButtonMode.Confirm) {
- if (mUiStage != Stage.ChoiceConfirmed) {
- throw new IllegalStateException("expected ui stage " + Stage.ChoiceConfirmed
- + " when button is " + RightButtonMode.Confirm);
- }
- saveChosenPatternAndFinish();
- } else if (mUiStage.rightMode == RightButtonMode.Ok) {
- if (mUiStage != Stage.HelpScreen) {
- throw new IllegalStateException("Help screen is only mode with ok button, but " +
- "stage is " + mUiStage);
- }
- mLockPatternView.clearPattern();
- mLockPatternView.setDisplayMode(DisplayMode.Correct);
- updateStage(Stage.Introduction);
- }
+ handleRightButton();
}
}
@@ -489,8 +505,8 @@
mFooterLeftButton.setEnabled(stage.leftMode.enabled);
}
- mFooterRightButton.setText(stage.rightMode.text);
- mFooterRightButton.setEnabled(stage.rightMode.enabled);
+ setRightButtonText(stage.rightMode.text);
+ setRightButtonEnabled(stage.rightMode.enabled);
// same for whether the patten is enabled
if (stage.patternEnabled) {
@@ -555,8 +571,8 @@
final boolean required = getActivity().getIntent().getBooleanExtra(
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
utils.setCredentialRequiredToDecrypt(required);
- utils.saveLockPattern(mChosenPattern, isFallback);
utils.setLockPatternEnabled(true);
+ utils.saveLockPattern(mChosenPattern, isFallback);
if (lockVirgin) {
utils.setVisiblePatternEnabled(true);
diff --git a/src/com/android/settings/DeviceAdminSettings.java b/src/com/android/settings/DeviceAdminSettings.java
index bc22637..334d18f 100644
--- a/src/com/android/settings/DeviceAdminSettings.java
+++ b/src/com/android/settings/DeviceAdminSettings.java
@@ -16,7 +16,6 @@
package com.android.settings;
-import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.app.Activity;
@@ -25,9 +24,11 @@
import android.app.admin.DeviceAdminInfo;
import android.app.admin.DeviceAdminReceiver;
import android.app.admin.DevicePolicyManager;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
@@ -49,14 +50,13 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import java.util.Collection;
public class DeviceAdminSettings extends ListFragment {
static final String TAG = "DeviceAdminSettings";
- static final int DIALOG_WARNING = 1;
private DevicePolicyManager mDPM;
private UserManager mUm;
@@ -70,6 +70,18 @@
private String mDeviceOwnerPkg;
private SparseArray<ComponentName> mProfileOwnerComponents = new SparseArray<ComponentName>();
+ private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // Refresh the list, if state change has been received. It could be that checkboxes
+ // need to be updated
+ if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED.equals(
+ intent.getAction())) {
+ updateList();
+ }
+ }
+ };
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -93,6 +105,10 @@
@Override
public void onResume() {
super.onResume();
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
+ getActivity().registerReceiverAsUser(
+ mBroadcastReceiver, UserHandle.ALL, filter, null, null);
mDeviceOwnerPkg = mDPM.getDeviceOwner();
if (mDeviceOwnerPkg != null && !mDPM.isDeviceOwner(mDeviceOwnerPkg)) {
mDeviceOwnerPkg = null;
@@ -107,6 +123,12 @@
updateList();
}
+ @Override
+ public void onPause() {
+ getActivity().unregisterReceiver(mBroadcastReceiver);
+ super.onPause();
+ }
+
/**
* Update the internal collection of available admins for all profiles associated with the
* current user.
@@ -264,6 +286,10 @@
&& (isDeviceOwner(info) || isProfileOwner(info))) {
return false;
}
+ // Disable item if admin is being removed
+ if (isRemovingAdmin(info)) {
+ return false;
+ }
return true;
}
@@ -340,6 +366,10 @@
return mDPM.isAdminActiveAsUser(item.getComponent(), getUserId(item));
}
+ private boolean isRemovingAdmin(DeviceAdminInfo item) {
+ return mDPM.isRemovingAdmin(item.getComponent(), getUserId(item));
+ }
+
/**
* Add device admins to the internal collection that belong to a profile.
*
diff --git a/src/com/android/settings/EnableWifiTether.java b/src/com/android/settings/EnableWifiTether.java
index a67250d..329d92e 100644
--- a/src/com/android/settings/EnableWifiTether.java
+++ b/src/com/android/settings/EnableWifiTether.java
@@ -38,31 +38,16 @@
super.onCreate(icicle);
mProvisionApp = getResources().getStringArray(
com.android.internal.R.array.config_mobile_hotspot_provision_app);
- setContentView(R.layout.settings_main_dashboard);
- startProvisioningIfNecessary();
+ startProvisioning();
}
- private static boolean isProvisioningNeeded(String[] provisionApp) {
- if (SystemProperties.getBoolean("net.tethering.noprovisioning", false)
- || provisionApp == null) {
- return false;
- }
- return (provisionApp.length == 2);
- }
-
- private void startProvisioningIfNecessary() {
-
- if (isProvisioningNeeded(mProvisionApp)) {
- Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
- sendBroadcast(closeDialog);
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.setClassName(mProvisionApp[0], mProvisionApp[1]);
- intent.putExtra(TETHER_CHOICE, WIFI_TETHERING);
- startActivityForResult(intent, PROVISION_REQUEST);
- } else {
- enableTethering();
- finish();
- }
+ private void startProvisioning() {
+ Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
+ sendBroadcast(closeDialog);
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.setClassName(mProvisionApp[0], mProvisionApp[1]);
+ intent.putExtra(TETHER_CHOICE, WIFI_TETHERING);
+ startActivityForResult(intent, PROVISION_REQUEST);
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
@@ -72,8 +57,8 @@
if (resultCode == Activity.RESULT_OK) {
enableTethering();
}
+ finish();
}
- finish();
}
private void enableTethering() {
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index 554f848..dfbed77 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -41,7 +41,7 @@
public class EncryptionInterstitial extends SettingsActivity {
- private static final String EXTRA_PASSWORD_QUALITY = "extra_password_quality";
+ protected static final String EXTRA_PASSWORD_QUALITY = "extra_password_quality";
public static final String EXTRA_REQUIRE_PASSWORD = "extra_require_password";
@Override
diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java
index 2894f85..42e2baa 100644
--- a/src/com/android/settings/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/SetupChooseLockGeneric.java
@@ -18,11 +18,13 @@
import com.android.setupwizard.navigationbar.SetupWizardNavBar;
+import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceFragment;
+import android.util.MutableBoolean;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -87,9 +89,32 @@
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
+ SetupWizardUtils.setIllustration(getActivity(),
+ R.drawable.setup_illustration_lock_screen);
SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
}
+ /***
+ * Disables preferences that are less secure than required quality and shows only secure
+ * screen lock options here.
+ *
+ * @param quality the requested quality.
+ * @param allowBiometric whether to allow biometic screen lock
+ */
+ @Override
+ protected void disableUnusablePreferences(final int quality,
+ MutableBoolean allowBiometric) {
+ // At this part of the flow, the user has already indicated they want to add a pin,
+ // pattern or password, so don't show "None" or "Slide". We disable them here and set
+ // the HIDE_DISABLED flag to true to hide them. This only happens for setup wizard.
+ // We do the following max check here since the device may already have a Device Admin
+ // installed with a policy we need to honor.
+ final int newQuality = Math.max(quality,
+ DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
+ super.disableUnusablePreferencesImpl(newQuality, allowBiometric,
+ true /* hideDisabled */);
+ }
+
@Override
protected Intent getLockPasswordIntent(Context context, int quality, boolean isFallback,
int minLength, int maxLength, boolean requirePasswordToDecrypt,
diff --git a/src/com/android/settings/SetupChooseLockPassword.java b/src/com/android/settings/SetupChooseLockPassword.java
index ed6fab4..0c7e57f 100644
--- a/src/com/android/settings/SetupChooseLockPassword.java
+++ b/src/com/android/settings/SetupChooseLockPassword.java
@@ -47,6 +47,9 @@
return intent;
}
+ private SetupWizardNavBar mNavigationBar;
+ private SetupChooseLockPasswordFragment mFragment;
+
@Override
protected boolean isValidFragment(String fragmentName) {
return SetupChooseLockPasswordFragment.class.getName().equals(fragmentName);
@@ -65,6 +68,7 @@
@Override
public void onNavigationBarCreated(SetupWizardNavBar bar) {
+ mNavigationBar = bar;
SetupWizardUtils.setImmersiveMode(this, bar);
}
@@ -75,6 +79,17 @@
@Override
public void onNavigateNext() {
+ if (mFragment != null) {
+ mFragment.handleNext();
+ }
+ }
+
+ @Override
+ public void onAttachFragment(Fragment fragment) {
+ super.onAttachFragment(fragment);
+ if (fragment instanceof SetupChooseLockPasswordFragment) {
+ mFragment = (SetupChooseLockPasswordFragment) fragment;
+ }
}
public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment {
@@ -91,6 +106,8 @@
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
+ SetupWizardUtils.setIllustration(getActivity(),
+ R.drawable.setup_illustration_lock_screen);
SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
}
@@ -100,5 +117,17 @@
SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
return intent;
}
+
+ @Override
+ protected void setNextEnabled(boolean enabled) {
+ SetupChooseLockPassword activity = (SetupChooseLockPassword) getActivity();
+ activity.mNavigationBar.getNextButton().setEnabled(enabled);
+ }
+
+ @Override
+ protected void setNextText(int text) {
+ SetupChooseLockPassword activity = (SetupChooseLockPassword) getActivity();
+ activity.mNavigationBar.getNextButton().setText(text);
+ }
}
}
diff --git a/src/com/android/settings/SetupChooseLockPattern.java b/src/com/android/settings/SetupChooseLockPattern.java
index b44dea1..7f2480b 100644
--- a/src/com/android/settings/SetupChooseLockPattern.java
+++ b/src/com/android/settings/SetupChooseLockPattern.java
@@ -26,6 +26,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
/**
* Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
@@ -45,6 +46,9 @@
return intent;
}
+ private SetupWizardNavBar mNavigationBar;
+ private SetupChooseLockPatternFragment mFragment;
+
@Override
protected boolean isValidFragment(String fragmentName) {
return SetupChooseLockPatternFragment.class.getName().equals(fragmentName);
@@ -63,6 +67,7 @@
@Override
public void onNavigationBarCreated(SetupWizardNavBar bar) {
+ mNavigationBar = bar;
SetupWizardUtils.setImmersiveMode(this, bar);
}
@@ -73,10 +78,23 @@
@Override
public void onNavigateNext() {
+ if (mFragment != null) {
+ mFragment.handleRightButton();
+ }
+ }
+
+ @Override
+ public void onAttachFragment(Fragment fragment) {
+ super.onAttachFragment(fragment);
+ if (fragment instanceof ChooseLockPatternFragment) {
+ mFragment = (SetupChooseLockPatternFragment) fragment;
+ }
}
public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment {
+ private Button mRetryButton;
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -88,7 +106,11 @@
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
+ mRetryButton = (Button) view.findViewById(R.id.retryButton);
+ mRetryButton.setOnClickListener(this);
super.onViewCreated(view, savedInstanceState);
+ SetupWizardUtils.setIllustration(getActivity(),
+ R.drawable.setup_illustration_lock_screen);
SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
}
@@ -98,5 +120,33 @@
SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
return intent;
}
+
+ @Override
+ public void onClick(View v) {
+ if (v == mRetryButton) {
+ handleLeftButton();
+ } else {
+ super.onClick(v);
+ }
+ }
+
+ @Override
+ protected void setRightButtonEnabled(boolean enabled) {
+ SetupChooseLockPattern activity = (SetupChooseLockPattern) getActivity();
+ activity.mNavigationBar.getNextButton().setEnabled(enabled);
+ }
+
+ @Override
+ protected void setRightButtonText(int text) {
+ SetupChooseLockPattern activity = (SetupChooseLockPattern) getActivity();
+ activity.mNavigationBar.getNextButton().setText(text);
+ }
+
+ @Override
+ protected void updateStage(Stage stage) {
+ super.updateStage(stage);
+ // Only enable the button for retry
+ mRetryButton.setEnabled(stage == Stage.FirstChoiceValid);
+ }
}
}
diff --git a/src/com/android/settings/SetupEncryptionInterstitial.java b/src/com/android/settings/SetupEncryptionInterstitial.java
index 53548bd..41782da 100644
--- a/src/com/android/settings/SetupEncryptionInterstitial.java
+++ b/src/com/android/settings/SetupEncryptionInterstitial.java
@@ -18,6 +18,7 @@
import com.android.setupwizard.navigationbar.SetupWizardNavBar;
+import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -93,10 +94,27 @@
return view;
}
+ private int getHeaderTextResource() {
+ final int quality = getActivity().getIntent().getIntExtra(EXTRA_PASSWORD_QUALITY, 0);
+ switch (quality) {
+ case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
+ return R.string.unlock_set_unlock_pattern_title;
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
+ return R.string.unlock_set_unlock_pin_title;
+ default:
+ return R.string.unlock_set_unlock_password_title;
+ }
+ }
+
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- SetupWizardUtils.setHeaderText(getActivity(), R.string.encryption_interstitial_header);
+ SetupWizardUtils.setIllustration(getActivity(),
+ R.drawable.setup_illustration_lock_screen);
+ final int title = getHeaderTextResource();
+ getActivity().setTitle(title);
+ SetupWizardUtils.setHeaderText(getActivity(), title);
}
}
}
diff --git a/src/com/android/settings/SetupRedactionInterstitial.java b/src/com/android/settings/SetupRedactionInterstitial.java
index 96f4dff..453e729 100644
--- a/src/com/android/settings/SetupRedactionInterstitial.java
+++ b/src/com/android/settings/SetupRedactionInterstitial.java
@@ -22,7 +22,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
-import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -96,6 +95,8 @@
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
+ SetupWizardUtils.setIllustration(getActivity(),
+ R.drawable.setup_illustration_lock_screen);
SetupWizardUtils.setHeaderText(getActivity(), R.string.notification_section_header);
}
}
diff --git a/src/com/android/settings/SetupWizardUtils.java b/src/com/android/settings/SetupWizardUtils.java
index 0f54e63..3d44125 100644
--- a/src/com/android/settings/SetupWizardUtils.java
+++ b/src/com/android/settings/SetupWizardUtils.java
@@ -16,12 +16,17 @@
package com.android.settings;
+import com.android.settings.widget.SetupWizardIllustration;
import com.android.setupwizard.navigationbar.SetupWizardNavBar;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+import android.view.Gravity;
import android.view.Window;
import android.widget.TextView;
@@ -109,4 +114,24 @@
toIntent.putExtra(EXTRA_USE_IMMERSIVE_MODE,
fromIntent.getBooleanExtra(EXTRA_USE_IMMERSIVE_MODE, false));
}
+
+ public static void setIllustration(Activity activity, int asset) {
+ SetupWizardIllustration illustration =
+ (SetupWizardIllustration) activity.findViewById(R.id.setup_illustration);
+ if (illustration != null) {
+ Drawable drawable = activity.getDrawable(R.drawable.setup_illustration);
+ Drawable newIllustration = activity.getDrawable(asset);
+ if (drawable instanceof LayerDrawable) {
+ LayerDrawable layers = (LayerDrawable) drawable;
+ Drawable oldIllustration = layers.findDrawableByLayerId(R.id.illustration_image);
+ if (newIllustration instanceof BitmapDrawable
+ && oldIllustration instanceof BitmapDrawable) {
+ final int gravity = ((BitmapDrawable) oldIllustration).getGravity();
+ ((BitmapDrawable) newIllustration).setGravity(gravity);
+ }
+ layers.setDrawableByLayerId(R.id.illustration_image, newIllustration);
+ illustration.setForeground(layers);
+ }
+ }
+ }
}
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index fd8489b..be031ea 100755
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -17,12 +17,14 @@
package com.android.settings.bluetooth;
import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothUuid;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
+import android.os.ParcelUuid;
import android.text.Editable;
import android.text.Html;
import android.text.InputFilter;
@@ -111,6 +113,7 @@
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
mType = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);
+ mDevice.fetchUuidsWithSdp();
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
@@ -318,7 +321,7 @@
}
}
- private void allowPhonebookAccess() {
+ private void processPhonebookAccess() {
CachedBluetoothDevice cachedDevice = mCachedDeviceManager.findDevice(mDevice);
if (cachedDevice == null) {
cachedDevice = mCachedDeviceManager.addDevice(
@@ -326,11 +329,14 @@
mBluetoothManager.getProfileManager(),
mDevice);
}
- cachedDevice.setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED);
+ ParcelUuid[] uuids = mDevice.getUuids();
+ if (BluetoothUuid.containsAnyUuid(uuids, PbapServerProfile.PBAB_CLIENT_UUIDS)) {
+ cachedDevice.setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED);
+ }
}
private void onPair(String value) {
- allowPhonebookAccess();
+ processPhonebookAccess();
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
diff --git a/src/com/android/settings/bluetooth/PbapServerProfile.java b/src/com/android/settings/bluetooth/PbapServerProfile.java
index 87e51a5..6e48b12 100755
--- a/src/com/android/settings/bluetooth/PbapServerProfile.java
+++ b/src/com/android/settings/bluetooth/PbapServerProfile.java
@@ -21,7 +21,9 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothPbap;
import android.bluetooth.BluetoothProfile;
+import android.bluetooth.BluetoothUuid;
import android.content.Context;
+import android.os.ParcelUuid;
import android.util.Log;
import com.android.settings.R;
@@ -44,6 +46,13 @@
// Order of this profile in device profiles list
private static final int ORDINAL = 6;
+ // The UUIDs indicate that remote device might access pbap server
+ static final ParcelUuid[] PBAB_CLIENT_UUIDS = {
+ BluetoothUuid.HSP,
+ BluetoothUuid.Handsfree,
+ BluetoothUuid.PBAP_PCE
+ };
+
// These callbacks run on the main thread.
private final class PbapServiceListener
implements BluetoothPbap.ServiceListener {
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index 2afdb84..2d1da40 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -153,7 +153,7 @@
}
}
- mSir = mSelectableSubInfos.get(0);
+ mSir = mSelectableSubInfos.size() > 0 ? mSelectableSubInfos.get(0) : null;
if (mSelectableSubInfos.size() > 1) {
setContentView(R.layout.sim_information);
@@ -343,7 +343,7 @@
}
}
- String rawNumber = mPhone.getLine1Number(); // may be null or empty
+ String rawNumber = mTelephonyManager.getLine1Number(); // may be null or empty
String formattedNumber = null;
if (!TextUtils.isEmpty(rawNumber)) {
formattedNumber = PhoneNumberUtils.formatNumber(rawNumber);
@@ -353,9 +353,7 @@
final String imei = mPhone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
? mPhone.getImei() : mPhone.getDeviceId();
setSummaryText(KEY_IMEI, imei);
- setSummaryText(KEY_IMEI_SV,
- ((TelephonyManager) getSystemService(TELEPHONY_SERVICE))
- .getDeviceSoftwareVersion(/*slotId*/));
+ setSummaryText(KEY_IMEI_SV, mTelephonyManager.getDeviceSoftwareVersion(/*slotId*/));
if (!mShowLatestAreaInfo) {
removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
@@ -363,33 +361,35 @@
}
private void updatePhoneInfos() {
- final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(
+ if (mSir != null) {
+ final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(
mSir.getSubscriptionId()));
- if (UserHandle.myUserId() == UserHandle.USER_OWNER
- && mSir.getSubscriptionId() != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
- if (phone == null) {
- Log.e(TAG, "Unable to locate a phone object for the given Subscription ID.");
- return;
+ if (UserHandle.myUserId() == UserHandle.USER_OWNER
+ && mSir.getSubscriptionId() != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ if (phone == null) {
+ Log.e(TAG, "Unable to locate a phone object for the given Subscription ID.");
+ return;
+ }
+
+ mPhone = phone;
+ mPhoneStateListener = new PhoneStateListener(mSir.getSubscriptionId()) {
+ @Override
+ public void onDataConnectionStateChanged(int state) {
+ updateDataState();
+ updateNetworkType();
+ }
+
+ @Override
+ public void onSignalStrengthsChanged(SignalStrength signalStrength) {
+ updateSignalStrength(signalStrength);
+ }
+
+ @Override
+ public void onServiceStateChanged(ServiceState serviceState) {
+ updateServiceState(serviceState);
+ }
+ };
}
-
- mPhone = phone;
- mPhoneStateListener = new PhoneStateListener(mSir.getSubscriptionId()) {
- @Override
- public void onDataConnectionStateChanged(int state) {
- updateDataState();
- updateNetworkType();
- }
-
- @Override
- public void onSignalStrengthsChanged(SignalStrength signalStrength) {
- updateSignalStrength(signalStrength);
- }
-
- @Override
- public void onServiceStateChanged(ServiceState serviceState) {
- updateServiceState(serviceState);
- }
- };
}
}
private OnTabChangeListener mTabListener = new OnTabChangeListener() {
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index 6c3ddb5..f993b8a 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -30,7 +30,6 @@
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
-import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.provider.SearchIndexableResource;
import android.provider.Telephony;
@@ -118,7 +117,7 @@
private SubscriptionInfo mCalls = null;
private SubscriptionInfo mSMS = null;
- private PreferenceCategory mSimCards = null;
+ private PreferenceScreen mSimCards = null;
private SubscriptionManager mSubscriptionManager;
private Utils mUtils;
@@ -151,14 +150,16 @@
addPreferencesFromResource(R.xml.sim_settings);
- mSimCards = (PreferenceCategory)findPreference(SIM_CARD_CATEGORY);
+ mSimCards = (PreferenceScreen)findPreference(SIM_CARD_CATEGORY);
final int numSlots = tm.getSimCount();
mAvailableSubInfos = new ArrayList<SubscriptionInfo>(numSlots);
mSelectableSubInfos = new ArrayList<SubscriptionInfo>();
for (int i = 0; i < numSlots; ++i) {
final SubscriptionInfo sir = Utils.findRecordBySlotId(getActivity(), i);
- mSimCards.addPreference(new SimPreference(getActivity(), sir, i));
+ SimPreference simPreference = new SimPreference(getActivity(), sir, i);
+ simPreference.setOrder(i-numSlots);
+ mSimCards.addPreference(simPreference);
mAvailableSubInfos.add(sir);
if (sir != null) {
mSelectableSubInfos.add(sir);
@@ -246,7 +247,7 @@
simPref.setTitle(R.string.calls_title);
simPref.setSummary(phoneAccount == null
- ? getResources().getString(R.string.sim_selection_required_pref)
+ ? getResources().getString(R.string.sim_calls_ask_first_prefs_title)
: (String)telecomManager.getPhoneAccount(phoneAccount).getLabel());
}
@@ -418,7 +419,7 @@
} else {
sir = mSelectableSubInfos.get(position);
holder.title.setText(sir.getDisplayName());
- holder.summary.setText(sir.getNumber());
+ holder.summary.setText(getPhoneNumber(sir));
holder.icon.setImageBitmap(sir.createIconBitmap(mContext));
}
return rowView;
@@ -458,11 +459,11 @@
setTitle(String.format(getResources()
.getString(R.string.sim_editor_title), (mSlotId + 1)));
if (mSubInfoRecord != null) {
- if (TextUtils.isEmpty(mSubInfoRecord.getNumber())) {
+ if (TextUtils.isEmpty(getPhoneNumber(mSubInfoRecord))) {
setSummary(mSubInfoRecord.getDisplayName());
} else {
setSummary(mSubInfoRecord.getDisplayName() + " - " +
- mSubInfoRecord.getNumber());
+ getPhoneNumber(mSubInfoRecord));
setEnabled(true);
}
setIcon(new BitmapDrawable(res, (mSubInfoRecord.createIconBitmap(mContext))));
@@ -517,7 +518,7 @@
});
TextView numberView = (TextView)dialogLayout.findViewById(R.id.number);
- final String rawNumber = mSubInfoRecord.getNumber();
+ final String rawNumber = getPhoneNumber(mSubInfoRecord);
if (TextUtils.isEmpty(rawNumber)) {
numberView.setText(res.getString(com.android.internal.R.string.unknownName));
} else {
@@ -635,6 +636,14 @@
}
+ // Returns the line1Number. Line1number should always be read from TelephonyManager since it can
+ // be overridden for display purposes.
+ private String getPhoneNumber(SubscriptionInfo info) {
+ final TelephonyManager tm =
+ (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
+ return tm.getLine1NumberForSubscriber(info.getSubscriptionId());
+ }
+
private void log(String s) {
Log.d(TAG, s);
}
diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java
index 45c3a5b..1bf1a5c 100644
--- a/src/com/android/settings/wifi/AccessPoint.java
+++ b/src/com/android/settings/wifi/AccessPoint.java
@@ -595,7 +595,7 @@
* For ephemeral connections (networkId is invalid), this returns false if the network is
* disconnected.
*/
- private boolean isActive() {
+ boolean isActive() {
return mNetworkInfo != null &&
(networkId != WifiConfiguration.INVALID_NETWORK_ID ||
mNetworkInfo.getState() != State.DISCONNECTED);
@@ -617,7 +617,8 @@
StringBuilder summary = new StringBuilder();
if (isActive()) { // This is the active connection
- summary.append(Summary.get(context, getState()));
+ summary.append(Summary.get(context, getState(),
+ networkId == WifiConfiguration.INVALID_NETWORK_ID));
} else if (mConfig != null
&& mConfig.hasNoInternetAccess()) {
summary.append(context.getString(R.string.wifi_no_internet));
diff --git a/src/com/android/settings/wifi/Summary.java b/src/com/android/settings/wifi/Summary.java
index d96d23e..123f64a 100644
--- a/src/com/android/settings/wifi/Summary.java
+++ b/src/com/android/settings/wifi/Summary.java
@@ -22,7 +22,12 @@
import android.net.NetworkInfo.DetailedState;
class Summary {
- static String get(Context context, String ssid, DetailedState state) {
+ static String get(Context context, String ssid, DetailedState state, boolean isEphemeral) {
+ if (state == DetailedState.CONNECTED && isEphemeral && ssid == null) {
+ // Special case for connected + ephemeral networks.
+ return context.getString(R.string.connected_via_wfa);
+ }
+
String[] formats = context.getResources().getStringArray((ssid == null)
? R.array.wifi_status : R.array.wifi_status_with_ssid);
int index = state.ordinal();
@@ -33,7 +38,7 @@
return String.format(formats[index], ssid);
}
- static String get(Context context, DetailedState state) {
- return get(context, null, state);
+ static String get(Context context, DetailedState state, boolean isEphemeral) {
+ return get(context, null, state, isEphemeral);
}
}
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index b00faf1..5462d26 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -242,7 +242,8 @@
}
}
- if (mAccessPoint.networkId == INVALID_NETWORK_ID || mEdit) {
+ if ((mAccessPoint.networkId == INVALID_NETWORK_ID && !mAccessPoint.isActive())
+ || mEdit) {
showSecurityFields();
showIpConfigFields();
showProxyFields();
@@ -266,7 +267,8 @@
} else {
if (state != null) {
addRow(group, R.string.wifi_status, Summary.get(mConfigUi.getContext(),
- state));
+ state, mAccessPoint.networkId ==
+ WifiConfiguration.INVALID_NETWORK_ID));
}
if (signalLevel != null) {
@@ -300,7 +302,7 @@
addRow(group, R.string.wifi_security, mAccessPoint.getSecurityString(false));
mView.findViewById(R.id.ip_fields).setVisibility(View.GONE);
}
- if (mAccessPoint.networkId != INVALID_NETWORK_ID
+ if ((mAccessPoint.networkId != INVALID_NETWORK_ID || mAccessPoint.isActive())
&& ActivityManager.getCurrentUser() == UserHandle.USER_OWNER) {
mConfigUi.setForgetButton(res.getString(R.string.wifi_forget));
}
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 9dfd201..8eab1c7 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -502,26 +502,21 @@
mSelectedAccessPoint = (AccessPoint) preference;
menu.setHeaderTitle(mSelectedAccessPoint.ssid);
if (mSelectedAccessPoint.getLevel() != -1) {
- int connectStringRes = 0;
if (mSelectedAccessPoint.getState() == null) {
- connectStringRes = R.string.wifi_menu_connect;
- } else if (mSelectedAccessPoint.networkId == INVALID_NETWORK_ID &&
- mSelectedAccessPoint.getNetworkInfo().getState()
- != State.DISCONNECTED) {
- // State is non-null (and not disconnected) but this network has no
- // configuration, which means it is ephemeral. Allow the user to save the
- // configuration permanently (but still issue this as a CONNECT command).
- connectStringRes = R.string.wifi_menu_remember;
- }
-
- if (connectStringRes != 0) {
- menu.add(Menu.NONE, MENU_ID_CONNECT, 0, connectStringRes);
+ menu.add(Menu.NONE, MENU_ID_CONNECT, 0, R.string.wifi_menu_connect);
}
}
+
+ if (ActivityManager.getCurrentUser() == UserHandle.USER_OWNER &&
+ (mSelectedAccessPoint.networkId != INVALID_NETWORK_ID ||
+ (mSelectedAccessPoint.getNetworkInfo() != null &&
+ mSelectedAccessPoint.getNetworkInfo().getState() != State.DISCONNECTED))) {
+ // Allow forgetting a network if the current user is the owner and either the
+ // network is saved or ephemerally connected. (In the latter case, "forget"
+ // blacklists the network so it won't be used again, ephemerally).
+ menu.add(Menu.NONE, MENU_ID_FORGET, 0, R.string.wifi_menu_forget);
+ }
if (mSelectedAccessPoint.networkId != INVALID_NETWORK_ID) {
- if (ActivityManager.getCurrentUser() == UserHandle.USER_OWNER) {
- menu.add(Menu.NONE, MENU_ID_FORGET, 0, R.string.wifi_menu_forget);
- }
menu.add(Menu.NONE, MENU_ID_MODIFY, 0, R.string.wifi_menu_modify);
if (mSelectedAccessPoint.security != AccessPoint.SECURITY_NONE) {
@@ -552,7 +547,7 @@
return true;
}
case MENU_ID_FORGET: {
- mWifiManager.forget(mSelectedAccessPoint.networkId, mForgetListener);
+ forget();
return true;
}
case MENU_ID_MODIFY: {
@@ -571,9 +566,10 @@
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
if (preference instanceof AccessPoint) {
mSelectedAccessPoint = (AccessPoint) preference;
- /** Bypass dialog for unsecured, unsaved networks */
+ /** Bypass dialog for unsecured, unsaved, and inactive networks */
if (mSelectedAccessPoint.security == AccessPoint.SECURITY_NONE &&
- mSelectedAccessPoint.networkId == INVALID_NETWORK_ID) {
+ mSelectedAccessPoint.networkId == INVALID_NETWORK_ID &&
+ !mSelectedAccessPoint.isActive()) {
mSelectedAccessPoint.generateOpenNetworkConfig();
if (!savedNetworksExist) {
savedNetworksExist = true;
@@ -903,12 +899,19 @@
/* package */ void forget() {
if (mSelectedAccessPoint.networkId == INVALID_NETWORK_ID) {
- // Should not happen, but a monkey seems to trigger it
- Log.e(TAG, "Failed to forget invalid network " + mSelectedAccessPoint.getConfig());
- return;
+ if (mSelectedAccessPoint.getNetworkInfo().getState() != State.DISCONNECTED) {
+ // Network is active but has no network ID - must be ephemeral.
+ mWifiManager.disableEphemeralNetwork(
+ AccessPoint.convertToQuotedString(mSelectedAccessPoint.ssid));
+ } else {
+ // Should not happen, but a monkey seems to trigger it
+ Log.e(TAG, "Failed to forget invalid network " + mSelectedAccessPoint.getConfig());
+ return;
+ }
+ } else {
+ mWifiManager.forget(mSelectedAccessPoint.networkId, mForgetListener);
}
- mWifiManager.forget(mSelectedAccessPoint.networkId, mForgetListener);
if (mWifiManager.isWifiEnabled()) {
mScanner.resume();
diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
index bc387cb..2588309 100644
--- a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
+++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
@@ -285,7 +285,7 @@
default: // DISCONNECTED, FAILED
if (mScreenState != SCREEN_STATE_CONNECTED &&
mWifiSettings.getAccessPointsCount() > 0) {
- showDisconnectedState(Summary.get(this, state));
+ showDisconnectedState(Summary.get(this, state, false /* isEphemeral */));
}
break;
}
diff --git a/src/com/android/settings/wifi/WifiStatusTest.java b/src/com/android/settings/wifi/WifiStatusTest.java
index 1b23834..dbd8eec 100644
--- a/src/com/android/settings/wifi/WifiStatusTest.java
+++ b/src/com/android/settings/wifi/WifiStatusTest.java
@@ -17,12 +17,16 @@
package com.android.settings.wifi;
import com.android.settings.R;
+
import android.net.wifi.ScanResult;
+
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
+
import java.util.List;
+
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -30,6 +34,7 @@
import android.content.IntentFilter;
import android.net.NetworkInfo;
import android.net.wifi.SupplicantState;
+import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
@@ -40,6 +45,7 @@
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
+
import java.io.IOException;
import java.net.UnknownHostException;
@@ -294,8 +300,9 @@
private void handleNetworkStateChanged(NetworkInfo networkInfo) {
if (mWifiManager.isWifiEnabled()) {
- String summary = Summary.get(this, mWifiManager.getConnectionInfo().getSSID(),
- networkInfo.getDetailedState());
+ WifiInfo info = mWifiManager.getConnectionInfo();
+ String summary = Summary.get(this, info.getSSID(), networkInfo.getDetailedState(),
+ info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID);
mNetworkState.setText(summary);
}
}