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

Commit 42230728 authored by Jungshik Jang's avatar Jungshik Jang
Browse files

Add port number to hot plug event handler.

This is to remove a TODO about adding port number to
jni interface.

Bug: 15844074
Change-Id: I4dba0879527035a4cabad6cc80e359e6c1fd39b0
parent c4ae64d5
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ final class HdmiCecController {
         *
         * @param deviceType requested device type to allocate logical address
         * @param logicalAddress allocated logical address. If it is
         *                       {@link Constants.ADDR_UNREGISTERED}, it means that
         *                       {@link Constants#ADDR_UNREGISTERED}, it means that
         *                       it failed to allocate logical address for the given device type
         */
        void onAllocated(int deviceType, int logicalAddress);
@@ -158,7 +158,7 @@ final class HdmiCecController {
     *
     * @param deviceType type of device to used to determine logical address
     * @param preferredAddress a logical address preferred to be allocated.
     *                         If sets {@link Constants.ADDR_UNREGISTERED}, scans
     *                         If sets {@link Constants#ADDR_UNREGISTERED}, scans
     *                         the smallest logical address matched with the given device type.
     *                         Otherwise, scan address will start from {@code preferredAddress}
     * @param callback callback interface to report allocated logical address to caller
@@ -559,10 +559,10 @@ final class HdmiCecController {
    /**
     * Called by native when a hotplug event issues.
     */
    private void handleHotplug(boolean connected) {
        // TODO: once add port number to cec HAL interface, pass port number
        // to the service.
        mService.onHotplug(0, connected);
    @ServiceThreadOnly
    private void handleHotplug(int port, boolean connected) {
        assertRunOnServiceThread();
        mService.onHotplug(port, connected);
    }

    private static native long nativeInit(HdmiCecController handler, MessageQueue messageQueue);
+4 −2
Original line number Diff line number Diff line
@@ -162,8 +162,10 @@ private:
    void propagateHotplugEvent(const hotplug_event_t& event) {
        // Note that this method should be called in service thread.
        JNIEnv* env = AndroidRuntime::getJNIEnv();
        jint port = event.port;
        jboolean connected = (jboolean) event.connected;
        env->CallVoidMethod(mController->getCallbacksObj(),
                gHdmiCecControllerClassInfo.handleHotplug, event.connected);
                gHdmiCecControllerClassInfo.handleHotplug, port, connected);

        checkAndClearExceptionFromCallback(env, __FUNCTION__);
    }
@@ -314,7 +316,7 @@ static jlong nativeInit(JNIEnv* env, jclass clazz, jobject callbacksObj,
    GET_METHOD_ID(gHdmiCecControllerClassInfo.handleIncomingCecCommand, clazz,
            "handleIncomingCecCommand", "(II[B)V");
    GET_METHOD_ID(gHdmiCecControllerClassInfo.handleHotplug, clazz,
            "handleHotplug", "(Z)V");
            "handleHotplug", "(IZ)V");

    return reinterpret_cast<jlong>(controller);
}