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

Commit 2fe4e6f9 authored by Brian Duddie's avatar Brian Duddie
Browse files

Revise sensor rate capping exemption

Also handle the case when mic access is disabled on the initial request,
not just if the access is toggled while the request is active.

Remove the exemption from regular event connection, since the request
parameters are shared across all clients (unlike direct channel), and
all known system clients do not need more than the capped rate, so this
change is unnecessary at present.

Bug: 409015086
Test: manual with dumpsys sensorservice
Flag: EXEMPT bugfix
Change-Id: I8e7cece2c7f56e909df1cd0eeb06b84450f6d467
parent 0fb92152
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -189,7 +189,9 @@ int32_t SensorService::SensorDirectConnection::configureChannel(int handle, int
    }

    int requestedRateLevel = rateLevel;
    if (mService->isSensorInCappedSet(s.getType()) && rateLevel != SENSOR_DIRECT_RATE_STOP) {
    // TODO(b/398253250): Create a more robust way to allow VNDK and system clients to be exempted
    if (mService->isSensorInCappedSet(s.getType()) && rateLevel != SENSOR_DIRECT_RATE_STOP &&
        mUid != AID_SYSTEM) {
        status_t err = mService->adjustRateLevelBasedOnMicAndPermission(&rateLevel, mOpPackageName);
        if (err != OK) {
            return err;
+0 −5
Original line number Diff line number Diff line
@@ -764,11 +764,6 @@ status_t SensorService::SensorEventConnection::setEventRate(int handle, nsecs_t
}

void SensorService::SensorEventConnection::onMicSensorAccessChanged(bool isMicToggleOn) {
     // TODO(b/398253250): Create a more robust way to allow VNDK and system clients to be exempted
     if (mUid == AID_SYSTEM) {
        return;
    }

    if (isMicToggleOn) {
        capRates();
    } else {