Bootstrap

Android11.0默认壁纸缩放

获取壁纸缩放值的代码

//in com.android.server.wm.WallpaperController 
private final float mMaxWallpaperScale;
//construct method
WallpaperController(WindowManagerService service, DisplayContent displayContent) {
  ......
  mMaxWallpaperScale = service.mContext.getResources()
          .getFloat(com.android.internal.R.dimen.config_wallpaperMaxScale);
}

修改默认值framework/base/res/res/values/config.xml

<!-- The max scale for the wallpaper when it's zoomed in -->
- <item name="config_wallpaperMaxScale" format="float" type="dimen">1.10</item>
+ <item name="config_wallpaperMaxScale" format="float" type="dimen">1.00</item>

也可以修改SystemUI 返回false不缩放

public class ImageWallpaper extends WallpaperService {
    @Override
    public Engine onCreateEngine() {
        return new GLEngine();
    }
    
   class GLEngine extends Engine {
        @Override
        public boolean shouldZoomOutWallpaper() {return false;}
    ...... 

;