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

Commit f7d30b1f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add app badges to conversation icons"

parents ef83d265 bfd03422
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@
    <dimen name="notification_importance_button_padding">14dp</dimen>

    <dimen name="notification_history_header_drawable_start">26dp</dimen>
    <dimen name="conversation_icon_size">48dp</dimen>

    <dimen name="zen_mode_button_padding_vertical">16dp</dimen>
    <dimen name="zen_schedule_rule_checkbox_padding">7dp</dimen>
+12 −4
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -51,6 +53,7 @@ import androidx.annotation.VisibleForTesting;

import com.android.settingslib.R;
import com.android.settingslib.Utils;
import com.android.settingslib.notification.ConversationIconFactory;
import com.android.settingslib.utils.StringUtil;

import java.util.ArrayList;
@@ -509,10 +512,15 @@ public class NotificationBackend {
        return null;
    }

    public Drawable getConversationDrawable(Context context, ShortcutInfo info) {
        LauncherApps la = context.getSystemService(LauncherApps.class);
        return la.getShortcutBadgedIconDrawable(info,
                context.getResources().getDisplayMetrics().densityDpi);
    public Drawable getConversationDrawable(Context context, ShortcutInfo info, String pkg,
            int uid) {
        ConversationIconFactory iconFactory = new ConversationIconFactory(context,
                context.getSystemService(LauncherApps.class),
                context.getPackageManager(), IconDrawableFactory.newInstance(context),
                context.getResources().getDimensionPixelSize(
                        R.dimen.conversation_icon_size));
        return new BitmapDrawable(context.getResources(),
                iconFactory.getConversationBitmap(info, pkg, uid));
    }

    public void requestPinShortcut(Context context, ShortcutInfo shortcutInfo) {
+1 −1
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ public class ConversationListPreferenceController extends NotificationPreference
                conversation.getParentChannelLabel(), conversation.getGroupLabel())
                : conversation.getParentChannelLabel());
        if (si != null) {
            pref.setIcon(mBackend.getConversationDrawable(mContext, si));
            pref.setIcon(mBackend.getConversationDrawable(mContext, si, mAppRow.pkg, mAppRow.uid));
        }
        pref.setKey(conversation.getNotificationChannel().getId());

+3 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.ShortcutInfo;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.UserHandle;
@@ -203,7 +204,8 @@ abstract public class NotificationSettings extends DashboardFragment {
        mConversationInfo = mBackend.getConversationInfo(
                mContext, mPkg, mUid, mChannel.getConversationId());
        if (mConversationInfo != null) {
            mConversationDrawable = mBackend.getConversationDrawable(mContext, mConversationInfo);
            mConversationDrawable = mBackend.getConversationDrawable(
                    mContext, mConversationInfo, mAppRow.pkg, mAppRow.uid);
        }
    }