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

Commit e83f72e1 authored by Gustav Sennton's avatar Gustav Sennton Committed by Android (Google) Code Review
Browse files

Merge "Add logcat logging for smart suggestions."

parents 0f5d4fe9 2d66b51a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -230,6 +230,10 @@ public class Assistant extends NotificationAssistantService {
        NotificationEntry entry =
                new NotificationEntry(mPackageManager, sbn, channel, mSmsHelper);
        SmartActionsHelper.SmartSuggestions suggestions = mSmartActionsHelper.suggest(entry);
        if (DEBUG) {
            Log.d(TAG, String.format("Creating Adjustment for %s, with %d actions, and %d replies.",
                    sbn.getKey(), suggestions.actions.size(), suggestions.replies.size()));
        }
        return createEnqueuedNotificationAdjustment(
                entry, suggestions.actions, suggestions.replies);
    }
+13 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import java.util.List;
public class NotificationContentView extends FrameLayout {

    private static final String TAG = "NotificationContentView";
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
    public static final int VISIBLE_TYPE_CONTRACTED = 0;
    public static final int VISIBLE_TYPE_EXPANDED = 1;
    public static final int VISIBLE_TYPE_HEADSUP = 2;
@@ -1319,6 +1320,14 @@ public class NotificationContentView extends FrameLayout {

        SmartRepliesAndActions smartRepliesAndActions =
                chooseSmartRepliesAndActions(mSmartReplyConstants, entry);
        if (DEBUG) {
            Log.d(TAG, String.format("Adding suggestions for %s, %d actions, and %d replies.",
                    entry.notification.getKey(),
                    smartRepliesAndActions.smartActions == null ? 0 :
                            smartRepliesAndActions.smartActions.actions.size(),
                    smartRepliesAndActions.smartReplies == null ? 0 :
                            smartRepliesAndActions.smartReplies.choices.length));
        }

        applyRemoteInput(entry, smartRepliesAndActions.hasFreeformRemoteInput);
        applySmartReplyView(smartRepliesAndActions, entry);
@@ -1341,6 +1350,10 @@ public class NotificationContentView extends FrameLayout {
                notification.findRemoteInputActionPair(true /* freeform */);

        if (!smartReplyConstants.isEnabled()) {
            if (DEBUG) {
                Log.d(TAG, "Smart suggestions not enabled, not adding suggestions for "
                        + entry.notification.getKey());
            }
            return new SmartRepliesAndActions(null, null, freeformRemoteInputActionPair != null);
        }
        // Only use smart replies from the app if they target P or above. We have this check because