Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eea9743b authored by Dongwon Kang's avatar Dongwon Kang
Browse files

TIF: introduce TvContract.buildChannelUriForPassthroughTvInput()

This change adds a way to get a dummy channel for starting pass-through
TV inputs which don't have real channels in TvProvider.
Bug: 15496325

Change-Id: I7a6b99964319f12a0f8692b4e307e03480119a69
parent 5b2295a5
Loading
Loading
Loading
Loading
+31 −23
Original line number Diff line number Diff line
@@ -16464,6 +16464,7 @@ package android.media.tv {
    method public static final android.net.Uri buildChannelLogoUri(long);
    method public static final android.net.Uri buildChannelLogoUri(android.net.Uri);
    method public static final android.net.Uri buildChannelUri(long);
    method public static final android.net.Uri buildChannelUriForPassthroughTvInput(java.lang.String);
    method public static final android.net.Uri buildChannelsUriForInput(java.lang.String);
    method public static final java.lang.String buildInputId(android.content.ComponentName);
    method public static final android.net.Uri buildProgramUri(long);
@@ -16501,31 +16502,30 @@ package android.media.tv {
    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 = 263168; // 0x40400
    field public static final int TYPE_ATSC_C = 197120; // 0x30200
    field public static final int TYPE_ATSC_M_H = 197376; // 0x30300
    field public static final int TYPE_ATSC_T = 196608; // 0x30000
    field public static final int TYPE_CMMB = 327936; // 0x50100
    field public static final int TYPE_DTMB = 327680; // 0x50000
    field public static final int TYPE_DVB_C = 131584; // 0x20200
    field public static final int TYPE_DVB_C2 = 131585; // 0x20201
    field public static final int TYPE_DVB_H = 131840; // 0x20300
    field public static final int TYPE_DVB_S = 131328; // 0x20100
    field public static final int TYPE_DVB_S2 = 131329; // 0x20101
    field public static final int TYPE_DVB_SH = 132096; // 0x20400
    field public static final int TYPE_DVB_T = 131072; // 0x20000
    field public static final int TYPE_DVB_T2 = 131073; // 0x20001
    field public static final int TYPE_ISDB_C = 262912; // 0x40300
    field public static final int TYPE_ISDB_S = 262656; // 0x40200
    field public static final int TYPE_ISDB_T = 262144; // 0x40000
    field public static final int TYPE_ISDB_TB = 262400; // 0x40100
    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_PASSTHROUGH = 65536; // 0x10000
    field public static final int TYPE_SECAM = 3; // 0x3
    field public static final int TYPE_S_DMB = 393472; // 0x60100
    field public static final int TYPE_T_DMB = 393216; // 0x60000
    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 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";
@@ -16594,13 +16594,21 @@ package android.media.tv {
    method public java.lang.String getParentId();
    method public android.content.pm.ServiceInfo getServiceInfo();
    method public int getType();
    method public boolean isPassthroughInputType();
    method public android.graphics.drawable.Drawable loadIcon(android.content.Context);
    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_HDMI = 1; // 0x1
    field public static final int TYPE_PASSTHROUGH = 3; // 0x3
    field public static final int TYPE_COMPONENT = 8; // 0x8
    field public static final int TYPE_COMPOSITE = 9; // 0x9
    field public static final int TYPE_DISPLAY_PORT = 4; // 0x4
    field public static final int TYPE_DVI = 6; // 0x6
    field public static final int TYPE_HDMI = 3; // 0x3
    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 = 10; // 0xa
    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
  }
+40 −31
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ public final class TvContract {
    private static final String PATH_CHANNEL = "channel";
    private static final String PATH_PROGRAM = "program";
    private static final String PATH_INPUT = "input";
    private static final String PATH_PASSTHROUGH = "passthrough";

    /**
     * An optional query, update or delete URI parameter that allows the caller to specify start
@@ -106,6 +107,18 @@ public final class TvContract {
        return ContentUris.withAppendedId(Channels.CONTENT_URI, channelId);
    }

    /**
     * Build a special channel URI intended to be used with pass-through type inputs. (e.g. HDMI)
     *
     * @param inputId The ID of the TV input to build a channels URI for.
     * @see TvInputInfo#isPassthroughInputType()
     */
    public static final Uri buildChannelUriForPassthroughTvInput(String inputId) {
        return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY)
                .appendPath(PATH_INPUT).appendPath(inputId).appendPath(PATH_CHANNEL)
                .appendPath(PATH_PASSTHROUGH).build();
    }

    /**
     * Builds a URI that points to a channel logo. See {@link Channels.Logo}.
     *
@@ -338,68 +351,65 @@ public final class TvContract {
        /** The channel type for SECAM. */
        public static final int TYPE_SECAM = 0x3;

        /** The special channel type used for pass-through inputs such as HDMI. */
        public static final int TYPE_PASSTHROUGH = 0x00010000;

        /** The channel type for DVB-T (terrestrial). */
        public static final int TYPE_DVB_T = 0x00020000;
        public static final int TYPE_DVB_T = 0x00010000;

        /** The channel type for DVB-T2 (terrestrial). */
        public static final int TYPE_DVB_T2 = 0x00020001;
        public static final int TYPE_DVB_T2 = 0x00010001;

        /** The channel type for DVB-S (satellite). */
        public static final int TYPE_DVB_S = 0x00020100;
        public static final int TYPE_DVB_S = 0x00010100;

        /** The channel type for DVB-S2 (satellite). */
        public static final int TYPE_DVB_S2 = 0x00020101;
        public static final int TYPE_DVB_S2 = 0x00010101;

        /** The channel type for DVB-C (cable). */
        public static final int TYPE_DVB_C = 0x00020200;
        public static final int TYPE_DVB_C = 0x00010200;

        /** The channel type for DVB-C2 (cable). */
        public static final int TYPE_DVB_C2 = 0x00020201;
        public static final int TYPE_DVB_C2 = 0x00010201;

        /** The channel type for DVB-H (handheld). */
        public static final int TYPE_DVB_H = 0x00020300;
        public static final int TYPE_DVB_H = 0x00010300;

        /** The channel type for DVB-SH (satellite). */
        public static final int TYPE_DVB_SH = 0x00020400;
        public static final int TYPE_DVB_SH = 0x00010400;

        /** The channel type for ATSC (terrestrial). */
        public static final int TYPE_ATSC_T = 0x00030000;
        public static final int TYPE_ATSC_T = 0x00020000;

        /** The channel type for ATSC (cable). */
        public static final int TYPE_ATSC_C = 0x00030200;
        public static final int TYPE_ATSC_C = 0x00020200;

        /** The channel type for ATSC-M/H (mobile/handheld). */
        public static final int TYPE_ATSC_M_H = 0x00030300;
        public static final int TYPE_ATSC_M_H = 0x00020300;

        /** The channel type for ISDB-T (terrestrial). */
        public static final int TYPE_ISDB_T = 0x00040000;
        public static final int TYPE_ISDB_T = 0x00030000;

        /** The channel type for ISDB-Tb (Brazil). */
        public static final int TYPE_ISDB_TB = 0x00040100;
        public static final int TYPE_ISDB_TB = 0x00030100;

        /** The channel type for ISDB-S (satellite). */
        public static final int TYPE_ISDB_S = 0x00040200;
        public static final int TYPE_ISDB_S = 0x00030200;

        /** The channel type for ISDB-C (cable). */
        public static final int TYPE_ISDB_C = 0x00040300;
        public static final int TYPE_ISDB_C = 0x00030300;

        /** The channel type for 1seg (handheld). */
        public static final int TYPE_1SEG = 0x00040400;
        public static final int TYPE_1SEG = 0x00030400;

        /** The channel type for DTMB (terrestrial). */
        public static final int TYPE_DTMB = 0x00050000;
        public static final int TYPE_DTMB = 0x00040000;

        /** The channel type for CMMB (handheld). */
        public static final int TYPE_CMMB = 0x00050100;
        public static final int TYPE_CMMB = 0x00040100;

        /** The channel type for T-DMB (terrestrial). */
        public static final int TYPE_T_DMB = 0x00060000;
        public static final int TYPE_T_DMB = 0x00050000;

        /** The channel type for S-DMB (satellite). */
        public static final int TYPE_S_DMB = 0x00060100;
        public static final int TYPE_S_DMB = 0x00050100;

        /** A generic service type. */
        public static final int SERVICE_TYPE_OTHER = 0x0;
@@ -501,14 +511,13 @@ public final class TvContract {
         * The predefined type of this TV channel.
         * <p>
         * This is primarily used to indicate which broadcast standard (e.g. ATSC, DVB or ISDB) the
         * current channel conforms to, with an exception being {@link #TYPE_PASSTHROUGH}, which is
         * a special channel type used only by pass-through inputs such as HDMI. The value should
         * match to one of the followings: {@link #TYPE_OTHER}, {@link #TYPE_PASSTHROUGH},
         * {@link #TYPE_DVB_T}, {@link #TYPE_DVB_T2}, {@link #TYPE_DVB_S}, {@link #TYPE_DVB_S2},
         * {@link #TYPE_DVB_C}, {@link #TYPE_DVB_C2}, {@link #TYPE_DVB_H}, {@link #TYPE_DVB_SH},
         * {@link #TYPE_ATSC_T}, {@link #TYPE_ATSC_C}, {@link #TYPE_ATSC_M_H}, {@link #TYPE_ISDB_T},
         * {@link #TYPE_ISDB_TB}, {@link #TYPE_ISDB_S}, {@link #TYPE_ISDB_C} {@link #TYPE_1SEG},
         * {@link #TYPE_DTMB}, {@link #TYPE_CMMB}, {@link #TYPE_T_DMB}, {@link #TYPE_S_DMB}
         * current channel conforms to. The value should match to one of the followings:
         * {@link #TYPE_OTHER}, {@link #TYPE_DVB_T}, {@link #TYPE_DVB_T2}, {@link #TYPE_DVB_S},
         * {@link #TYPE_DVB_S2}, {@link #TYPE_DVB_C}, {@link #TYPE_DVB_C2}, {@link #TYPE_DVB_H},
         * {@link #TYPE_DVB_SH}, {@link #TYPE_ATSC_T}, {@link #TYPE_ATSC_C},
         * {@link #TYPE_ATSC_M_H}, {@link #TYPE_ISDB_T}, {@link #TYPE_ISDB_TB},
         * {@link #TYPE_ISDB_S}, {@link #TYPE_ISDB_C}, {@link #TYPE_1SEG}, {@link #TYPE_DTMB},
         * {@link #TYPE_CMMB}, {@link #TYPE_T_DMB}, {@link #TYPE_S_DMB}
         * </p><p>
         * This is a required field.
         * </p><p>
+47 −4
Original line number Diff line number Diff line
@@ -57,17 +57,45 @@ public final class TvInputInfo implements Parcelable {
    // Should be in sync with hardware/libhardware/include/hardware/tv_input.h

    /**
     * TV input type: the TV input service is HDMI. (e.g. HDMI 1)
     * TV input type: a generic hardware TV input type.
     */
    public static final int TYPE_HDMI = 1;
    public static final int TYPE_OTHER_HARDWARE = 1;
    /**
     * TV input type: the TV input service is a tuner. (e.g. terrestrial tuner)
     */
    public static final int TYPE_TUNER = 2;
    /**
     * TV input type: the TV input service is stateless pass-through. (e.g. RGB, composite, etc.)
     * TV input type: the TV input service is HDMI. (e.g. HDMI 1)
     */
    public static final int TYPE_HDMI = 3;
    /**
     * TV input type: the TV input service represents a display port.
     */
    public static final int TYPE_DISPLAY_PORT = 4;
    /**
     * TV input type: the TV input service represents a SCART port.
     */
    public static final int TYPE_SCART = 5;
    /**
     * TV input type: the TV input service represents a DVI port.
     */
    public static final int TYPE_DVI = 6;
    /**
     * TV input type: the TV input service represents a VGA port.
     */
    public static final int TYPE_VGA = 7;
    /**
     * TV input type: the TV input service represents a component port.
     */
    public static final int TYPE_PASSTHROUGH = 3;
    public static final int TYPE_COMPONENT = 8;
    /**
     * TV input type: the TV input service represents a composite port.
     */
    public static final int TYPE_COMPOSITE = 9;
    /**
     * TV input type: the TV input service represents a SVIDEO port.
     */
    public static final int TYPE_SVIDEO = 10;

    /**
     * The ID of the TV input to provide to the setup activity and settings activity.
@@ -276,6 +304,21 @@ public final class TvInputInfo implements Parcelable {
        return mType;
    }

    /**
     * Returns {@code true} if this TV input is pass-though which does not have any real channels
     * in TvProvider. {@code false} otherwise.
     *
     * @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;
    }

    /**
     * Loads the user-displayed label for this TV input service.
     *