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

Commit 08e2bcbc authored by Hall Liu's avatar Hall Liu Committed by Automerger Merge Worker
Browse files

Merge "Rename NotificationChannel#setBlockableSystem" into rvc-dev am: 2227afaa am: baf26eaf

Change-Id: I75156adb76d476707a45e86af3d09d14e2b03def
parents db513da2 baf26eaf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -665,7 +665,7 @@ package android.app {
    method public int getUserLockedFields();
    method public boolean isDeleted();
    method public void populateFromXml(org.xmlpull.v1.XmlPullParser);
    method public void setBlockableSystem(boolean);
    method public void setBlockable(boolean);
    method public org.json.JSONObject toJson() throws org.json.JSONException;
    method public void writeXml(org.xmlpull.v1.XmlSerializer) throws java.io.IOException;
    field public static final int USER_LOCKED_SOUND = 32; // 0x20
+2 −2
Original line number Diff line number Diff line
@@ -426,11 +426,11 @@ package android.app {

  public final class NotificationChannel implements android.os.Parcelable {
    method public int getOriginalImportance();
    method public boolean isBlockableSystem();
    method public boolean isBlockable();
    method public boolean isImportanceLockedByCriticalDeviceFunction();
    method public boolean isImportanceLockedByOEM();
    method public void lockFields(int);
    method public void setBlockableSystem(boolean);
    method public void setBlockable(boolean);
    method public void setDeleted(boolean);
    method public void setFgServiceShown(boolean);
    method public void setImportanceLockedByCriticalDeviceFunction(boolean);
+15 −12
Original line number Diff line number Diff line
@@ -370,15 +370,18 @@ public final class NotificationChannel implements Parcelable {

    /**
     * Allows users to block notifications sent through this channel, if this channel belongs to
     * a package that is signed with the system signature. If the channel does not belong to a
     * package that is signed with the system signature, this method does nothing.
     * @param blockableSystem if {@code true}, allows users to block notifications on this channel.
     * a package that is signed with the system signature.
     *
     * If the channel does not belong to a package that is signed with the system signature, this
     * method does nothing, since such channels are blockable by default and cannot be set to be
     * unblockable.
     * @param blockable if {@code true}, allows users to block notifications on this channel.
     * @hide
     */
    @SystemApi
    @TestApi
    public void setBlockableSystem(boolean blockableSystem) {
        mBlockableSystem = blockableSystem;
    public void setBlockable(boolean blockable) {
        mBlockableSystem = blockable;
    }
    // Modifiable by apps post channel creation

@@ -749,7 +752,7 @@ public final class NotificationChannel implements Parcelable {
     * @hide
     */
    @TestApi
    public boolean isBlockableSystem() {
    public boolean isBlockable() {
        return mBlockableSystem;
    }

@@ -873,7 +876,7 @@ public final class NotificationChannel implements Parcelable {
        setGroup(parser.getAttributeValue(null, ATT_GROUP));
        lockFields(safeInt(parser, ATT_USER_LOCKED, 0));
        setFgServiceShown(safeBool(parser, ATT_FG_SERVICE_SHOWN, false));
        setBlockableSystem(safeBool(parser, ATT_BLOCKABLE_SYSTEM, false));
        setBlockable(safeBool(parser, ATT_BLOCKABLE_SYSTEM, false));
        setAllowBubbles(safeBool(parser, ATT_ALLOW_BUBBLE, DEFAULT_ALLOW_BUBBLE));
        setOriginalImportance(safeInt(parser, ATT_ORIG_IMP, DEFAULT_IMPORTANCE));
        setConversationId(parser.getAttributeValue(null, ATT_PARENT_CHANNEL),
@@ -995,8 +998,8 @@ public final class NotificationChannel implements Parcelable {
        if (getGroup() != null) {
            out.attribute(null, ATT_GROUP, getGroup());
        }
        if (isBlockableSystem()) {
            out.attribute(null, ATT_BLOCKABLE_SYSTEM, Boolean.toString(isBlockableSystem()));
        if (isBlockable()) {
            out.attribute(null, ATT_BLOCKABLE_SYSTEM, Boolean.toString(isBlockable()));
        }
        if (canBubble() != DEFAULT_ALLOW_BUBBLE) {
            out.attribute(null, ATT_ALLOW_BUBBLE, Boolean.toString(canBubble()));
@@ -1060,7 +1063,7 @@ public final class NotificationChannel implements Parcelable {
        record.put(ATT_SHOW_BADGE, Boolean.toString(canShowBadge()));
        record.put(ATT_DELETED, Boolean.toString(isDeleted()));
        record.put(ATT_GROUP, getGroup());
        record.put(ATT_BLOCKABLE_SYSTEM, isBlockableSystem());
        record.put(ATT_BLOCKABLE_SYSTEM, isBlockable());
        record.put(ATT_ALLOW_BUBBLE, canBubble());
        // TODO: original importance
        return record;
@@ -1162,7 +1165,7 @@ public final class NotificationChannel implements Parcelable {
                && mVibrationEnabled == that.mVibrationEnabled
                && mShowBadge == that.mShowBadge
                && isDeleted() == that.isDeleted()
                && isBlockableSystem() == that.isBlockableSystem()
                && isBlockable() == that.isBlockable()
                && mAllowBubbles == that.mAllowBubbles
                && Objects.equals(getId(), that.getId())
                && Objects.equals(getName(), that.getName())
@@ -1186,7 +1189,7 @@ public final class NotificationChannel implements Parcelable {
                getLockscreenVisibility(), getSound(), mLights, getLightColor(),
                getUserLockedFields(),
                isFgServiceShown(), mVibrationEnabled, mShowBadge, isDeleted(), getGroup(),
                getAudioAttributes(), isBlockableSystem(), mAllowBubbles,
                getAudioAttributes(), isBlockable(), mAllowBubbles,
                mImportanceLockedByOEM, mImportanceLockedDefaultApp, mOriginalImportance,
                mParentId, mConversationId, mDemoted, mImportantConvo);
        result = 31 * result + Arrays.hashCode(mVibration);
+9 −9
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ public class SystemNotificationChannels {
                VIRTUAL_KEYBOARD,
                context.getString(R.string.notification_channel_virtual_keyboard),
                NotificationManager.IMPORTANCE_LOW);
        keyboard.setBlockableSystem(true);
        keyboard.setBlockable(true);
        channelsList.add(keyboard);

        final NotificationChannel physicalKeyboardChannel = new NotificationChannel(
@@ -74,7 +74,7 @@ public class SystemNotificationChannels {
                NotificationManager.IMPORTANCE_DEFAULT);
        physicalKeyboardChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI,
                Notification.AUDIO_ATTRIBUTES_DEFAULT);
        physicalKeyboardChannel.setBlockableSystem(true);
        physicalKeyboardChannel.setBlockable(true);
        channelsList.add(physicalKeyboardChannel);

        final NotificationChannel security = new NotificationChannel(
@@ -87,7 +87,7 @@ public class SystemNotificationChannels {
                CAR_MODE,
                context.getString(R.string.notification_channel_car_mode),
                NotificationManager.IMPORTANCE_LOW);
        car.setBlockableSystem(true);
        car.setBlockable(true);
        channelsList.add(car);

        channelsList.add(newAccountChannel(context));
@@ -96,14 +96,14 @@ public class SystemNotificationChannels {
                DEVELOPER,
                context.getString(R.string.notification_channel_developer),
                NotificationManager.IMPORTANCE_LOW);
        developer.setBlockableSystem(true);
        developer.setBlockable(true);
        channelsList.add(developer);

        final NotificationChannel developerImportant = new NotificationChannel(
                DEVELOPER_IMPORTANT,
                context.getString(R.string.notification_channel_developer_important),
                NotificationManager.IMPORTANCE_HIGH);
        developer.setBlockableSystem(true);
        developer.setBlockable(true);
        channelsList.add(developerImportant);

        final NotificationChannel updates = new NotificationChannel(
@@ -116,21 +116,21 @@ public class SystemNotificationChannels {
                NETWORK_STATUS,
                context.getString(R.string.notification_channel_network_status),
                NotificationManager.IMPORTANCE_LOW);
        network.setBlockableSystem(true);
        network.setBlockable(true);
        channelsList.add(network);

        final NotificationChannel networkAlertsChannel = new NotificationChannel(
                NETWORK_ALERTS,
                context.getString(R.string.notification_channel_network_alerts),
                NotificationManager.IMPORTANCE_HIGH);
        networkAlertsChannel.setBlockableSystem(true);
        networkAlertsChannel.setBlockable(true);
        channelsList.add(networkAlertsChannel);

        final NotificationChannel networkAvailable = new NotificationChannel(
                NETWORK_AVAILABLE,
                context.getString(R.string.notification_channel_network_available),
                NotificationManager.IMPORTANCE_LOW);
        networkAvailable.setBlockableSystem(true);
        networkAvailable.setBlockable(true);
        channelsList.add(networkAvailable);

        final NotificationChannel vpn = new NotificationChannel(
@@ -167,7 +167,7 @@ public class SystemNotificationChannels {
                FOREGROUND_SERVICE,
                context.getString(R.string.notification_channel_foreground_service),
                NotificationManager.IMPORTANCE_LOW);
        foregroundChannel.setBlockableSystem(true);
        foregroundChannel.setBlockable(true);
        channelsList.add(foregroundChannel);

        NotificationChannel heavyWeightChannel = new NotificationChannel(
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ class PackageInstalledNotificationUtils {
        channel.enableVibration(false);
        channel.setSound(null, null);
        channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
        channel.setBlockableSystem(true);
        channel.setBlockable(true);

        mNotificationManager.createNotificationChannel(channel);
    }
Loading