预制客供壁纸
之前这个功能在 6.0 上修改过,已经是三年前了,之前壁纸选择还集成在 Launcher3 中,当时参考这篇
Q 版本中已经独立出来了,在 WallpaperPicker 中进行修改
制作缩略图,将客户提供的壁纸丢给美工制作对应的缩略图,然后将所有资源图片放置到
vendor\mediatek\proprietary\packages\apps\WallpaperPicker\res\drawable-xhdpi
我这里预制两张,注意文件命名
注意 small为缩略图 ,必须要有(可以使用原文件),不然不显示预览选择的图片
packages/apps/WallpaperPicker/res/drawable-xhdpi/wallpaper_01.png
packages/apps/WallpaperPicker/res/drawable-xhdpi/wallpaper_01_small.png
packages/apps/WallpaperPicker/res/drawable-xhdpi/wallpaper_02.png
packages/apps/WallpaperPicker/res/drawable-xhdpi/wallpaper_02_small.png
将刚刚所添加的 png 壁纸名称配置 wallpapers.xml
packages\apps\WallpaperPicker\res\values-nodpi\wallpapers.xml
<resources>
<string-array name="wallpapers" translatable="false">
<item>wallpaper_01</item>
<item>wallpaper_02</item>
</string-array>
</resources>
调整获取默认壁纸尺寸大小值
packages\apps\WallpaperPicker\src\com\android\wallpaperpicker\WallpaperUtils.java
public static Point getDefaultWallpaperSize(Resources res, WindowManager windowManager) {
if (sDefaultWallpaperSize == null) {
Point realSize = new Point();
windowManager.getDefaultDisplay().getRealSize(realSize);
int maxDim = Math.max(realSize.x, realSize.y);
int minDim = Math.min(realSize.x, realSize.y);
// We need to ensure that there is enough extra space in the wallpaper
// for the intended parallax effects
final int defaultWidth, defaultHeight;
if (res.getConfiguration().smallestScreenWidthDp >= 720) {
defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
defaultHeight = maxDim;
} else {
//defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim);
//defaultHeight = maxDim;
//add begin set full screen start
defaultWidth = realSize.x;
defaultHeight = realSize.y;
//add begin set full screen end
}
//add begin set full screen start
//sDefaultWallpaperSize = new Point(defaultWidth, defaultHeight);
sDefaultWallpaperSize = realSize;
//add begin set full screen end
}
return sDefaultWallpaperSize;
}
预制客供铃声
这个没啥特殊的,确保格式是 ogg 就行
预制到 frameworks/base/data/sounds/ringtones/ogg/ 中
并修改 frameworks/base/data/sounds/AllAudio.mk 将其拷贝到 out 路径下即可
这里有个坑提醒一下
如果预制以后,发现系统铃声选择列表中少了或者名称不对,那么你需要修改下原文件的标题
你可以通过右键原文件详细信息里查看是否带有标题或者其它艺术家之类的信息,需要把这些都
删除方可正常。