|
22 | 22 | */
|
23 | 23 | public final class SpecialComponentList {
|
24 | 24 |
|
| 25 | + public static class ConflictInstrumentation { |
| 26 | + private static final HashSet<String> INSTRUMENTATION_CONFLICTING = new HashSet<>(2); |
| 27 | + |
| 28 | + static { |
| 29 | + INSTRUMENTATION_CONFLICTING.add("com.qihoo.magic"); |
| 30 | + INSTRUMENTATION_CONFLICTING.add("com.qihoo.magic_mutiple"); |
| 31 | + INSTRUMENTATION_CONFLICTING.add("com.facebook.katana"); |
| 32 | + } |
| 33 | + |
| 34 | + public static boolean isConflictingInstrumentation(String packageName) { |
| 35 | + return INSTRUMENTATION_CONFLICTING.contains(packageName); |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + public static class SpecSystemComponent { |
| 40 | + |
| 41 | + private static final HashSet<String> SPEC_SYSTEM_APP_LIST = new HashSet<>(3); |
| 42 | + |
| 43 | + static { |
| 44 | + SPEC_SYSTEM_APP_LIST.add("android"); |
| 45 | + SPEC_SYSTEM_APP_LIST.add("com.google.android.webview"); |
| 46 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| 47 | + try { |
| 48 | + String webViewPkgN = IWebViewUpdateService.getCurrentWebViewPackageName.call(WebViewFactory.getUpdateService.call()); |
| 49 | + if (webViewPkgN != null) { |
| 50 | + SPEC_SYSTEM_APP_LIST.add(webViewPkgN); |
| 51 | + } |
| 52 | + } catch (Throwable e) { |
| 53 | + e.printStackTrace(); |
| 54 | + } |
| 55 | + } |
| 56 | + } |
| 57 | + |
| 58 | + public static boolean isSpecSystemPackage(String pkg) { |
| 59 | + return SPEC_SYSTEM_APP_LIST.contains(pkg); |
| 60 | + } |
| 61 | + } |
| 62 | + |
25 | 63 | private static final List<String> ACTION_BLACK_LIST = new ArrayList<String>(1);
|
26 | 64 | private static final Map<String, String> PROTECTED_ACTION_MAP = new HashMap<>(5);
|
27 | 65 | private static final HashSet<String> WHITE_PERMISSION = new HashSet<>(3);
|
28 |
| - private static final HashSet<String> INSTRUMENTATION_CONFLICTING = new HashSet<>(2); |
29 |
| - private static final HashSet<String> SPEC_SYSTEM_APP_LIST = new HashSet<>(3); |
30 | 66 | private static final Set<String> SYSTEM_BROADCAST_ACTION = new HashSet<>(7);
|
31 | 67 | private static String PROTECT_ACTION_PREFIX = "_VA_protected_";
|
32 | 68 |
|
@@ -66,31 +102,9 @@ public final class SpecialComponentList {
|
66 | 102 | PROTECTED_ACTION_MAP.put("android.intent.action.USER_ADDED", Constants.ACTION_USER_ADDED);
|
67 | 103 | PROTECTED_ACTION_MAP.put("android.intent.action.USER_REMOVED", Constants.ACTION_USER_REMOVED);
|
68 | 104 |
|
69 |
| - INSTRUMENTATION_CONFLICTING.add("com.qihoo.magic"); |
70 |
| - INSTRUMENTATION_CONFLICTING.add("com.qihoo.magic_mutiple"); |
71 |
| - INSTRUMENTATION_CONFLICTING.add("com.facebook.katana"); |
72 |
| - |
73 |
| - SPEC_SYSTEM_APP_LIST.add("android"); |
74 |
| - SPEC_SYSTEM_APP_LIST.add("com.google.android.webview"); |
75 |
| - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
76 |
| - try { |
77 |
| - String webViewPkgN = IWebViewUpdateService.getCurrentWebViewPackageName.call(WebViewFactory.getUpdateService.call()); |
78 |
| - if (webViewPkgN != null) { |
79 |
| - SPEC_SYSTEM_APP_LIST.add(webViewPkgN); |
80 |
| - } |
81 |
| - } catch (Throwable e) { |
82 |
| - e.printStackTrace(); |
83 |
| - } |
84 |
| - } |
85 | 105 | }
|
86 | 106 |
|
87 |
| - public static boolean isSpecSystemPackage(String pkg) { |
88 |
| - return SPEC_SYSTEM_APP_LIST.contains(pkg); |
89 |
| - } |
90 | 107 |
|
91 |
| - public static boolean isConflictingInstrumentation(String packageName) { |
92 |
| - return INSTRUMENTATION_CONFLICTING.contains(packageName); |
93 |
| - } |
94 | 108 |
|
95 | 109 | /**
|
96 | 110 | * Check if the action in the BlackList.
|
|
0 commit comments