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

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

Merge "Add Tiles for all Recent Conversations via flag"

parents 58b20258 331215b4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -14550,6 +14550,16 @@ public final class Settings {
         */
        public static final String SHOW_PEOPLE_SPACE = "show_people_space";
        /**
         * Which types of conversations to show in People Space.
         * Values are:
         * 0: All conversations (default)
         * 1: Priority conversations only
         * @hide
         */
        public static final String PEOPLE_SPACE_CONVERSATION_TYPE =
                "people_space_conversation_type";
        /**
         * Whether to show new lockscreen & AOD UI.
         * Values are:
+1 −0
Original line number Diff line number Diff line
@@ -408,6 +408,7 @@ public class SettingsBackupTest {
                    Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT,
                    Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS,
                    Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT,
                    Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE,
                    Settings.Global.POLICY_CONTROL,
                    Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE,
                    Settings.Global.POWER_MANAGER_CONSTANTS,
+19 −9
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.people;

import android.app.Activity;
import android.app.INotificationManager;
import android.app.people.ConversationChannel;
import android.app.people.IPeopleManager;
import android.content.Context;
import android.content.pm.LauncherApps;
@@ -29,6 +30,7 @@ import android.icu.util.MeasureUnit;
import android.os.Bundle;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.service.notification.ConversationChannelWrapper;
import android.util.Log;
import android.view.ViewGroup;
@@ -52,7 +54,6 @@ public class PeopleSpaceActivity extends Activity {
    private INotificationManager mNotificationManager;
    private PackageManager mPackageManager;
    private LauncherApps mLauncherApps;
    private List<ConversationChannelWrapper> mConversations;
    private Context mContext;

    @Override
@@ -77,15 +78,25 @@ public class PeopleSpaceActivity extends Activity {
     */
    private void setTileViewsWithPriorityConversations() {
        try {
            boolean showAllConversations = Settings.Global.getInt(mContext.getContentResolver(),
                    Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE) == 0;
            List<ConversationChannelWrapper> conversations =
                    mNotificationManager.getConversations(
                            true /* priority only */).getList();
            mConversations = conversations.stream().filter(
                    c -> shouldKeepConversation(c)).collect(Collectors.toList());
            for (ConversationChannelWrapper conversation : mConversations) {
                            !showAllConversations /* priority only */).getList();
            List<ShortcutInfo> shortcutInfos = conversations.stream().filter(
                    c -> shouldKeepConversation(c)).map(c -> c.getShortcutInfo()).collect(
                    Collectors.toList());
            if (showAllConversations) {
                List<ConversationChannel> recentConversations =
                        mPeopleManager.getRecentConversations().getList();
                List<ShortcutInfo> recentShortcuts = recentConversations.stream().map(
                        c -> c.getShortcutInfo()).collect(Collectors.toList());
                shortcutInfos.addAll(recentShortcuts);
            }
            for (ShortcutInfo conversation : shortcutInfos) {
                PeopleSpaceTileView tileView = new PeopleSpaceTileView(mContext,
                        mPeopleSpaceLayout,
                        conversation.getShortcutInfo().getId());
                        conversation.getId());
                setTileView(tileView, conversation);
            }
        } catch (Exception e) {
@@ -95,11 +106,10 @@ public class PeopleSpaceActivity extends Activity {

    /** Sets {@code tileView} with the data in {@code conversation}. */
    private void setTileView(PeopleSpaceTileView tileView,
            ConversationChannelWrapper conversation) {
            ShortcutInfo shortcutInfo) {
        try {
            ShortcutInfo shortcutInfo = conversation.getShortcutInfo();
            int userId = UserHandle.getUserHandleForUid(
                    conversation.getUid()).getIdentifier();
                    shortcutInfo.getUserId()).getIdentifier();

            String pkg = shortcutInfo.getPackage();
            long lastInteraction = mPeopleManager.getLastInteraction(
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ public class PeopleService extends SystemService {

        @Override
        public ParceledListSlice<ConversationChannel> getRecentConversations() {
            enforceSystemOrRoot("get recent conversations");
            enforceSystemRootOrSystemUI(getContext(), "get recent conversations");
            return new ParceledListSlice<>(
                    mDataManager.getRecentConversations(
                            Binder.getCallingUserHandle().getIdentifier()));