Loading core/java/android/hardware/SystemSensorManager.java +8 −3 Original line number Diff line number Diff line Loading @@ -285,19 +285,24 @@ public class SystemSensorManager extends SensorManager { } // Initialize a client for data_injection. if (sInjectEventQueue == null) { sInjectEventQueue = new InjectEventQueue(mMainLooper, this, mContext.getPackageName()); try { sInjectEventQueue = new InjectEventQueue( mMainLooper, this, mContext.getPackageName()); } catch (RuntimeException e) { Log.e(TAG, "Cannot create InjectEventQueue: " + e); } } return sInjectEventQueue != null; } else { // If data injection is being disabled clean up the native resources. if (sInjectEventQueue != null) { sInjectEventQueue.dispose(); sInjectEventQueue = null; } } return true; } } } protected boolean injectSensorDataImpl(Sensor sensor, float[] values, int accuracy, long timestamp) { Loading core/jni/android_hardware_SensorManager.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -427,6 +427,11 @@ static jlong nativeInitSensorEventQueue(JNIEnv *env, jclass clazz, jlong sensorM String8 clientName(packageUtf.c_str()); sp<SensorEventQueue> queue(mgr->createEventQueue(clientName, mode)); if (queue == NULL) { jniThrowRuntimeException(env, "Cannot construct native SensorEventQueue."); return 0; } sp<MessageQueue> messageQueue = android_os_MessageQueue_getMessageQueue(env, msgQ); if (messageQueue == NULL) { jniThrowRuntimeException(env, "MessageQueue is not initialized."); Loading Loading
core/java/android/hardware/SystemSensorManager.java +8 −3 Original line number Diff line number Diff line Loading @@ -285,19 +285,24 @@ public class SystemSensorManager extends SensorManager { } // Initialize a client for data_injection. if (sInjectEventQueue == null) { sInjectEventQueue = new InjectEventQueue(mMainLooper, this, mContext.getPackageName()); try { sInjectEventQueue = new InjectEventQueue( mMainLooper, this, mContext.getPackageName()); } catch (RuntimeException e) { Log.e(TAG, "Cannot create InjectEventQueue: " + e); } } return sInjectEventQueue != null; } else { // If data injection is being disabled clean up the native resources. if (sInjectEventQueue != null) { sInjectEventQueue.dispose(); sInjectEventQueue = null; } } return true; } } } protected boolean injectSensorDataImpl(Sensor sensor, float[] values, int accuracy, long timestamp) { Loading
core/jni/android_hardware_SensorManager.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -427,6 +427,11 @@ static jlong nativeInitSensorEventQueue(JNIEnv *env, jclass clazz, jlong sensorM String8 clientName(packageUtf.c_str()); sp<SensorEventQueue> queue(mgr->createEventQueue(clientName, mode)); if (queue == NULL) { jniThrowRuntimeException(env, "Cannot construct native SensorEventQueue."); return 0; } sp<MessageQueue> messageQueue = android_os_MessageQueue_getMessageQueue(env, msgQ); if (messageQueue == NULL) { jniThrowRuntimeException(env, "MessageQueue is not initialized."); Loading