Merge "Sync the constants in HAL and framework"
diff --git a/Android.mk b/Android.mk
index 004e352..8daab8f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -567,8 +567,9 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
framework-protos \
- android.hardware.thermal@1.0-java-constants \
android.hardware.health@1.0-java-constants \
+ android.hardware.thermal@1.0-java-constants \
+ android.hardware.tv.input@1.0-java-constants \
android.hardware.usb@1.0-java-constants \
android.hardware.vibrator@1.0-java-constants \
diff --git a/media/java/android/media/tv/TvInputHardwareInfo.java b/media/java/android/media/tv/TvInputHardwareInfo.java
index 957c582..762f0c0 100644
--- a/media/java/android/media/tv/TvInputHardwareInfo.java
+++ b/media/java/android/media/tv/TvInputHardwareInfo.java
@@ -20,6 +20,7 @@
import android.annotation.IntDef;
import android.annotation.SystemApi;
+import android.hardware.tv.input.V1_0.Constants;
import android.media.AudioManager;
import android.os.Parcel;
import android.os.Parcelable;
@@ -37,16 +38,16 @@
static final String TAG = "TvInputHardwareInfo";
// Match hardware/libhardware/include/hardware/tv_input.h
- public static final int TV_INPUT_TYPE_OTHER_HARDWARE = 1;
- public static final int TV_INPUT_TYPE_TUNER = 2;
- public static final int TV_INPUT_TYPE_COMPOSITE = 3;
- public static final int TV_INPUT_TYPE_SVIDEO = 4;
- public static final int TV_INPUT_TYPE_SCART = 5;
- public static final int TV_INPUT_TYPE_COMPONENT = 6;
- public static final int TV_INPUT_TYPE_VGA = 7;
- public static final int TV_INPUT_TYPE_DVI = 8;
- public static final int TV_INPUT_TYPE_HDMI = 9;
- public static final int TV_INPUT_TYPE_DISPLAY_PORT = 10;
+ public static final int TV_INPUT_TYPE_OTHER_HARDWARE = Constants.TV_INPUT_TYPE_OTHER;
+ public static final int TV_INPUT_TYPE_TUNER = Constants.TV_INPUT_TYPE_TUNER;
+ public static final int TV_INPUT_TYPE_COMPOSITE = Constants.TV_INPUT_TYPE_COMPOSITE;
+ public static final int TV_INPUT_TYPE_SVIDEO = Constants.TV_INPUT_TYPE_SVIDEO;
+ public static final int TV_INPUT_TYPE_SCART = Constants.TV_INPUT_TYPE_SCART;
+ public static final int TV_INPUT_TYPE_COMPONENT = Constants.TV_INPUT_TYPE_COMPONENT;
+ public static final int TV_INPUT_TYPE_VGA = Constants.TV_INPUT_TYPE_VGA;
+ public static final int TV_INPUT_TYPE_DVI = Constants.TV_INPUT_TYPE_DVI;
+ public static final int TV_INPUT_TYPE_HDMI = Constants.TV_INPUT_TYPE_HDMI;
+ public static final int TV_INPUT_TYPE_DISPLAY_PORT = Constants.TV_INPUT_TYPE_DISPLAY_PORT;
/** @hide */
@Retention(SOURCE)
@@ -58,17 +59,20 @@
/**
* The hardware is unsure about the connection status or does not support cable detection.
*/
- public static final int CABLE_CONNECTION_STATUS_UNKNOWN = 0;
+ public static final int CABLE_CONNECTION_STATUS_UNKNOWN =
+ Constants.CABLE_CONNECTION_STATUS_UNKNOWN;
/**
* Cable is connected to the hardware.
*/
- public static final int CABLE_CONNECTION_STATUS_CONNECTED = 1;
+ public static final int CABLE_CONNECTION_STATUS_CONNECTED =
+ Constants.CABLE_CONNECTION_STATUS_CONNECTED;
/**
* Cable is disconnected to the hardware.
*/
- public static final int CABLE_CONNECTION_STATUS_DISCONNECTED = 2;
+ public static final int CABLE_CONNECTION_STATUS_DISCONNECTED =
+ Constants.CABLE_CONNECTION_STATUS_DISCONNECTED;
public static final Parcelable.Creator<TvInputHardwareInfo> CREATOR =
new Parcelable.Creator<TvInputHardwareInfo>() {
diff --git a/services/core/java/com/android/server/tv/TvInputHal.java b/services/core/java/com/android/server/tv/TvInputHal.java
index ebbb8b3..42f12eb 100644
--- a/services/core/java/com/android/server/tv/TvInputHal.java
+++ b/services/core/java/com/android/server/tv/TvInputHal.java
@@ -16,6 +16,7 @@
package com.android.server.tv;
+import android.hardware.tv.input.V1_0.Constants;
import android.media.tv.TvInputHardwareInfo;
import android.media.tv.TvStreamConfig;
import android.os.Handler;
@@ -41,9 +42,10 @@
public final static int ERROR_STALE_CONFIG = -2;
public final static int ERROR_UNKNOWN = -3;
- public static final int EVENT_DEVICE_AVAILABLE = 1;
- public static final int EVENT_DEVICE_UNAVAILABLE = 2;
- public static final int EVENT_STREAM_CONFIGURATION_CHANGED = 3;
+ public static final int EVENT_DEVICE_AVAILABLE = Constants.EVENT_DEVICE_AVAILABLE;
+ public static final int EVENT_DEVICE_UNAVAILABLE = Constants.EVENT_DEVICE_UNAVAILABLE;
+ public static final int EVENT_STREAM_CONFIGURATION_CHANGED =
+ Constants.EVENT_STREAM_CONFIGURATIONS_CHANGED;
public static final int EVENT_FIRST_FRAME_CAPTURED = 4;
public interface Callback {
diff --git a/services/core/jni/com_android_server_tv_TvInputHal.cpp b/services/core/jni/com_android_server_tv_TvInputHal.cpp
index b433350..78c0fa7 100644
--- a/services/core/jni/com_android_server_tv_TvInputHal.cpp
+++ b/services/core/jni/com_android_server_tv_TvInputHal.cpp
@@ -577,7 +577,6 @@
}
Return<void> JTvInputHal::TvInputCallback::notify(const TvInputEvent& event) {
- // TODO(b/32200867): Ensure the event type values are in sync with the framework code.
mHal->mLooper->sendMessage(new NotifyHandler(mHal, event), static_cast<int>(event.type));
return Void();
}