本文主要是介绍AndroidQ(10.0) 预制客供壁纸和铃声,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
预制客供壁纸
之前这个功能在 6.0 上修改过,已经是三年前了,之前壁纸选择还集成在 Launcher3 中,当时参考这篇
https://blog.csdn.net/jspping/article/details/50569097 进行的修改
Q 版本中已经独立出来了,在 WallpaperPicker 中进行修改
制作缩略图,将客户提供的壁纸丢给美工制作对应的缩略图,然后将所有资源图片放置到
vendor\mediatek\proprietary\packages\apps\WallpaperPicker\res\drawable-xhdpi
我这里预制两张,注意文件命名
vendor/mediatek/proprietary/packages/apps/WallpaperPicker/res/drawable-xhdpi/wallpaper_01.png
vendor/mediatek/proprietary/packages/apps/WallpaperPicker/res/drawable-xhdpi/wallpaper_01_small.png
vendor/mediatek/proprietary/packages/apps/WallpaperPicker/res/drawable-xhdpi/wallpaper_02.png
vendor/mediatek/proprietary/packages/apps/WallpaperPicker/res/drawable-xhdpi/wallpaper_02_small.png
将刚刚所添加的 png 壁纸名称配置 wallpapers.xml
vendor\mediatek\proprietary\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>
调整获取默认壁纸尺寸大小值
vendor\mediatek\proprietary\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 effectsfinal 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 startdefaultWidth = 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 路径下即可
这里有个坑提醒一下
如果预制以后,发现系统铃声选择列表中少了或者名称不对,那么你需要修改下原文件的标题
你可以通过右键原文件详细信息里查看是否带有标题或者其它艺术家之类的信息,需要把这些都
删除方可正常。
这篇关于AndroidQ(10.0) 预制客供壁纸和铃声的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!