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

Commit 1e849b97 authored by Alison Cichowlas's avatar Alison Cichowlas Committed by Android (Google) Code Review
Browse files

Merge "RON demotion: add logging when demote happens from UI." into main

parents 296376bf 37e4b0c7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -28,7 +28,11 @@ enum NotificationControlsEvent implements UiEventLogger.UiEventEnum {
    NOTIFICATION_CONTROLS_SAVE_IMPORTANCE(595),

    @UiEvent(doc = "The user closed the notification inline controls.")
    NOTIFICATION_CONTROLS_CLOSE(596);
    NOTIFICATION_CONTROLS_CLOSE(596),

    @UiEvent(doc = "The user demoted a notification using inline controls.")
    NOTIFICATION_DEMOTION_COMMIT(2234);


    private final int mId;
    NotificationControlsEvent(int id) {
+2 −3
Original line number Diff line number Diff line
@@ -347,7 +347,7 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta
            } else if (gutsView instanceof FeedbackInfo) {
                initializeFeedbackInfo(row, sbn, ranking, (FeedbackInfo) gutsView);
            } else if (gutsView instanceof PromotedPermissionGutsContent) {
                initializeDemoteView(row, sbn, (PromotedPermissionGutsContent) gutsView);
                initializeDemoteView(sbn, (PromotedPermissionGutsContent) gutsView);
            }
            return true;
        } catch (Exception e) {
@@ -384,15 +384,14 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta
     * @param demoteGuts view to set up/bind within {@code row}
     */
    private void initializeDemoteView(
            @NonNull final ExpandableNotificationRow row,
            @NonNull StatusBarNotification sbn,
            @NonNull PromotedPermissionGutsContent demoteGuts) {
        demoteGuts.setOnDemoteAction(v -> {
            try {
                // TODO(b/391661009): Signal AutomaticPromotionCoordinator here
                mNotificationManager.setCanBePromoted(
                        sbn.getPackageName(), sbn.getUid(), false, true);
                mPackageDemotionInteractor.onPackageDemoted(sbn.getPackageName(), sbn.getUid());
                mUiEventLogger.log(NotificationControlsEvent.NOTIFICATION_DEMOTION_COMMIT);
            } catch (RemoteException e) {
                Log.e(TAG, "Couldn't revoke live update permission", e);
            }