diff --git a/Android.mk b/Android.mk
index a1d91c363b0b3..c1de8a05bb92b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -146,8 +146,6 @@ LOCAL_SRC_FILES += \
core/java/android/hardware/ISerialManager.aidl \
core/java/android/hardware/display/IDisplayManager.aidl \
core/java/android/hardware/display/IDisplayManagerCallback.aidl \
- core/java/android/hardware/hdmi/IHdmiCecListener.aidl \
- core/java/android/hardware/hdmi/IHdmiCecService.aidl \
core/java/android/hardware/hdmi/IHdmiControlCallback.aidl \
core/java/android/hardware/hdmi/IHdmiControlService.aidl \
core/java/android/hardware/hdmi/IHdmiHotplugEventListener.aidl \
diff --git a/api/current.txt b/api/current.txt
index bb7e57d9fb0ed..6cbcadceb07e9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6993,7 +6993,6 @@ package android.content {
field public static final java.lang.String DISPLAY_SERVICE = "display";
field public static final java.lang.String DOWNLOAD_SERVICE = "download";
field public static final java.lang.String DROPBOX_SERVICE = "dropbox";
- field public static final java.lang.String HDMI_CEC_SERVICE = "hdmi_cec";
field public static final java.lang.String HDMI_CONTROL_SERVICE = "hdmi_control";
field public static final java.lang.String INPUT_METHOD_SERVICE = "input_method";
field public static final java.lang.String INPUT_SERVICE = "input";
@@ -12828,21 +12827,6 @@ package android.hardware.hdmi {
field public static final int UNKNOWN_VENDOR_ID = 16777215; // 0xffffff
}
- public final class HdmiCecClient {
- method public boolean isTvOn();
- method public void sendActiveSource();
- method public void sendGiveDevicePowerStatus(int);
- method public void sendImageViewOn();
- method public void sendInactiveSource();
- method public void sendTextViewOn();
- }
-
- public static abstract class HdmiCecClient.Listener {
- ctor public HdmiCecClient.Listener();
- method public void onCableStatusChanged(boolean);
- method public void onMessageReceived(android.hardware.hdmi.HdmiCecMessage);
- }
-
public final class HdmiCecDeviceInfo implements android.os.Parcelable {
method public int describeContents();
method public int getDeviceType();
@@ -12854,10 +12838,6 @@ package android.hardware.hdmi {
field public static final android.os.Parcelable.Creator CREATOR;
}
- public final class HdmiCecManager {
- method public android.hardware.hdmi.HdmiCecClient getClient(int, android.hardware.hdmi.HdmiCecClient.Listener);
- }
-
public final class HdmiCecMessage implements android.os.Parcelable {
ctor public HdmiCecMessage(int, int, int, byte[]);
method public int describeContents();
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index ac25a5315e3a3..5bbc43cba2cfe 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -57,9 +57,7 @@ import android.hardware.ConsumerIrManager;
import android.hardware.ISerialManager;
import android.hardware.SerialManager;
import android.hardware.SystemSensorManager;
-import android.hardware.hdmi.HdmiCecManager;
import android.hardware.hdmi.HdmiControlManager;
-import android.hardware.hdmi.IHdmiCecService;
import android.hardware.hdmi.IHdmiControlService;
import android.hardware.camera2.CameraManager;
import android.hardware.display.DisplayManager;
@@ -384,12 +382,6 @@ class ContextImpl extends Context {
return new BluetoothManager(ctx);
}});
- registerService(HDMI_CEC_SERVICE, new StaticServiceFetcher() {
- public Object createStaticService() {
- IBinder b = ServiceManager.getService(HDMI_CEC_SERVICE);
- return new HdmiCecManager(IHdmiCecService.Stub.asInterface(b));
- }});
-
registerService(HDMI_CONTROL_SERVICE, new StaticServiceFetcher() {
public Object createStaticService() {
IBinder b = ServiceManager.getService(HDMI_CONTROL_SERVICE);
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 9baac3244ee18..571bb4d2ea1ab 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2148,8 +2148,6 @@ public abstract class Context {
* @see android.app.SearchManager
* @see #SENSOR_SERVICE
* @see android.hardware.SensorManager
- * @see #HDMI_CEC_SERVICE
- * @see android.hardware.hdmi.HdmiCecManager
* @see #STORAGE_SERVICE
* @see android.os.storage.StorageManager
* @see #VIBRATOR_SERVICE
@@ -2636,17 +2634,6 @@ public abstract class Context {
*/
public static final String SERIAL_SERVICE = "serial";
- /**
- * Use with {@link #getSystemService} to retrieve a
- * {@link android.hardware.hdmi.HdmiCecManager} for controlling and managing
- * HDMI-CEC protocol.
- *
- * @see #getSystemService
- * @see android.hardware.hdmi.HdmiCecManager
- */
- // TODO: Remove this once HdmiControlService is ready.
- public static final String HDMI_CEC_SERVICE = "hdmi_cec";
-
/**
* Use with {@link #getSystemService} to retrieve a
* {@link android.hardware.hdmi.HdmiControlManager} for controlling and managing
diff --git a/core/java/android/hardware/hdmi/HdmiCecClient.java b/core/java/android/hardware/hdmi/HdmiCecClient.java
deleted file mode 100644
index dcb362457e835..0000000000000
--- a/core/java/android/hardware/hdmi/HdmiCecClient.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2014 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;
-
-import android.os.IBinder;
-import android.os.RemoteException;
-
-import android.util.Log;
-
-/**
- * HdmiCecClient is used to control HDMI-CEC logical device instance in the system.
- * It is connected to actual hardware part via HdmiCecService. It provides with methods
- * to send CEC messages to other device on the bus, and listener that allows to receive
- * incoming messages to the device.
- */
-public final class HdmiCecClient {
- private static final String TAG = "HdmiCecClient";
-
- private final IHdmiCecService mService;
- private final IBinder mBinder;
-
- /**
- * Listener used by the client to get the incoming messages.
- */
- public static abstract class Listener {
- /**
- * Called when CEC message arrives. Override this method to receive the incoming
- * CEC messages from other device on the bus.
- *
- * @param message {@link HdmiCecMessage} object
- */
- public void onMessageReceived(HdmiCecMessage message) { }
-
- /**
- * Called when hotplug event occurs. Override this method to receive the events.
- *
- * @param connected true if the cable is connected; otherwise false.
- */
- public void onCableStatusChanged(boolean connected) { }
- }
-
- // Private constructor.
- private HdmiCecClient(IHdmiCecService service, IBinder b) {
- mService = service;
- mBinder = b;
- }
-
- // Factory method for HdmiCecClient.
- // Declared package-private. Accessed by HdmiCecManager only.
- static HdmiCecClient create(IHdmiCecService service, IBinder b) {
- return new HdmiCecClient(service, b);
- }
-
- /**
- * Send <Active Source> message.
- */
- public void sendActiveSource() {
- Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
- }
-
- /**
- * Send <Inactive Source> message.
- */
- public void sendInactiveSource() {
- Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
- }
-
- /**
- * Send <Text View On> message.
- */
- public void sendTextViewOn() {
- Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
- }
-
- /**
- * Send <Image View On> message.
- */
- public void sendImageViewOn() {
- Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
- }
-
- /**
- * Send <Give Device Power Status> message.
- *
- * @param address logical address of the device to send the message to, such as
- * {@link HdmiCec#ADDR_TV}.
- */
- public void sendGiveDevicePowerStatus(int address) {
- Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
- }
-
- /**
- * Returns true if the TV or attached display is powered on.
- *
- * The result of this method is only meaningful on playback devices (where the device
- * type is {@link HdmiCec#DEVICE_PLAYBACK}).
- *
- *
- * @return true if TV is on; otherwise false.
- */
- public boolean isTvOn() {
- Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
- return true;
- }
-}
diff --git a/core/java/android/hardware/hdmi/HdmiCecManager.java b/core/java/android/hardware/hdmi/HdmiCecManager.java
deleted file mode 100644
index 03c46d881465f..0000000000000
--- a/core/java/android/hardware/hdmi/HdmiCecManager.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2014 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;
-
-import android.os.IBinder;
-import android.os.RemoteException;
-
-/**
- * The HdmiCecManager class is used to provide an HdmiCecClient instance,
- * get various information on HDMI ports configuration. It is connected to actual hardware
- * via HdmiCecService.
- */
-public final class HdmiCecManager {
- private final IHdmiCecService mService;
-
- /**
- * @hide - hide this constructor because it has a parameter of type IHdmiCecService,
- * which is a system private class. The right way to create an instance of this class
- * is using the factory Context.getSystemService.
- */
- public HdmiCecManager(IHdmiCecService service) {
- mService = service;
- }
-
- /**
- * Provide the HdmiCecClient instance of the given type. It also registers the listener
- * for client to get the events coming to the device.
- *
- * @param type type of the HDMI-CEC logical device
- * @param listener listener to be called
- * @return {@link HdmiCecClient} instance. {@code null} on failure.
- */
- public HdmiCecClient getClient(int type, HdmiCecClient.Listener listener) {
- return HdmiCecClient.create(mService, null);
- }
-
- private IHdmiCecListener getListenerWrapper(final HdmiCecClient.Listener listener) {
- // TODO: The message/events are not yet forwarded to client since it is not clearly
- // defined as to how/who to handle them. Revisit it once the decision is
- // made on what messages will have to reach the clients, what will be
- // handled by service/manager.
- return new IHdmiCecListener.Stub() {
- @Override
- public void onMessageReceived(HdmiCecMessage message) {
- // Do nothing.
- }
-
- @Override
- public void onCableStatusChanged(boolean connected) {
- // Do nothing.
- }
- };
- }
-}
diff --git a/core/java/android/hardware/hdmi/IHdmiCecListener.aidl b/core/java/android/hardware/hdmi/IHdmiCecListener.aidl
deleted file mode 100644
index d281ce6f4702f..0000000000000
--- a/core/java/android/hardware/hdmi/IHdmiCecListener.aidl
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2014 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;
-
-import android.hardware.hdmi.HdmiCecMessage;
-
-/**
- * Interface definition for HdmiCecService to do interprocess communcation.
- *
- * @hide
- */
-oneway interface IHdmiCecListener {
- void onMessageReceived(in HdmiCecMessage message);
- void onCableStatusChanged(in boolean connected);
-}
diff --git a/core/java/android/hardware/hdmi/IHdmiCecService.aidl b/core/java/android/hardware/hdmi/IHdmiCecService.aidl
deleted file mode 100644
index ecdd345eec4c5..0000000000000
--- a/core/java/android/hardware/hdmi/IHdmiCecService.aidl
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2014 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;
-
-import android.hardware.hdmi.HdmiCecMessage;
-import android.hardware.hdmi.IHdmiCecListener;
-import android.os.IBinder;
-
-/**
- * Binder interface that components running in the appplication process
- * will use to enable HDMI-CEC protocol exchange with other devices.
- *
- * @hide
- */
-interface IHdmiCecService {
- IBinder allocateLogicalDevice(int type, IHdmiCecListener listener);
- void removeServiceListener(IBinder b, IHdmiCecListener listener);
- void sendActiveSource(IBinder b);
- void sendInactiveSource(IBinder b);
- void sendImageViewOn(IBinder b);
- void sendTextViewOn(IBinder b);
- void sendGiveDevicePowerStatus(IBinder b, int address);
- boolean isTvOn(IBinder b);
- void sendMessage(IBinder b, in HdmiCecMessage message);
-}
-
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecDevice.java
deleted file mode 100644
index baae1d99f9fc3..0000000000000
--- a/services/core/java/com/android/server/hdmi/HdmiCecDevice.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.server.hdmi;
-
-import android.hardware.hdmi.HdmiCec;
-import android.hardware.hdmi.HdmiCecMessage;
-import android.hardware.hdmi.IHdmiCecListener;
-import android.os.Binder;
-import android.os.RemoteException;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * HdmiCecDevice class represents a CEC logical device characterized
- * by its device type. It is a superclass of those serving concrete device type.
- * Currently we're interested in playback(one of sources), display(sink) device type
- * only. The support for the other types like recorder, audio system will come later.
- *
- * A physical device can contain the functions of
- * more than one logical device, in which case it should create
- * as many logical devices as necessary.
- *
- *
Note that if a physical device has multiple instances of a particular
- * functionality, it should advertize only one instance. For instance, if
- * a device has multiple tuners, it should only expose one for control
- * via CEC. In this case, it is up to the device itself to manage multiple tuners.
- *
- *
The version of HDMI-CEC protocol supported in this class is 1.3a.
- *
- *
Declared as package-private, accessed by HdmiCecService only.
- */
-abstract class HdmiCecDevice {
- private static final String TAG = "HdmiCecDevice";
-
- private final int mType;
-
- // List of listeners to the message/event coming to the device.
- private final List mListeners = new ArrayList();
- private final Binder mBinder = new Binder();
- private final HdmiCecService mService;
-
- private boolean mIsActiveSource;
-
- /**
- * Factory method that creates HdmiCecDevice instance to the device type.
- */
- public static HdmiCecDevice create(HdmiCecService service, int type) {
- if (type == HdmiCec.DEVICE_PLAYBACK) {
- return new HdmiCecDevicePlayback(service, type);
- } else if (type == HdmiCec.DEVICE_TV) {
- return new HdmiCecDeviceTv(service, type);
- }
- return null;
- }
-
- /**
- * Constructor.
- */
- public HdmiCecDevice(HdmiCecService service, int type) {
- mService = service;
- mType = type;
- mIsActiveSource = false;
- }
-
- /**
- * Called right after the class is instantiated. This method can be used to
- * implement any initialization tasks for the instance.
- */
- abstract public void initialize();
-
- /**
- * Return the binder token that identifies this instance.
- */
- public Binder getToken() {
- return mBinder;
- }
-
- /**
- * Return the service instance.
- */
- public HdmiCecService getService() {
- return mService;
- }
-
- /**
- * Return the type of this device.
- */
- public int getType() {
- return mType;
- }
-
- /**
- * Register a listener to be invoked when events occur.
- *
- * @param listener the listern that will run
- */
- public void addListener(IHdmiCecListener listener) {
- mListeners.add(listener);
- }
-
- /**
- * Remove the listener that was previously registered.
- *
- * @param listener IHdmiCecListener instance to be removed
- */
- public void removeListener(IHdmiCecListener listener) {
- mListeners.remove(listener);
- }
-
- /**
- * Indicate if the device has listeners.
- *
- * @return true if there are listener instances for this device
- */
- public boolean hasListener() {
- return !mListeners.isEmpty();
- }
-
- /**
- * Handle HDMI-CEC message coming to the device by invoking the registered
- * listeners.
- */
- public void handleMessage(int srcAddress, int dstAddress, int opcode, byte[] params) {
- if (opcode == HdmiCec.MESSAGE_ACTIVE_SOURCE) {
- mIsActiveSource = false;
- }
-
- if (mListeners.size() == 0) {
- return;
- }
- HdmiCecMessage message = new HdmiCecMessage(srcAddress, dstAddress, opcode, params);
- for (IHdmiCecListener listener : mListeners) {
- try {
- listener.onMessageReceived(message);
- } catch (RemoteException e) {
- Log.e(TAG, "listener.onMessageReceived failed.");
- }
- }
- }
-
- public void handleHotplug(boolean connected) {
- for (IHdmiCecListener listener : mListeners) {
- try {
- listener.onCableStatusChanged(connected);
- } catch (RemoteException e) {
- Log.e(TAG, "listener.onCableStatusChanged failed.");
- }
- }
- }
-
- /**
- * Return the active status of the device.
- *
- * @return true if the device is the active source among the connected
- * HDMI-CEC-enabled devices; otherwise false.
- */
- public boolean isActiveSource() {
- return mIsActiveSource;
- }
-
- /**
- * Update the active source state of the device.
- */
- public void setIsActiveSource(boolean state) {
- mIsActiveSource = state;
- }
-
- /**
- * Send <Active Source> command. The default implementation does nothing. Should be
- * overriden by subclass.
- */
- public void sendActiveSource(int physicalAddress) {
- logWarning(" not valid for the device type: " + mType
- + " address:" + physicalAddress);
- }
-
- /**
- * Send <Inactive Source> command. The default implementation does nothing. Should be
- * overriden by subclass.
- */
- public void sendInactiveSource(int physicalAddress) {
- logWarning(" not valid for the device type: " + mType
- + " address:" + physicalAddress);
- }
-
- /**
- * Send <Image View On> command. The default implementation does nothing. Should be
- * overriden by subclass.
- */
- public void sendImageViewOn() {
- logWarning(" not valid for the device type: " + mType);
- }
-
- /**
- * Send <Text View On> command. The default implementation does nothing. Should be
- * overriden by subclass.
- */
- public void sendTextViewOn() {
- logWarning(" not valid for the device type: " + mType);
- }
-
- /**
- * Check if the connected sink device is in powered-on state. The default implementation
- * simply returns false. Should be overriden by subclass to report the correct state.
- */
- public boolean isSinkDeviceOn() {
- logWarning("isSinkDeviceOn() not valid for the device type: " + mType);
- return false;
- }
-
- private void logWarning(String msg) {
- Log.w(TAG, msg);
- }
-}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecDevicePlayback.java b/services/core/java/com/android/server/hdmi/HdmiCecDevicePlayback.java
deleted file mode 100644
index f8cf11dbf92f0..0000000000000
--- a/services/core/java/com/android/server/hdmi/HdmiCecDevicePlayback.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.server.hdmi;
-
-import android.hardware.hdmi.HdmiCec;
-
-/**
- * Class for the logical device of playback type. Devices such as DVD/Blueray player
- * that support 'playback' feature are classified as playback device. It is common
- * that they don't have built-in display, therefore need to talk, stream their contents
- * to TV/display device which is connected through HDMI cable.
- *
- * It closely monitors the status of display device (other devices can be of interest
- * too, but with much less priority), declares itself as 'active source' to have
- * display show its output, switch the source state as ordered by display that may be
- * talking to many other devices connected to it. It also receives commands from display
- * such as remote control signal, standby, status report, playback mode.
- *
- *
Declared as package-private, accessed by HdmiCecService only.
- */
-final class HdmiCecDevicePlayback extends HdmiCecDevice {
- private static final String TAG = "HdmiCecDevicePlayback";
-
- private int mSinkDevicePowerStatus;
-
- /**
- * Constructor.
- */
- public HdmiCecDevicePlayback(HdmiCecService service, int type) {
- super(service, type);
- mSinkDevicePowerStatus = HdmiCec.POWER_STATUS_UNKNOWN;
- }
-
- @Override
- public void initialize() {
- // Playback device tries to obtain the power status of TV/display when created,
- // and maintains it all through its lifecycle. CEC spec says there is
- // a maximum 1 second response time. Therefore it should be kept in mind
- // that there can be as much amount of period of time the power status
- // of the display remains unknown after the query is sent out.
- queryTvPowerStatus();
- }
-
- private void queryTvPowerStatus() {
- getService().sendMessage(getType(), HdmiCec.ADDR_TV,
- HdmiCec.MESSAGE_GIVE_DEVICE_POWER_STATUS, HdmiCecService.EMPTY_PARAM);
- }
-
- @Override
- public void handleMessage(int srcAddress, int dstAddress, int opcode, byte[] params) {
- // Updates power status of display. The cases are:
- // 1) Response for the queried power status request arrives. Update the status.
- // 2) Broadcast or direct command from TV, which is sent as TV itself is going
- // into standby mode too.
- if (opcode == HdmiCec.MESSAGE_REPORT_POWER_STATUS) {
- mSinkDevicePowerStatus = params[0];
- } else if (srcAddress == HdmiCec.ADDR_TV) {
- if (opcode == HdmiCec.MESSAGE_STANDBY) {
- mSinkDevicePowerStatus = HdmiCec.POWER_STATUS_STANDBY;
- }
- }
- super.handleMessage(srcAddress, dstAddress, opcode, params);
- }
-
- @Override
- public void handleHotplug(boolean connected) {
- // If cable get disconnected sink device becomes unreachable. Switch the status
- // to unknown, and query the status once the cable gets connected back.
- if (!connected) {
- mSinkDevicePowerStatus = HdmiCec.POWER_STATUS_UNKNOWN;
- } else {
- queryTvPowerStatus();
- }
- super.handleHotplug(connected);
- }
-
- @Override
- public boolean isSinkDeviceOn() {
- return mSinkDevicePowerStatus == HdmiCec.POWER_STATUS_ON;
- }
-
- @Override
- public void sendActiveSource(int physicalAddress) {
- setIsActiveSource(true);
- byte[] param = new byte[] {
- (byte) ((physicalAddress >> 8) & 0xff),
- (byte) (physicalAddress & 0xff)
- };
- getService().sendMessage(getType(), HdmiCec.ADDR_BROADCAST, HdmiCec.MESSAGE_ACTIVE_SOURCE,
- param);
- }
-
- @Override
- public void sendInactiveSource(int physicalAddress) {
- setIsActiveSource(false);
- byte[] param = new byte[] {
- (byte) ((physicalAddress >> 8) & 0xff),
- (byte) (physicalAddress & 0xff)
- };
- getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_INACTIVE_SOURCE,
- param);
- }
-
- @Override
- public void sendImageViewOn() {
- getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_IMAGE_VIEW_ON,
- HdmiCecService.EMPTY_PARAM);
- }
-
- @Override
- public void sendTextViewOn() {
- getService().sendMessage(getType(), HdmiCec.ADDR_TV, HdmiCec.MESSAGE_TEXT_VIEW_ON,
- HdmiCecService.EMPTY_PARAM);
- }
-}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecDeviceTv.java
deleted file mode 100644
index 09ff3ca75d6ba..0000000000000
--- a/services/core/java/com/android/server/hdmi/HdmiCecDeviceTv.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.server.hdmi;
-
-/**
- * Class for logical device of TV type.
- */
-final class HdmiCecDeviceTv extends HdmiCecDevice {
- private static final String TAG = "HdmiCecDeviceTv";
-
- /**
- * Constructor.
- */
- public HdmiCecDeviceTv(HdmiCecService service, int type) {
- super(service, type);
- }
-
- public void initialize() {
- // TODO: Do the initialization task for TV device here.
- }
-}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecService.java b/services/core/java/com/android/server/hdmi/HdmiCecService.java
deleted file mode 100644
index 98dc72fa74463..0000000000000
--- a/services/core/java/com/android/server/hdmi/HdmiCecService.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.server.hdmi;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.hardware.hdmi.HdmiCec;
-import android.hardware.hdmi.HdmiCecMessage;
-import android.hardware.hdmi.IHdmiCecListener;
-import android.hardware.hdmi.IHdmiCecService;
-import android.os.Binder;
-import android.os.Build;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.text.TextUtils;
-import android.util.Log;
-import android.util.SparseArray;
-
-import com.android.server.SystemService;
-import libcore.util.EmptyArray;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Locale;
-
-/**
- * Provides a service for sending and processing HDMI-CEC messages, and providing
- * the information on HDMI settings in general.
- */
-public final class HdmiCecService extends SystemService {
- private static final String TAG = "HdmiCecService";
-
- // Maintains the allocated logical devices. Device type, not logical address,
- // is used for key as logical address is likely to change over time while
- // device type is permanent. Type-address mapping is maintained only at
- // native level.
- private final SparseArray mLogicalDevices = new SparseArray();
-
- // List of IBinder.DeathRecipient instances to handle dead IHdmiCecListener
- // objects.
- private final ArrayList mListenerRecords = new ArrayList();
-
- // Used to synchronize the access to the service.
- private final Object mLock = new Object();
-
- // Stores the pointer to the native implementation of the service that
- // interacts with HAL.
- private long mNativePtr;
-
- private static final String PERMISSION = "android.permission.HDMI_CEC";
-
- static final byte[] EMPTY_PARAM = EmptyArray.BYTE;
-
- public HdmiCecService(Context context) {
- super(context);
- }
-
- private static native long nativeInit(HdmiCecService service);
-
- @Override
- public void onStart() {
- // Stop publishing the service. Soon to be deprecated.
- Log.w(TAG, "In transition to HdmiControlService. May not work.");
- }
-
- /**
- * Called by native when an HDMI-CEC message arrived. Invokes the registered
- * listeners to handle the message.
- */
- private void handleMessage(int srcAddress, int dstAddress, int opcode, byte[] params) {
- // TODO: Messages like may not need be passed to listener
- // but better be handled in service by turning off the screen
- // or putting the device into suspend mode. List up such messages
- // and handle them here.
- synchronized (mLock) {
- if (dstAddress == HdmiCec.ADDR_BROADCAST) {
- for (int i = 0; i < mLogicalDevices.size(); ++i) {
- mLogicalDevices.valueAt(i).handleMessage(srcAddress, dstAddress, opcode,
- params);
- }
- } else {
- int type = HdmiCec.getTypeFromAddress(dstAddress);
- HdmiCecDevice device = mLogicalDevices.get(type);
- if (device == null) {
- Log.w(TAG, "logical device not found. type: " + type);
- return;
- }
- device.handleMessage(srcAddress, dstAddress, opcode, params);
- }
- }
- }
-
- /**
- * Called by native when internal HDMI hotplug event occurs. Invokes the registered
- * listeners to handle the event.
- */
- private void handleHotplug(boolean connected) {
- synchronized(mLock) {
- for (int i = 0; i < mLogicalDevices.size(); ++i) {
- mLogicalDevices.valueAt(i).handleHotplug(connected);
- }
- }
- }
-
- /**
- * Called by native when it needs to know whether we have an active source.
- * The native part uses the return value to respond to <Request Active
- * Source >.
- *
- * @return type of the device which is active; DEVICE_INACTIVE if there is
- * no active logical device in the system.
- */
- private int getActiveSource() {
- synchronized(mLock) {
- for (int i = 0; i < mLogicalDevices.size(); ++i) {
- if (mLogicalDevices.valueAt(i).isActiveSource()) {
- return mLogicalDevices.keyAt(i);
- }
- }
- }
- return HdmiCec.DEVICE_INACTIVE;
- }
-
- /**
- * Called by native when a request for the menu language of the device was
- * received. The native part uses the return value to generate the message
- * <Set Menu Language> in response. The language should be of
- * the 3-letter format as defined in ISO/FDIS 639-2. We use system default
- * locale.
- */
- private String getLanguage(int type) {
- return Locale.getDefault().getISO3Language();
- }
-
- private void enforceAccessPermission() {
- getContext().enforceCallingOrSelfPermission(PERMISSION, "HdmiCecService");
- }
-
- private void dumpInternal(PrintWriter pw) {
- pw.println("HdmiCecService (dumpsys hdmi_cec)");
- pw.println("");
- synchronized (mLock) {
- for (int i = 0; i < mLogicalDevices.size(); ++i) {
- HdmiCecDevice device = mLogicalDevices.valueAt(i);
- pw.println("Device: type=" + device.getType() +
- ", active=" + device.isActiveSource());
- }
- }
- }
-
- // Remove logical device of a given type.
- private void removeLogicalDeviceLocked(int type) {
- ensureValidType(type);
- mLogicalDevices.remove(type);
- nativeRemoveLogicalAddress(mNativePtr, type);
- }
-
- private static void ensureValidType(int type) {
- if (!HdmiCec.isValidType(type)) {
- throw new IllegalArgumentException("invalid type: " + type);
- }
- }
-
- // Return the logical device identified by the given binder token.
- private HdmiCecDevice getLogicalDeviceLocked(IBinder b) {
- for (int i = 0; i < mLogicalDevices.size(); ++i) {
- HdmiCecDevice device = mLogicalDevices.valueAt(i);
- if (device.getToken() == b) {
- return device;
- }
- }
- throw new IllegalArgumentException("Device not found");
- }
-
- // package-private. Used by HdmiCecDevice and its subclasses only.
- void sendMessage(int type, int address, int opcode, byte[] params) {
- nativeSendMessage(mNativePtr, type, address, opcode, params);
- }
-
- private void setOsdNameLocked(String name) {
- nativeSetOsdName(mNativePtr, name.getBytes(Charset.forName("US-ASCII")));
- }
-
- private final class ListenerRecord implements IBinder.DeathRecipient {
- private final IHdmiCecListener mListener;
- private final int mType;
-
- public ListenerRecord(IHdmiCecListener listener, int type) {
- mListener = listener;
- mType = type;
- }
-
- @Override
- public void binderDied() {
- synchronized (mLock) {
- mListenerRecords.remove(this);
- HdmiCecDevice device = mLogicalDevices.get(mType);
- if (device != null) {
- device.removeListener(mListener);
- if (!device.hasListener()) {
- removeLogicalDeviceLocked(mType);
- }
- }
- }
- }
- }
-
- private final class BinderService extends IHdmiCecService.Stub {
-
- @Override
- public IBinder allocateLogicalDevice(int type, IHdmiCecListener listener) {
- enforceAccessPermission();
- ensureValidType(type);
- if (listener == null) {
- throw new IllegalArgumentException("listener must not be null");
- }
- synchronized (mLock) {
- HdmiCecDevice device = mLogicalDevices.get(type);
- if (device != null) {
- Log.v(TAG, "Logical address already allocated. Adding listener only.");
- } else {
- int address = nativeAllocateLogicalAddress(mNativePtr, type);
- if (!HdmiCec.isValidAddress(address)) {
- Log.e(TAG, "Logical address was not allocated");
- return null;
- } else {
- device = HdmiCecDevice.create(HdmiCecService.this, type);
- if (device == null) {
- Log.e(TAG, "Device type not supported yet.");
- return null;
- }
- device.initialize();
- mLogicalDevices.put(type, device);
- }
- }
-
- // Adds the listener and its monitor
- ListenerRecord record = new ListenerRecord(listener, type);
- try {
- listener.asBinder().linkToDeath(record, 0);
- } catch (RemoteException e) {
- Log.w(TAG, "Listener already died");
- if (!device.hasListener()) {
- removeLogicalDeviceLocked(type);
- }
- return null;
- }
- mListenerRecords.add(record);
- device.addListener(listener);
- return device.getToken();
- }
- }
-
- @Override
- public void sendActiveSource(IBinder b) {
- enforceAccessPermission();
- synchronized (mLock) {
- HdmiCecDevice device = getLogicalDeviceLocked(b);
- device.sendActiveSource(nativeGetPhysicalAddress(mNativePtr));
- }
- }
-
- @Override
- public void sendInactiveSource(IBinder b) {
- enforceAccessPermission();
- synchronized (mLock) {
- HdmiCecDevice device = getLogicalDeviceLocked(b);
- device.sendInactiveSource(nativeGetPhysicalAddress(mNativePtr));
- }
- }
-
- @Override
- public void sendImageViewOn(IBinder b) {
- enforceAccessPermission();
- synchronized (mLock) {
- HdmiCecDevice device = getLogicalDeviceLocked(b);
- device.sendImageViewOn();
- }
- }
-
- @Override
- public void sendTextViewOn(IBinder b) {
- enforceAccessPermission();
- synchronized (mLock) {
- HdmiCecDevice device = getLogicalDeviceLocked(b);
- device.sendTextViewOn();
- }
- }
-
- public void sendGiveDevicePowerStatus(IBinder b, int address) {
- enforceAccessPermission();
- synchronized (mLock) {
- HdmiCecDevice device = getLogicalDeviceLocked(b);
- nativeSendMessage(mNativePtr, device.getType(), address,
- HdmiCec.MESSAGE_GIVE_DEVICE_POWER_STATUS, EMPTY_PARAM);
- }
- }
-
- @Override
- public boolean isTvOn(IBinder b) {
- enforceAccessPermission();
- synchronized (mLock) {
- HdmiCecDevice device = getLogicalDeviceLocked(b);
- return device.isSinkDeviceOn();
- }
- }
-
- @Override
- public void removeServiceListener(IBinder b, IHdmiCecListener listener) {
- enforceAccessPermission();
- if (listener == null) {
- throw new IllegalArgumentException("listener must not be null");
- }
- synchronized (mLock) {
- HdmiCecDevice device = getLogicalDeviceLocked(b);
- for (ListenerRecord record : mListenerRecords) {
- if (record.mType == device.getType()
- && record.mListener.asBinder() == listener.asBinder()) {
- mListenerRecords.remove(record);
- device.removeListener(record.mListener);
- if (!device.hasListener()) {
- removeLogicalDeviceLocked(record.mType);
- }
- break;
- }
- }
- }
- }
-
- @Override
- public void sendMessage(IBinder b, HdmiCecMessage message) {
- enforceAccessPermission();
- if (message == null) {
- throw new IllegalArgumentException("message must not be null");
- }
- synchronized (mLock) {
- HdmiCecDevice device = getLogicalDeviceLocked(b);
- nativeSendMessage(mNativePtr, device.getType(), message.getDestination(),
- message.getOpcode(), message.getParams());
- }
- }
-
- @Override
- protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- if (getContext().checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
- != PackageManager.PERMISSION_GRANTED) {
- pw.println("Permission denial: can't dump HdmiCecService from pid="
- + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()
- + " without permission " + android.Manifest.permission.DUMP);
- return;
- }
- final long ident = Binder.clearCallingIdentity();
- try {
- dumpInternal(pw);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
- }
-
- private static native int nativeAllocateLogicalAddress(long handler, int deviceType);
- private static native void nativeRemoveLogicalAddress(long handler, int deviceType);
- private static native void nativeSendMessage(long handler, int deviceType, int destination,
- int opcode, byte[] params);
- private static native int nativeGetPhysicalAddress(long handler);
- private static native void nativeSetOsdName(long handler, byte[] name);
-}
diff --git a/services/core/jni/Android.mk b/services/core/jni/Android.mk
index 3cfb45b593ee6..db44d3a2893e2 100644
--- a/services/core/jni/Android.mk
+++ b/services/core/jni/Android.mk
@@ -12,7 +12,6 @@ LOCAL_SRC_FILES += \
$(LOCAL_REL_DIR)/com_android_server_ConsumerIrService.cpp \
$(LOCAL_REL_DIR)/com_android_server_dreams_McuHal.cpp \
$(LOCAL_REL_DIR)/com_android_server_hdmi_HdmiCecController.cpp \
- $(LOCAL_REL_DIR)/com_android_server_hdmi_HdmiCecService.cpp \
$(LOCAL_REL_DIR)/com_android_server_hdmi_HdmiMhlController.cpp \
$(LOCAL_REL_DIR)/com_android_server_input_InputApplicationHandle.cpp \
$(LOCAL_REL_DIR)/com_android_server_input_InputManagerService.cpp \
diff --git a/services/core/jni/com_android_server_hdmi_HdmiCecService.cpp b/services/core/jni/com_android_server_hdmi_HdmiCecService.cpp
deleted file mode 100644
index 1d111a1e7990a..0000000000000
--- a/services/core/jni/com_android_server_hdmi_HdmiCecService.cpp
+++ /dev/null
@@ -1,756 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#define LOG_TAG "HdmiCecJni"
-
-#define LOG_NDEBUG 1
-
-#include "ScopedPrimitiveArray.h"
-
-#include
-#include
-#include