mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-03 12:07:58 +00:00
Merge "setActiveGroup null, 0 length, unwritable dir should fail" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
04b086dd08
@@ -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()));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user