blob: 02ecd1392bc794afdf1ab019c51eb373afa1a258 [file] [log] [blame]
Yuncheol Heo63a2e062014-05-27 23:06:01 +09001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.hdmi;
18
Jungshik Jang61f4fbd2014-08-06 19:21:12 +090019import android.hardware.hdmi.HdmiDeviceInfo;
Jungshik Jangea67c182014-06-19 22:19:20 +090020import android.hardware.hdmi.IHdmiControlCallback;
Yuncheol Heo63a2e062014-05-27 23:06:01 +090021
22
23/**
24 * Feature action that handles System Audio initiated by TV devices.
25 */
26final class SystemAudioActionFromTv extends SystemAudioAction {
Yuncheol Heoc516d652014-07-11 18:23:24 +090027
Yuncheol Heo63a2e062014-05-27 23:06:01 +090028 /**
29 * Constructor
30 *
Jungshik Jang79c58a42014-06-16 16:45:36 +090031 * @param sourceAddress {@link HdmiCecLocalDevice} instance
Yuncheol Heo63a2e062014-05-27 23:06:01 +090032 * @param avrAddress logical address of AVR device
33 * @param targetStatus Whether to enable the system audio mode or not
Jungshik Jangea67c182014-06-19 22:19:20 +090034 * @param callback callback interface to be notified when it's done
Yuncheol Heo63a2e062014-05-27 23:06:01 +090035 * @throw IllegalArugmentException if device type of tvAddress is invalid
36 */
Jungshik Jang79c58a42014-06-16 16:45:36 +090037 SystemAudioActionFromTv(HdmiCecLocalDevice sourceAddress, int avrAddress,
Jungshik Jangea67c182014-06-19 22:19:20 +090038 boolean targetStatus, IHdmiControlCallback callback) {
39 super(sourceAddress, avrAddress, targetStatus, callback);
Jungshik Jang61f4fbd2014-08-06 19:21:12 +090040 HdmiUtils.verifyAddressType(getSourceAddress(), HdmiDeviceInfo.DEVICE_TV);
Yuncheol Heo63a2e062014-05-27 23:06:01 +090041 }
42
43 @Override
44 boolean start() {
Yuncheol Heo63a2e062014-05-27 23:06:01 +090045 removeSystemAudioActionInProgress();
46 sendSystemAudioModeRequest();
47 return true;
48 }
49}