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

Commit 61c9b1f8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove launched flags for AudioAttributes validation." into main

parents 235f6faf 585ee98e
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -192,27 +192,6 @@ flag {
  bug: "330193582"
}

flag {
  name: "restrict_audio_attributes_call"
  namespace: "systemui"
  description: "Only CallStyle notifs can use USAGE_NOTIFICATION_RINGTONE"
  bug: "331793339"
}

flag {
  name: "restrict_audio_attributes_alarm"
  namespace: "systemui"
  description: "Only alarm category notifs can use USAGE_ALARM"
  bug: "331793339"
}

flag {
  name: "restrict_audio_attributes_media"
  namespace: "systemui"
  description: "No notifs can use USAGE_UNKNOWN or USAGE_MEDIA"
  bug: "331793339"
}

flag {
  name: "clean_up_spans_and_new_lines"
  namespace: "systemui"
+0 −2
Original line number Diff line number Diff line
@@ -704,8 +704,6 @@ public class NotificationChannelTest {
    }

    @Test
    @EnableFlags({Flags.FLAG_RESTRICT_AUDIO_ATTRIBUTES_MEDIA,
            Flags.FLAG_RESTRICT_AUDIO_ATTRIBUTES_CALL, Flags.FLAG_RESTRICT_AUDIO_ATTRIBUTES_ALARM})
    public void testCopy() {
        NotificationChannel original = new NotificationChannel("id", "name", 2);
        original.setDescription("desc");
+28 −37
Original line number Diff line number Diff line
@@ -15,9 +15,6 @@
*/
package com.android.server.notification;

import static android.app.Flags.restrictAudioAttributesAlarm;
import static android.app.Flags.restrictAudioAttributesCall;
import static android.app.Flags.restrictAudioAttributesMedia;
import static android.app.Notification.CATEGORY_ALARM;
import static android.media.AudioAttributes.USAGE_NOTIFICATION;

@@ -76,8 +73,6 @@ public class NotificationChannelExtractor implements NotificationSignalExtractor
                record.getSbn().getShortcutId(), true, false);
        record.updateNotificationChannel(updatedChannel);

        if (restrictAudioAttributesCall() || restrictAudioAttributesAlarm()
                || restrictAudioAttributesMedia()) {
        AudioAttributes attributes = record.getChannel().getAudioAttributes();
        if (attributes == null) {
            if (DBG) Slog.d(TAG, "missing AudioAttributes");
@@ -85,20 +80,17 @@ public class NotificationChannelExtractor implements NotificationSignalExtractor
        }

        boolean updateAttributes =  false;
            if (restrictAudioAttributesCall()
                    && !record.getNotification().isStyle(Notification.CallStyle.class)
        if (!record.getNotification().isStyle(Notification.CallStyle.class)
                && attributes.getUsage() == AudioAttributes.USAGE_NOTIFICATION_RINGTONE) {
            updateAttributes = true;
        }
            if (restrictAudioAttributesAlarm()
                    && !CATEGORY_ALARM.equals(record.getNotification().category)
        if (!CATEGORY_ALARM.equals(record.getNotification().category)
               && attributes.getUsage() == AudioAttributes.USAGE_ALARM) {
            updateAttributes = true;
        }

            if (restrictAudioAttributesMedia()
                    && (attributes.getUsage() == AudioAttributes.USAGE_UNKNOWN
                    || attributes.getUsage() == AudioAttributes.USAGE_MEDIA)) {
        if (attributes.getUsage() == AudioAttributes.USAGE_UNKNOWN
                || attributes.getUsage() == AudioAttributes.USAGE_MEDIA) {
            updateAttributes = true;
        }

@@ -110,7 +102,6 @@ public class NotificationChannelExtractor implements NotificationSignalExtractor
                     .build());
            record.updateNotificationChannel(clone);
        }
        }

        return null;
    }
+4 −10
Original line number Diff line number Diff line
@@ -15,9 +15,6 @@
 */
package com.android.server.notification;

import static android.app.Flags.restrictAudioAttributesAlarm;
import static android.app.Flags.restrictAudioAttributesCall;
import static android.app.Flags.restrictAudioAttributesMedia;
import static android.app.Flags.sortSectionByTime;
import static android.app.NotificationChannel.USER_LOCKED_IMPORTANCE;
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
@@ -1245,8 +1242,6 @@ public final class NotificationRecord {
            calculateImportance();
            calculateUserSentiment();
            mVibration = calculateVibration();
            if (restrictAudioAttributesCall() || restrictAudioAttributesAlarm()
                    || restrictAudioAttributesMedia()) {
            if (channel.getAudioAttributes() != null) {
                mAttributes = channel.getAudioAttributes();
            } else {
@@ -1254,7 +1249,6 @@ public final class NotificationRecord {
            }
        }
    }
    }

    public void setShowBadge(boolean showBadge) {
        mShowBadge = showBadge;
+1 −7
Original line number Diff line number Diff line
@@ -15,9 +15,6 @@
 */
package com.android.server.notification;

import static android.app.Flags.restrictAudioAttributesAlarm;
import static android.app.Flags.restrictAudioAttributesCall;
import static android.app.Flags.restrictAudioAttributesMedia;
import static android.app.Flags.sortSectionByTime;
import static android.app.NotificationManager.IMPORTANCE_MIN;
import static android.text.TextUtils.formatSimple;
@@ -80,10 +77,7 @@ public class RankingHelper {
                extractor.setConfig(config);
                extractor.setZenHelper(zenHelper);
                extractor.setGroupHelper(groupHelper);
                if (restrictAudioAttributesAlarm() || restrictAudioAttributesMedia()
                        || restrictAudioAttributesCall()) {
                extractor.setCompatChangeLogger(platformCompat);
                }
                mSignalExtractors[i] = extractor;
            } catch (ClassNotFoundException e) {
                Slog.w(TAG, "Couldn't find extractor " + extractorNames[i] + ".", e);
Loading