Merge "TIF: Revisit types in TvInputInfo and TvContract.Channels." into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index 3684f57..ce5e366 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -746,6 +746,7 @@
     field public static final int l_resource_pad23 = 16843770; // 0x10103fa
     field public static final int l_resource_pad24 = 16843769; // 0x10103f9
     field public static final int l_resource_pad25 = 16843768; // 0x10103f8
+    field public static final int l_resource_pad26 = 16843767; // 0x10103f7
     field public static final int l_resource_pad3 = 16843790; // 0x101040e
     field public static final int l_resource_pad4 = 16843789; // 0x101040d
     field public static final int l_resource_pad5 = 16843788; // 0x101040c
@@ -1329,7 +1330,6 @@
     field public static final int trimPathEnd = 16843813; // 0x1010425
     field public static final int trimPathOffset = 16843814; // 0x1010426
     field public static final int trimPathStart = 16843812; // 0x1010424
-    field public static final int tvInputType = 16843767; // 0x10103f7
     field public static final int type = 16843169; // 0x10101a1
     field public static final int typeface = 16842902; // 0x1010096
     field public static final int uiOptions = 16843672; // 0x1010398
@@ -16762,33 +16762,33 @@
     field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/channel";
     field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/channel";
     field public static final android.net.Uri CONTENT_URI;
-    field public static final int SERVICE_TYPE_AUDIO = 2; // 0x2
-    field public static final int SERVICE_TYPE_AUDIO_VIDEO = 1; // 0x1
-    field public static final int SERVICE_TYPE_OTHER = 0; // 0x0
-    field public static final int TYPE_1SEG = 197632; // 0x30400
-    field public static final int TYPE_ATSC_C = 131584; // 0x20200
-    field public static final int TYPE_ATSC_M_H = 131840; // 0x20300
-    field public static final int TYPE_ATSC_T = 131072; // 0x20000
-    field public static final int TYPE_CMMB = 262400; // 0x40100
-    field public static final int TYPE_DTMB = 262144; // 0x40000
-    field public static final int TYPE_DVB_C = 66048; // 0x10200
-    field public static final int TYPE_DVB_C2 = 66049; // 0x10201
-    field public static final int TYPE_DVB_H = 66304; // 0x10300
-    field public static final int TYPE_DVB_S = 65792; // 0x10100
-    field public static final int TYPE_DVB_S2 = 65793; // 0x10101
-    field public static final int TYPE_DVB_SH = 66560; // 0x10400
-    field public static final int TYPE_DVB_T = 65536; // 0x10000
-    field public static final int TYPE_DVB_T2 = 65537; // 0x10001
-    field public static final int TYPE_ISDB_C = 197376; // 0x30300
-    field public static final int TYPE_ISDB_S = 197120; // 0x30200
-    field public static final int TYPE_ISDB_T = 196608; // 0x30000
-    field public static final int TYPE_ISDB_TB = 196864; // 0x30100
-    field public static final int TYPE_NTSC = 1; // 0x1
-    field public static final int TYPE_OTHER = 0; // 0x0
-    field public static final int TYPE_PAL = 2; // 0x2
-    field public static final int TYPE_SECAM = 3; // 0x3
-    field public static final int TYPE_S_DMB = 327936; // 0x50100
-    field public static final int TYPE_T_DMB = 327680; // 0x50000
+    field public static final java.lang.String SERVICE_TYPE_AUDIO = "SERVICE_TYPE_AUDIO";
+    field public static final java.lang.String SERVICE_TYPE_AUDIO_VIDEO = "SERVICE_TYPE_AUDIO_VIDEO";
+    field public static final java.lang.String SERVICE_TYPE_OTHER = "SERVICE_TYPE_OTHER";
+    field public static final java.lang.String TYPE_1SEG = "TYPE_1SEG";
+    field public static final java.lang.String TYPE_ATSC_C = "TYPE_ATSC_C";
+    field public static final java.lang.String TYPE_ATSC_M_H = "TYPE_ATSC_M_H";
+    field public static final java.lang.String TYPE_ATSC_T = "TYPE_ATSC_T";
+    field public static final java.lang.String TYPE_CMMB = "TYPE_CMMB";
+    field public static final java.lang.String TYPE_DTMB = "TYPE_DTMB";
+    field public static final java.lang.String TYPE_DVB_C = "TYPE_DVB_C";
+    field public static final java.lang.String TYPE_DVB_C2 = "TYPE_DVB_C2";
+    field public static final java.lang.String TYPE_DVB_H = "TYPE_DVB_H";
+    field public static final java.lang.String TYPE_DVB_S = "TYPE_DVB_S";
+    field public static final java.lang.String TYPE_DVB_S2 = "TYPE_DVB_S2";
+    field public static final java.lang.String TYPE_DVB_SH = "TYPE_DVB_SH";
+    field public static final java.lang.String TYPE_DVB_T = "TYPE_DVB_T";
+    field public static final java.lang.String TYPE_DVB_T2 = "TYPE_DVB_T2";
+    field public static final java.lang.String TYPE_ISDB_C = "TYPE_ISDB_C";
+    field public static final java.lang.String TYPE_ISDB_S = "TYPE_ISDB_S";
+    field public static final java.lang.String TYPE_ISDB_T = "TYPE_ISDB_T";
+    field public static final java.lang.String TYPE_ISDB_TB = "TYPE_ISDB_TB";
+    field public static final java.lang.String TYPE_NTSC = "TYPE_NTSC";
+    field public static final java.lang.String TYPE_OTHER = "TYPE_OTHER";
+    field public static final java.lang.String TYPE_PAL = "TYPE_PAL";
+    field public static final java.lang.String TYPE_SECAM = "TYPE_SECAM";
+    field public static final java.lang.String TYPE_S_DMB = "TYPE_S_DMB";
+    field public static final java.lang.String TYPE_T_DMB = "TYPE_T_DMB";
     field public static final java.lang.String VIDEO_FORMAT_1080I = "VIDEO_FORMAT_1080I";
     field public static final java.lang.String VIDEO_FORMAT_1080P = "VIDEO_FORMAT_1080P";
     field public static final java.lang.String VIDEO_FORMAT_2160P = "VIDEO_FORMAT_2160P";
@@ -16865,17 +16865,16 @@
     method public java.lang.CharSequence loadLabel(android.content.Context);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final java.lang.String EXTRA_INPUT_ID = "inputId";
-    field public static final int TYPE_COMPONENT = 6; // 0x6
-    field public static final int TYPE_COMPOSITE = 3; // 0x3
-    field public static final int TYPE_DISPLAY_PORT = 10; // 0xa
-    field public static final int TYPE_DVI = 8; // 0x8
-    field public static final int TYPE_HDMI = 9; // 0x9
-    field public static final int TYPE_OTHER_HARDWARE = 1; // 0x1
-    field public static final int TYPE_SCART = 5; // 0x5
-    field public static final int TYPE_SVIDEO = 4; // 0x4
-    field public static final int TYPE_TUNER = 2; // 0x2
-    field public static final int TYPE_VGA = 7; // 0x7
-    field public static final int TYPE_VIRTUAL = 0; // 0x0
+    field public static final int TYPE_COMPONENT = 1004; // 0x3ec
+    field public static final int TYPE_COMPOSITE = 1001; // 0x3e9
+    field public static final int TYPE_DISPLAY_PORT = 1008; // 0x3f0
+    field public static final int TYPE_DVI = 1006; // 0x3ee
+    field public static final int TYPE_HDMI = 1007; // 0x3ef
+    field public static final int TYPE_OTHER = 1000; // 0x3e8
+    field public static final int TYPE_SCART = 1003; // 0x3eb
+    field public static final int TYPE_SVIDEO = 1002; // 0x3ea
+    field public static final int TYPE_TUNER = 0; // 0x0
+    field public static final int TYPE_VGA = 1005; // 0x3ed
   }
 
   public final class TvInputManager {
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index f69ab0f..8d1b397 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -7213,24 +7213,6 @@
              the settings for this service. -->
         <attr name="settingsActivity" />
         <!-- Type of this service. -->
-        <attr name="tvInputType">
-            <!-- Should be in sync with constant values defined in
-                 {@link android.media.tv.TvInputInfo}. -->
-
-            <!-- Virtual input (default) -->
-            <enum name="virtual" value="0" />
-
-            <enum name="otherHardware" value="1" />
-            <enum name="tuner" value="2" />
-            <enum name="composite" value="3" />
-            <enum name="svideo" value="4" />
-            <enum name="scart" value="5" />
-            <enum name="component" value="6" />
-            <enum name="vga" value="7" />
-            <enum name="dvi" value="8" />
-            <enum name="hdmi" value="9" />
-            <enum name="displayPort" value="10" />
-        </attr>
     </declare-styleable>
 
     <declare-styleable name="ResolverDrawerLayout">
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index a441382..5036c24 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2097,7 +2097,6 @@
   <public type="attr" name="isGame" id="0x10103f4" />
   <public type="attr" name="allowEmbedded" id="0x10103f5" />
   <public type="attr" name="setupActivity" id="0x10103f6"/>
-  <public type="attr" name="tvInputType" id="0x10103f7"/>
 
 <!-- ===============================================================
      Resources added in version 21 of the platform
diff --git a/media/java/android/media/tv/TvContract.java b/media/java/android/media/tv/TvContract.java
index a138862..acdfbe19 100644
--- a/media/java/android/media/tv/TvContract.java
+++ b/media/java/android/media/tv/TvContract.java
@@ -340,85 +340,85 @@
         public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/channel";
 
         /** A generic channel type. */
-        public static final int TYPE_OTHER = 0x0;
+        public static final String TYPE_OTHER = "TYPE_OTHER";
 
         /** The channel type for NTSC. */
-        public static final int TYPE_NTSC = 0x1;
+        public static final String TYPE_NTSC = "TYPE_NTSC";
 
         /** The channel type for PAL. */
-        public static final int TYPE_PAL = 0x2;
+        public static final String TYPE_PAL = "TYPE_PAL";
 
         /** The channel type for SECAM. */
-        public static final int TYPE_SECAM = 0x3;
+        public static final String TYPE_SECAM = "TYPE_SECAM";
 
         /** The channel type for DVB-T (terrestrial). */
-        public static final int TYPE_DVB_T = 0x00010000;
+        public static final String TYPE_DVB_T = "TYPE_DVB_T";
 
         /** The channel type for DVB-T2 (terrestrial). */
-        public static final int TYPE_DVB_T2 = 0x00010001;
+        public static final String TYPE_DVB_T2 = "TYPE_DVB_T2";
 
         /** The channel type for DVB-S (satellite). */
-        public static final int TYPE_DVB_S = 0x00010100;
+        public static final String TYPE_DVB_S = "TYPE_DVB_S";
 
         /** The channel type for DVB-S2 (satellite). */
-        public static final int TYPE_DVB_S2 = 0x00010101;
+        public static final String TYPE_DVB_S2 = "TYPE_DVB_S2";
 
         /** The channel type for DVB-C (cable). */
-        public static final int TYPE_DVB_C = 0x00010200;
+        public static final String TYPE_DVB_C = "TYPE_DVB_C";
 
         /** The channel type for DVB-C2 (cable). */
-        public static final int TYPE_DVB_C2 = 0x00010201;
+        public static final String TYPE_DVB_C2 = "TYPE_DVB_C2";
 
         /** The channel type for DVB-H (handheld). */
-        public static final int TYPE_DVB_H = 0x00010300;
+        public static final String TYPE_DVB_H = "TYPE_DVB_H";
 
         /** The channel type for DVB-SH (satellite). */
-        public static final int TYPE_DVB_SH = 0x00010400;
+        public static final String TYPE_DVB_SH = "TYPE_DVB_SH";
 
         /** The channel type for ATSC (terrestrial). */
-        public static final int TYPE_ATSC_T = 0x00020000;
+        public static final String TYPE_ATSC_T = "TYPE_ATSC_T";
 
         /** The channel type for ATSC (cable). */
-        public static final int TYPE_ATSC_C = 0x00020200;
+        public static final String TYPE_ATSC_C = "TYPE_ATSC_C";
 
         /** The channel type for ATSC-M/H (mobile/handheld). */
-        public static final int TYPE_ATSC_M_H = 0x00020300;
+        public static final String TYPE_ATSC_M_H = "TYPE_ATSC_M_H";
 
         /** The channel type for ISDB-T (terrestrial). */
-        public static final int TYPE_ISDB_T = 0x00030000;
+        public static final String TYPE_ISDB_T = "TYPE_ISDB_T";
 
         /** The channel type for ISDB-Tb (Brazil). */
-        public static final int TYPE_ISDB_TB = 0x00030100;
+        public static final String TYPE_ISDB_TB = "TYPE_ISDB_TB";
 
         /** The channel type for ISDB-S (satellite). */
-        public static final int TYPE_ISDB_S = 0x00030200;
+        public static final String TYPE_ISDB_S = "TYPE_ISDB_S";
 
         /** The channel type for ISDB-C (cable). */
-        public static final int TYPE_ISDB_C = 0x00030300;
+        public static final String TYPE_ISDB_C = "TYPE_ISDB_C";
 
         /** The channel type for 1seg (handheld). */
-        public static final int TYPE_1SEG = 0x00030400;
+        public static final String TYPE_1SEG = "TYPE_1SEG";
 
         /** The channel type for DTMB (terrestrial). */
-        public static final int TYPE_DTMB = 0x00040000;
+        public static final String TYPE_DTMB = "TYPE_DTMB";
 
         /** The channel type for CMMB (handheld). */
-        public static final int TYPE_CMMB = 0x00040100;
+        public static final String TYPE_CMMB = "TYPE_CMMB";
 
         /** The channel type for T-DMB (terrestrial). */
-        public static final int TYPE_T_DMB = 0x00050000;
+        public static final String TYPE_T_DMB = "TYPE_T_DMB";
 
         /** The channel type for S-DMB (satellite). */
-        public static final int TYPE_S_DMB = 0x00050100;
+        public static final String TYPE_S_DMB = "TYPE_S_DMB";
 
         /** A generic service type. */
-        public static final int SERVICE_TYPE_OTHER = 0x0;
+        public static final String SERVICE_TYPE_OTHER = "SERVICE_TYPE_OTHER";
 
         /** The service type for regular TV channels that have both audio and video. */
-        public static final int SERVICE_TYPE_AUDIO_VIDEO = 0x1;
+        public static final String SERVICE_TYPE_AUDIO_VIDEO = "SERVICE_TYPE_AUDIO_VIDEO";
 
         /** The service type for radio channels that have audio only. */
-        public static final int SERVICE_TYPE_AUDIO = 0x2;
+        public static final String SERVICE_TYPE_AUDIO = "SERVICE_TYPE_AUDIO";
 
         /** The video format for 240p. */
         public static final String VIDEO_FORMAT_240P = "VIDEO_FORMAT_240P";
@@ -521,7 +521,7 @@
          * </p><p>
          * This is a required field.
          * </p><p>
-         * Type: INTEGER
+         * Type: TEXT
          * </p>
          */
         public static final String COLUMN_TYPE = "type";
@@ -537,7 +537,7 @@
          * </p><p>
          * This is a required field.
          * </p><p>
-         * Type: INTEGER
+         * Type: TEXT
          * </p>
          */
         public static final String COLUMN_SERVICE_TYPE = "service_type";
diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java
index 86fd4ff..331283e 100644
--- a/media/java/android/media/tv/TvInputInfo.java
+++ b/media/java/android/media/tv/TvInputInfo.java
@@ -33,6 +33,7 @@
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.util.Log;
+import android.util.SparseIntArray;
 import android.util.Xml;
 
 import org.xmlpull.v1.XmlPullParser;
@@ -47,60 +48,55 @@
     private static final boolean DEBUG = false;
     private static final String TAG = "TvInputInfo";
 
+    // Should be in sync with frameworks/base/core/res/res/values/attrs.xml
     /**
-     * TV input type: the TV input service is not handling input from hardware. For example,
-     * services showing streaming from the internet falls into this type.
+     * TV input type: the TV input service is a tuner which provides channels.
      */
-    public static final int TYPE_VIRTUAL = 0;
-
-    // Should be in sync with TvInputHardwareInfo.
-
+    public static final int TYPE_TUNER = 0;
     /**
      * TV input type: a generic hardware TV input type.
      */
-    public static final int TYPE_OTHER_HARDWARE = TvInputHardwareInfo.TV_INPUT_TYPE_OTHER_HARDWARE;
-    /**
-     * TV input type: the TV input service is a tuner. (e.g. terrestrial tuner)
-     */
-    public static final int TYPE_TUNER = TvInputHardwareInfo.TV_INPUT_TYPE_TUNER;
+    public static final int TYPE_OTHER = 1000;
     /**
      * TV input type: the TV input service represents a composite port.
      */
-    public static final int TYPE_COMPOSITE = TvInputHardwareInfo.TV_INPUT_TYPE_COMPOSITE;
+    public static final int TYPE_COMPOSITE = 1001;
     /**
      * TV input type: the TV input service represents a SVIDEO port.
      */
-    public static final int TYPE_SVIDEO = TvInputHardwareInfo.TV_INPUT_TYPE_SVIDEO;
+    public static final int TYPE_SVIDEO = 1002;
     /**
      * TV input type: the TV input service represents a SCART port.
      */
-    public static final int TYPE_SCART = TvInputHardwareInfo.TV_INPUT_TYPE_SCART;
+    public static final int TYPE_SCART = 1003;
     /**
      * TV input type: the TV input service represents a component port.
      */
-    public static final int TYPE_COMPONENT = TvInputHardwareInfo.TV_INPUT_TYPE_COMPONENT;
+    public static final int TYPE_COMPONENT = 1004;
     /**
      * TV input type: the TV input service represents a VGA port.
      */
-    public static final int TYPE_VGA = TvInputHardwareInfo.TV_INPUT_TYPE_VGA;
+    public static final int TYPE_VGA = 1005;
     /**
      * TV input type: the TV input service represents a DVI port.
      */
-    public static final int TYPE_DVI = TvInputHardwareInfo.TV_INPUT_TYPE_DVI;
+    public static final int TYPE_DVI = 1006;
     /**
      * TV input type: the TV input service is HDMI. (e.g. HDMI 1)
      */
-    public static final int TYPE_HDMI = TvInputHardwareInfo.TV_INPUT_TYPE_HDMI;
+    public static final int TYPE_HDMI = 1007;
     /**
      * TV input type: the TV input service represents a display port.
      */
-    public static final int TYPE_DISPLAY_PORT = TvInputHardwareInfo.TV_INPUT_TYPE_DISPLAY_PORT;
+    public static final int TYPE_DISPLAY_PORT = 1008;
 
     /**
      * The ID of the TV input to provide to the setup activity and settings activity.
      */
     public static final String EXTRA_INPUT_ID = "inputId";
 
+    private static SparseIntArray sHardwareTypeToTvInputType = new SparseIntArray();
+
     private static final String XML_START_TAG_NAME = "tv-input";
 
     private final ResolveInfo mService;
@@ -110,7 +106,22 @@
     // Attributes from XML meta data.
     private String mSetupActivity;
     private String mSettingsActivity;
-    private int mType = TYPE_VIRTUAL;
+    private int mType = TYPE_TUNER;
+
+    static {
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_OTHER_HARDWARE,
+                TYPE_OTHER);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_TUNER, TYPE_TUNER);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_COMPOSITE, TYPE_COMPOSITE);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_SVIDEO, TYPE_SVIDEO);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_SCART, TYPE_SCART);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_COMPONENT, TYPE_COMPONENT);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_VGA, TYPE_VGA);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_DVI, TYPE_DVI);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_HDMI, TYPE_HDMI);
+        sHardwareTypeToTvInputType.put(TvInputHardwareInfo.TV_INPUT_TYPE_DISPLAY_PORT,
+                TYPE_DISPLAY_PORT);
+    }
 
     /**
      * Create a new instance of the TvInputInfo class,
@@ -123,7 +134,7 @@
             throws XmlPullParserException, IOException {
         return createTvInputInfo(context, service, generateInputIdForComponentName(
                 new ComponentName(service.serviceInfo.packageName, service.serviceInfo.name)),
-                null);
+                null, TYPE_TUNER);
     }
 
     /**
@@ -138,7 +149,7 @@
             HdmiCecDeviceInfo cecInfo, String parentId) throws XmlPullParserException, IOException {
         return createTvInputInfo(context, service, generateInputIdForHdmiCec(
                 new ComponentName(service.serviceInfo.packageName, service.serviceInfo.name),
-                cecInfo), parentId);
+                cecInfo), parentId, TYPE_HDMI);
     }
 
     /**
@@ -151,13 +162,14 @@
      */
     public static TvInputInfo createTvInputInfo(Context context, ResolveInfo service,
             TvInputHardwareInfo hardwareInfo) throws XmlPullParserException, IOException {
+        int inputType = sHardwareTypeToTvInputType.get(hardwareInfo.getType(), TYPE_TUNER);
         return createTvInputInfo(context, service, generateInputIdForHardware(
                 new ComponentName(service.serviceInfo.packageName, service.serviceInfo.name),
-                hardwareInfo), null);
+                hardwareInfo), null, inputType);
     }
 
     private static TvInputInfo createTvInputInfo(Context context, ResolveInfo service,
-            String id, String parentId) throws XmlPullParserException, IOException {
+            String id, String parentId, int inputType) throws XmlPullParserException, IOException {
         ServiceInfo si = service.serviceInfo;
         PackageManager pm = context.getPackageManager();
         XmlResourceParser parser = null;
@@ -182,7 +194,7 @@
                         "Meta-data does not start with tv-input-service tag in " + si.name);
             }
 
-            TvInputInfo input = new TvInputInfo(service, id, parentId);
+            TvInputInfo input = new TvInputInfo(service, id, parentId, inputType);
             TypedArray sa = res.obtainAttributes(attrs,
                     com.android.internal.R.styleable.TvInputService);
             input.mSetupActivity = sa.getString(
@@ -196,14 +208,6 @@
                 Log.d(TAG, "Settings activity loaded. [" + input.mSettingsActivity + "] for "
                         + si.name);
             }
-            if (pm.checkPermission(android.Manifest.permission.TV_INPUT_HARDWARE, si.packageName)
-                    == PackageManager.PERMISSION_GRANTED) {
-                input.mType = sa.getInt(
-                        com.android.internal.R.styleable.TvInputService_tvInputType, TYPE_VIRTUAL);
-                if (DEBUG) {
-                    Log.d(TAG, "Type loaded. [" + input.mType + "] for " + si.name);
-                }
-            }
             sa.recycle();
 
             return input;
@@ -222,11 +226,13 @@
      * @param service The ResolveInfo returned from the package manager about this TV input service.
      * @param id ID of this TV input. Should be generated via generateInputId*().
      * @param parentId ID of this TV input's parent input. {@code null} if none exists.
+     * @param type The type of this TV input service.
      */
-    private TvInputInfo(ResolveInfo service, String id, String parentId) {
+    private TvInputInfo(ResolveInfo service, String id, String parentId, int type) {
         mService = service;
         mId = id;
         mParentId = parentId;
+        mType = type;
     }
 
     /**
@@ -314,12 +320,7 @@
      * @see TvContract#buildChannelUriForPassthroughTvInput(String)
      */
     public boolean isPassthroughInputType() {
-        if (mType == TYPE_HDMI || mType == TYPE_DISPLAY_PORT || mType == TYPE_SCART
-                || mType == TYPE_DVI || mType == TYPE_VGA || mType == TYPE_COMPONENT
-                || mType == TYPE_COMPOSITE || mType == TYPE_SVIDEO) {
-            return true;
-        }
-        return false;
+        return mType != TYPE_TUNER;
     }
 
     /**
diff --git a/services/core/java/com/android/server/tv/TvInputHardwareManager.java b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
index 8854869..ea19012 100644
--- a/services/core/java/com/android/server/tv/TvInputHardwareManager.java
+++ b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
@@ -211,9 +211,6 @@
     }
 
     public void addHardwareTvInput(int deviceId, TvInputInfo info) {
-        if (info.getType() == TvInputInfo.TYPE_VIRTUAL) {
-            throw new IllegalArgumentException("info (" + info + ") has virtual type.");
-        }
         synchronized (mLock) {
             String oldInputId = mHardwareInputIdMap.get(deviceId);
             if (oldInputId != null) {