am 71cdc73d: am 53acc7ae: am f5598210: Merge "AArch64: Use long for pointers in hardware classes"

* commit '71cdc73d2808944fca0a9e200696253d1f4a5bf4':
  AArch64: Use long for pointers in hardware classes
This commit is contained in:
Narayan Kamath
2014-01-08 12:01:09 +00:00
committed by Android Git Automerger
8 changed files with 51 additions and 51 deletions

View File

@@ -151,7 +151,7 @@ public class Camera {
private static final int CAMERA_MSG_PREVIEW_METADATA = 0x400;
private static final int CAMERA_MSG_FOCUS_MOVE = 0x800;
private int mNativeContext; // accessed by native methods
private long mNativeContext; // accessed by native methods
private EventHandler mEventHandler;
private ShutterCallback mShutterCallback;
private PictureCallback mRawImageCallback;

View File

@@ -222,14 +222,14 @@ public class SystemSensorManager extends SensorManager {
* the queues and the listeners.
*/
private static abstract class BaseEventQueue {
private native int nativeInitBaseEventQueue(BaseEventQueue eventQ, MessageQueue msgQ,
private native long nativeInitBaseEventQueue(BaseEventQueue eventQ, MessageQueue msgQ,
float[] scratch);
private static native int nativeEnableSensor(int eventQ, int handle, int rateUs,
private static native int nativeEnableSensor(long eventQ, int handle, int rateUs,
int maxBatchReportLatencyUs, int reservedFlags);
private static native int nativeDisableSensor(int eventQ, int handle);
private static native void nativeDestroySensorEventQueue(int eventQ);
private static native int nativeFlushSensor(int eventQ);
private int nSensorEventQueue;
private static native int nativeDisableSensor(long eventQ, int handle);
private static native void nativeDestroySensorEventQueue(long eventQ);
private static native int nativeFlushSensor(long eventQ);
private long nSensorEventQueue;
private final SparseBooleanArray mActiveSensors = new SparseBooleanArray();
protected final SparseIntArray mSensorAccuracies = new SparseIntArray();
protected final SparseBooleanArray mFirstEvent = new SparseBooleanArray();

View File

@@ -32,7 +32,7 @@ public class UsbDeviceConnection {
private final UsbDevice mDevice;
// used by the JNI code
private int mNativeContext;
private long mNativeContext;
/**
* UsbDevice should only be instantiated by UsbService implementation

View File

@@ -37,7 +37,7 @@ public class UsbRequest {
private static final String TAG = "UsbRequest";
// used by the JNI code
private int mNativeContext;
private long mNativeContext;
private UsbEndpoint mEndpoint;

View File

@@ -113,7 +113,7 @@ sp<Camera> get_native_camera(JNIEnv *env, jobject thiz, JNICameraContext** pCont
{
sp<Camera> camera;
Mutex::Autolock _l(sLock);
JNICameraContext* context = reinterpret_cast<JNICameraContext*>(env->GetIntField(thiz, fields.context));
JNICameraContext* context = reinterpret_cast<JNICameraContext*>(env->GetLongField(thiz, fields.context));
if (context != NULL) {
camera = context->getCamera();
}
@@ -500,7 +500,7 @@ static void android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
camera->setListener(context);
// save context in opaque field
env->SetIntField(thiz, fields.context, (int)context.get());
env->SetLongField(thiz, fields.context, (jlong)context.get());
}
// disconnect from camera service
@@ -515,10 +515,10 @@ static void android_hardware_Camera_release(JNIEnv *env, jobject thiz)
sp<Camera> camera;
{
Mutex::Autolock _l(sLock);
context = reinterpret_cast<JNICameraContext*>(env->GetIntField(thiz, fields.context));
context = reinterpret_cast<JNICameraContext*>(env->GetLongField(thiz, fields.context));
// Make sure we do not attempt to callback on a deleted Java object.
env->SetIntField(thiz, fields.context, 0);
env->SetLongField(thiz, fields.context, 0);
}
// clean up if release has not been called before
@@ -627,13 +627,13 @@ static void android_hardware_Camera_stopPreview(JNIEnv *env, jobject thiz)
c->stopPreview();
}
static bool android_hardware_Camera_previewEnabled(JNIEnv *env, jobject thiz)
static jboolean android_hardware_Camera_previewEnabled(JNIEnv *env, jobject thiz)
{
ALOGV("previewEnabled");
sp<Camera> c = get_native_camera(env, thiz, NULL);
if (c == 0) return false;
if (c == 0) return JNI_FALSE;
return c->previewEnabled();
return c->previewEnabled() ? JNI_TRUE : JNI_FALSE;
}
static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject thiz, jboolean installed, jboolean manualBuffer)
@@ -651,10 +651,10 @@ static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject t
context->setCallbackMode(env, installed, manualBuffer);
}
static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, int msgType) {
static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, jint msgType) {
ALOGV("addCallbackBuffer: 0x%x", msgType);
JNICameraContext* context = reinterpret_cast<JNICameraContext*>(env->GetIntField(thiz, fields.context));
JNICameraContext* context = reinterpret_cast<JNICameraContext*>(env->GetLongField(thiz, fields.context));
if (context != NULL) {
context->addCallbackBuffer(env, bytes, msgType);
@@ -685,7 +685,7 @@ static void android_hardware_Camera_cancelAutoFocus(JNIEnv *env, jobject thiz)
}
}
static void android_hardware_Camera_takePicture(JNIEnv *env, jobject thiz, int msgType)
static void android_hardware_Camera_takePicture(JNIEnv *env, jobject thiz, jint msgType)
{
ALOGV("takePicture");
JNICameraContext* context;
@@ -999,7 +999,7 @@ static int find_fields(JNIEnv *env, field *fields, int count)
int register_android_hardware_Camera(JNIEnv *env)
{
field fields_to_find[] = {
{ "android/hardware/Camera", "mNativeContext", "I", &fields.context },
{ "android/hardware/Camera", "mNativeContext", "J", &fields.context },
{ "android/hardware/Camera$CameraInfo", "facing", "I", &fields.facing },
{ "android/hardware/Camera$CameraInfo", "orientation", "I", &fields.orientation },
{ "android/hardware/Camera$CameraInfo", "canDisableShutterSound", "Z",

View File

@@ -187,7 +187,7 @@ private:
}
};
static jint nativeInitSensorEventQueue(JNIEnv *env, jclass clazz, jobject eventQ, jobject msgQ, jfloatArray scratch) {
static jlong nativeInitSensorEventQueue(JNIEnv *env, jclass clazz, jobject eventQ, jobject msgQ, jfloatArray scratch) {
SensorManager& mgr(SensorManager::getInstance());
sp<SensorEventQueue> queue(mgr.createEventQueue());
@@ -199,28 +199,28 @@ static jint nativeInitSensorEventQueue(JNIEnv *env, jclass clazz, jobject eventQ
sp<Receiver> receiver = new Receiver(queue, messageQueue, eventQ, scratch);
receiver->incStrong((void*)nativeInitSensorEventQueue);
return jint(receiver.get());
return jlong(receiver.get());
}
static jint nativeEnableSensor(JNIEnv *env, jclass clazz, jint eventQ, jint handle, jint rate_us,
static jint nativeEnableSensor(JNIEnv *env, jclass clazz, jlong eventQ, jint handle, jint rate_us,
jint maxBatchReportLatency, jint reservedFlags) {
sp<Receiver> receiver(reinterpret_cast<Receiver *>(eventQ));
return receiver->getSensorEventQueue()->enableSensor(handle, rate_us, maxBatchReportLatency,
reservedFlags);
}
static jint nativeDisableSensor(JNIEnv *env, jclass clazz, jint eventQ, jint handle) {
static jint nativeDisableSensor(JNIEnv *env, jclass clazz, jlong eventQ, jint handle) {
sp<Receiver> receiver(reinterpret_cast<Receiver *>(eventQ));
return receiver->getSensorEventQueue()->disableSensor(handle);
}
static void nativeDestroySensorEventQueue(JNIEnv *env, jclass clazz, jint eventQ, jint handle) {
static void nativeDestroySensorEventQueue(JNIEnv *env, jclass clazz, jlong eventQ, jint handle) {
sp<Receiver> receiver(reinterpret_cast<Receiver *>(eventQ));
receiver->destroy();
receiver->decStrong((void*)nativeInitSensorEventQueue);
}
static jint nativeFlushSensor(JNIEnv *env, jclass clazz, jint eventQ) {
static jint nativeFlushSensor(JNIEnv *env, jclass clazz, jlong eventQ) {
sp<Receiver> receiver(reinterpret_cast<Receiver *>(eventQ));
return receiver->getSensorEventQueue()->flush();
}
@@ -239,23 +239,23 @@ static JNINativeMethod gSystemSensorManagerMethods[] = {
static JNINativeMethod gBaseEventQueueMethods[] = {
{"nativeInitBaseEventQueue",
"(Landroid/hardware/SystemSensorManager$BaseEventQueue;Landroid/os/MessageQueue;[F)I",
"(Landroid/hardware/SystemSensorManager$BaseEventQueue;Landroid/os/MessageQueue;[F)J",
(void*)nativeInitSensorEventQueue },
{"nativeEnableSensor",
"(IIIII)I",
"(JIIII)I",
(void*)nativeEnableSensor },
{"nativeDisableSensor",
"(II)I",
"(JI)I",
(void*)nativeDisableSensor },
{"nativeDestroySensorEventQueue",
"(I)V",
"(J)V",
(void*)nativeDestroySensorEventQueue },
{"nativeFlushSensor",
"(I)I",
"(J)I",
(void*)nativeFlushSensor },
};

View File

@@ -35,7 +35,7 @@ static jfieldID field_context;
struct usb_device* get_device_from_object(JNIEnv* env, jobject connection)
{
return (struct usb_device*)env->GetIntField(connection, field_context);
return (struct usb_device*)env->GetLongField(connection, field_context);
}
static jboolean
@@ -46,19 +46,19 @@ android_hardware_UsbDeviceConnection_open(JNIEnv *env, jobject thiz, jstring dev
// duplicate the file descriptor, since ParcelFileDescriptor will eventually close its copy
fd = dup(fd);
if (fd < 0)
return false;
return JNI_FALSE;
const char *deviceNameStr = env->GetStringUTFChars(deviceName, NULL);
struct usb_device* device = usb_device_new(deviceNameStr, fd);
if (device) {
env->SetIntField(thiz, field_context, (int)device);
env->SetLongField(thiz, field_context, (jlong)device);
} else {
ALOGE("usb_device_open failed for %s", deviceNameStr);
close(fd);
}
env->ReleaseStringUTFChars(deviceName, deviceNameStr);
return (device != NULL);
return (device != NULL) ? JNI_TRUE : JNI_FALSE;
}
static void
@@ -68,7 +68,7 @@ android_hardware_UsbDeviceConnection_close(JNIEnv *env, jobject thiz)
struct usb_device* device = get_device_from_object(env, thiz);
if (device) {
usb_device_close(device);
env->SetIntField(thiz, field_context, 0);
env->SetLongField(thiz, field_context, 0);
}
}
@@ -106,12 +106,12 @@ android_hardware_UsbDeviceConnection_get_desc(JNIEnv *env, jobject thiz)
static jboolean
android_hardware_UsbDeviceConnection_claim_interface(JNIEnv *env, jobject thiz,
int interfaceID, jboolean force)
jint interfaceID, jboolean force)
{
struct usb_device* device = get_device_from_object(env, thiz);
if (!device) {
ALOGE("device is closed in native_claim_interface");
return -1;
return JNI_FALSE;
}
int ret = usb_device_claim_interface(device, interfaceID);
@@ -120,11 +120,11 @@ android_hardware_UsbDeviceConnection_claim_interface(JNIEnv *env, jobject thiz,
usb_device_connect_kernel_driver(device, interfaceID, false);
ret = usb_device_claim_interface(device, interfaceID);
}
return ret == 0;
return (ret == 0) ? JNI_TRUE : JNI_FALSE;
}
static jint
android_hardware_UsbDeviceConnection_release_interface(JNIEnv *env, jobject thiz, int interfaceID)
android_hardware_UsbDeviceConnection_release_interface(JNIEnv *env, jobject thiz, jint interfaceID)
{
struct usb_device* device = get_device_from_object(env, thiz);
if (!device) {
@@ -246,7 +246,7 @@ int register_android_hardware_UsbDeviceConnection(JNIEnv *env)
ALOGE("Can't find android/hardware/usb/UsbDeviceConnection");
return -1;
}
field_context = env->GetFieldID(clazz, "mNativeContext", "I");
field_context = env->GetFieldID(clazz, "mNativeContext", "J");
if (field_context == NULL) {
ALOGE("Can't find UsbDeviceConnection.mNativeContext");
return -1;

View File

@@ -32,7 +32,7 @@ static jfieldID field_context;
struct usb_request* get_request_from_object(JNIEnv* env, jobject java_request)
{
return (struct usb_request*)env->GetIntField(java_request, field_context);
return (struct usb_request*)env->GetLongField(java_request, field_context);
}
// in android_hardware_UsbDeviceConnection.cpp
@@ -61,7 +61,7 @@ android_hardware_UsbRequest_init(JNIEnv *env, jobject thiz, jobject java_device,
struct usb_request* request = usb_request_new(device, &desc);
if (request)
env->SetIntField(thiz, field_context, (int)request);
env->SetLongField(thiz, field_context, (jlong)request);
return (request != NULL);
}
@@ -72,7 +72,7 @@ android_hardware_UsbRequest_close(JNIEnv *env, jobject thiz)
struct usb_request* request = get_request_from_object(env, thiz);
if (request) {
usb_request_free(request);
env->SetIntField(thiz, field_context, 0);
env->SetLongField(thiz, field_context, 0);
}
}
@@ -114,14 +114,14 @@ android_hardware_UsbRequest_queue_array(JNIEnv *env, jobject thiz,
}
}
static int
static jint
android_hardware_UsbRequest_dequeue_array(JNIEnv *env, jobject thiz,
jbyteArray buffer, jint length, jboolean out)
{
struct usb_request* request = get_request_from_object(env, thiz);
if (!request) {
ALOGE("request is closed in native_dequeue");
return -1;
return (jint) -1;
}
if (buffer && length && request->buffer && !out) {
@@ -130,7 +130,7 @@ android_hardware_UsbRequest_dequeue_array(JNIEnv *env, jobject thiz,
}
free(request->buffer);
env->DeleteGlobalRef((jobject)request->client_data);
return request->actual_length;
return (jint) request->actual_length;
}
static jboolean
@@ -164,17 +164,17 @@ android_hardware_UsbRequest_queue_direct(JNIEnv *env, jobject thiz,
}
}
static int
static jint
android_hardware_UsbRequest_dequeue_direct(JNIEnv *env, jobject thiz)
{
struct usb_request* request = get_request_from_object(env, thiz);
if (!request) {
ALOGE("request is closed in native_dequeue");
return -1;
return (jint) -1;
}
// all we need to do is delete our global ref
env->DeleteGlobalRef((jobject)request->client_data);
return request->actual_length;
return (jint) request->actual_length;
}
static jboolean
@@ -207,7 +207,7 @@ int register_android_hardware_UsbRequest(JNIEnv *env)
ALOGE("Can't find android/hardware/usb/UsbRequest");
return -1;
}
field_context = env->GetFieldID(clazz, "mNativeContext", "I");
field_context = env->GetFieldID(clazz, "mNativeContext", "J");
if (field_context == NULL) {
ALOGE("Can't find UsbRequest.mNativeContext");
return -1;