How does Android solve the problem of changing the default wallpaper to a wallpaper other than ImageWallpaper, resulting in a crash in a specific operation.

Source: Internet
Author: User

 

 

Modify the default_wallpaper_component attribute in the config. xml file so that other wallpaper applications are used by default when the system is started for the first time. After the device is started, choose Settings> Applications> All> Find the apk of the default wallpaper when the device is started for the first time. Click Go to stop and choose disable. This will cause the device to crash. How to modify the code so that in this scenario, the mobile phone does not crash and the wallpaper is restored to ImageWallpaper. Add the red code in the bindWallpaperComponentLocked method in WallpaperManagerService. java. Modify it to the following: ServiceInfo si = mIPackageManager. getServiceInfo (componentName,
PackageManager. GET_META_DATA | PackageManager. GET_PERMISSIONS, serviceUserId); // add for change default wallpaper if (si = null)
{
ComponentName = IMAGE_WALLPAPER;
Si = mIPackageManager. getServiceInfo (componentName,
PackageManager. GET_META_DATA | PackageManager. GET_PERMISSIONS, serviceUserId );
} // Add for change default wallpaper
If (! Android. Manifest. permission. BIND_WALLPAPER.equals (si. permission )){
String msg = Selected service does not require
+ Android. Manifest. permission. BIND_WALLPAPER
+: + ComponentName;
If (fromUser ){
Throw new SecurityException (msg );
}
Slog. w (TAG, msg );
Return false;
}
After the modification, the phone will not restart and the default static wallpaper will be restored.

 

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.