sensors: 2.1: Squash previous sensors commits

sensors: 2.1: get rid of com.samsung.permission.SSENSOR

Samsung uses a permission com.samsung.permission.SSENSOR
for Samsung-specfic sensors. Android obviously does not
have that and the default is denied when there is no
permission. As such, those sensors are inaccessible.

Thus, this change removes this permission from those sensors
so we can use them.

Android does not require special permissions for most sensors
so this change doesn't attach additional permission requirements
to those sensors.

However, note that it is possible that some sensitive sensors
introduced by Samsung in the future may use SSENSOR permission
and for privacy reasons they should be handled separately with
appropriate permission control attached.

Change-Id: Ia3033898722039b285e522e226074238508f6093

sensors: 2.1: map Samsung proximity sensor type to generic

Samsung uses their own com.samsung.sensor.physical_proximity
type instead of SENSOR_TYPE_PROXIMITY of Android.

This makes proximity sensor unavailable for us as we only
look for SENSOR_TYPE_PROXIMITY.

Thus, this change maps Samsung's vendor-specific proximity
sensor type to generic one.

Change-Id: I64f6558876e1398dfbea0e5c0eb76aa1aafd2dfd

sensors: 2.1: set max range of proximity sensor to 1

Samsung's proximity sensor type is binary in nature.
There are only two state: FAR and NEAR.

However, Samsung uses values between min and max for
other purposes like proximity detection during Always-On
Display.

This breaks proximity detection during Doze for AOSP as
AOSP only considers the proximity sensor in FAR state
when the value equals or larger than max.

Thus, this change sets the max to 1 so any > 1 value
would be considered as FAR and the behavior of this vendor
proximity sensor type matches the behavior expected by AOSP.

Change-Id: I56af8e2ae743b47e3c4894e5ef68ce0b54e5cfdb

hidl:sensors: 2.1 Dump sensor information if verbose is turned on

This is useful for improving the sensors HAL.

Change-Id: I41430974b40e14095396aaf645b8b37d08b13710

sensors: 2.1: declare override="true" in manifest

Change-Id: If8349ca7b8102c3ffee545d1065d0e7d08d22652
tirimbino
Willi Ye 4 years ago committed by Jan Altensen
parent 1090133b80
commit 004df56ac2
  1. 23
      hidl/sensors/2.1/HalProxy.cpp
  2. 2
      hidl/sensors/2.1/android.hardware.sensors@2.1-samsung-multihal.xml

@ -14,6 +14,8 @@
* limitations under the License.
*/
//#define VERBOSE
#include "HalProxy.h"
#include <android/hardware/sensors/2.0/types.h>
@ -115,7 +117,26 @@ HalProxy::~HalProxy() {
Return<void> HalProxy::getSensorsList_2_1(ISensorsV2_1::getSensorsList_2_1_cb _hidl_cb) {
std::vector<V2_1::SensorInfo> sensors;
for (const auto& iter : mSensors) {
sensors.push_back(iter.second);
V2_1::SensorInfo dst = iter.second;
if (dst.requiredPermission == "com.samsung.permission.SSENSOR") {
dst.requiredPermission = "";
}
if (dst.typeAsString == "com.samsung.sensor.physical_proximity") {
ALOGI("Fixing com.samsung.sensor.physical_proximity");
dst.type = V2_1::SensorType::PROXIMITY;
dst.typeAsString = SENSOR_STRING_TYPE_PROXIMITY;
dst.maxRange = 1;
}
#ifdef VERBOSE
ALOGI( "SENSOR NAME:%s ", dst.name.c_str());
ALOGI( " VENDOR:%s ", dst.name.c_str());
ALOGI( " TYPE:%d ", (uint32_t)dst.type);
ALOGI( " TYPE_AS_STRING:%s ", dst.typeAsString.c_str());
#endif
sensors.push_back(dst);
}
_hidl_cb(sensors);
return Void();

@ -1,5 +1,5 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<hal format="hidl" override="true">
<name>android.hardware.sensors</name>
<transport>hwbinder</transport>
<version>2.1</version>

Loading…
Cancel
Save