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

Commit 41d370b6 authored by Paul Colta's avatar Paul Colta Committed by Android (Google) Code Review
Browse files

Merge "HDMI: Include intents that are implemented in HdmiControlManager" into main

parents 682c2627 49d3c9e8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -299,6 +299,9 @@

    <protected-broadcast android:name="android.hardware.display.action.WIFI_DISPLAY_STATUS_CHANGED" />

    <protected-broadcast android:name="android.hardware.hdmi.action.OSD_MESSAGE" />
    <protected-broadcast android:name="android.hardware.hdmi.action.ON_ACTIVE_SOURCE_RECOVERED_DISMISS_UI" />

    <protected-broadcast android:name="android.hardware.usb.action.USB_STATE" />
    <protected-broadcast android:name="android.hardware.usb.action.USB_PORT_CHANGED" />
    <protected-broadcast android:name="android.hardware.usb.action.USB_PORT_COMPLIANCE_CHANGED" />
+1 −3
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.os.Binder;
import android.os.Handler;
import android.os.PowerManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.sysprop.HdmiProperties;
import android.util.Slog;

@@ -278,8 +277,7 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
    void dismissUiOnActiveSourceStatusRecovered() {
        assertRunOnServiceThread();
        Intent intent = new Intent(HdmiControlManager.ACTION_ON_ACTIVE_SOURCE_RECOVERED_DISMISS_UI);
        mService.getContext().sendBroadcastAsUser(intent, UserHandle.ALL,
                HdmiControlService.PERMISSION);
        mService.sendBroadcastAsUser(intent);
    }

    @Override
+13 −4
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import static com.android.server.power.ShutdownThread.SHUTDOWN_ACTION_PROPERTY;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -4392,8 +4393,7 @@ public class HdmiControlService extends SystemService {
        assertRunOnServiceThread();
        Intent intent = new Intent(HdmiControlManager.ACTION_OSD_MESSAGE);
        intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_ID, messageId);
        getContext().sendBroadcastAsUser(intent, UserHandle.ALL,
                HdmiControlService.PERMISSION);
        sendBroadcastAsUser(intent);
    }

    @ServiceThreadOnly
@@ -4402,8 +4402,17 @@ public class HdmiControlService extends SystemService {
        Intent intent = new Intent(HdmiControlManager.ACTION_OSD_MESSAGE);
        intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_ID, messageId);
        intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_EXTRA_PARAM1, extra);
        getContext().sendBroadcastAsUser(intent, UserHandle.ALL,
                HdmiControlService.PERMISSION);
        sendBroadcastAsUser(intent);
    }

    // This method is used such that we can override it inside unit tests to avoid a
    // SecurityException.
    @ServiceThreadOnly
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
    @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS)
    protected void sendBroadcastAsUser(@RequiresPermission Intent intent) {
        assertRunOnServiceThread();
        getContext().sendBroadcastAsUser(intent, UserHandle.ALL, HdmiControlService.PERMISSION);
    }

    @VisibleForTesting
+7 −0
Original line number Diff line number Diff line
@@ -24,8 +24,10 @@ import static com.google.common.truth.Truth.assertThat;

import static org.mockito.Mockito.spy;

import android.annotation.RequiresPermission;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.os.Looper;
import android.os.test.TestLooper;
import android.platform.test.annotations.Presubmit;
@@ -72,6 +74,11 @@ public class ActiveSourceActionTest {
            protected void writeStringSystemProperty(String key, String value) {
                // do nothing
            }

            @Override
            protected void sendBroadcastAsUser(@RequiresPermission Intent intent) {
                // do nothing
            }
        };

        Looper looper = mTestLooper.getLooper();
+7 −0
Original line number Diff line number Diff line
@@ -22,8 +22,10 @@ import static com.google.common.truth.Truth.assertThat;

import static org.mockito.Mockito.spy;

import android.annotation.RequiresPermission;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.hardware.tv.cec.V1_0.SendMessageResult;
import android.os.Looper;
import android.os.test.TestLooper;
@@ -84,6 +86,11 @@ public class ArcInitiationActionFromAvrTest {
                    protected Looper getServiceLooper() {
                        return mTestLooper.getLooper();
                    }

                    @Override
                    protected void sendBroadcastAsUser(@RequiresPermission Intent intent) {
                        // do nothing
                    }
                };

        mHdmiCecLocalDeviceAudioSystem = new HdmiCecLocalDeviceAudioSystem(hdmiControlService) {
Loading