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

Commit f9a8552f authored by Dan Sandler's avatar Dan Sandler
Browse files

Support updated rendering of conversation icons.

Note that changes to channel settings now generate
onResume() for all available controllers to ensure they get
the updated drawable.

Bug: 149747760
Change-Id: I3f73c025b1d32194e3d5147d03cb781e370f2a1b
Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.notification"
parent 490eba35
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -37,14 +37,11 @@ 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;
import android.os.UserHandle;
import android.service.notification.ConversationChannelWrapper;
import android.service.notification.NotifyingApp;
import android.text.format.DateUtils;
import android.util.IconDrawableFactory;
import android.util.Log;
@@ -522,17 +519,17 @@ public class NotificationBackend {
    }

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

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

+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ public class ConversationHeaderPreferenceController extends NotificationPreferen
                    .setHasAppInfoLink(true)
                    .setRecyclerView(mFragment.getListView(), mFragment.getSettingsLifecycle())
                    .done(activity, mContext);

            pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -74,8 +74,8 @@ public class ConversationImportantPreferenceController extends NotificationPrefe
        mChannel.setImportantConversation(value);
        if (value && bubbleImportantConversations()) {
            mChannel.setAllowBubbles(true);
            mDependentFieldListener.onFieldValueChanged();
        }
        mDependentFieldListener.onFieldValueChanged();
        saveChannel();

        return true;
+2 −1
Original line number Diff line number Diff line
@@ -88,7 +88,8 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe
        pref.setTitle(getTitle(conversation));
        pref.setSummary(getSummary(conversation));
        pref.setIcon(mBackend.getConversationDrawable(mContext, conversation.getShortcutInfo(),
                conversation.getPkg(), conversation.getUid()));
                conversation.getPkg(), conversation.getUid(),
                conversation.getNotificationChannel().isImportantConversation()));
        pref.setKey(conversation.getNotificationChannel().getId());
        pref.setIntent(getIntent(conversation, pref.getTitle()));

Loading