40 lines
1.6 KiB
Diff
40 lines
1.6 KiB
Diff
From 019df05a5d610f34f167195a2b69228e99160d6c Mon Sep 17 00:00:00 2001
|
|
From: Pierre-Hugues Husson <phh@phh.me>
|
|
Date: Sun, 25 Oct 2020 23:57:26 +0100
|
|
Subject: [PATCH 1/6] Re-implement fnmatch-like behaviour for RRO java-side
|
|
|
|
T: Also apply to FrameworkParsingPackageUtils (@PeterCxy)
|
|
|
|
Change-Id: Id38292a9a1453aa87b8401c1fdb390fa4e63c7d1
|
|
---
|
|
.../pm/parsing/FrameworkParsingPackageUtils.java | 13 +++++++++++--
|
|
1 file changed, 11 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
|
index fc06dd8de3b6..41da26bff956 100644
|
|
--- a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
|
+++ b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
|
@@ -223,8 +223,17 @@ public class FrameworkParsingPackageUtils {
|
|
continue;
|
|
}
|
|
// 3. Check if prop is equal to expected value.
|
|
- if (!currValue.equals(propValues[i])) {
|
|
- return false;
|
|
+ final String value = propValues[i];
|
|
+ if(value.startsWith("+")) {
|
|
+ final java.util.regex.Pattern regex = java.util.regex.Pattern.compile(value.substring(1, value.length()).replace("*", ".*"));
|
|
+ java.util.regex.Matcher matcher = regex.matcher(currValue);
|
|
+ if (!matcher.find()) {
|
|
+ return false;
|
|
+ }
|
|
+ } else {
|
|
+ if(!value.equals(currValue)) {
|
|
+ return false;
|
|
+ }
|
|
}
|
|
}
|
|
return true;
|
|
--
|
|
2.34.1
|
|
|