This repository was archived by the owner on Jul 22, 2024. It is now read-only.
File tree 2 files changed +86
-1
lines changed
ClassySharkWS/src/com/google/classyshark/silverghost/translator/apk
2 files changed +86
-1
lines changed Original file line number Diff line number Diff line change @@ -100,12 +100,33 @@ public void apply() {
100
100
101
101
List <String > sortedNativeDependencies = new LinkedList <>(apkAnalysis .nativeDependencies );
102
102
Collections .sort (sortedNativeDependencies );
103
+ List <String > nativeLibNames = extractLibNames (apkAnalysis .nativeLibs );
103
104
for (String nativeLib : sortedNativeDependencies ) {
104
- element = new ELEMENT (nativeLib + "\n " , TAG .DOCUMENT );
105
+ element = new ELEMENT (nativeLib + " " +
106
+ PrivateNativeLibsInspector .check (nativeLib , nativeLibNames ) + "\n " , TAG .DOCUMENT );
105
107
elements .add (element );
106
108
}
107
109
}
108
110
111
+
112
+ private static List <String > extractLibNames (List <String > nativeLibs ) {
113
+ // libs/x86/lib.so\n ==> libs.so
114
+ LinkedList <String > result = new LinkedList <>();
115
+
116
+ for (String nativeLib : nativeLibs ) {
117
+ String simpleNativeLibName = nativeLib ;
118
+
119
+ if (nativeLib .contains ("/" )) {
120
+ simpleNativeLibName = simpleNativeLibName .substring (simpleNativeLibName .lastIndexOf ("/" ) + 1 ,
121
+ simpleNativeLibName .length () - 1 );
122
+ }
123
+
124
+ result .add (simpleNativeLibName );
125
+ }
126
+
127
+ return result ;
128
+ }
129
+
109
130
@ Override
110
131
public List <ELEMENT > getElementsList () {
111
132
return elements ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2016 Google, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com .google .classyshark .silverghost .translator .apk ;
18
+
19
+ import java .util .Arrays ;
20
+ import java .util .LinkedList ;
21
+ import java .util .List ;
22
+
23
+ public class PrivateNativeLibsInspector {
24
+
25
+ private static final String [] apiLibs = {
26
+ "libz.so" ,
27
+ "libz.a" ,
28
+ "libvulkan.so" ,
29
+ "libstdc++.so" ,
30
+ "libstdc++.a" ,
31
+ "libmediandk.so" ,
32
+ "libm.so" ,
33
+ "libm.a" ,
34
+ "liblog.so" ,
35
+ "libjnigraphics.so" ,
36
+ "libdl.so" ,
37
+ "libc.so" ,
38
+ "libc.a" ,
39
+ "libandroid.so" ,
40
+ "libOpenSLES.so" ,
41
+ "libOpenMAXAL.so" ,
42
+ "libGLESv3.so" ,
43
+ "libGLESv2.so" ,
44
+ "libGLESv1_CM.so" ,
45
+ "libEGL.so" ,
46
+ "crtend_so.o" ,
47
+ "crtend_android.o" ,
48
+ "crtbegin_static.o" ,
49
+ "crtbegin_so.o" ,
50
+ "crtbegin_dynamic.o" ,
51
+ "lsOutput.log"
52
+ };
53
+
54
+ private static List <String > APIS_LIB_LIST = new LinkedList <>(Arrays .asList (apiLibs ));
55
+
56
+ public static String check (String nativeLib , List <String > nativeLibNames ) {
57
+
58
+ if (!APIS_LIB_LIST .contains (nativeLib ) && !nativeLibNames .contains (nativeLib )) {
59
+ return " -- private api!" ;
60
+ }
61
+
62
+ return "" ;
63
+ }
64
+ }
You can’t perform that action at this time.
0 commit comments