diff options
author | Narayan Kamath <narayan@google.com> | 2014-02-11 16:34:08 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-02-11 16:34:08 +0000 |
commit | a9d171bd5bab29feaef409489ed23d3c490285ce (patch) | |
tree | e52967b6789a1519e5767020d66e64095861e154 | |
parent | d350af9695018e81f85600fb7dd906003cbaf62e (diff) | |
parent | 5c770dfba2846ee173d147fd974f8e9f073c1534 (diff) | |
download | frameworks_base-a9d171bd5bab29feaef409489ed23d3c490285ce.zip frameworks_base-a9d171bd5bab29feaef409489ed23d3c490285ce.tar.gz frameworks_base-a9d171bd5bab29feaef409489ed23d3c490285ce.tar.bz2 |
am 5c770dfb: am b823bd45: Merge "Use long to store pointers in ConsumerIrService"
* commit '5c770dfba2846ee173d147fd974f8e9f073c1534':
Use long to store pointers in ConsumerIrService
-rw-r--r-- | services/core/java/com/android/server/ConsumerIrService.java | 22 | ||||
-rw-r--r-- | services/core/jni/com_android_server_ConsumerIrService.cpp | 16 |
2 files changed, 19 insertions, 19 deletions
diff --git a/services/core/java/com/android/server/ConsumerIrService.java b/services/core/java/com/android/server/ConsumerIrService.java index 783dff1..583f1bc 100644 --- a/services/core/java/com/android/server/ConsumerIrService.java +++ b/services/core/java/com/android/server/ConsumerIrService.java @@ -49,13 +49,13 @@ public class ConsumerIrService extends IConsumerIrService.Stub { private static final int MAX_XMIT_TIME = 2000000; /* in microseconds */ - private static native int halOpen(); - private static native int halTransmit(int halObject, int carrierFrequency, int[] pattern); - private static native int[] halGetCarrierFrequencies(int halObject); + private static native long halOpen(); + private static native int halTransmit(long halObject, int carrierFrequency, int[] pattern); + private static native int[] halGetCarrierFrequencies(long halObject); private final Context mContext; private final PowerManager.WakeLock mWakeLock; - private final int mHal; + private final long mNativeHal; private final Object mHalLock = new Object(); ConsumerIrService(Context context) { @@ -65,23 +65,23 @@ public class ConsumerIrService extends IConsumerIrService.Stub { mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); mWakeLock.setReferenceCounted(true); - mHal = halOpen(); + mNativeHal = halOpen(); if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CONSUMER_IR)) { - if (mHal == 0) { + if (mNativeHal == 0) { throw new RuntimeException("FEATURE_CONSUMER_IR present, but no IR HAL loaded!"); } - } else if (mHal != 0) { + } else if (mNativeHal != 0) { throw new RuntimeException("IR HAL present, but FEATURE_CONSUMER_IR is not set!"); } } @Override public boolean hasIrEmitter() { - return mHal != 0; + return mNativeHal != 0; } private void throwIfNoIrEmitter() { - if (mHal == 0) { + if (mNativeHal == 0) { throw new UnsupportedOperationException("IR emitter not available"); } } @@ -111,7 +111,7 @@ public class ConsumerIrService extends IConsumerIrService.Stub { // Right now there is no mechanism to ensure fair queing of IR requests synchronized (mHalLock) { - int err = halTransmit(mHal, carrierFrequency, pattern); + int err = halTransmit(mNativeHal, carrierFrequency, pattern); if (err < 0) { Slog.e(TAG, "Error transmitting: " + err); @@ -129,7 +129,7 @@ public class ConsumerIrService extends IConsumerIrService.Stub { throwIfNoIrEmitter(); synchronized(mHalLock) { - return halGetCarrierFrequencies(mHal); + return halGetCarrierFrequencies(mNativeHal); } } } diff --git a/services/core/jni/com_android_server_ConsumerIrService.cpp b/services/core/jni/com_android_server_ConsumerIrService.cpp index 004c0aa..3a50ff7 100644 --- a/services/core/jni/com_android_server_ConsumerIrService.cpp +++ b/services/core/jni/com_android_server_ConsumerIrService.cpp @@ -29,7 +29,7 @@ namespace android { -static jint halOpen(JNIEnv *env, jobject obj) { +static jlong halOpen(JNIEnv *env, jobject obj) { hw_module_t const* module; consumerir_device_t *dev; int err; @@ -47,10 +47,10 @@ static jint halOpen(JNIEnv *env, jobject obj) { return 0; } - return reinterpret_cast<jint>(dev); + return reinterpret_cast<jlong>(dev); } -static jint halTransmit(JNIEnv *env, jobject obj, jint halObject, +static jint halTransmit(JNIEnv *env, jobject obj, jlong halObject, jint carrierFrequency, jintArray pattern) { int ret; @@ -67,8 +67,8 @@ static jint halTransmit(JNIEnv *env, jobject obj, jint halObject, } static jintArray halGetCarrierFrequencies(JNIEnv *env, jobject obj, - jint halObject) { - consumerir_device_t *dev = (consumerir_device_t *) halObject; + jlong halObject) { + consumerir_device_t *dev = reinterpret_cast<consumerir_device_t*>(halObject); consumerir_freq_range_t *ranges; int len; @@ -101,9 +101,9 @@ static jintArray halGetCarrierFrequencies(JNIEnv *env, jobject obj, } static JNINativeMethod method_table[] = { - { "halOpen", "()I", (void *)halOpen }, - { "halTransmit", "(II[I)I", (void *)halTransmit }, - { "halGetCarrierFrequencies", "(I)[I", (void *)halGetCarrierFrequencies}, + { "halOpen", "()J", (void *)halOpen }, + { "halTransmit", "(JI[I)I", (void *)halTransmit }, + { "halGetCarrierFrequencies", "(J)[I", (void *)halGetCarrierFrequencies}, }; int register_android_server_ConsumerIrService(JNIEnv *env) { |