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

Commit 0ccbea7c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove MSC_ANDROID_TIME_SEC usages"

parents 3fedfcb4 5a7f40df
Loading
Loading
Loading
Loading
+2 −20
Original line number Diff line number Diff line
@@ -255,8 +255,6 @@ final class TvRemoteProviderProxy implements ServiceConnection {

        void clearInputBridge(TvRemoteProviderProxy provider, IBinder token);

        void sendTimeStamp(TvRemoteProviderProxy provider, IBinder token, long timestamp);

        void sendKeyDown(TvRemoteProviderProxy provider, IBinder token, int keyCode);

        void sendKeyUp(TvRemoteProviderProxy provider, IBinder token, int keyCode);
@@ -400,24 +398,8 @@ final class TvRemoteProviderProxy implements ServiceConnection {
        }

        void sendTimestamp(final IBinder token, final long timestamp) {
            synchronized (mLock) {
                if (mActiveConnection == this && Binder.getCallingUid() == mUid) {
                    final long idToken = Binder.clearCallingIdentity();
                    try {
                        if (mProviderMethods != null) {
                            mProviderMethods.sendTimeStamp(TvRemoteProviderProxy.this, token,
                                    timestamp);
                        }
                    } finally {
                        Binder.restoreCallingIdentity(idToken);
                    }
                } else {
            if (DEBUG) {
                        Slog.w(TAG,
                                "sendTimeStamp, Invalid connection or incorrect uid: " + Binder
                                        .getCallingUid());
                    }
                }
                Slog.e(TAG, "sendTimestamp is deprecated, please remove all usages of this API.");
            }
        }

+0 −16
Original line number Diff line number Diff line
@@ -147,13 +147,6 @@ public class TvRemoteService extends SystemService implements Watchdog.Monitor {
        }
    }

    private void sendTimeStampInternalLocked(IBinder token, long timestamp) {
        UinputBridge inputBridge = mBridgeMap.get(token);
        if (inputBridge != null) {
            inputBridge.sendTimestamp(token, timestamp);
        }
    }

    private void sendKeyDownInternalLocked(IBinder token, int keyCode) {
        if (DEBUG_KEYS) {
            Slog.d(TAG, "sendKeyDownInternalLocked(), token: " + token + ", keyCode: " + keyCode);
@@ -297,15 +290,6 @@ public class TvRemoteService extends SystemService implements Watchdog.Monitor {
            }
        }

        @Override
        public void sendTimeStamp(TvRemoteProviderProxy provider, IBinder token, long timestamp) {
            synchronized (mLock) {
                if (mProviderList.contains(provider)) {
                    mService.sendTimeStampInternalLocked(token, timestamp);
                }
            }
        }

        @Override
        public void sendKeyDown(TvRemoteProviderProxy provider, IBinder token, int keyCode) {
            if (DEBUG_KEYS) {
+2 −10
Original line number Diff line number Diff line
@@ -16,13 +16,12 @@

package com.android.server.tv;

import android.os.Binder;
import android.os.IBinder;

import java.io.IOException;

import dalvik.system.CloseGuard;

import java.io.IOException;

/**
 * Sends the input event to the linux driver.
 */
@@ -35,7 +34,6 @@ public final class UinputBridge {
                                          int maxPointers);
    private static native void nativeClose(long ptr);
    private static native void nativeClear(long ptr);
    private static native void nativeSendTimestamp(long ptr, long timestamp);
    private static native void nativeSendKey(long ptr, int keyCode, boolean down);
    private static native void nativeSendPointerDown(long ptr, int pointerId, int x, int y);
    private static native void nativeSendPointerUp(long ptr, int pointerId);
@@ -93,12 +91,6 @@ public final class UinputBridge {
        return mToken.equals(token);
    }

    public void sendTimestamp(IBinder token, long timestamp) {
        if (isTokenValid(token)) {
            nativeSendTimestamp(mPtr, timestamp);
        }
    }

    public void sendKeyDown(IBinder token, int keyCode) {
        if (isTokenValid(token)) {
            nativeSendKey(mPtr, keyCode, true /*down*/);
+0 −18
Original line number Diff line number Diff line
@@ -43,10 +43,6 @@
#include <sys/stat.h>
#include <sys/types.h>

// Refer to EventHub.h
#define MSC_ANDROID_TIME_SEC 0x6
#define MSC_ANDROID_TIME_USEC 0x7

#define SLOT_UNKNOWN -1

namespace android {
@@ -153,11 +149,6 @@ NativeConnection* NativeConnection::open(const char* name, const char* uniqueId,
        ioctl(fd, UI_SET_KEYBIT, KEYS[i].linuxKeyCode);
    }

    // set the misc events maps
    ioctl(fd, UI_SET_EVBIT, EV_MSC);
    ioctl(fd, UI_SET_MSCBIT, MSC_ANDROID_TIME_SEC);
    ioctl(fd, UI_SET_MSCBIT, MSC_ANDROID_TIME_USEC);

    // register the input device
    if (write(fd, &uinp, sizeof(uinp)) != sizeof(uinp)) {
        ALOGE("Cannot write uinput_user_dev to fd %d: %s.", fd, strerror(errno));
@@ -200,13 +191,6 @@ static void nativeClose(JNIEnv* env, jclass clazz, jlong ptr) {
    delete connection;
}

static void nativeSendTimestamp(JNIEnv* env, jclass clazz, jlong ptr, jlong timestamp) {
    NativeConnection* connection = reinterpret_cast<NativeConnection*>(ptr);

    connection->sendEvent(EV_MSC, MSC_ANDROID_TIME_SEC, timestamp / 1000L);
    connection->sendEvent(EV_MSC, MSC_ANDROID_TIME_USEC, (timestamp % 1000L) * 1000L);
}

static void nativeSendKey(JNIEnv* env, jclass clazz, jlong ptr, jint keyCode, jboolean down) {
    int32_t code = getLinuxKeyCode(keyCode);
    NativeConnection* connection = reinterpret_cast<NativeConnection*>(ptr);
@@ -281,8 +265,6 @@ static JNINativeMethod gUinputBridgeMethods[] = {
        (void*)nativeOpen },
    { "nativeClose", "(J)V",
        (void*)nativeClose },
    { "nativeSendTimestamp", "(JJ)V",
        (void*)nativeSendTimestamp },
    { "nativeSendKey", "(JIZ)V",
        (void*)nativeSendKey },
    { "nativeSendPointerDown", "(JIII)V",