OSDN Git Service

Merge tag 'android-9.0.0_r53' into pie-x86
[android-x86/frameworks-base.git] / core / jni / abipicker / ABIPicker.h
1 #ifndef _ABIPICKER_H_
2 #define _ABIPICKER_H_
3
4 #include <jni.h>
5 #include <stdlib.h>
6 #include <utils/Vector.h>
7 #include <sys/types.h>
8
9 #include <nativehelper/ScopedUtfChars.h>
10
11 namespace android {
12 //  assumption: the length of name of any abi type in abi list,
13 //  like armeabi-v7a, armeabi, x86, is not longer than 64
14 #define ABI_NAME_MAX_LENGTH     (64)
15
16 class ABIPicker {
17  public:
18     explicit ABIPicker(const char* pkgName,Vector<ScopedUtfChars*> abiList);
19     ~ABIPicker(void);
20
21     bool buildNativeLibList(void* apkHandle);
22     int  pickupRightABI(int sysPrefer);
23  private:
24     struct libInfo{
25         char abiName[ABI_NAME_MAX_LENGTH];
26         Vector<char*>* libNameList;
27     };
28     Vector<struct libInfo*>* mLibList;
29     char* mpkgName;
30
31     bool foundMixedELF(const char* abiName);
32     bool compare(char* armRef, char* iaRef, char* rawResult, char** result);
33     bool compareLibList(Vector<char*>& iaRefList, Vector<char*>& armRefList);
34     bool compare3rdPartyLibList( char* iaRef, char* armRef,
35             size_t* iaIsvLibCount, size_t* armIsvLibCount);
36     char*  getAbiName(int abi);
37     int    getAbiIndex(const char* abiName);
38     bool isABILibValid(const char* abiName);
39     Vector<char*>* getLibList(const char* abiName);
40 };
41
42 bool isInOEMWhiteList(const char* pkgName);
43 }  // namespace android
44 #endif  // _ABIPICKER_H_