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

Commit 240d1d6b authored by Brian Stack's avatar Brian Stack
Browse files

Only check noteOp in SensorService if AppOp >= 0

Do not add a sensor to the handle-to-appOp mapping if the sensor's
AppOp is less than 0 since this means that the sensor does not require
an AppOpp.

Bug: 132670516
Test: Verified test tool receives events for sensors
Test: Verified app targeting Q must have AR permission to access Step
      Detector and Step Counter.
Test: Verified app targeting P with AR permission defined in manifest
      cannot receive Step Counter or Step Detector events if user
      revokes AR permission.
Test: Verified app targeting P without any permissions defined in the
      manifest can access Step Counter and Step Detector.
Test: Verified app targeting J cannot receive Step Counter or Step
      Detector events if user revokes AR permission.

Change-Id: Ied0f94fe7e91abd346a4033dbb321833b4a1958c
parent 3f8312b5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1550,7 +1550,8 @@ status_t SensorService::enable(const sp<SensorEventConnection>& connection,
    if (err == NO_ERROR) {
        connection->updateLooperRegistration(mLooper);

        if (sensor->getSensor().getRequiredPermission().size() > 0) {
        if (sensor->getSensor().getRequiredPermission().size() > 0 &&
                sensor->getSensor().getRequiredAppOp() >= 0) {
            connection->mHandleToAppOp[handle] = sensor->getSensor().getRequiredAppOp();
        }