Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit cb18bf8f authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-13.0.0_r52' into staging/lineage-20.0_merge-android-13.0.0_r52

Android 13.0.0 Release 52 (TQ3A.230605.012)

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZIi36gAKCRDorT+BmrEO
# eGobAJsH6WflDA15Awi9rWkqYsX88vSb8QCeJTeWhsh0BfjKN89Nc4ZHM8cV+SQ=
# =xRFw
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Jun 13 21:39:38 2023 EEST
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 1692 signatures in the past
#      19 months.  Encrypted 4 messages in the past 17 months.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Anushree Ganjam (6) and others
# Via Android (Google) Code Review (22) and others
* tag 'android-13.0.0_r52': (30 commits)
  [Thumbnails] Create ThumbnailCropType enum that supports FITTED mode.
  Do not leak launcher context from the SettingsAwareViewCapture.
  Invalidate ThemedIconDrawable when background color changes
  Migrating MotionLib tool from Protobuf-nano to Protobuf-lite.
  Migrating ViewCapture tool from Protobuf-nano to Protobuf-lite.
  Add generateWebTargetIdForRawQuery for Logging.
  Don't add ViewCapture Data to the Bugreport if it is empty and disabled.
  Add "PLACEHOLDER" and "RICHANSWER_PLACEHOLDER" to LayoutType.java
  Add extras to know if SearchTarget is zero-state recent item
  [Toast] Add an ICON_CONTAINER layout type.
  [play] Add generatePlayTargetIdForLogging.
  [play] Add bundle extra key for play image.
  Add WEB_SUG_COUNT to get the web suggestions count.
  Adding Clone Profile Badges in iconLoader library
  Add SearchTargetEventHelper to SearchUiLib
  add bundle key and SearchTargetConverter.java
  Name the key for the Extras attribute to control whether SearchTargets should show or hide (default) their label.
  [Toast] Rename the extra to be used to skip logging for both trampoline activity and open srp in chrome.
  [Toast] Add an extra field for trampoline activity.
  Apdating getShapePath to avoid creating new bitmaps via AdaptiveIconDrawable
  ...

Change-Id: I35ea0e732b897dd5081427406101aebea0196ba7
parents c95400c1 313ca2b3
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2023 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="@dimen/profile_badge_size"
    android:height="@dimen/profile_badge_size"
    android:viewportWidth="24"
    android:viewportHeight="24">

    <path
        android:fillColor="#11000000"
        android:pathData="M.5,12.25
        A11.5,11.5 0 1,1 23.5,12.25
        A11.5,11.5 0 1,1 .5,12.25" />

    <path
        android:fillColor="@android:color/white"
        android:pathData="M1,12
        A11,11 0 1,1 23,12
        A11,11 0 1,1 1,12" />

    <group android:scaleX=".6" android:scaleY=".6" android:pivotX="12" android:pivotY="12">
      <path
        android:pathData="M22,9.5C22,13.642 18.642,17 14.5,17C10.358,17 7,13.642 7,9.5C7,5.358 10.358,2 14.5,2C18.642,2 22,5.358 22,9.5Z"
        android:fillColor="#ff3C4043"/>
    <path
        android:pathData="M9.5,20.333C12.722,20.333 15.333,17.722 15.333,14.5C15.333,11.278 12.722,8.667 9.5,8.667C6.278,8.667 3.667,11.278 3.667,14.5C3.667,17.722 6.278,20.333 9.5,20.333ZM9.5,22C13.642,22 17,18.642 17,14.5C17,10.358 13.642,7 9.5,7C5.358,7 2,10.358 2,14.5C2,18.642 5.358,22 9.5,22Z"
        android:fillColor="#ff3C4043"
        android:fillType="evenOdd"/>
    </group>
</vector>
+31 −2
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import static android.graphics.Paint.DITHER_FLAG;
import static android.graphics.Paint.FILTER_BITMAP_FLAG;
import static android.graphics.drawable.AdaptiveIconDrawable.getExtraInsetFraction;

import static com.android.launcher3.icons.BitmapInfo.FLAG_CLONE;
import static com.android.launcher3.icons.BitmapInfo.FLAG_INSTANT;
import static com.android.launcher3.icons.BitmapInfo.FLAG_WORK;
import static com.android.launcher3.icons.ShadowGenerator.BLUR_FACTOR;
@@ -212,7 +213,8 @@ public class BaseIconFactory implements AutoCloseable {
        boolean shrinkNonAdaptiveIcons = options == null || options.mShrinkNonAdaptiveIcons;
        float[] scale = new float[1];
        icon = normalizeAndWrapToAdaptiveIcon(icon, shrinkNonAdaptiveIcons, null, scale);
        Bitmap bitmap = createIconBitmap(icon, scale[0], MODE_WITH_SHADOW);
        Bitmap bitmap = createIconBitmap(icon, scale[0],
                options == null ? MODE_WITH_SHADOW : options.mGenerationMode);

        int color = (options != null && options.mExtractedColor != null)
                ? options.mExtractedColor : mColorExtractor.findDominantColorByHue(bitmap);
@@ -265,7 +267,10 @@ public class BaseIconFactory implements AutoCloseable {
                    isBadged = (d != mPm.getUserBadgedIcon(d, options.mUserHandle));
                    mIsUserBadged.put(key, isBadged);
                }
                op = op.setFlag(FLAG_WORK, isBadged);
                // Set the clone profile badge flag in case it is present.
                op = op.setFlag(FLAG_CLONE, isBadged && options.mIsCloneProfile);
                // Set the Work profile badge for all other cases.
                op = op.setFlag(FLAG_WORK, isBadged && !options.mIsCloneProfile);
            }
        }
        return op;
@@ -463,6 +468,11 @@ public class BaseIconFactory implements AutoCloseable {

        boolean mIsInstantApp;

        boolean mIsCloneProfile;

        @BitmapGenerationMode
        int mGenerationMode = MODE_WITH_SHADOW;

        @Nullable UserHandle mUserHandle;

        @ColorInt
@@ -503,6 +513,25 @@ public class BaseIconFactory implements AutoCloseable {
            mExtractedColor = color;
            return this;
        }

        /**
         * Sets the bitmap generation mode to use for the bitmap info. Note that some generation
         * modes do not support color extraction, so consider setting a extracted color manually
         * in those cases.
         */
        public IconOptions setBitmapGenerationMode(@BitmapGenerationMode int generationMode) {
            mGenerationMode = generationMode;
            return this;
        }

        /**
         * Used to determine the badge type for this icon.
         */
        @NonNull
        public IconOptions setIsCloneProfile(boolean isCloneProfile) {
            mIsCloneProfile = isCloneProfile;
            return this;
        }
    }

    /**
+4 −0
Original line number Diff line number Diff line
@@ -30,9 +30,11 @@ public class BitmapInfo {

    static final int FLAG_WORK = 1 << 0;
    static final int FLAG_INSTANT = 1 << 1;
    static final int FLAG_CLONE = 1 << 2;
    @IntDef(flag = true, value = {
            FLAG_WORK,
            FLAG_INSTANT,
            FLAG_CLONE
    })
    @interface BitmapInfoFlags {}

@@ -155,6 +157,8 @@ public class BitmapInfo {
                drawable.setBadge(context.getDrawable(R.drawable.ic_instant_app_badge));
            } else if ((flags & FLAG_WORK) != 0) {
                drawable.setBadge(context.getDrawable(R.drawable.ic_work_app_badge));
            } else if ((flags & FLAG_CLONE) != 0) {
                drawable.setBadge(context.getDrawable(R.drawable.ic_clone_app_badge));
            }
        }
    }
+19 −1
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@
package com.android.launcher3.icons;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.Region;
@@ -28,6 +30,8 @@ import android.graphics.drawable.ColorDrawable;
import android.util.Log;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.core.graphics.PathParser;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -35,6 +39,7 @@ import java.io.IOException;
public class GraphicsUtils {

    private static final String TAG = "GraphicsUtils";
    private static final float MASK_SIZE = 100f;

    public static Runnable sOnNewBitmapRunnable = () -> { };

@@ -98,7 +103,20 @@ public class GraphicsUtils {
    /**
     * Returns the default path to be used by an icon
     */
    public static Path getShapePath(int size) {
    public static Path getShapePath(@NonNull Context context, int size) {
        if (IconProvider.CONFIG_ICON_MASK_RES_ID != Resources.ID_NULL) {
            Path path = PathParser.createPathFromPathData(
                    context.getString(IconProvider.CONFIG_ICON_MASK_RES_ID));
            if (path != null) {
                if (size != MASK_SIZE) {
                    Matrix m = new Matrix();
                    float scale = ((float) size) / MASK_SIZE;
                    m.setScale(scale, scale);
                    path.transform(m);
                }
                return path;
            }
        }
        AdaptiveIconDrawable drawable = new AdaptiveIconDrawable(
                new ColorDrawable(Color.BLACK), new ColorDrawable(Color.BLACK));
        drawable.setBounds(0, 0, size, size);
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ import java.util.function.Supplier;
public class IconProvider {

    private final String ACTION_OVERLAY_CHANGED = "android.intent.action.OVERLAY_CHANGED";
    private static final int CONFIG_ICON_MASK_RES_ID = Resources.getSystem().getIdentifier(
    static final int CONFIG_ICON_MASK_RES_ID = Resources.getSystem().getIdentifier(
            "config_icon_mask", "string", "android");

    private static final String TAG = "IconProvider";
Loading