问题:将launcher界面所有的APP图标LOGO默认为-圆形
解决:
vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/graphics/IconShapeOverride.java
正常情况下:
1. 我们需要打开开发者选项 , 再过一段时间(1分钟左右)
2. 长按Launcher第一屏界面空白地方—->点击主屏幕设置—–>(出现)更改图标形状
3. 点击更改图标形状, 会出现一个列表里面有(使用系统默认设置,方形,方圆形,圆形,泪珠形), 公版默认为“系统默认设置”
注意:如果不打开 开发者选项, 是看不到上述内容的
修改方法:
设置为不打开开发者选项 依然能出现上述现象
public static boolean isSupported(Context context) {
//@tony add:
if (context != null) {
return true;
}//@end
if (!Utilities.ATLEAST_OREO) {
return false;
}
// Only supported when developer settings is enabled
if (Settings.Global.getInt(context.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 1) {
return false;
}
try {
if (getSystemResField().get(null) != Resources.getSystem()) {
// Our assumption that mSystem is the system resource is not true.
return false;
}
} catch (Exception e) {
// Ignore, not supported
return false;
}
return getConfigResId() != 0;
}
默认为圆形
public static final String DEFAULT_ICON_SHAPE_CIRCLE = "M50 0A50 50,0,1,1,50 100A50 50,0,1,1,50 0"; //@tony add
private static String getAppliedValue(Context context) {
return getDevicePrefs(context).getString(KEY_PREFERENCE, DEFAULT_ICON_SHAPE_CIRCLE /* " " */); //@tony modify
}
解释:
M50 0A50 50,0,1,1,50 100A50 50,0,1,1,50 0:为代表图标为圆形的代码表示方式
此值在文件:vendor/mediatek/proprietary/packages/apps/Launcher3/res/values/config.xml
中有定义
<string-array translatable="false" name="icon_shape_override_paths_values">
<item>item> ----对应系统默认设置
<item>M50,0L100,0 100,100 0,100 0,0zitem> ----对应方形
<item>M50,0 C10,0 0,10 0,50 0,90 10,100 50,100 90,100 100,90 100,50 100,10 90,0 50,0 Zitem> ----对应方圆形
<item>M50 0A50 50,0,1,1,50 100A50 50,0,1,1,50 0item> ----对应圆形
<item>M50,0A50,50,0,0 1 100,50 L100,85 A15,15,0,0 1 85,100 L50,100 A50,50,0,0 1 50,0zitem> ----对应泪珠形
string-array>
<string-array translatable="false" name="icon_shape_override_paths_names">
<item>@string/icon_shape_system_defaultitem> ---系统默认设置
<item>@string/icon_shape_squareitem> ---方形
<item>@string/icon_shape_squircleitem> ---方圆形
<item>@string/icon_shape_circleitem> ---圆形
<item>@string/icon_shape_teardropitem> ---泪珠形
string-array>