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

Commit 8e0b0a73 authored by Himanshu Gupta's avatar Himanshu Gupta
Browse files

Adding Private Space badges in Iconloader lib.

Bug: 289224457
Test: Flashing on device and presubmit.
Flag: None
Change-Id: I059d1be289ee0226e6c7840b2ed2df119fe43165
parent f6b03684
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
<!--
  ~ 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:pathData="M12,0L12,0A12,12 0,0 1,24 12L24,12A12,12 0,0 1,12 24L12,24A12,12 0,0 1,0 12L0,12A12,12 0,0 1,12 0z"
        android:fillColor="#ffffff"/>
    <group>
        <clip-path
            android:pathData="M5,5h14v14h-14z"/>
        <path
            android:pathData="M11.033,14H12.967L12.6,11.85C12.789,11.75 12.933,11.606 13.033,11.417C13.144,11.228 13.2,11.022 13.2,10.8C13.2,10.467 13.083,10.183 12.85,9.95C12.617,9.717 12.333,9.6 12,9.6C11.667,9.6 11.383,9.717 11.15,9.95C10.917,10.183 10.8,10.467 10.8,10.8C10.8,11.022 10.85,11.228 10.95,11.417C11.061,11.606 11.211,11.75 11.4,11.85L11.033,14ZM12,18.4C10.5,18.033 9.256,17.183 8.267,15.85C7.289,14.517 6.8,13.039 6.8,11.417V7.6L12,5.6L17.2,7.6V11.417C17.2,13.039 16.706,14.517 15.717,15.85C14.739,17.183 13.5,18.033 12,18.4ZM12,17.15C13.156,16.794 14.111,16.078 14.867,15C15.622,13.922 16,12.728 16,11.417V8.417L12,6.883L8,8.417V11.417C8,12.728 8.378,13.922 9.133,15C9.889,16.078 10.844,16.794 12,17.15Z"
            android:fillColor="#001A41"/>
    </group>
</vector>
+32 −0
Original line number Diff line number Diff line
<!--
  ~ 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="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
    <path
        android:pathData="M12,0L12,0A12,12 0,0 1,24 12L24,12A12,12 0,0 1,12 24L12,24A12,12 0,0 1,0 12L0,12A12,12 0,0 1,12 0z"
        android:fillColor="@color/themed_badge_icon_background_color"/>
    <group>
        <clip-path
            android:pathData="M5,5h14v14h-14z"/>
        <path
            android:pathData="M11.033,14H12.967L12.6,11.85C12.789,11.75 12.933,11.606 13.033,11.417C13.144,11.228 13.2,11.022 13.2,10.8C13.2,10.467 13.083,10.183 12.85,9.95C12.617,9.717 12.333,9.6 12,9.6C11.667,9.6 11.383,9.717 11.15,9.95C10.917,10.183 10.8,10.467 10.8,10.8C10.8,11.022 10.85,11.228 10.95,11.417C11.061,11.606 11.211,11.75 11.4,11.85L11.033,14ZM12,18.4C10.5,18.033 9.256,17.183 8.267,15.85C7.289,14.517 6.8,13.039 6.8,11.417V7.6L12,5.6L17.2,7.6V11.417C17.2,13.039 16.706,14.517 15.717,15.85C14.739,17.183 13.5,18.033 12,18.4ZM12,17.15C13.156,16.794 14.111,16.078 14.867,15C15.622,13.922 16,12.728 16,11.417V8.417L12,6.883L8,8.417V11.417C8,12.728 8.378,13.922 9.133,15C9.889,16.078 10.844,16.794 12,17.15Z"
            android:fillColor="@color/themed_badge_icon_color"/>
    </group>
</vector>
+6 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ import static android.graphics.drawable.AdaptiveIconDrawable.getExtraInsetFracti

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_PRIVATE;
import static com.android.launcher3.icons.BitmapInfo.FLAG_WORK;
import static com.android.launcher3.icons.ShadowGenerator.BLUR_FACTOR;

@@ -265,6 +266,7 @@ public class BaseIconFactory implements AutoCloseable {
            if (info != null) {
                op = op.setFlag(FLAG_WORK, info.isWork());
                op = op.setFlag(FLAG_CLONE, info.isCloned());
                op = op.setFlag(FLAG_PRIVATE, info.isPrivate());
            }
        }
        return op;
@@ -274,6 +276,10 @@ public class BaseIconFactory implements AutoCloseable {
    protected UserIconInfo getUserInfo(@NonNull UserHandle user) {
        int key = user.hashCode();
        UserIconInfo info = mCachedUserInfo.get(key);
        /*
        * We do not have the ability to distinguish between different badged users here.
        * As such all badged users will have the work profile badge applied.
        */
        if (info == null) {
            // Simple check to check if the provided user is work profile or not based on badging
            NoopDrawable d = new NoopDrawable();
+7 −1
Original line number Diff line number Diff line
@@ -32,10 +32,12 @@ public class BitmapInfo {
    static final int FLAG_WORK = 1 << 0;
    static final int FLAG_INSTANT = 1 << 1;
    static final int FLAG_CLONE = 1 << 2;
    static final int FLAG_PRIVATE = 1 << 3;
    @IntDef(flag = true, value = {
            FLAG_WORK,
            FLAG_INSTANT,
            FLAG_CLONE
            FLAG_CLONE,
            FLAG_PRIVATE
    })
    @interface BitmapInfoFlags {}

@@ -179,6 +181,10 @@ public class BitmapInfo {
            return context.getDrawable(isThemed
                    ? R.drawable.ic_clone_app_badge_themed
                    : R.drawable.ic_clone_app_badge);
        } else if ((flags & FLAG_PRIVATE) != 0) {
            return context.getDrawable(isThemed
                    ? R.drawable.ic_private_profile_app_badge_themed
                    : R.drawable.ic_private_profile_app_badge);
        }
        return null;
    }