RK 7.1,增加默认锁屏壁纸:
works/ /packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
private static final boolean ENABLE_LOCKSCREEN_WALLPAPER = true;
要设置出厂默认锁屏壁纸,修改如下代码即可实现:
works/ /packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
public Bitmap getBitmap() {
if (mCached) {
return mCache;
}
if (!mWallpaperManager.isWallpaperSupported()) {
mCached = true;
mCache = null;
return null;
}
LoaderResult result = loadBitmap(mCurrentUserId, mSelectedUser);
if (result.success) {
mCached = true;
mUpdateMonitor.setHasLockscreenWallpaper(result.bitmap != null);
mCache = result.bitmap;
}
//add begin : 第一次开机加载失败,尝试读取系统资源default_lock_wallpaper.jpg,然后写入到锁屏壁纸文件中,并重新loadBitmap
if (mCache == null) {
try {
mWallpaperManager.setStream(
mContext.getResources().openRawResource(com.android.internal.R.drawable.default_lock_wallpaper),
null,
true,
WallpaperManager.FLAG_LOCK);
result = loadBitmap(mCurrentUserId, mSelectedUser);
if (result.success) {
mCached = true;
mUpdateMonitor.setHasLockscreenWallpaper(result.bitmap != null);
mCache = result.bitmap;
}
} catch (IOException e) {
Log.e(TAG, \"can not set default lockscreen wallpaper\");
}
}
//add end
return mCache;
}
works/ /core/res/res/values/config.
- <item name=\"default_lock_wallpaper\" type=\"drawable\">@null</item>
+ <!--<item name=\"default_lock_wallpaper\" type=\"drawable\">@null</item>-->
然后放入系统资源图片default_lock_wallpaper即可。
壁纸显示不全是因为dwidth 和dheight 的值不对,要改成屏幕尺寸分辨率大小的
works/ /packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
protected void onBoundsChange(Rect bounds) {
int vwidth = getBounds().width();
int vheight = getBounds().height();
- int dwidth = mState.mBackground.getWidth();
- int dheight = mState.mBackground.getHeight();
+ int dwidth = getBounds().width();
+ int dheight = getBounds().height();
继续阅读与本文标签相同的文章
-
大陆集团:仓储智慧化建设是我国物流行业降本增效最有效的途径之一
2026-05-18栏目: 教程
-
5G真的来了!2020年将在超340个城市覆盖5G
2026-05-18栏目: 教程
-
Windows 10计算器应用更新:完全支持三角函数运算
2026-05-18栏目: 教程
-
Docker容器实战(五) - 特殊的进程!
2026-05-18栏目: 教程
-
靠颜值进站!刷脸支付与轨道交通的大联合
2026-05-18栏目: 教程
