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

Commit 04b086dd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "setActiveGroup null, 0 length, unwritable dir should fail" into oc-dev

parents 007d23e7 d7e9b0fd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "BiometricsFingerprint.h"

#include <inttypes.h>
#include <unistd.h>

namespace android {
namespace hardware {
@@ -187,7 +188,12 @@ Return<RequestStatus> BiometricsFingerprint::setActiveGroup(uint32_t gid,
        const hidl_string& storePath) {
    if (storePath.size() >= PATH_MAX || storePath.size() <= 0) {
        ALOGE("Bad path length: %zd", storePath.size());
        return RequestStatus::SYS_EINVAL;
    }
    if (access(storePath.c_str(), W_OK)) {
        return RequestStatus::SYS_EINVAL;
    }

    return ErrorFilter(mDevice->set_active_group(mDevice, gid,
                                                    storePath.c_str()));
}
+3 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ namespace {
static const uint32_t kTimeout = 3;
static const std::chrono::seconds kTimeoutInSeconds = std::chrono::seconds(kTimeout);
static const uint32_t kGroupId = 99;
static const std::string kTmpDir = "/data/local/tmp/";
static const std::string kTmpDir = "/data/system/";
static const uint32_t kIterations = 1000;

// Wait for a callback to occur (signaled by the given future) up to the
@@ -186,6 +186,8 @@ class FingerprintHidlTest : public ::testing::VtsHalHidlTargetTestBase {
    ASSERT_FALSE(mService == nullptr);

    // Create an active group
    // FP service can only write to /data/system due to
    // SELinux Policy and Linux Dir Permissions
    Return<RequestStatus> res = mService->setActiveGroup(kGroupId, kTmpDir);
    ASSERT_EQ(RequestStatus::SYS_OK, static_cast<RequestStatus>(res));
  }