--- /dev/null
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.hdmi;
+
+/**
+ * HdmiAudioSystemClient represents HDMI-CEC logical device of type Audio System
+ * in the Android system which acts as an audio system device such as sound bar.
+ *
+ * <p>HdmiAudioSystemClient provides methods that control, get information from TV/Display device
+ * connected through HDMI bus.
+ *
+ * @hide
+ */
+public final class HdmiAudioSystemClient extends HdmiClient {
+ private static final String TAG = "HdmiAudioSystemClient";
+
+ /* package */ HdmiAudioSystemClient(IHdmiControlService service) {
+ super(service);
+ }
+
+ /**
+ * TODO(b/110094868): unhide and add @SystemApi for Q
+ * @hide
+ */
+ @Override
+ public int getDeviceType() {
+ return HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM;
+ }
+}
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.pm.PackageManager;
import android.annotation.SystemApi;
import android.annotation.SystemService;
+import android.content.Context;
+import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.util.ArrayMap;
import android.util.Log;
private final boolean mHasPlaybackDevice;
// True if we have a logical device of type TV hosted in the system.
private final boolean mHasTvDevice;
+ // True if we have a logical device of type audio system hosted in the system.
+ private final boolean mHasAudioSystemDevice;
/**
* {@hide} - hide this constructor because it has a parameter of type IHdmiControlService,
}
mHasTvDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_TV);
mHasPlaybackDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_PLAYBACK);
+ mHasAudioSystemDevice = hasDeviceType(types, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
}
private static boolean hasDeviceType(int[] types, int type) {
* @return {@link HdmiClient} instance. {@code null} on failure.
* See {@link HdmiDeviceInfo#DEVICE_PLAYBACK}
* See {@link HdmiDeviceInfo#DEVICE_TV}
+ * See {@link HdmiDeviceInfo#DEVICE_AUDIO_SYSTEM}
*/
@Nullable
@SuppressLint("Doclava125")
return mHasTvDevice ? new HdmiTvClient(mService) : null;
case HdmiDeviceInfo.DEVICE_PLAYBACK:
return mHasPlaybackDevice ? new HdmiPlaybackClient(mService) : null;
+ case HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM:
+ return mHasAudioSystemDevice ? new HdmiAudioSystemClient(mService) : null;
default:
return null;
}
}
/**
+ * Gets an object that represents an HDMI-CEC logical device of type audio system on the system.
+ *
+ * <p>Used to send HDMI control messages to other devices like TV through HDMI bus. It is also
+ * possible to communicate with other logical devices hosted in the same system if the system is
+ * configured to host more than one type of HDMI-CEC logical devices.
+ *
+ * @return {@link HdmiAudioSystemClient} instance. {@code null} on failure.
+ *
+ * TODO(b/110094868): unhide for Q
+ * @hide
+ */
+ @Nullable
+ @SuppressLint("Doclava125")
+ public HdmiAudioSystemClient getAudioSystemClient() {
+ return (HdmiAudioSystemClient) getClient(HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
+ }
+
+ /**
* Controls standby mode of the system. It will also try to turn on/off the connected devices if
* necessary.
*