Android5.1 Wallpaper Source option has two "wallpapers" option

Source: Internet
Author: User

Android5.1 Wallpaper Source option has two "wallpapers" option
Problem
System language is Chinese, open settings---show wallpaper--View display
You can see that the Settings menu has two wallpaper options displayed

The system language is in English and the menu has two "wallpapers" options

"Log"
01-12 12:26:47.194:d/subsettings (7598): Launching Fragment com.android.settings.WallpaperTypeSettings

"Debug"
Find Wallpapertypesettings This file

Click "Show", "wallpaper" option, pop up "Select Wallpaper Source" (Choose wallpaper from) page
Enter the following file
Wallpapertypesettings.java (packages\apps\settings\src\com\android\settings)

Wallpapertypesettings extends Settingspreferencefragment implements Indexable
This class inherits from Settingspreferencefragment

/**
* Base class for Settings fragments, with some helper functions and dialog Management.
*/
public class Settingspreferencefragment extends Preferencefragment implements Dialogcreatable


The settings options for the source of the wallpaper are dynamically loaded.
Populatewallpapertypes () method in Wallpapertypesettings.java

Private voidpopulatewallpapertypes () {//Search for activities that satisfy the Action_set_wallpaper ACTIONFinalIntent Intent =NewIntent (intent.action_set_wallpaper);FinalPackagemanager pm =Getpackagemanager ();FinalList<resolveinfo> rList =pm.queryintentactivities (intent,packagemanager.match_default_only);FinalPreferencescreen parent =Getpreferencescreen ();p arent.setorderingasadded (false);//Add Preference Items for each of the matching activities for(ResolveInfo info:rlist) {Preference pref=NewPreference (Getactivity ()); Intent prefintent=NewIntent (Intent);p refintent.setcomponent (Newcomponentname (Info.activityInfo.packageName, info.activityInfo.name));p ref.setintent (prefintent); Charsequence label=Info.loadlabel (PM);if(Label = =NULL) Label =info.activityinfo.packagename;pref.settitle (label);p arent.addpreference (pref);}}

Altogether found 4 packages to set wallpaper
com.android.launcher--Wallpaper Options
com.cyanogenmod.trebuchet--wallpapers, including photos and live wallpaper, etc.
com.android.gallery3d--Gallery
com.android.wallpaper.livepicker--Live Wallpaper

Here, I selectively do not load com.android.launcher
The Modified code:

if (!info.activityinfo.packagename.equals ("Com.android.launcher"  )) {   Parent.addpreference (pref);} // Fix Bug End

Last effect, select the wallpaper source interface with only 3 options


/**-------------------------------Appendix-------------------------------*/

Wallpaper_chooser.xml (Packages\apps\launcher2\res\layout)
Sets the page when the wallpaper is set. Above is the wallpaper, below is a set button.

Android5.1 Wallpaper Source option has two "wallpapers" option

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.