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

Commit 9b4d25a8 authored by Jungshik Jang's avatar Jungshik Jang Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE: Stop publishing HdmiCecService, start publishing...

Merge "DO NOT MERGE: Stop publishing HdmiCecService, start publishing HdmiControlService" into lmp-preview-dev
parents 9a4e0f12 e74282b7
Loading
Loading
Loading
Loading
+7 −31
Original line number Diff line number Diff line
@@ -69,44 +69,28 @@ public final class HdmiCecClient {
     * Send <Active Source> message.
     */
    public void sendActiveSource() {
        try {
            mService.sendActiveSource(mBinder);
        } catch (RemoteException e) {
            Log.e(TAG, "sendActiveSource threw exception ", e);
        }
        Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
    }

    /**
     * Send <Inactive Source> message.
     */
    public void sendInactiveSource() {
        try {
            mService.sendInactiveSource(mBinder);
        } catch (RemoteException e) {
            Log.e(TAG, "sendInactiveSource threw exception ", e);
        }
        Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
    }

    /**
     * Send <Text View On> message.
     */
    public void sendTextViewOn() {
        try {
            mService.sendTextViewOn(mBinder);
        } catch (RemoteException e) {
            Log.e(TAG, "sendTextViewOn threw exception ", e);
        }
        Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
    }

    /**
     * Send <Image View On> message.
     */
    public void sendImageViewOn() {
        try {
            mService.sendImageViewOn(mBinder);
        } catch (RemoteException e) {
            Log.e(TAG, "sendImageViewOn threw exception ", e);
        }
        Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
    }

    /**
@@ -116,11 +100,7 @@ public final class HdmiCecClient {
     *        {@link HdmiCec#ADDR_TV}.
     */
    public void sendGiveDevicePowerStatus(int address) {
        try {
            mService.sendGiveDevicePowerStatus(mBinder, address);
        } catch (RemoteException e) {
            Log.e(TAG, "sendGiveDevicePowerStatus threw exception ", e);
        }
        Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
    }

    /**
@@ -133,11 +113,7 @@ public final class HdmiCecClient {
     * @return true if TV is on; otherwise false.
     */
    public boolean isTvOn() {
        try {
            return mService.isTvOn(mBinder);
        } catch (RemoteException e) {
            Log.e(TAG, "isTvOn threw exception ", e);
        }
        return false;
        Log.w(TAG, "In transition to HdmiControlManager. Will not work.");
        return true;
    }
}
+1 −9
Original line number Diff line number Diff line
@@ -45,15 +45,7 @@ public final class HdmiCecManager {
     * @return {@link HdmiCecClient} instance. {@code null} on failure.
     */
    public HdmiCecClient getClient(int type, HdmiCecClient.Listener listener) {
        if (mService == null) {
            return null;
        }
        try {
            IBinder b = mService.allocateLogicalDevice(type, getListenerWrapper(listener));
            return HdmiCecClient.create(mService, b);
        } catch (RemoteException e) {
            return null;
        }
        return HdmiCecClient.create(mService, null);
    }

    private IHdmiCecListener getListenerWrapper(final HdmiCecClient.Listener listener) {
+2 −7
Original line number Diff line number Diff line
@@ -75,13 +75,8 @@ public final class HdmiCecService extends SystemService {

    @Override
    public void onStart() {
        mNativePtr = nativeInit(this);
        if (mNativePtr != 0) {
            // TODO: Consider using a dedicated, configurable identifier for OSD name, maybe from
            //       Settings. It should be ASCII only, not a very long one (limited to 15 chars).
            setOsdNameLocked(Build.MODEL);
            publishBinderService(Context.HDMI_CEC_SERVICE, new BinderService());
        }
        // Stop publishing the service. Soon to be deprecated.
        Log.w(TAG, "In transition to HdmiControlService. May not work.");
    }

    /**
+1 −2
Original line number Diff line number Diff line
@@ -140,8 +140,7 @@ public final class HdmiControlService extends SystemService {
            Slog.i(TAG, "Device does not support MHL-control.");
        }

        // TODO: Publish the BinderService
        // publishBinderService(Context.HDMI_CONTROL_SERVICE, new BinderService());
        publishBinderService(Context.HDMI_CONTROL_SERVICE, new BinderService());
    }

    /**
+0 −7
Original line number Diff line number Diff line
@@ -240,13 +240,6 @@ void HdmiCecController::onReceived(const hdmi_event_t* event, void* arg) {
        var = env->GetMethodID(clazz, methodName, methodDescriptor); \
        LOG_FATAL_IF(! var, "Unable to find method " methodName);

// TODO: replace above code with following once
// replace old HdmiCecService with HdmiControlService
#undef HDMI_CEC_HARDWARE_MODULE_ID
#define HDMI_CEC_HARDWARE_MODULE_ID "hdmi_cec_module"
#undef HDMI_CEC_HARDWARE_INTERFACE
#define HDMI_CEC_HARDWARE_INTERFACE "hdmi_cec_module_hw_if"

static jlong nativeInit(JNIEnv* env, jclass clazz, jobject callbacksObj,
        jobject messageQueueObj) {
    int err;