Android Launcher APP替换图标不随系统固定格式而改变

Android P 的修改:

--- a/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/graphics/LauncherIcons.java+++ b/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/graphics/LauncherIcons.java@@ -195,7 +195,8 @@ public class LauncherIcons implements AutoCloseable {         float[] scale = new float[1];         icon = normalizeAndWrapToAdaptiveIcon(icon, iconAppTargetSdk, null, scale);         Bitmap bitmap = createIconBitmap(icon, scale[0]);-        if (Utilities.ATLEAST_OREO && icon instanceof AdaptiveIconDrawable) {+        if (/*Utilities.ATLEAST_OREO*/false && icon instanceof AdaptiveIconDrawable) {             mCanvas.setBitmap(bitmap);             getShadowGenerator().recreateIcon(Bitmap.createBitmap(bitmap), mCanvas);             mCanvas.setBitmap(null);@@ -241,7 +242,8 @@ public class LauncherIcons implements AutoCloseable {     private Drawable normalizeAndWrapToAdaptiveIcon(Drawable icon, int iconAppTargetSdk,             RectF outIconBounds, float[] outScale) {         float scale = 1f;-        if (Utilities.ATLEAST_OREO && iconAppTargetSdk >= Build.VERSION_CODES.O) {+        if (/*Utilities.ATLEAST_OREO*/false && iconAppTargetSdk >= Build.VERSION_CODES.O) {             boolean[] outShape = new boolean[1];             if (mWrapperIcon == null) {                 mWrapperIcon = mContext.getDrawable(R.drawable.adaptive_icon_drawable_wrapper)@@ -250,7 +252,8 @@ public class LauncherIcons implements AutoCloseable {             AdaptiveIconDrawable dr = (AdaptiveIconDrawable) mWrapperIcon;             dr.setBounds(0, 0, 1, 1);             scale = getNormalizer().getScale(icon, outIconBounds, dr.getIconMask(), outShape);-            if (Utilities.ATLEAST_OREO && !outShape[0] && !(icon instanceof AdaptiveIconDrawable)) {+            if (/*Utilities.ATLEAST_OREO*/false && !outShape[0] && !(icon instanceof AdaptiveIconDrawable)) {                 FixedScaleDrawable fsd = ((FixedScaleDrawable) dr.getForeground());                 fsd.setDrawable(icon);                 fsd.setScale(scale);@@ -329,7 +332,8 @@ public class LauncherIcons implements AutoCloseable {         final int top = (textureHeight-height) / 2;          mOldBounds.set(icon.getBounds());-        if (Utilities.ATLEAST_OREO && icon instanceof AdaptiveIconDrawable) {+        if (/*Utilities.ATLEAST_OREO*/false && icon instanceof AdaptiveIconDrawable) {             int offset = Math.max((int) Math.ceil(BLUR_FACTOR * textureWidth), Math.max(left, top));             int size = Math.max(width, height);             icon.setBounds(offset, offset, offset + size, offset + size);

Android Q的修改:

--- a/packages/apps/Launcher3/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java+++ b/packages/apps/Launcher3/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java@@ -31,7 +31,7 @@ public class BaseIconFactory implements AutoCloseable {      private static final String TAG = "BaseIconFactory";     private static final int DEFAULT_WRAPPER_BACKGROUND = Color.WHITE;-    static final boolean ATLEAST_OREO = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;+    static final boolean ATLEAST_OREO = false;//Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;     static final boolean ATLEAST_P = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;      private final Rect mOldBounds = new Rect();
发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章