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

Commit e6ff946c authored by Selim Cinek's avatar Selim Cinek
Browse files

Switched the work profile badge used in the notifications

Change-Id: I62616f1ae8fcda9953853b9859c69a9f1e6f44ca
parent 6183d129
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1099,13 +1099,24 @@ public class ApplicationPackageManager extends PackageManager {

    @Override
    public Drawable getUserBadgeForDensity(UserHandle user, int density) {
        return getManagedProfileIconForDensity(user, density,
                com.android.internal.R.drawable.ic_corp_badge);
    }

    @Override
    public Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density) {
        return getManagedProfileIconForDensity(user, density,
                com.android.internal.R.drawable.ic_corp_badge_no_background);
    }

    private Drawable getManagedProfileIconForDensity(UserHandle user, int density,
            int drawableId) {
        UserInfo userInfo = getUserIfProfile(user.getIdentifier());
        if (userInfo != null && userInfo.isManagedProfile()) {
            if (density <= 0) {
                density = mContext.getResources().getDisplayMetrics().densityDpi;
            }
            return Resources.getSystem().getDrawableForDensity(
                    com.android.internal.R.drawable.ic_corp_badge, density);
            return Resources.getSystem().getDrawableForDensity(drawableId, density);
        }
        return null;
    }
+1 −1
Original line number Diff line number Diff line
@@ -2998,7 +2998,7 @@ public class Notification implements Parcelable
        private Drawable getProfileBadgeDrawable() {
            // Note: This assumes that the current user can read the profile badge of the
            // originating user.
            return mContext.getPackageManager().getUserBadgeForDensity(
            return mContext.getPackageManager().getUserBadgeForDensityNoBackground(
                    new UserHandle(mContext.getUserId()), 0);
        }

+16 −0
Original line number Diff line number Diff line
@@ -4266,6 +4266,22 @@ public abstract class PackageManager {
     */
    public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);

    /**
     * If the target user is a managed profile of the calling user or the caller
     * is itself a managed profile, then this returns a drawable to use as a small
     * icon to include in a view to distinguish it from the original icon. This version
     * doesn't have background protection and should be used over a light background instead of
     * a badge.
     *
     * @param user The target user.
     * @param density The optional desired density for the badge as per
     *         {@link android.util.DisplayMetrics#densityDpi}. If not provided
     *         the density of the current display is used.
     * @return the drawable or null if no drawable is required.
     * @hide
     */
    public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);

    /**
     * If the target user is a managed profile of the calling user or the caller
     * is itself a managed profile, then this returns a copy of the label with
+30 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2016 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="24.0dp"
    android:height="24.0dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
    <path
        android:pathData="M20.801,5.981L17.13,5.98l0.001,-1.471l-2.053,-2.055L8.969,2.453L6.915,4.506L6.914,5.977L3.203,5.976c-1.216,0.0 -2.189,0.983 -2.189,2.199L1.0,12.406c0.0,1.216 0.983,2.2 2.199,2.2L10.0,14.608l0.0,-1.644l0.291,0.0l3.351,0.0l0.291,0.0l0.0,1.645l6.863,0.002c1.216,0.0 2.2,-0.983 2.2,-2.199L23.0,8.181C23.0,6.965 22.017,5.981 20.801,5.981zM15.076,5.979L8.968,5.978l0.001,-1.471l6.108,0.001L15.076,5.979z"
        android:fillColor="#FF5722"/>
    <path
        android:pathData="M13.911,16.646L9.978,16.646L9.978,15.48L1.673,15.48l0.0,4.105c0.0,1.216 0.959,2.2 2.175,2.2l16.13,0.004c1.216,0.0 2.203,-0.983 2.203,-2.199l0.0,-4.11l-8.27,0.0L13.910999,16.646z"
        android:fillColor="#FF5722"/>
    <path
        android:pathData="M23.657,6.55 h4.72 v1.137 h-4.72z"
        android:fillColor="#00000000"/>
</vector>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@
        android:layout_height="@dimen/notification_badge_size"
        android:layout_gravity="center"
        android:layout_marginStart="4dp"
        android:paddingTop="1dp"
        android:scaleType="fitCenter"
        android:visibility="gone"
        android:contentDescription="@string/notification_work_profile_content_description"
Loading