问题定位是 *大师手机APP 设置壁纸导致。
系统裁剪显示静态壁纸的类 SystemUI/src/com/android/systemui/ImageWallpaper.java
boolean updateSurfaceSize(SurfaceHolder surfaceHolder, DisplayInfo displayInfo,
boolean forDraw) {
boolean hasWallpaper = true;
// Load background image dimensions, if we haven't saved them yet
if (mBackgroundWidth <= 0 || mBackgroundHeight <= 0) {
// Need to load the image to get dimensions
loadWallpaper(forDraw);
if (DEBUG) {
Log.d(TAG, "Reloading, redoing updateSurfaceSize later.");
}
hasWallpaper = false;
}
// Force the wallpaper to cover the screen in both dimensions
// 这里是给定壁纸绘制范围,原生的会去判断取当前display和壁纸数值的最大值,修改强制按照 displayInfo 适配
// int surfaceWidth = Math.max(displayInfo.logicalWidth, mBackgroundWidth);
// int surfaceHeight = Math.max(displayInfo.logicalHeight, mBackgroundHeight);
int surfaceWidth = displayInfo.logicalWidth;
int surfaceHeight = displayInfo.logicalHeight;
// Used a fixed size surface, because we are special. We can do
// this because we know the current design of window animations doesn't
// cause this to break.
surfaceHolder.setFixedSize(surfaceWidth, surfaceHeight);
mLastRequestedWidth = surfaceWidth;
mLastRequestedHeight = surfaceHeight;
return hasWallpaper;
}
三方APP也可以通过 extends WallpaperService ,使用系统接口去绘制图片。但是需要在 设置-显示-壁纸 中去修改壁纸设置应用。修改设置壁纸应用使用 WallpaperManagerService.java -> setWallpaperComponent(ComponentName name)。*大师手机APP设置为壁纸APP之后就出问题了。