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

Commit d05b0a7f authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Add support for Conversation settings"

parents ec10bfa3 882f2069
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40417,6 +40417,7 @@ package android.provider {
    field public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED = "android.settings.extra.battery_saver_mode_enabled";
    field public static final String EXTRA_BIOMETRIC_MINIMUM_STRENGTH_REQUIRED = "android.provider.extra.BIOMETRIC_MINIMUM_STRENGTH_REQUIRED";
    field public static final String EXTRA_CHANNEL_ID = "android.provider.extra.CHANNEL_ID";
    field public static final String EXTRA_CONVERSATION_ID = "android.provider.extra.CONVERSATION_ID";
    field public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED = "android.settings.extra.do_not_disturb_mode_enabled";
    field public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES = "android.settings.extra.do_not_disturb_mode_minutes";
    field public static final String EXTRA_EASY_CONNECT_ATTEMPTED_SSID = "android.provider.extra.EASY_CONNECT_ATTEMPTED_SSID";
+2 −1
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ interface INotificationManager
    void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList);
    void createNotificationChannels(String pkg, in ParceledListSlice channelsList);
    void createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList);
    ParceledListSlice getConversationsForPackage(String pkg, int uid);
    ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted);
    NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid);
    NotificationChannelGroup getPopulatedNotificationChannelGroupForPackage(String pkg, int uid, String groupId, boolean includeDeleted);
@@ -96,7 +97,7 @@ interface INotificationManager
    NotificationChannel getNotificationChannel(String callingPkg, int userId, String pkg, String channelId);
    NotificationChannel getConversationNotificationChannel(String callingPkg, int userId, String pkg, String channelId, boolean returnParentIfNoConversationChannel, String conversationId);
    void createConversationNotificationChannelForPackage(String pkg, int uid, String triggeringKey, in NotificationChannel parentChannel, String conversationId);
    NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, boolean includeDeleted);
    NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted);
    void deleteNotificationChannel(String pkg, String channelId);
    void deleteConversationNotificationChannels(String pkg, int uid, String conversationId);
    ParceledListSlice getNotificationChannels(String callingPkg, String targetPkg, int userId);
+11 −0
Original line number Diff line number Diff line
@@ -1829,6 +1829,17 @@ public final class Settings {
     */
    public static final String EXTRA_CHANNEL_ID = "android.provider.extra.CHANNEL_ID";
    /**
     * Activity Extra: The {@link NotificationChannel#getConversationId()} of the notification
     * conversation settings to display.
     * <p>
     * This is an optional extra field to the {@link #ACTION_CHANNEL_NOTIFICATION_SETTINGS}. If
     * included the system will first look up notification settings by channel and conversation id,
     * and will fall back to channel id if a specialized channel for this conversation doesn't
     * exist, similar to {@link NotificationManager#getNotificationChannel(String, String)}.
     */
    public static final String EXTRA_CONVERSATION_ID = "android.provider.extra.CONVERSATION_ID";
    /**
     * Activity Action: Show notification redaction settings.
     *
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2020, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.service.notification;

parcelable ConversationChannelWrapper;
 No newline at end of file
+122 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2020, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.service.notification;

import android.app.NotificationChannel;
import android.content.pm.ShortcutInfo;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.Objects;

/**
 * @hide
 */
public final class ConversationChannelWrapper implements Parcelable {

    private NotificationChannel mNotificationChannel;
    private CharSequence mGroupLabel;
    private CharSequence mParentChannelLabel;
    private ShortcutInfo mShortcutInfo;

    public ConversationChannelWrapper() {}

    protected ConversationChannelWrapper(Parcel in) {
        mNotificationChannel = in.readParcelable(NotificationChannel.class.getClassLoader());
        mGroupLabel = in.readCharSequence();
        mParentChannelLabel = in.readCharSequence();
        mShortcutInfo = in.readParcelable(ShortcutInfo.class.getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(mNotificationChannel, flags);
        dest.writeCharSequence(mGroupLabel);
        dest.writeCharSequence(mParentChannelLabel);
        dest.writeParcelable(mShortcutInfo, flags);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<ConversationChannelWrapper> CREATOR =
            new Creator<ConversationChannelWrapper>() {
                @Override
                public ConversationChannelWrapper createFromParcel(Parcel in) {
                    return new ConversationChannelWrapper(in);
                }

                @Override
                public ConversationChannelWrapper[] newArray(int size) {
                    return new ConversationChannelWrapper[size];
                }
            };


    public NotificationChannel getNotificationChannel() {
        return mNotificationChannel;
    }

    public void setNotificationChannel(
            NotificationChannel notificationChannel) {
        mNotificationChannel = notificationChannel;
    }

    public CharSequence getGroupLabel() {
        return mGroupLabel;
    }

    public void setGroupLabel(CharSequence groupLabel) {
        mGroupLabel = groupLabel;
    }

    public CharSequence getParentChannelLabel() {
        return mParentChannelLabel;
    }

    public void setParentChannelLabel(CharSequence parentChannelLabel) {
        mParentChannelLabel = parentChannelLabel;
    }

    public ShortcutInfo getShortcutInfo() {
        return mShortcutInfo;
    }

    public void setShortcutInfo(ShortcutInfo shortcutInfo) {
        mShortcutInfo = shortcutInfo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ConversationChannelWrapper that = (ConversationChannelWrapper) o;
        return Objects.equals(getNotificationChannel(), that.getNotificationChannel()) &&
                Objects.equals(getGroupLabel(), that.getGroupLabel()) &&
                Objects.equals(getParentChannelLabel(), that.getParentChannelLabel()) &&
                Objects.equals(getShortcutInfo(), that.getShortcutInfo());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getNotificationChannel(), getGroupLabel(), getParentChannelLabel(),
                getShortcutInfo());
    }
}
Loading