Merge "[WifiSetup] Workaround for accessibility in landscape" into lmp-dev
diff --git a/res/drawable-hdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-hdpi/setup_illustration_horizontal_tile.jpg
new file mode 100644
index 0000000..428b2f4
--- /dev/null
+++ b/res/drawable-hdpi/setup_illustration_horizontal_tile.jpg
Binary files differ
diff --git a/res/drawable-hdpi/setup_illustration_tile.jpg b/res/drawable-hdpi/setup_illustration_tile.jpg
new file mode 100644
index 0000000..ed6575c
--- /dev/null
+++ b/res/drawable-hdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-hdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-hdpi/setup_illustration_wifi_wide_image.jpg
new file mode 100644
index 0000000..fccea72
--- /dev/null
+++ b/res/drawable-hdpi/setup_illustration_wifi_wide_image.jpg
Binary files differ
diff --git a/res/drawable-mdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-mdpi/setup_illustration_horizontal_tile.jpg
new file mode 100644
index 0000000..52e7993
--- /dev/null
+++ b/res/drawable-mdpi/setup_illustration_horizontal_tile.jpg
Binary files differ
diff --git a/res/drawable-mdpi/setup_illustration_tile.jpg b/res/drawable-mdpi/setup_illustration_tile.jpg
new file mode 100644
index 0000000..9dbe131
--- /dev/null
+++ b/res/drawable-mdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-mdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-mdpi/setup_illustration_wifi_wide_image.jpg
new file mode 100644
index 0000000..f21dffb
--- /dev/null
+++ b/res/drawable-mdpi/setup_illustration_wifi_wide_image.jpg
Binary files differ
diff --git a/res/drawable-nodpi/setup_illustration_tile.png b/res/drawable-nodpi/setup_illustration_tile.png
deleted file mode 100644
index ae6d244..0000000
--- a/res/drawable-nodpi/setup_illustration_tile.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-nodpi/setup_illustration_wifi_image.jpg b/res/drawable-nodpi/setup_illustration_wifi_image.jpg
index 2579225..a27c93e 100644
--- a/res/drawable-nodpi/setup_illustration_wifi_image.jpg
+++ b/res/drawable-nodpi/setup_illustration_wifi_image.jpg
Binary files differ
diff --git a/res/drawable-nodpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-nodpi/setup_illustration_wifi_wide_image.jpg
deleted file mode 100644
index b876fa6..0000000
--- a/res/drawable-nodpi/setup_illustration_wifi_wide_image.jpg
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-xhdpi/setup_illustration_horizontal_tile.jpg
new file mode 100644
index 0000000..2733f8e
--- /dev/null
+++ b/res/drawable-xhdpi/setup_illustration_horizontal_tile.jpg
Binary files differ
diff --git a/res/drawable-xhdpi/setup_illustration_tile.jpg b/res/drawable-xhdpi/setup_illustration_tile.jpg
new file mode 100644
index 0000000..71dabd5
--- /dev/null
+++ b/res/drawable-xhdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-xhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-xhdpi/setup_illustration_wifi_wide_image.jpg
new file mode 100644
index 0000000..3d1b3f3
--- /dev/null
+++ b/res/drawable-xhdpi/setup_illustration_wifi_wide_image.jpg
Binary files differ
diff --git a/res/drawable-xxhdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-xxhdpi/setup_illustration_horizontal_tile.jpg
new file mode 100644
index 0000000..aec8d0f
--- /dev/null
+++ b/res/drawable-xxhdpi/setup_illustration_horizontal_tile.jpg
Binary files differ
diff --git a/res/drawable-xxhdpi/setup_illustration_tile.jpg b/res/drawable-xxhdpi/setup_illustration_tile.jpg
new file mode 100644
index 0000000..46b3d02
--- /dev/null
+++ b/res/drawable-xxhdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-xxhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-xxhdpi/setup_illustration_wifi_wide_image.jpg
new file mode 100644
index 0000000..6a590b7
--- /dev/null
+++ b/res/drawable-xxhdpi/setup_illustration_wifi_wide_image.jpg
Binary files differ
diff --git a/res/drawable-xxxhdpi/illustration_tile.jpg b/res/drawable-xxxhdpi/illustration_tile.jpg
new file mode 100644
index 0000000..ab3899e
--- /dev/null
+++ b/res/drawable-xxxhdpi/illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-xxxhdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-xxxhdpi/setup_illustration_horizontal_tile.jpg
new file mode 100644
index 0000000..448a651
--- /dev/null
+++ b/res/drawable-xxxhdpi/setup_illustration_horizontal_tile.jpg
Binary files differ
diff --git a/res/drawable-xxxhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-xxxhdpi/setup_illustration_wifi_wide_image.jpg
new file mode 100644
index 0000000..d6f2f82
--- /dev/null
+++ b/res/drawable-xxxhdpi/setup_illustration_wifi_wide_image.jpg
Binary files differ
diff --git a/res/drawable/setup_illustration_wifi_wide.xml b/res/drawable/setup_illustration_wifi_wide.xml
index 3af3561..33ee2f6 100644
--- a/res/drawable/setup_illustration_wifi_wide.xml
+++ b/res/drawable/setup_illustration_wifi_wide.xml
@@ -15,6 +15,19 @@
limitations under the License.
-->
-<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
- android:autoMirrored="true"
- android:src="@drawable/setup_illustration_wifi_wide_image" />
+<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" />
+ </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/res/layout-land/setup_preference.xml b/res/layout-land/setup_preference.xml
index b2e1cc7..ce655d6 100644
--- a/res/layout-land/setup_preference.xml
+++ b/res/layout-land/setup_preference.xml
@@ -33,13 +33,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wifi_setup_wizard_title" />
+
</FrameLayout>
<TextView
android:id="@+id/wifi_required_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
+ android:layout_marginBottom="6dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/wifi_required_info_text"
android:visibility="gone" />
diff --git a/res/layout-sw600dp-land/setup_preference.xml b/res/layout-sw600dp-land/setup_preference.xml
index ad364f9..431ac29 100644
--- a/res/layout-sw600dp-land/setup_preference.xml
+++ b/res/layout-sw600dp-land/setup_preference.xml
@@ -39,6 +39,7 @@
style="@style/SetupCardTitle"
android:layout_width="1dp"
android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height"
android:layout_weight="6"
android:text="@string/wifi_setup_wizard_title"/>
diff --git a/res/layout-sw720dp-port/setup_preference.xml b/res/layout-sw600dp/setup_preference.xml
similarity index 94%
rename from res/layout-sw720dp-port/setup_preference.xml
rename to res/layout-sw600dp/setup_preference.xml
index 8d1f53b..1e772d9 100644
--- a/res/layout-sw720dp-port/setup_preference.xml
+++ b/res/layout-sw600dp/setup_preference.xml
@@ -15,9 +15,7 @@
limitations under the License.
-->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -28,12 +26,12 @@
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/setup_illustration_bg"
- android:foreground="@drawable/setup_illustration_wifi_wide"
- settings:aspectRatio="4.0">
+ android:foreground="@drawable/setup_illustration_wifi_wide">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height"
android:orientation="vertical"
android:paddingLeft="@dimen/setup_wizard_card_port_margin_sides"
android:paddingRight="@dimen/setup_wizard_card_port_margin_sides">
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 1aa4b55..5f524af 100755
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -45,7 +45,6 @@
<!-- Dashboard tile image margin start / end -->
<dimen name="dashboard_tile_image_margin_start">12dp</dimen>
- <dimen name="setup_wizard_card_title_margin_top">256dp</dimen>
<dimen name="setup_wizard_card_title_padding_end">32dp</dimen>
<dimen name="setup_wizard_card_title_padding_start">56dp</dimen>
<dimen name="setup_wizard_card_title_padding_top">24dp</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 18306ca..fcfd5bc 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -50,7 +50,7 @@
<dimen name="setup_add_network_item_height">56dp</dimen>
<dimen name="setup_wizard_card_corner_radius">2dp</dimen>
<dimen name="setup_wizard_card_elevation">5dp</dimen>
- <dimen name="setup_wizard_card_title_margin_top">0dp</dimen>
+ <dimen name="setup_wizard_tablet_illustration_height">256dp</dimen>
<dimen name="setup_wizard_card_title_padding_end">0dp</dimen>
<dimen name="setup_wizard_card_title_padding_start">0dp</dimen>
<dimen name="setup_wizard_card_title_padding_top">16dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 97d99e7..87de49c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1273,7 +1273,7 @@
<string name="bluetooth_device_advanced_online_mode_title">Connect</string>
<!-- Bluetooth settings. Connection options screen. The summary of the online mode checkbox. This describes what the setting does in the context of the screen. -->
<string name="bluetooth_device_advanced_online_mode_summary">Connect to Bluetooth device</string>
- <!-- Bluetooth settings. Connection options screen. The title of the header that is above all of the profiles.
+ <!-- Bluetooth settings. Connection options screen. The title of the header that is above all of the profiles.
When a user decides what Bluetooth capabilities to use with the device. -->
<string name="bluetooth_device_advanced_profile_header_title">Use for</string>
<!-- Bluetooth settings. Connection options screen. Title for option to rename the device. [CHAR LIMIT=30] -->
@@ -4345,14 +4345,10 @@
<!-- Title of Usage Access preference item [CHAR LIMIT=30] -->
<string name="usage_access_title">Apps with usage access</string>
- <!-- Header of list of apps in Usage Access screen [CHAR LIMIT=30] -->
- <string name="usage_access_app_list_header">Apps requesting access</string>
- <!-- Body of Usage Access preference screen [CHAR LIMIT=NONE] -->
- <string name="usage_access_body">Only allow apps you trust to have access to usage data. Apps you allow will have access to your app usage history, such as the last time an app was used, or the total time you spent using an app.</string>
<!-- AlertDialog title for warning user when enabling usage access [CHAR LIMIT=30] -->
<string name="allow_usage_access_title">Allow access?</string>
<!-- AlertDialog message for warning user when enabling usage access [CHAR LIMIT=NONE] -->
- <string name="allow_usage_access_message">If you allow access, this app can view general info about your apps, such as how often you use them."</string>
+ <string name="allow_usage_access_message">If you allow access, this app can view general information about the apps on your device, such as how often you use them.</string>
<!-- Sound settings screen, setting check box label -->
<string name="emergency_tone_title">Emergency tone</string>
@@ -4838,11 +4834,14 @@
<string name="show_all_anrs_summary">Show App Not Responding dialog
for background apps</string>
+ <!-- UI debug setting: webview data reduction proxy [CHAR LIMIT=100] -->
+ <string name="dev_settings_use_google_settings">Please use GoogleSettings app for this operation</string>
+
<!-- UI debug setting: webview data reduction proxy [CHAR LIMIT=50] -->
<string name="webview_data_reduction_proxy">Reduce WebView Network Usage</string>
<!-- UI debug setting: webview data reduction proxy summary [CHAR LIMIT=200] -->
<string name="webview_data_reduction_proxy_summary">Reduce network usage by
- proxying WebView connections through Google compression servers (Experimental)</string>
+ proxying WebView connections through Google compression servers</string>
<!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
<string name="data_usage_summary_title">Data usage</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 3f5f39d..c3d2564 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -176,7 +176,6 @@
<!-- Alternate title style used for some tablet layouts -->
<style name="SetupCardTitle">
- <item name="android:layout_marginTop">@dimen/setup_wizard_card_title_margin_top</item>
<item name="android:paddingBottom">@dimen/setup_wizard_card_title_padding_bottom</item>
<item name="android:paddingEnd">@dimen/setup_wizard_card_title_padding_end</item>
<item name="android:paddingStart">@dimen/setup_wizard_card_title_padding_start</item>
diff --git a/res/xml/usage_access_settings.xml b/res/xml/usage_access_settings.xml
index 944126e..cd87be5 100644
--- a/res/xml/usage_access_settings.xml
+++ b/res/xml/usage_access_settings.xml
@@ -16,16 +16,4 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="usage_access"
- android:title="@string/usage_access_title">
-
- <PreferenceCategory
- android:key="apps"
- android:title="@string/usage_access_app_list_header"
- android:persistent="false" />
-
- <Preference
- android:summary="@string/usage_access_body"
- android:persistent="false"
- android:selectable="false" />
-
-</PreferenceScreen>
+ android:title="@string/usage_access_title"/>
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 2cffe28..d801ae0 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -31,7 +31,9 @@
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
+import android.database.Cursor;
import android.hardware.usb.IUsbManager;
+import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.BatteryManager;
@@ -153,6 +155,9 @@
private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
private static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = "webview_data_reduction_proxy";
+ // GoogleSetting name for the data reduction proxy setting.
+ // Setting type: int ( 0 = disallow, 1 = allow )
+ private static final String WEBVIEW_DATA_REDUCTION_PROXY = "use_webview_data_reduction_proxy";
private static final String PROCESS_STATS = "proc_stats";
@@ -166,6 +171,11 @@
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
+ // The setting Uri. Used when querying GoogleSettings.
+ private static final Uri GOOGLE_SETTINGS_CONTENT_URI = Uri.parse("content://com.google.settings/partner");
+ private static final String GOOGLE_SETTINGS_COMPONENT = "com.google.android.gms";
+ private static final String GOOGLE_SETTINGS_ACTIVITY = ".app.settings.GoogleSettingsActivity";
+
private static String DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = "262144"; // 256K
private IWindowManager mWindowManager;
@@ -372,6 +382,13 @@
mAllPrefs.add(mProcessStats);
mWebViewDataReductionProxy = findAndInitCheckboxPref(WEBVIEW_DATA_REDUCTION_PROXY_KEY);
+ mWebViewDataReductionProxy.setOnPreferenceChangeListener(
+ new Preference.OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ return handleDataReductionProxyPreferenceChange();
+ }
+ });
}
private ListPreference addListPreference(String prefKey) {
@@ -1277,6 +1294,50 @@
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
}
+ // Reads the googlesetting and converts to an int. Throws an exception if GoogleSettings
+ // provider does not exist or if the setting name cannot be found.
+ private int getGoogleSettingValue(String name) throws Exception {
+ String value = null;
+ Cursor c = null;
+ try {
+ ContentResolver resolver = getActivity().getContentResolver();
+ c = resolver.query(GOOGLE_SETTINGS_CONTENT_URI, new String[] { "value" },
+ "name=?", new String[]{ name }, null);
+ if (c != null && c.moveToNext()) value = c.getString(0);
+ } finally {
+ if (c != null) c.close();
+ }
+ // Throw an exception if value is null. This will indicate that setting is not found.
+ return Integer.parseInt(value);
+ }
+
+ private boolean handleDataReductionProxyPreferenceChange() {
+ int val;
+ try {
+ val = getGoogleSettingValue(WEBVIEW_DATA_REDUCTION_PROXY);
+ } catch (Exception e) {
+ // Accessing GoogleSettings failed. Use the developer setting.
+ return true;
+ }
+
+ Intent i = new Intent();
+ i.setClassName(GOOGLE_SETTINGS_COMPONENT,
+ GOOGLE_SETTINGS_COMPONENT + GOOGLE_SETTINGS_ACTIVITY);
+ try {
+ startActivity(i);
+ } catch (android.content.ActivityNotFoundException ex) {
+ // We found the GoogleSetting but for some reason activity not found.
+ // Do our best and put an alert dialog
+ new AlertDialog.Builder(getActivity()).setMessage(
+ getActivity().getResources().getString(
+ R.string.dev_settings_use_google_settings))
+ .setPositiveButton(android.R.string.ok, this)
+ .show();
+ }
+ // Use GoogleSettings to set.
+ return false;
+ }
+
private void writeWebViewDataReductionProxyOptions() {
Settings.Secure.putInt(getActivity().getContentResolver(),
Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY,
@@ -1287,9 +1348,17 @@
}
private void updateWebViewDataReductionProxyOptions() {
- updateCheckBox(mWebViewDataReductionProxy, Settings.Secure.getInt(
- getActivity().getContentResolver(),
- Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY, 0) != 0);
+ int val = -1;
+ try {
+ val = getGoogleSettingValue(WEBVIEW_DATA_REDUCTION_PROXY);
+ } catch (Exception e) {
+ // Accessing GoogleSettings failed. Use the developer setting
+ }
+ if (val == -1) {
+ val = Settings.Secure.getInt(getActivity().getContentResolver(),
+ Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY, 0);
+ }
+ updateCheckBox(mWebViewDataReductionProxy, val != 0);
}
@Override
diff --git a/src/com/android/settings/UsageAccessSettings.java b/src/com/android/settings/UsageAccessSettings.java
index 1816c50..8d0650b 100644
--- a/src/com/android/settings/UsageAccessSettings.java
+++ b/src/com/android/settings/UsageAccessSettings.java
@@ -34,7 +34,7 @@
import android.os.Looper;
import android.os.RemoteException;
import android.preference.Preference;
-import android.preference.PreferenceCategory;
+import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.util.ArrayMap;
import android.util.Log;
@@ -181,7 +181,7 @@
if (newEntries == null) {
mPackageEntryMap.clear();
- mAppsCategory.removeAll();
+ mPreferenceScreen.removeAll();
return;
}
@@ -192,7 +192,7 @@
final PackageEntry newPackageEntry = newEntries.get(oldPackageEntry.packageName);
if (newPackageEntry == null) {
// This package has been removed.
- mAppsCategory.removePreference(oldPackageEntry.preference);
+ mPreferenceScreen.removePreference(oldPackageEntry.preference);
} else {
// This package already exists in the preference hierarchy, so reuse that
// Preference.
@@ -208,7 +208,7 @@
packageEntry.preference = new SwitchPreference(mContext);
packageEntry.preference.setPersistent(false);
packageEntry.preference.setOnPreferenceChangeListener(UsageAccessSettings.this);
- mAppsCategory.addPreference(packageEntry.preference);
+ mPreferenceScreen.addPreference(packageEntry.preference);
}
updatePreference(packageEntry);
}
@@ -244,15 +244,15 @@
private AppsRequestingAccessFetcher mLastFetcherTask;
ArrayMap<String, PackageEntry> mPackageEntryMap = new ArrayMap<>();
AppOpsManager mAppOpsManager;
- PreferenceCategory mAppsCategory;
+ PreferenceScreen mPreferenceScreen;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.usage_access_settings);
- mAppsCategory = (PreferenceCategory) getPreferenceScreen().findPreference("apps");
- mAppsCategory.setOrderingAsAdded(false);
+ mPreferenceScreen = getPreferenceScreen();
+ mPreferenceScreen.setOrderingAsAdded(false);
mAppOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);
}
@@ -357,7 +357,7 @@
.setMessage(R.string.allow_usage_access_message)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setNegativeButton(R.string.cancel, this)
- .setPositiveButton(R.string.allow, this)
+ .setPositiveButton(android.R.string.ok, this)
.create();
}
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index ce3164d..ab7e28b 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -130,7 +130,7 @@
// Check for carrier apps that can handle provisioning first
Intent provisioningIntent = new Intent(TelephonyIntents.ACTION_CARRIER_SETUP);
List<String> carrierPackages =
- mTm.getCarrierPackageNamesForBroadcastIntent(provisioningIntent);
+ mTm.getCarrierPackageNamesForIntent(provisioningIntent);
if (carrierPackages != null && !carrierPackages.isEmpty()) {
if (carrierPackages.size() != 1) {
Log.w(TAG, "Multiple matching carrier apps found, launching the first.");
diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java
index 2b0fd5c..a523a75 100644
--- a/src/com/android/settings/notification/NotificationSettings.java
+++ b/src/com/android/settings/notification/NotificationSettings.java
@@ -40,6 +40,7 @@
import android.provider.Settings;
import android.util.Log;
+import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
@@ -82,6 +83,8 @@
private TwoStatePreference mNotificationPulse;
private DropDownPreference mLockscreen;
private Preference mNotificationAccess;
+ private boolean mSecure;
+ private int mLockscreenSelectedValue;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -89,6 +92,7 @@
mContext = getActivity();
mPM = mContext.getPackageManager();
mVoiceCapable = Utils.isVoiceCapable(mContext);
+ mSecure = new LockPatternUtils(getActivity()).isSecure();
addPreferencesFromResource(R.xml.notification_settings);
final PreferenceCategory sound = (PreferenceCategory) findPreference(KEY_SOUND);
@@ -303,10 +307,13 @@
Log.i(TAG, "Preference not found: " + KEY_LOCK_SCREEN_NOTIFICATIONS);
return;
}
+
mLockscreen.addItem(R.string.lock_screen_notifications_summary_show,
R.string.lock_screen_notifications_summary_show);
- mLockscreen.addItem(R.string.lock_screen_notifications_summary_hide,
- R.string.lock_screen_notifications_summary_hide);
+ if (mSecure) {
+ mLockscreen.addItem(R.string.lock_screen_notifications_summary_hide,
+ R.string.lock_screen_notifications_summary_hide);
+ }
mLockscreen.addItem(R.string.lock_screen_notifications_summary_disable,
R.string.lock_screen_notifications_summary_disable);
updateLockscreenNotifications();
@@ -314,12 +321,16 @@
@Override
public boolean onItemSelected(int pos, Object value) {
final int val = (Integer) value;
+ if (val == mLockscreenSelectedValue) {
+ return true;
+ }
final boolean enabled = val != R.string.lock_screen_notifications_summary_disable;
final boolean show = val == R.string.lock_screen_notifications_summary_show;
Settings.Secure.putInt(getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, show ? 1 : 0);
Settings.Secure.putInt(getContentResolver(),
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0);
+ mLockscreenSelectedValue = val;
return true;
}
});
@@ -329,12 +340,12 @@
if (mLockscreen == null) {
return;
}
- final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
final boolean enabled = getLockscreenNotificationsEnabled();
- final int selectedVal = !enabled ? R.string.lock_screen_notifications_summary_disable :
+ final boolean allowPrivate = !mSecure || getLockscreenAllowPrivateNotifications();
+ mLockscreenSelectedValue = !enabled ? R.string.lock_screen_notifications_summary_disable :
allowPrivate ? R.string.lock_screen_notifications_summary_show :
R.string.lock_screen_notifications_summary_hide;
- mLockscreen.setSelectedValue(selectedVal);
+ mLockscreen.setSelectedValue(mLockscreenSelectedValue);
}
private boolean getLockscreenNotificationsEnabled() {
diff --git a/src/com/android/settings/widget/SetupWizardIllustration.java b/src/com/android/settings/widget/SetupWizardIllustration.java
index fa8dd80..acdb5b3 100644
--- a/src/com/android/settings/widget/SetupWizardIllustration.java
+++ b/src/com/android/settings/widget/SetupWizardIllustration.java
@@ -20,9 +20,11 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
+import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
+import android.view.Gravity;
import android.widget.FrameLayout;
import com.android.settings.R;
@@ -42,7 +44,8 @@
private float mBaselineGridSize;
private Drawable mBackground;
private Drawable mForeground;
- private int mForegroundHeight = 0;
+ private final Rect mViewBounds = new Rect();
+ private final Rect mForegroundBounds = new Rect();
private float mScale = 1.0f;
private float mAspectRatio = 0.0f;
@@ -112,36 +115,35 @@
final int layoutWidth = right - left;
final int layoutHeight = bottom - top;
if (mForeground != null) {
- final float intrinsicWidth = mForeground.getIntrinsicWidth();
- final float intrinsicHeight = mForeground.getIntrinsicHeight();
- if (intrinsicWidth <= 0 || intrinsicHeight <= 0) {
- Log.e(TAG, "Foreground drawable intrinsic size must be defined and positive");
- mForeground = null;
- mForegroundHeight = 0;
- mScale = 1.0f;
- } else {
- // Scale the foreground to fill the width of the view
- mScale = layoutWidth / intrinsicWidth;
- mForegroundHeight = (int) (intrinsicHeight * mScale);
- mForeground.setBounds(0, 0, layoutWidth, mForegroundHeight);
+ int intrinsicWidth = mForeground.getIntrinsicWidth();
+ int intrinsicHeight = mForeground.getIntrinsicHeight();
+ final int layoutDirection = getLayoutDirection();
+
+ mViewBounds.set(0, 0, layoutWidth, layoutHeight);
+ if (mAspectRatio != 0f) {
+ mScale = layoutWidth / (float) intrinsicWidth;
+ intrinsicWidth = layoutWidth;
+ intrinsicHeight = (int) (intrinsicHeight * mScale);
}
+ Gravity.apply(Gravity.FILL_HORIZONTAL | Gravity.TOP, intrinsicWidth, intrinsicHeight,
+ mViewBounds, mForegroundBounds, layoutDirection);
+ mForeground.setBounds(mForegroundBounds);
}
if (mBackground != null) {
// Scale the bounds by mScale to compensate for the scale done to the canvas before
// drawing.
mBackground.setBounds(0, 0, (int) Math.ceil(layoutWidth / mScale),
- (int) Math.ceil((layoutHeight - mForegroundHeight) / mScale));
+ (int) Math.ceil((layoutHeight - mForegroundBounds.height()) / mScale));
}
super.onLayout(changed, left, top, right, bottom);
}
@Override
public void onDraw(Canvas canvas) {
- canvas.save();
if (mBackground != null) {
canvas.save();
// Draw the background filling parts not covered by the illustration
- canvas.translate(0, mForegroundHeight);
+ canvas.translate(0, mForegroundBounds.height());
// Scale the background so its size matches the foreground
canvas.scale(mScale, mScale, 0, 0);
mBackground.draw(canvas);
@@ -153,7 +155,6 @@
mForeground.draw(canvas);
canvas.restore();
}
- canvas.restore();
super.onDraw(canvas);
}
}