summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/hdmi/HdmiMhlControllerStub.java
blob: c27cf18034c8272e54c70fa45e0acb5f53f17659 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
 * 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.HdmiPortInfo;
import android.util.SparseArray;

import com.android.server.hdmi.HdmiControlService.SendMessageCallback;

/**
 * A handler class for MHL control command. It converts user's command into MHL command and pass it
 * to MHL HAL layer.
 * <p>
 * It can be created only by {@link HdmiMhlControllerStub#create}.
 */
final class HdmiMhlControllerStub {

    private static final SparseArray<HdmiMhlLocalDevice> mLocalDevices = new SparseArray<>();
    private static final HdmiPortInfo[] EMPTY_PORT_INFO = new HdmiPortInfo[0];
    private static final int INVALID_MHL_VERSION = 0;
    private static final int NO_SUPPORTED_FEATURES = 0;
    private static final int INVALID_DEVICE_ROLES = 0;

    // Private constructor. Use HdmiMhlControllerStub.create().
    private HdmiMhlControllerStub(HdmiControlService service) {
    }

    // Returns true if MHL controller is initialized and ready to use.
    boolean isReady() {
        return false;
    }

    static HdmiMhlControllerStub create(HdmiControlService service) {
        return new HdmiMhlControllerStub(service);
    }

    HdmiPortInfo[] getPortInfos() {
        return EMPTY_PORT_INFO;
    }

    /**
     * Return {@link HdmiMhlLocalDevice} matched with the given port id.
     *
     * @return null if has no matched port id
     */
    HdmiMhlLocalDevice getLocalDevice(int portId) {
        return null;
    }

    /**
     * Return {@link HdmiMhlLocalDevice} matched with the given device id.
     *
     * @return null if has no matched id
     */
    HdmiMhlLocalDevice getLocalDeviceById(int deviceId) {
        return null;
    }

    SparseArray<HdmiMhlLocalDevice> getAllLocalDevices() {
        return mLocalDevices;
    }

    /**
     * Remove a {@link HdmiMhlLocalDevice} matched with the given port id.
     *
     * @return removed {@link HdmiMhlLocalDevice}. Return null if no matched port id.
     */
    HdmiMhlLocalDevice removeLocalDevice(int portId) {
        return null;
    }

    /**
     * Add a new {@link HdmiMhlLocalDevice}.
     *
     * @return old {@link HdmiMhlLocalDevice} having same port id
     */
    HdmiMhlLocalDevice addLocalDevice(HdmiMhlLocalDevice device) {
        return null;
    }

    void clearAllLocalDevices() {
    }

    /**
     * Send MHL MSC-Subcommand to the device connected to the given port.
     */
    void sendSubcommand(int portId, HdmiMhlSubcommand command) {
    }

    void sendSubcommand(final int portId, final HdmiMhlSubcommand command,
            SendMessageCallback callback) {
    }


    void sendScratchpadCommand(int portId, int offset, int length, byte[] data) {
    }

    void setOption(int flag, int value) {
    }

    /**
     * Get the MHL version supported by underlying hardware port of the given {@code portId}.
     * MHL specification version 2.0 returns 0x20, 3.0 will return 0x30 respectively.
     * The return value is stored in 'version'. Return INVALID_VERSION if MHL hardware layer
     * is not ready.
     */
    int getMhlVersion(int portId) {
        return INVALID_MHL_VERSION;
    }

    /**
     * Get MHL version of a device which is connected to a port of the given {@code portId}.
     * MHL specification version 2.0 returns 0x20, 3.0 will return 0x30 respectively.
     * The return value is stored in 'version'.
     */
    int getPeerMhlVersion(int portId) {
        return INVALID_MHL_VERSION;
    }

    /**
     * Get the bit flags describing the features supported by the system. Refer to feature support
     * flag register info in MHL specification.
     */
    int getSupportedFeatures(int portId) {
        return NO_SUPPORTED_FEATURES;
    }

    /**
     * Get the bit flags describing the roles which ECBUS device can play. Refer to the
     * ECBUS_DEV_ROLES Register info MHL3.0 specification
     */
    int getEcbusDeviceRoles(int portId) {
        return INVALID_DEVICE_ROLES;
    }
}