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

Commit c7eba0f1 authored by Jinsuk Kim's avatar Jinsuk Kim
Browse files

Intent definition for HdmiControlService for OSD display

Intent action/extra for TV app to show a message on screen about events
HdmiControlService need to report for user's attention. The app
needs system permission HDMI_CEC to receive the intent.

Change-Id: I4fbe4621efa20a17ca64a3ca8f2df64bee03c51b
parent 347a6044
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package android.hardware.hdmi;

import android.annotation.Nullable;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.os.RemoteException;

@@ -36,6 +38,22 @@ import android.os.RemoteException;
public final class HdmiControlManager {
    @Nullable private final IHdmiControlService mService;

    /**
     * Broadcast Action: Display OSD message.
     * <p>Send when the service has a message to display on screen for events
     * that need user's attention such as ARC status change.
     * <p>Always contains the extra fields {@link #EXTRA_MESSAGE}.
     * <p>Requires {@link android.Manifest.permission#HDMI_CEC} to receive.
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_OSD_MESSAGE = "android.hardware.hdmi.action.OSD_MESSAGE";

    /**
     * Used as an extra field in the intent {@link #ACTION_OSD_MESSAGE}. Contains the ID of
     * the message to display on screen.
     */
    public static final String EXTRA_MESSAGE_ID = "android.hardware.hdmi.extra.MESSAGE_ID";

    public static final int POWER_STATUS_UNKNOWN = -1;
    public static final int POWER_STATUS_ON = 0;
    public static final int POWER_STATUS_STANDBY = 1;
+8 −0
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@

package com.android.server.hdmi;

import android.content.Intent;
import android.hardware.hdmi.HdmiCecDeviceInfo;
import android.hardware.hdmi.HdmiControlManager;
import android.hardware.hdmi.IHdmiControlCallback;
import android.media.AudioSystem;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Slog;
import android.util.SparseArray;

@@ -1052,5 +1054,11 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {

    boolean isPowerStandbyOrTransient() {
        return mService.isPowerStandbyOrTransient();

    void displayOsd(int messageId) {
        Intent intent = new Intent(HdmiControlManager.ACTION_OSD_MESSAGE);
        intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_ID, messageId);
        mService.getContext().sendBroadcastAsUser(intent, UserHandle.ALL,
                HdmiControlService.PERMISSION);
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -62,8 +62,7 @@ import java.util.List;
public final class HdmiControlService extends SystemService {
    private static final String TAG = "HdmiControlService";

    // TODO: Rename the permission to HDMI_CONTROL.
    private static final String PERMISSION = "android.permission.HDMI_CEC";
    static final String PERMISSION = "android.permission.HDMI_CEC";

    /**
     * Interface to report send result.