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

Commit df3d59bf authored by Philip Junker's avatar Philip Junker
Browse files

Support for notification panel key on ATV

Add activity intents to open and toggle notification panel (requires
STATUS_BAR_SERVICE permission).
Add protected broadcast intent to close notification panel.
Make long-press-on-home configurable to open notification panel.
Create TvNotificationPanel class which forwards notification panel
requests to the configured handler.

Bug: 158661029
Test: manually tested on ATV device with adapted launcher
Change-Id: I555bb3801ac949c8985692b41b02323c56332ccd
parent 2c313a31
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -670,6 +670,9 @@ package android.app {
    method @Nullable public android.content.ComponentName getAllowedNotificationAssistant();
    method public boolean isNotificationAssistantAccessGranted(@NonNull android.content.ComponentName);
    method public void setNotificationAssistantAccessGranted(@Nullable android.content.ComponentName, boolean);
    field @RequiresPermission(android.Manifest.permission.STATUS_BAR_SERVICE) public static final String ACTION_CLOSE_NOTIFICATION_HANDLER_PANEL = "android.app.action.CLOSE_NOTIFICATION_HANDLER_PANEL";
    field @RequiresPermission(android.Manifest.permission.STATUS_BAR_SERVICE) public static final String ACTION_OPEN_NOTIFICATION_HANDLER_PANEL = "android.app.action.OPEN_NOTIFICATION_HANDLER_PANEL";
    field @RequiresPermission(android.Manifest.permission.STATUS_BAR_SERVICE) public static final String ACTION_TOGGLE_NOTIFICATION_HANDLER_PANEL = "android.app.action.TOGGLE_NOTIFICATION_HANDLER_PANEL";
  }
  public final class RuntimeAppOpAccessMessage implements android.os.Parcelable {
+68 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.app;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
@@ -130,6 +131,73 @@ public class NotificationManager {
    public static final String ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED =
            "android.app.action.NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED";

    /**
     * Activity action: Toggle notification panel of the specified handler.
     *
     * <p><strong>Important:</strong>You must protect the activity that handles this action with
     * the {@link android.Manifest.permission#STATUS_BAR_SERVICE} permission to ensure that only
     * the SystemUI can launch this activity. Activities that are not properly protected will not
     * be launched.
     *
     * <p class="note">This is currently only used on TV to allow a system app to handle the
     * notification panel. The package handling the notification panel has to be specified by
     * config_notificationHandlerPackage in values/config.xml.
     *
     * Input: nothing
     * Output: nothing
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.STATUS_BAR_SERVICE)
    @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_TOGGLE_NOTIFICATION_HANDLER_PANEL =
            "android.app.action.TOGGLE_NOTIFICATION_HANDLER_PANEL";

    /**
     * Activity action: Open notification panel of the specified handler.
     *
     * <p><strong>Important:</strong>You must protect the activity that handles this action with
     * the {@link android.Manifest.permission#STATUS_BAR_SERVICE} permission to ensure that only
     * the SystemUI can launch this activity. Activities that are not properly protected will
     * not be launched.
     *
     * <p class="note"> This is currently only used on TV to allow a system app to handle the
     * notification panel. The package handling the notification panel has to be specified by
     * config_notificationHandlerPackage in values/config.xml.
     *
     * Input: nothing
     * Output: nothing
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.STATUS_BAR_SERVICE)
    @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_OPEN_NOTIFICATION_HANDLER_PANEL =
            "android.app.action.OPEN_NOTIFICATION_HANDLER_PANEL";

    /**
     * Intent that is broadcast when the notification panel of the specified handler is to be
     * closed.
     *
     * <p><strong>Important:</strong>You should protect the receiver that handles this action with
     * the {@link android.Manifest.permission#STATUS_BAR_SERVICE} permission to ensure that only
     * the SystemUI can send this broadcast to the notification handler.
     *
     * <p class="note"> This is currently only used on TV to allow a system app to handle the
     * notification panel. The package handling the notification panel has to be specified by
     * config_notificationHandlerPackage in values/config.xml. This is a protected intent that can
     * only be sent by the system.
     *
     * Input: nothing.
     * Output: nothing.
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.STATUS_BAR_SERVICE)
    @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_CLOSE_NOTIFICATION_HANDLER_PANEL =
            "android.app.action.CLOSE_NOTIFICATION_HANDLER_PANEL";

    /**
     * Extra for {@link #ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED} containing the id of the
     * {@link NotificationChannel} which has a new blocked state.
+2 −0
Original line number Diff line number Diff line
@@ -107,6 +107,8 @@
    <!-- @deprecated This is rarely used and will be phased out soon. -->
    <protected-broadcast android:name="android.os.action.SCREEN_BRIGHTNESS_BOOST_CHANGED" />

    <protected-broadcast android:name="android.app.action.CLOSE_NOTIFICATION_HANDLER_PANEL" />

    <protected-broadcast android:name="android.app.action.ENTER_CAR_MODE" />
    <protected-broadcast android:name="android.app.action.EXIT_CAR_MODE" />
    <protected-broadcast android:name="android.app.action.ENTER_CAR_MODE_PRIORITIZED" />
+4 −0
Original line number Diff line number Diff line
@@ -1166,6 +1166,7 @@
            0 - Nothing
            1 - Launch all apps intent
            2 - Launch assist intent
            3 - Launch notification panel
         This needs to match the constants in
         policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
    -->
@@ -3389,6 +3390,9 @@
         service. -->
    <string name="config_tvRemoteServicePackage" translatable="false"></string>

    <!-- The package name of the package implementing the custom notification panel -->
    <string name="config_notificationHandlerPackage" translatable="false"></string>

    <!-- True if the device supports persisting security logs across reboots.
         This requires the device's kernel to have pstore and pmsg enabled,
         and DRAM to be powered and refreshed through all stages of reboot. -->
+3 −0
Original line number Diff line number Diff line
@@ -3047,6 +3047,9 @@
  <java-symbol type="string" name="config_tvRemoteServicePackage" />
  <java-symbol type="string" name="notification_messaging_title_template" />

  <!-- Notification handler / dashboard package -->
  <java-symbol type="string" name="config_notificationHandlerPackage" />

  <java-symbol type="bool" name="config_supportPreRebootSecurityLogs" />

  <java-symbol type="dimen" name="notification_media_image_margin_end" />
Loading