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

Commit cd1d9aed authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Expose errors for some of the SensorPrivacyManager calls" into sc-dev am: 1ee455e9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/13463040

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3b2118cbc6f9a0c0d433541652bc0d73181701fb
parents 818b9d35 1ee455e9
Loading
Loading
Loading
Loading
+17 −2
Original line number Original line Diff line number Diff line
@@ -64,13 +64,15 @@ void SensorPrivacyManager::addSensorPrivacyListener(
    }
    }
}
}


void SensorPrivacyManager::addIndividualSensorPrivacyListener(int userId, int sensor,
status_t SensorPrivacyManager::addIndividualSensorPrivacyListener(int userId, int sensor,
        const sp<hardware::ISensorPrivacyListener>& listener)
        const sp<hardware::ISensorPrivacyListener>& listener)
{
{
    sp<hardware::ISensorPrivacyManager> service = getService();
    sp<hardware::ISensorPrivacyManager> service = getService();
    if (service != nullptr) {
    if (service != nullptr) {
        service->addIndividualSensorPrivacyListener(userId, sensor, listener);
        return service->addIndividualSensorPrivacyListener(userId, sensor, listener)
                .transactionError();
    }
    }
    return UNEXPECTED_NULL;
}
}


void SensorPrivacyManager::removeSensorPrivacyListener(
void SensorPrivacyManager::removeSensorPrivacyListener(
@@ -106,6 +108,19 @@ bool SensorPrivacyManager::isIndividualSensorPrivacyEnabled(int userId, int sens
    return false;
    return false;
}
}


status_t SensorPrivacyManager::isIndividualSensorPrivacyEnabled(int userId, int sensor,
        bool &returnVal)
{
    sp<hardware::ISensorPrivacyManager> service = getService();
    if (service != nullptr) {
        binder::Status res = service->isIndividualSensorPrivacyEnabled(userId, sensor, &returnVal);
        return res.transactionError();
    }
    // if the SensorPrivacyManager is not available then assume sensor privacy is disabled
    returnVal = false;
    return UNKNOWN_ERROR;
}

status_t SensorPrivacyManager::linkToDeath(const sp<IBinder::DeathRecipient>& recipient)
status_t SensorPrivacyManager::linkToDeath(const sp<IBinder::DeathRecipient>& recipient)
{
{
    sp<hardware::ISensorPrivacyManager> service = getService();
    sp<hardware::ISensorPrivacyManager> service = getService();
+2 −1
Original line number Original line Diff line number Diff line
@@ -36,11 +36,12 @@ public:
    SensorPrivacyManager();
    SensorPrivacyManager();


    void addSensorPrivacyListener(const sp<hardware::ISensorPrivacyListener>& listener);
    void addSensorPrivacyListener(const sp<hardware::ISensorPrivacyListener>& listener);
    void addIndividualSensorPrivacyListener(int userId, int sensor,
    status_t addIndividualSensorPrivacyListener(int userId, int sensor,
            const sp<hardware::ISensorPrivacyListener>& listener);
            const sp<hardware::ISensorPrivacyListener>& listener);
    void removeSensorPrivacyListener(const sp<hardware::ISensorPrivacyListener>& listener);
    void removeSensorPrivacyListener(const sp<hardware::ISensorPrivacyListener>& listener);
    bool isSensorPrivacyEnabled();
    bool isSensorPrivacyEnabled();
    bool isIndividualSensorPrivacyEnabled(int userId, int sensor);
    bool isIndividualSensorPrivacyEnabled(int userId, int sensor);
    status_t isIndividualSensorPrivacyEnabled(int userId, int sensor, bool &result);


    status_t linkToDeath(const sp<IBinder::DeathRecipient>& recipient);
    status_t linkToDeath(const sp<IBinder::DeathRecipient>& recipient);
    status_t unlinkToDeath(const sp<IBinder::DeathRecipient>& recipient);
    status_t unlinkToDeath(const sp<IBinder::DeathRecipient>& recipient);