mirror of
https://github.com/yurisieucuti/treble_evolution.git
synced 2024-11-28 02:24:31 +00:00
65 lines
3.0 KiB
Diff
65 lines
3.0 KiB
Diff
From 34fc24102978184eba88717083db434ba75c4e33 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 15/51] Re-implement fnmatch-like behaviour for RRO java-side
|
|
|
|
T: Also apply to FrameworkParsingPackageUtils (@PeterCxy)
|
|
|
|
Change-Id: Id38292a9a1453aa87b8401c1fdb390fa4e63c7d1
|
|
---
|
|
core/java/android/content/pm/PackageParser.java | 13 +++++++++++--
|
|
.../pm/parsing/FrameworkParsingPackageUtils.java | 13 +++++++++++--
|
|
2 files changed, 22 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
|
|
index 4b579e7db9f8..3bee878e2fc8 100644
|
|
--- a/core/java/android/content/pm/PackageParser.java
|
|
+++ b/core/java/android/content/pm/PackageParser.java
|
|
@@ -2545,8 +2545,17 @@ public class PackageParser {
|
|
for (int i = 0; i < propNames.length; i++) {
|
|
// Check property value: make sure it is both set and equal to expected value
|
|
final String currValue = SystemProperties.get(propNames[i]);
|
|
- if (!TextUtils.equals(currValue, 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;
|
|
diff --git a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
|
index 153dd9a93490..4eacc197b4e9 100644
|
|
--- a/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
|
+++ b/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java
|
|
@@ -215,8 +215,17 @@ public class FrameworkParsingPackageUtils {
|
|
for (int i = 0; i < propNames.length; i++) {
|
|
// Check property value: make sure it is both set and equal to expected value
|
|
final String currValue = SystemProperties.get(propNames[i]);
|
|
- if (!TextUtils.equals(currValue, 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.25.1
|
|
|