diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-02-20 07:38:31 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-02-20 07:38:31 -0800 |
commit | 15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b (patch) | |
tree | d03d027a7ed97af616904e02a7b420babf40d44f /core/java/android/hardware/SensorManager.java | |
parent | 3001a035439d8134a7d70d796376d1dfbff3cdcd (diff) | |
download | frameworks_base-15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b.zip frameworks_base-15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b.tar.gz frameworks_base-15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b.tar.bz2 |
auto import from //branches/cupcake/...@132569
Diffstat (limited to 'core/java/android/hardware/SensorManager.java')
-rw-r--r-- | core/java/android/hardware/SensorManager.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java index 3981f27..e232c2c 100644 --- a/core/java/android/hardware/SensorManager.java +++ b/core/java/android/hardware/SensorManager.java @@ -620,6 +620,9 @@ public class SensorManager extends IRotationWatcher.Stub */ @Deprecated public boolean registerListener(SensorListener listener, int sensors, int rate) { + if (listener == null) { + return false; + } boolean result = false; result = registerLegacyListener(SENSOR_ACCELEROMETER, Sensor.TYPE_ACCELEROMETER, listener, sensors, rate) || result; @@ -638,6 +641,9 @@ public class SensorManager extends IRotationWatcher.Stub private boolean registerLegacyListener(int legacyType, int type, SensorListener listener, int sensors, int rate) { + if (listener == null) { + return false; + } boolean result = false; // Are we activating this legacy sensor? if ((sensors & legacyType) != 0) { @@ -693,6 +699,9 @@ public class SensorManager extends IRotationWatcher.Stub private void unregisterLegacyListener(int legacyType, int type, SensorListener listener, int sensors) { + if (listener == null) { + return; + } // do we know about this listener? LegacyListener legacyListener = null; synchronized (mLegacyListenersMap) { @@ -800,6 +809,9 @@ public class SensorManager extends IRotationWatcher.Stub */ public boolean registerListener(SensorEventListener listener, Sensor sensor, int rate, Handler handler) { + if (listener == null || sensor == null) { + return false; + } boolean result; int delay = -1; switch (rate) { @@ -856,6 +868,9 @@ public class SensorManager extends IRotationWatcher.Stub } private void unregisterListener(Object listener, Sensor sensor) { + if (listener == null || sensor == null) { + return; + } try { synchronized (sListeners) { final int size = sListeners.size(); @@ -881,6 +896,9 @@ public class SensorManager extends IRotationWatcher.Stub } private void unregisterListener(Object listener) { + if (listener == null) { + return; + } try { synchronized (sListeners) { final int size = sListeners.size(); |