frameworks/base
リビジョン | bf10629e34e836527a7cb855d633f6a932fed89a (tree) |
---|---|
日時 | 2018-04-25 19:46:45 |
作者 | Chih-Wei Huang <cwhuang@linu...> |
コミッター | Chih-Wei Huang |
houdini: match package name by patterns
PRC apps from different markets usually have different package names.
This change tries to match them by patterns.
To test it, install the Implosion apps from Wandoujia and CoolMarket
and run them OK.
@@ -5,6 +5,7 @@ | ||
5 | 5 | |
6 | 6 | #include <androidfw/ZipFileRO.h> |
7 | 7 | #include <androidfw/ZipUtils.h> |
8 | +#include <fnmatch.h> | |
8 | 9 | |
9 | 10 | namespace android { |
10 | 11 | #define ARR_SIZE(x) (sizeof(x)/sizeof(x[0])) |
@@ -106,8 +107,8 @@ bool isInOEMWhiteList(const char* pkgName) { | ||
106 | 107 | Vector<char*>::iterator it = cfgWhite.begin(); |
107 | 108 | for (; it != cfgWhite.end(); it++) { |
108 | 109 | P_LOG("whitelist : %s", *it); |
109 | - if (0 == strcmp(pkgName, *it)) { | |
110 | - ALOGI("found %s in whitelist", pkgName); | |
110 | + if (0 == fnmatch(*it, pkgName, 0)) { | |
111 | + ALOGI("whitelist %s by %s", pkgName, *it); | |
111 | 112 | result = true; |
112 | 113 | break; |
113 | 114 | } |
@@ -128,8 +129,8 @@ bool isInOEMBlackList(const char* pkgName) { | ||
128 | 129 | |
129 | 130 | Vector<char*>::iterator it = cfgBlack.begin(); |
130 | 131 | for (; it != cfgBlack.end(); it++) { |
131 | - if (0 == strcmp(pkgName, *it)) { | |
132 | - ALOGI("found %s in blacklist", pkgName); | |
132 | + if (0 == fnmatch(*it, pkgName, 0)) { | |
133 | + ALOGI("blacklist %s by %s", pkgName, *it); | |
133 | 134 | result = true; |
134 | 135 | break; |
135 | 136 | } |