From fe4e80b98bc8ff38800461fd7f263d4322b929ad Mon Sep 17 00:00:00 2001 From: Jiaquan He Date: Wed, 11 May 2016 09:56:55 -0700 Subject: [PATCH] Add an option allowing to skip wallpaper apps selection. This commit adds an option to the Settings application, making it possible to skip the wallpaper apps selecting and directly lead to the wallpaper picker. Bug: 28554244 Change-Id: Id93b69c397e7eec6fdf9fd2c5812fd359cae58c2 --- res/values/config.xml | 4 ++++ src/com/android/settings/DisplaySettings.java | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/res/values/config.xml b/res/values/config.xml index 6cae9cfa6ee..9d0ec17c241 100755 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -40,4 +40,8 @@ com.android.settings.overlay.FeatureFactoryImpl + + + + diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java index 8e389a930c5..c1bd774730b 100644 --- a/src/com/android/settings/DisplaySettings.java +++ b/src/com/android/settings/DisplaySettings.java @@ -19,11 +19,11 @@ package com.android.settings; import android.app.Activity; import android.app.ActivityManager; import android.app.UiModeManager; -import android.app.WallpaperManager; import android.app.admin.DevicePolicyManager; +import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; -import android.content.ComponentName; +import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; @@ -66,7 +66,6 @@ import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE; import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC; import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT; - import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; public class DisplaySettings extends SettingsPreferenceFragment implements @@ -252,6 +251,16 @@ public class DisplaySettings extends SettingsPreferenceFragment implements mNightModePreference.setValue(String.valueOf(currentNightMode)); mNightModePreference.setOnPreferenceChangeListener(this); } + + // Check if we want to skip the wallpaper options and lead to the wallpaper picker directly. + String wallpaperPicker = getResources().getString(R.string.wallpaper_picker); + if (!wallpaperPicker.isEmpty()) { + final RestrictedPreference pref = (RestrictedPreference) findPreference(KEY_WALLPAPER); + final Intent intent = new Intent(); + intent.setComponent(ComponentName.unflattenFromString(wallpaperPicker)); + pref.setFragment(null); + pref.setIntent(intent); + } } private static boolean allowAllRotations(Context context) {