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
This commit is contained in:
Jiaquan He
2016-05-11 09:56:55 -07:00
parent 4828bf3b7f
commit fe4e80b98b
2 changed files with 16 additions and 3 deletions

View File

@@ -40,4 +40,8 @@
<!-- Fully-qualified class name for the implementation of the FeatureFactory to be instantiated. -->
<string name="config_featureFactory" translatable="false">com.android.settings.overlay.FeatureFactoryImpl</string>
<!-- Whether we skip the wallpaper options, and lead to the wallpaper picker directly -->
<string name="wallpaper_picker" translatable="false"></string>
</resources>

View File

@@ -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) {