final boolean multiArch;
final boolean extractNativeLibs;
final boolean debuggable;
+ final String pkgName;
public static Handle create(File packageFile) throws IOException {
try {
return create(pkg.getAllCodePaths(),
(pkg.applicationInfo.flags & ApplicationInfo.FLAG_MULTIARCH) != 0,
(pkg.applicationInfo.flags & ApplicationInfo.FLAG_EXTRACT_NATIVE_LIBS) != 0,
- (pkg.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
+ (pkg.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0, pkg.packageName);
}
public static Handle create(PackageLite lite) throws IOException {
return create(lite.getAllCodePaths(), lite.multiArch, lite.extractNativeLibs,
- lite.debuggable);
+ lite.debuggable, lite.packageName);
}
private static Handle create(List<String> codePaths, boolean multiArch,
- boolean extractNativeLibs, boolean debuggable) throws IOException {
+ boolean extractNativeLibs, boolean debuggable, String pkgName) throws IOException {
final int size = codePaths.size();
final long[] apkHandles = new long[size];
for (int i = 0; i < size; i++) {
}
}
- return new Handle(apkHandles, multiArch, extractNativeLibs, debuggable);
+ return new Handle(apkHandles, multiArch, extractNativeLibs, debuggable, pkgName);
}
public static Handle createFd(PackageLite lite, FileDescriptor fd) throws IOException {
throw new IOException("Unable to open APK " + path + " from fd " + fd);
}
- return new Handle(apkHandles, lite.multiArch, lite.extractNativeLibs, lite.debuggable);
+ return new Handle(apkHandles, lite.multiArch, lite.extractNativeLibs, lite.debuggable, lite.packageName);
}
Handle(long[] apkHandles, boolean multiArch, boolean extractNativeLibs,
- boolean debuggable) {
+ boolean debuggable, String pkgName) {
this.apkHandles = apkHandles;
this.multiArch = multiArch;
this.extractNativeLibs = extractNativeLibs;
this.debuggable = debuggable;
+ this.pkgName = pkgName;
mGuard.open("close");
}
public static int findSupportedAbi(Handle handle, String[] supportedAbis) {
int finalRes = NO_NATIVE_LIBRARIES;
for (long apkHandle : handle.apkHandles) {
- final int res = nativeFindSupportedAbi(apkHandle, supportedAbis, handle.debuggable);
+ int res;
+ if (true) {
+ res = nativeFindSupportedAbiReplace(apkHandle, supportedAbis, handle.debuggable, handle.pkgName);
+ } else {
+ res = nativeFindSupportedAbi(apkHandle, supportedAbis, handle.debuggable);
+ }
+
if (res == NO_NATIVE_LIBRARIES) {
// No native code, keep looking through all APKs.
} else if (res == INSTALL_FAILED_NO_MATCHING_ABIS) {
private native static int nativeFindSupportedAbi(long handle, String[] supportedAbis,
boolean debuggable);
+ private native static int nativeFindSupportedAbiReplace(long handle, String[] supportedAbis,
+ boolean debuggable, String pkgName);
+
// Convenience method to call removeNativeBinariesFromDirLI(File)
public static void removeNativeBinariesLI(String nativeLibraryPath) {
if (nativeLibraryPath == null) return;