init: use macro to handle prefix matching
This commit is contained in:
parent
6870114c33
commit
4deb916a32
|
@ -8,6 +8,11 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define PROP_STARTS_WITH(prop, prefix) \
|
||||
(android::base::GetProperty(prop, "").rfind(prefix, 0) == 0)
|
||||
#define FP_STARTS_WITH(prefix) \
|
||||
PROP_STARTS_WITH("ro.vendor.build.fingerprint", prefix)
|
||||
|
||||
using namespace std;
|
||||
|
||||
template<typename... Args>
|
||||
|
|
|
@ -9,8 +9,7 @@ using namespace std;
|
|||
class UnihertzKeylayoutQuirk : DeviceQuirk {
|
||||
public:
|
||||
bool ShouldRun() {
|
||||
return android::base::GetProperty("ro.vendor.build.fingerprint", "")
|
||||
.rfind("Unihertz/", 0) == 0;
|
||||
return FP_STARTS_WITH("Unihertz/");
|
||||
}
|
||||
|
||||
void Run() {
|
||||
|
|
Loading…
Reference in a new issue