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

Commit d11b9e77 authored by Dmitri Plotnikov's avatar Dmitri Plotnikov Committed by Android (Google) Code Review
Browse files

Merge "Adding TvExtender channel override"

parents 5f1a2a34 b8a04eee
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -5504,9 +5504,11 @@ package android.app {
    ctor public Notification.TvExtender();
    ctor public Notification.TvExtender();
    ctor public Notification.TvExtender(android.app.Notification);
    ctor public Notification.TvExtender(android.app.Notification);
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public java.lang.String getChannel();
    method public android.app.PendingIntent getContentIntent();
    method public android.app.PendingIntent getContentIntent();
    method public android.app.PendingIntent getDeleteIntent();
    method public android.app.PendingIntent getDeleteIntent();
    method public boolean isAvailableOnTv();
    method public boolean isAvailableOnTv();
    method public android.app.Notification.TvExtender setChannel(java.lang.String);
    method public android.app.Notification.TvExtender setContentIntent(android.app.PendingIntent);
    method public android.app.Notification.TvExtender setContentIntent(android.app.PendingIntent);
    method public android.app.Notification.TvExtender setDeleteIntent(android.app.PendingIntent);
    method public android.app.Notification.TvExtender setDeleteIntent(android.app.PendingIntent);
  }
  }
+21 −0
Original line number Original line Diff line number Diff line
@@ -7088,11 +7088,13 @@ public class Notification implements Parcelable
        private static final String EXTRA_FLAGS = "flags";
        private static final String EXTRA_FLAGS = "flags";
        private static final String EXTRA_CONTENT_INTENT = "content_intent";
        private static final String EXTRA_CONTENT_INTENT = "content_intent";
        private static final String EXTRA_DELETE_INTENT = "delete_intent";
        private static final String EXTRA_DELETE_INTENT = "delete_intent";
        private static final String EXTRA_CHANNEL_ID = "channel_id";


        // Flags bitwise-ored to mFlags
        // Flags bitwise-ored to mFlags
        private static final int FLAG_AVAILABLE_ON_TV = 0x1;
        private static final int FLAG_AVAILABLE_ON_TV = 0x1;


        private int mFlags;
        private int mFlags;
        private String mChannelId;
        private PendingIntent mContentIntent;
        private PendingIntent mContentIntent;
        private PendingIntent mDeleteIntent;
        private PendingIntent mDeleteIntent;


@@ -7113,6 +7115,7 @@ public class Notification implements Parcelable
                null : notif.extras.getBundle(EXTRA_TV_EXTENDER);
                null : notif.extras.getBundle(EXTRA_TV_EXTENDER);
            if (bundle != null) {
            if (bundle != null) {
                mFlags = bundle.getInt(EXTRA_FLAGS);
                mFlags = bundle.getInt(EXTRA_FLAGS);
                mChannelId = bundle.getString(EXTRA_CHANNEL_ID);
                mContentIntent = bundle.getParcelable(EXTRA_CONTENT_INTENT);
                mContentIntent = bundle.getParcelable(EXTRA_CONTENT_INTENT);
                mDeleteIntent = bundle.getParcelable(EXTRA_DELETE_INTENT);
                mDeleteIntent = bundle.getParcelable(EXTRA_DELETE_INTENT);
            }
            }
@@ -7128,6 +7131,7 @@ public class Notification implements Parcelable
            Bundle bundle = new Bundle();
            Bundle bundle = new Bundle();


            bundle.putInt(EXTRA_FLAGS, mFlags);
            bundle.putInt(EXTRA_FLAGS, mFlags);
            bundle.putString(EXTRA_CHANNEL_ID, mChannelId);
            if (mContentIntent != null) {
            if (mContentIntent != null) {
                bundle.putParcelable(EXTRA_CONTENT_INTENT, mContentIntent);
                bundle.putParcelable(EXTRA_CONTENT_INTENT, mContentIntent);
            }
            }
@@ -7148,6 +7152,23 @@ public class Notification implements Parcelable
            return (mFlags & FLAG_AVAILABLE_ON_TV) != 0;
            return (mFlags & FLAG_AVAILABLE_ON_TV) != 0;
        }
        }


        /**
         * Specifies the channel the notification should be delivered on when shown on TV.
         * It can be different from the channel that the notification is delivered to when
         * posting on a non-TV device.
         */
        public TvExtender setChannel(String channelId) {
            mChannelId = channelId;
            return this;
        }

        /**
         * Returns the id of the channel this notification posts to on TV.
         */
        public String getChannel() {
            return mChannelId;
        }

        /**
        /**
         * Supplies a {@link PendingIntent} to be sent when the notification is selected on TV.
         * Supplies a {@link PendingIntent} to be sent when the notification is selected on TV.
         * If provided, it is used instead of the content intent specified
         * If provided, it is used instead of the content intent specified