/frameworks/base/packages/SystemUI/tests/utils/src/com/android/systemui/util/sensors/ |
D | FakeSensorManager.java | 21 import android.hardware.Sensor; 63 Sensor proxSensor = context.getSystemService(SensorManager.class) in FakeSensorManager() 64 .getDefaultSensor(Sensor.TYPE_PROXIMITY, true); in FakeSensorManager() 68 createSensor(Sensor.TYPE_PROXIMITY, null, 1 /* SENSOR_FLAG_WAKE_UP_SENSOR */); in FakeSensorManager() 73 mFakeLightSensor = new FakeGenericSensor(createSensor(Sensor.TYPE_LIGHT, null)), in FakeSensorManager() 75 mFakeLightSensor2 = new FakeGenericSensor(createSensor(Sensor.TYPE_LIGHT, null)) in FakeSensorManager() 96 public Sensor getDefaultSensor(int type) { in getDefaultSensor() 97 Sensor s = super.getDefaultSensor(type); in getDefaultSensor() 107 protected List<Sensor> getFullSensorList() { in getFullSensorList() 115 protected List<Sensor> getFullDynamicSensorList() { in getFullDynamicSensorList() [all …]
|
/frameworks/native/libs/sensor/ |
D | Sensor.cpp | 36 Sensor::Sensor(const char * name) : in Sensor() function in android::Sensor 44 Sensor::Sensor(struct sensor_t const* hwSensor, int halVersion) : in Sensor() function in android::Sensor 45 Sensor(*hwSensor, uuid_t(), halVersion) { in Sensor() 48 Sensor::Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersion) : in Sensor() function in android::Sensor 49 Sensor("") { in Sensor() 376 Sensor::~Sensor() { in ~Sensor() 379 const String8& Sensor::getName() const { in getName() 383 const String8& Sensor::getVendor() const { in getVendor() 387 int32_t Sensor::getHandle() const { in getHandle() 391 int32_t Sensor::getType() const { in getType() [all …]
|
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/doze/ |
D | DozeSensorsTest.java | 21 import static com.android.systemui.plugins.SensorManagerPlugin.Sensor.TYPE_WAKE_LOCK_SCREEN; 41 import android.hardware.Sensor; 166 verify(mSensorManager, never()).registerListener(any(), any(Sensor.class), anyInt()); in testSetListening_firstTrue_registerSettingsObserver() 174 verify(mSensorManager, never()).registerListener(any(), any(Sensor.class), anyInt()); in testSetListening_twiceTrue_onlyRegisterSettingsObserverOnce() 213 Sensor mockSensor = mock(Sensor.class); in testDozeSensorSetListening() 234 Sensor mockSensor = mock(Sensor.class); in testDozeSensorSettingDisabled() 255 Sensor mockSensor = mock(Sensor.class); in testDozeSensorIgnoreSetting() 279 Sensor mockSensor = mock(Sensor.class); in testUpdateListeningAfterAlreadyRegistered() 298 Sensor closedSensor = createSensor(Sensor.TYPE_LIGHT, Sensor.STRING_TYPE_LIGHT); in testPostureStartStateClosed_registersCorrectSensor() 299 Sensor openedSensor = createSensor(Sensor.TYPE_PROXIMITY, Sensor.STRING_TYPE_LIGHT); in testPostureStartStateClosed_registersCorrectSensor() [all …]
|
/frameworks/base/core/java/android/hardware/input/ |
D | InputDeviceSensorManager.java | 21 import android.hardware.Sensor; 63 private final Map<Integer, List<Sensor>> mSensors = new HashMap<>(); 135 private static boolean sensorEquals(@NonNull Sensor lhs, @NonNull Sensor rhs) { in sensorEquals() 143 List<Sensor> sensors = new ArrayList<Sensor>(); in populateSensorsForInputDeviceLocked() 145 Sensor sensor = new Sensor(sensorInfos[i]); in populateSensorsForInputDeviceLocked() 172 private Sensor getInputDeviceSensorLocked(int deviceId, int sensorType) { in getInputDeviceSensorLocked() 173 List<Sensor> sensors = mSensors.get(deviceId); in getInputDeviceSensorLocked() 174 for (Sensor sensor : sensors) { in getInputDeviceSensorLocked() 199 Sensor sensor = getInputDeviceSensorLocked(deviceId, sensorType); in onInputSensorChanged() 258 private List<Sensor> mSensors = new ArrayList<Sensor>(); [all …]
|
/frameworks/base/core/java/android/hardware/ |
D | SystemSensorManager.java | 81 Sensor sensor, int index); in nativeGetSensorAtIndex() 82 private static native void nativeGetDynamicSensors(long nativeInstance, List<Sensor> list); in nativeGetDynamicSensors() 101 private final ArrayList<Sensor> mFullSensorsList = new ArrayList<>(); 102 private List<Sensor> mFullDynamicSensorsList = new ArrayList<>(); 105 private final HashMap<Integer, Sensor> mHandleToSensor = new HashMap<>(); 145 Sensor sensor = new Sensor(); in SystemSensorManager() 154 protected List<Sensor> getFullSensorList() { in getFullSensorList() 160 protected List<Sensor> getFullDynamicSensorList() { in getFullDynamicSensorList() 170 protected boolean registerListenerImpl(SensorEventListener listener, Sensor sensor, in registerListenerImpl() 177 if (sensor.getReportingMode() == Sensor.REPORTING_MODE_ONE_SHOT) { in registerListenerImpl() [all …]
|
D | SensorManager.java | 97 private final SparseArray<List<Sensor>> mSensorListByType = 98 new SparseArray<List<Sensor>>(); 387 protected abstract List<Sensor> getFullSensorList(); in getFullSensorList() 393 protected abstract List<Sensor> getFullDynamicSensorList(); in getFullDynamicSensorList() 427 public List<Sensor> getSensorList(int type) { in getSensorList() 429 List<Sensor> list; in getSensorList() 430 final List<Sensor> fullList = getFullSensorList(); in getSensorList() 434 if (type == Sensor.TYPE_ALL) { in getSensorList() 437 list = new ArrayList<Sensor>(); in getSensorList() 438 for (Sensor i : fullList) { in getSensorList() [all …]
|
D | LegacySensorManager.java | 72 final List<Sensor> fullList = mSensorManager.getFullSensorList(); in getSensors() 73 for (Sensor i : fullList) { in getSensors() 75 case Sensor.TYPE_ACCELEROMETER: in getSensors() 78 case Sensor.TYPE_MAGNETIC_FIELD: in getSensors() 81 case Sensor.TYPE_ORIENTATION: in getSensors() 96 Sensor.TYPE_ACCELEROMETER, listener, sensors, rate) || result; in registerListener() 98 Sensor.TYPE_MAGNETIC_FIELD, listener, sensors, rate) || result; in registerListener() 100 Sensor.TYPE_ORIENTATION, listener, sensors, rate) || result; in registerListener() 102 Sensor.TYPE_ORIENTATION, listener, sensors, rate) || result; in registerListener() 104 Sensor.TYPE_TEMPERATURE, listener, sensors, rate) || result; in registerListener() [all …]
|
/frameworks/base/packages/SystemUI/plugin/src/com/android/systemui/plugins/ |
D | SensorManagerPlugin.java | 38 void registerListener(Sensor sensor, SensorEventListener listener); in registerListener() 45 void unregisterListener(Sensor sensor, SensorEventListener listener); in unregisterListener() 57 class Sensor { class 65 public Sensor(int type) { in Sensor() method in SensorManagerPlugin.Sensor 80 Sensor mSensor; 90 public SensorEvent(Sensor sensor, int vendorType) { in SensorEvent() 101 public SensorEvent(Sensor sensor, int vendorType, float[] values) { in SensorEvent() 107 public Sensor getSensor() { in getSensor()
|
/frameworks/base/native/android/ |
D | sensor.cpp | 35 using android::Sensor; 78 Sensor const* const* l; in ASensorManager_getSensorList() 88 Sensor const* const* l; in ASensorManager_getDynamicSensorList() 103 Sensor const* const* sensorList; in ASensorManager_getDefaultSensorEx() 211 sensorHandle = static_cast<Sensor const *>(sensor)->getHandle(); in ASensorManager_configureDirectReport() 229 static_cast<Sensor const*>(sensor)->getHandle(), samplingPeriodUs, in ASensorEventQueue_registerSensor() 238 static_cast<Sensor const*>(sensor)); in ASensorEventQueue_enableSensor() 246 static_cast<Sensor const*>(sensor)); in ASensorEventQueue_disableSensor() 259 static_cast<Sensor const*>(sensor), us2ns(usec)); in ASensorEventQueue_setEventRate() 307 return static_cast<Sensor const*>(sensor)->getName().string(); in ASensor_getName() [all …]
|
/frameworks/native/libs/sensor/include/sensor/ |
D | SensorManager.h | 49 class Sensor; variable 60 ssize_t getSensorList(Sensor const* const** list); 61 ssize_t getDynamicSensorList(Vector<Sensor>& list); 62 ssize_t getDynamicSensorList(Sensor const* const** list); 63 Sensor const* getDefaultSensor(int type); 86 Sensor const** mSensorList; 87 Vector<Sensor> mSensors; 88 Sensor const** mDynamicSensorList = nullptr; 89 Vector<Sensor> mDynamicSensors;
|
D | Sensor.h | 44 class Sensor : public ASensor, public LightFlattenable<Sensor> 64 Sensor(const Sensor&) = default; 65 Sensor& operator=(const Sensor&) = default; 67 explicit Sensor(const char * name = ""); 68 explicit Sensor(struct sensor_t const* hwSensor, int halVersion = 0); 69 Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersion = 0); 70 ~Sensor();
|
/frameworks/base/core/java/com/android/internal/os/ |
D | SensorPowerCalculator.java | 18 import android.hardware.Sensor; 30 private final SparseArray<Sensor> mSensors; 33 List<Sensor> sensors = sensorManager.getSensorList(Sensor.TYPE_ALL); in SensorPowerCalculator() 36 Sensor sensor = sensors.get(i); in SensorPowerCalculator() 79 final SparseArray<? extends BatteryStats.Uid.Sensor> sensorStats = u.getSensorStats(); in calculateDuration() 83 if (sensorHandle == BatteryStats.Uid.Sensor.GPS) { in calculateDuration() 87 final BatteryStats.Uid.Sensor sensor = sensorStats.valueAt(ise); in calculateDuration() 96 final SparseArray<? extends BatteryStats.Uid.Sensor> sensorStats = u.getSensorStats(); in calculatePowerMah() 101 if (sensorHandle == BatteryStats.Uid.Sensor.GPS) { in calculatePowerMah() 105 final BatteryStats.Uid.Sensor sensor = sensorStats.valueAt(ise); in calculatePowerMah() [all …]
|
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/ |
D | IndividualSensorPrivacyController.java | 19 import android.hardware.SensorPrivacyManager.Sensors.Sensor; 26 boolean supportsSensorToggle(@Sensor int sensor); in supportsSensorToggle() 28 boolean isSensorBlocked(@Sensor int sensor); in isSensorBlocked() 34 boolean isSensorBlockedByHardwareToggle(@Sensor int sensor); in isSensorBlockedByHardwareToggle() 36 void setSensorBlocked(@Source int source, @Sensor int sensor, boolean blocked); in setSensorBlocked() 46 void onSensorBlockedChanged(@Sensor int sensor, boolean blocked); in onSensorBlockedChanged()
|
/frameworks/base/services/tests/servicestests/src/com/android/server/display/ |
D | TestUtils.java | 19 import android.hardware.Sensor; 31 public static SensorEvent createSensorEvent(Sensor sensor, int value) throws Exception { in createSensorEvent() 43 public static void setSensorType(Sensor sensor, int type, String strType) throws Exception { in setSensorType() 44 Method setter = Sensor.class.getDeclaredMethod("setType", Integer.TYPE); in setSensorType() 54 public static Sensor createSensor(int type, String strType) throws Exception { in createSensor() 55 Constructor<Sensor> constr = Sensor.class.getDeclaredConstructor(); in createSensor() 57 Sensor sensor = constr.newInstance(); in createSensor()
|
/frameworks/base/packages/SystemUI/src/com/android/systemui/util/sensors/ |
D | AsyncSensorManager.java | 21 import android.hardware.Sensor; 58 private final List<Sensor> mSensorCache; 67 mSensorCache = mInner.getSensorList(Sensor.TYPE_ALL); in AsyncSensorManager() 76 protected List<Sensor> getFullSensorList() { in getFullSensorList() 81 protected List<Sensor> getFullDynamicSensorList() { in getFullDynamicSensorList() 82 return mInner.getSensorList(Sensor.TYPE_ALL); in getFullDynamicSensorList() 87 Sensor sensor, int delayUs, Handler handler, int maxReportLatencyUs, in registerListenerImpl() 114 protected int configureDirectChannelImpl(SensorDirectChannel channel, Sensor s, int rate) { in configureDirectChannelImpl() 130 protected boolean requestTriggerSensorImpl(TriggerEventListener listener, Sensor sensor) { in requestTriggerSensorImpl() 146 protected boolean cancelTriggerSensorImpl(TriggerEventListener listener, Sensor sensor, in cancelTriggerSensorImpl() [all …]
|
D | ThresholdSensorImpl.java | 20 import android.hardware.Sensor; 45 private final Sensor mSensor; 65 public void onAccuracyChanged(Sensor sensor, int accuracy) { 69 private ThresholdSensorImpl(AsyncSensorManager sensorManager, Sensor sensor, in ThresholdSensorImpl() 239 private Sensor mSensor; 287 Sensor sensor = findSensorByType(sensorType, requireWakeUp); in setSensorType() 309 Builder setSensor(Sensor sensor) { in setSensor() 338 Sensor findSensorByType(String sensorType, boolean requireWakeUp) { in findSensorByType() 343 List<Sensor> sensorList = mSensorManager.getSensorList(Sensor.TYPE_ALL); in findSensorByType() 344 Sensor sensor = null; in findSensorByType() [all …]
|
/frameworks/base/core/tests/coretests/src/android/hardware/input/ |
D | InputDeviceSensorManagerTest.java | 34 import android.hardware.Sensor; 99 createInputSensorInfo(DEVICE_ID, Sensor.TYPE_ACCELEROMETER), in setUp() 100 createInputSensorInfo(DEVICE_ID, Sensor.TYPE_GYROSCOPE)}); in setUp() 143 public void onAccuracyChanged(Sensor sensor, int accuracy) { in onAccuracyChanged() 182 List<Sensor> accelList = sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER); in getInputDeviceSensors_withExpectedType() 186 assertEquals(Sensor.TYPE_ACCELEROMETER, accelList.get(0).getType()); in getInputDeviceSensors_withExpectedType() 188 List<Sensor> gyroList = sensorManager.getSensorList(Sensor.TYPE_GYROSCOPE); in getInputDeviceSensors_withExpectedType() 192 assertEquals(Sensor.TYPE_GYROSCOPE, gyroList.get(0).getType()); in getInputDeviceSensors_withExpectedType() 203 List<Sensor> gameRotationList = sensorManager.getSensorList( in getInputDeviceSensors_withUnexpectedType() 204 Sensor.TYPE_GAME_ROTATION_VECTOR); in getInputDeviceSensors_withUnexpectedType() [all …]
|
/frameworks/base/core/tests/coretests/src/com/android/internal/os/ |
D | SensorPowerCalculatorTest.java | 24 import android.hardware.Sensor; 55 Sensor sensor1 = createSensor(SENSOR_HANDLE_1, Sensor.TYPE_AMBIENT_TEMPERATURE, 360); in testTimerBasedModel() 56 Sensor sensor2 = createSensor(SENSOR_HANDLE_2, Sensor.TYPE_STEP_COUNTER, 720); in testTimerBasedModel() 59 when(sensorManager.getSensorList(Sensor.TYPE_ALL)) in testTimerBasedModel() 87 private Sensor createSensor(int handle, int type, double power) { in createSensor() 88 return new Sensor(new InputSensorInfo("name", "vendor", 0 /* version */, in createSensor()
|
/frameworks/base/services/core/java/com/android/server/display/utils/ |
D | SensorUtils.java | 19 import android.hardware.Sensor; 34 public static Sensor findSensor(SensorManager sensorManager, String sensorType, in findSensor() 46 final List<Sensor> sensors = sensorManager.getSensorList(Sensor.TYPE_ALL); in findSensor() 47 for (Sensor sensor : sensors) { in findSensor()
|
/frameworks/base/packages/SystemUI/src/com/android/systemui/doze/ |
D | DozeSensors.java | 21 import static com.android.systemui.plugins.SensorManagerPlugin.Sensor.TYPE_WAKE_DISPLAY; 22 import static com.android.systemui.plugins.SensorManagerPlugin.Sensor.TYPE_WAKE_LOCK_SCREEN; 27 import android.hardware.Sensor; 183 mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION), in DozeSensors() 191 mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE), in DozeSensors() 252 new SensorManagerPlugin.Sensor(TYPE_WAKE_DISPLAY), in DozeSensors() 261 new SensorManagerPlugin.Sensor(TYPE_WAKE_LOCK_SCREEN), in DozeSensors() 326 private Sensor findSensor(String type) { in findSensor() 331 private Sensor[] findSensors(@NonNull String[] types) { in findSensors() 332 Sensor[] sensorMap = new Sensor[DevicePostureController.SUPPORTED_POSTURES_SIZE]; in findSensors() [all …]
|
/frameworks/native/services/sensorservice/ |
D | SensorList.cpp | 29 const Sensor SensorList::mNonSensor = Sensor("unknown"); 77 const Vector<Sensor> SensorList::getUserSensors() const { in getUserSensors() 79 Vector<Sensor> sensors; in getUserSensors() 90 const Vector<Sensor> SensorList::getUserDebugSensors() const { in getUserDebugSensors() 92 Vector<Sensor> sensors; in getUserDebugSensors() 103 const Vector<Sensor> SensorList::getDynamicSensors() const { in getDynamicSensors() 105 Vector<Sensor> sensors; in getDynamicSensors() 116 const Vector<Sensor> SensorList::getVirtualSensors() const { in getVirtualSensors() 118 Vector<Sensor> sensors; in getVirtualSensors() 132 forEachSensor([&result] (const Sensor& s) -> bool { in dump() [all …]
|
D | SensorList.h | 59 const Vector<Sensor> getUserSensors() const; 60 const Vector<Sensor> getUserDebugSensors() const; 61 const Vector<Sensor> getDynamicSensors() const; 62 const Vector<Sensor> getVirtualSensors() const; 92 const Sensor& getNonSensor() const { return mNonSensor;} in getNonSensor() 100 const static Sensor mNonSensor; //.getName() == "unknown",
|
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/util/sensors/ |
D | ThresholdSensorImplTest.java | 19 import static android.hardware.Sensor.TYPE_ALL; 27 import android.hardware.Sensor; 75 Sensor mockNonWakeupProx = mock(Sensor.class); in testRegistersWakeUpProxSensor_givenWakeUpExistsAfterNonWakeup() 79 Sensor mockWakeupProx = mock(Sensor.class); in testRegistersWakeUpProxSensor_givenWakeUpExistsAfterNonWakeup() 89 Sensor proxSensor = thresholdSensorBuilder.findSensorByType(sensorTypeProx, true); in testRegistersWakeUpProxSensor_givenWakeUpExistsAfterNonWakeup() 101 Sensor mockNonWakeupProx = mock(Sensor.class); in testRegistersWakeUpProxSensor_givenNonWakeUpExistsAfterWakeup() 105 Sensor mockWakeupProx = mock(Sensor.class); in testRegistersWakeUpProxSensor_givenNonWakeUpExistsAfterWakeup() 115 Sensor proxSensor = thresholdSensorBuilder.findSensorByType(sensorTypeProx, true); in testRegistersWakeUpProxSensor_givenNonWakeUpExistsAfterWakeup() 127 Sensor mockNonWakeupProx = mock(Sensor.class); in testRegistersNonWakeUpProxSensor_givenNonWakeUpOnly() 136 Sensor proxSensor = thresholdSensorBuilder.findSensorByType(sensorTypeProx, true); in testRegistersNonWakeUpProxSensor_givenNonWakeUpOnly()
|
/frameworks/base/services/tests/mockingservicestests/src/com/android/server/sensorprivacy/ |
D | CameraPrivacyLightControllerTest.java | 35 import android.hardware.Sensor; 95 private Sensor mLightSensor; 134 doReturn(mLightSensor).when(mSensorManager).getDefaultSensor(Sensor.TYPE_LIGHT); in setUp() 281 doReturn(null).when(mSensorManager).getDefaultSensor(Sensor.TYPE_LIGHT); in testNoLightSensor() 297 Sensor sensor = mock(Sensor.class); in testALSListenerNotRegisteredUntilCameraIsOpened() 298 doReturn(sensor).when(mSensorManager).getDefaultSensor(Sensor.TYPE_LIGHT); in testALSListenerNotRegisteredUntilCameraIsOpened() 303 any(Sensor.class), anyInt(), any(Handler.class)); in testALSListenerNotRegisteredUntilCameraIsOpened() 308 any(Sensor.class), anyInt(), any(Handler.class)); in testALSListenerNotRegisteredUntilCameraIsOpened() 328 Sensor sensor = mock(Sensor.class); in testBrightnessToColor() 329 doReturn(sensor).when(mSensorManager).getDefaultSensor(Sensor.TYPE_LIGHT); in testBrightnessToColor() [all …]
|
/frameworks/base/services/tests/servicestests/src/com/android/server/display/whitebalance/ |
D | AmbientSensorTest.java | 30 import android.hardware.Sensor; 62 private Sensor mLightSensor; 63 private Sensor mAmbientColorSensor; 72 mLightSensor = TestUtils.createSensor(Sensor.TYPE_LIGHT, null); in setUp() 81 when(mSensorManagerMock.getDefaultSensor(Sensor.TYPE_LIGHT)).thenReturn(mLightSensor); in testAmbientBrightnessSensorCallback_NoCallbacks() 89 verify(mSensorManagerMock).registerListener(captor.capture(), isA(Sensor.class), anyInt(), in testAmbientBrightnessSensorCallback_NoCallbacks() 101 when(mSensorManagerMock.getDefaultSensor(Sensor.TYPE_LIGHT)).thenReturn(mLightSensor); in testAmbientBrightnessSensorCallback_CallbacksCalled() 129 final List<Sensor> sensorList = ImmutableList.of(mLightSensor, mAmbientColorSensor); in testAmbientColorTemperatureSensorCallback_CallbacksCalled() 130 when(mSensorManagerMock.getSensorList(Sensor.TYPE_ALL)).thenReturn(sensorList); in testAmbientColorTemperatureSensorCallback_CallbacksCalled()
|