Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b534db9 authored by Shai Barack's avatar Shai Barack
Browse files

SensorManager doesn't need to ping the remote service

Change-Id: I3c964a497e2fcc9106fe469e71a7d61f0d089653
Bug: 322228259
Test: presubmit, and verified performance with stack samples
parent 05e3113c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -21,6 +21,18 @@ package {
    default_applicable_licenses: ["frameworks_native_license"],
}

aconfig_declarations {
    name: "libsensor_flags",
    package: "com.android.hardware.libsensor.flags",
    srcs: ["libsensor_flags.aconfig"],
}

cc_aconfig_library {
    name: "libsensor_flags_c_lib",
    host_supported: true,
    aconfig_declarations: "libsensor_flags",
}

cc_library {
    name: "libsensor",

@@ -52,6 +64,10 @@ cc_library {
        "android.companion.virtual.virtualdevice_aidl-cpp",
    ],

    static_libs: [
        "libsensor_flags_c_lib",
    ],

    export_include_dirs: ["include"],

    export_shared_lib_headers: [
+6 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@
#include <sensor/Sensor.h>
#include <sensor/SensorEventQueue.h>

#include <com_android_hardware_libsensor_flags.h>

// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
@@ -192,6 +194,9 @@ void SensorManager::sensorManagerDied() {
}

status_t SensorManager::assertStateLocked() {
#if COM_ANDROID_HARDWARE_LIBSENSOR_FLAGS(SENSORMANAGER_PING_BINDER)
    if (mSensorServer == nullptr) {
#else
    bool initSensorManager = false;
    if (mSensorServer == nullptr) {
        initSensorManager = true;
@@ -203,6 +208,7 @@ status_t SensorManager::assertStateLocked() {
        }
    }
    if (initSensorManager) {
#endif
        waitForSensorService(&mSensorServer);
        LOG_ALWAYS_FATAL_IF(mSensorServer == nullptr, "getService(SensorService) NULL");

+9 −0
Original line number Diff line number Diff line
package: "com.android.hardware.libsensor.flags"

flag {
  name: "sensormanager_ping_binder"
  namespace: "libsensors"
  description: "Whether to pingBinder on SensorManager init"
  bug: "322228259"
  is_fixed_read_only: true
}
 No newline at end of file