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

Commit 1a083939 authored by Rhiannon Malia's avatar Rhiannon Malia
Browse files

Adding suppressShowOverApps to TvExtender

This allows senders to override the default behavior on launcher for
max and high level notifications so that heads up messages for
those notifications do not pop up over non-launcher apps.

Test: ag/3508615
Change-Id: I90b85a5e959c1980a91881d23749e0f2b7b98b3b
Fixes: 72409064
parent ff73b838
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -335,11 +335,13 @@ package android.app {
    method public java.lang.String getChannelId();
    method public android.app.PendingIntent getContentIntent();
    method public android.app.PendingIntent getDeleteIntent();
    method public boolean getSuppressShowOverApps();
    method public boolean isAvailableOnTv();
    method public android.app.Notification.TvExtender setChannel(java.lang.String);
    method public android.app.Notification.TvExtender setChannelId(java.lang.String);
    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 setSuppressShowOverApps(boolean);
  }

  public final class NotificationChannel implements android.os.Parcelable {
+21 −0
Original line number Diff line number Diff line
@@ -8845,6 +8845,7 @@ public class Notification implements Parcelable
        private static final String EXTRA_CONTENT_INTENT = "content_intent";
        private static final String EXTRA_DELETE_INTENT = "delete_intent";
        private static final String EXTRA_CHANNEL_ID = "channel_id";
        private static final String EXTRA_SUPPRESS_SHOW_OVER_APPS = "suppressShowOverApps";

        // Flags bitwise-ored to mFlags
        private static final int FLAG_AVAILABLE_ON_TV = 0x1;
@@ -8853,6 +8854,7 @@ public class Notification implements Parcelable
        private String mChannelId;
        private PendingIntent mContentIntent;
        private PendingIntent mDeleteIntent;
        private boolean mSuppressShowOverApps;

        /**
         * Create a {@link TvExtender} with default options.
@@ -8872,6 +8874,7 @@ public class Notification implements Parcelable
            if (bundle != null) {
                mFlags = bundle.getInt(EXTRA_FLAGS);
                mChannelId = bundle.getString(EXTRA_CHANNEL_ID);
                mSuppressShowOverApps = bundle.getBoolean(EXTRA_SUPPRESS_SHOW_OVER_APPS);
                mContentIntent = bundle.getParcelable(EXTRA_CONTENT_INTENT);
                mDeleteIntent = bundle.getParcelable(EXTRA_DELETE_INTENT);
            }
@@ -8888,6 +8891,7 @@ public class Notification implements Parcelable

            bundle.putInt(EXTRA_FLAGS, mFlags);
            bundle.putString(EXTRA_CHANNEL_ID, mChannelId);
            bundle.putBoolean(EXTRA_SUPPRESS_SHOW_OVER_APPS, mSuppressShowOverApps);
            if (mContentIntent != null) {
                bundle.putParcelable(EXTRA_CONTENT_INTENT, mContentIntent);
            }
@@ -8980,6 +8984,23 @@ public class Notification implements Parcelable
        public PendingIntent getDeleteIntent() {
            return mDeleteIntent;
        }

        /**
         * Specifies whether this notification should suppress showing a message over top of apps
         * outside of the launcher.
         */
        public TvExtender setSuppressShowOverApps(boolean suppress) {
            mSuppressShowOverApps = suppress;
            return this;
        }

        /**
         * Returns true if this notification should not show messages over top of apps
         * outside of the launcher.
         */
        public boolean getSuppressShowOverApps() {
            return mSuppressShowOverApps;
        }
    }

    /**