summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/pm/PackageInstallerSession.java41
1 files changed, 33 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java
index 1b41c3617a05..352985d5a023 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerSession.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java
@@ -189,6 +189,7 @@ import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Preconditions;
import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
+import com.android.server.IoThread;
import com.android.server.LocalServices;
import com.android.server.art.ArtManagedInstallFileHelper;
import com.android.server.pm.Installer.InstallerException;
@@ -236,6 +237,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
private static final int MSG_SESSION_VALIDATION_FAILURE = 5;
private static final int MSG_PRE_APPROVAL_REQUEST = 6;
+ private static final int MSG_ON_NATIVE_LIBS_EXTRACTED = 7;
+
/** XML constants used for persisting a session */
static final String TAG_SESSION = "session";
static final String TAG_CHILD_SESSION = "childSession";
@@ -943,6 +946,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
case MSG_PRE_APPROVAL_REQUEST:
handlePreapprovalRequest();
break;
+ case MSG_ON_NATIVE_LIBS_EXTRACTED:
+ handleOnNativeLibsExtracted();
}
return true;
@@ -2908,15 +2913,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
}
private void verify() {
+ // Extract native libraries on the IO thread before proceeding to the verification
+ runExtractNativeLibraries();
+ }
+
+ @WorkerThread
+ private void handleOnNativeLibsExtracted() {
try {
- List<PackageInstallerSession> children = getChildSessions();
- if (isMultiPackage()) {
- for (PackageInstallerSession child : children) {
- child.extractNativeLibraries();
- }
- } else {
- extractNativeLibraries();
- }
verifyNonStaged();
} catch (PackageManagerException e) {
final String completeMsg = ExceptionUtils.getCompleteMessage(e);
@@ -2926,6 +2929,27 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
}
}
+ private void runExtractNativeLibraries() {
+ IoThread.getHandler().post(() -> {
+ try {
+ List<PackageInstallerSession> children = getChildSessions();
+ if (isMultiPackage()) {
+ for (PackageInstallerSession child : children) {
+ child.extractNativeLibraries();
+ }
+ } else {
+ extractNativeLibraries();
+ }
+ mHandler.obtainMessage(MSG_ON_NATIVE_LIBS_EXTRACTED).sendToTarget();
+ } catch (PackageManagerException e) {
+ final String completeMsg = ExceptionUtils.getCompleteMessage(e);
+ final String errorMsg = PackageManager.installStatusToString(e.error, completeMsg);
+ setSessionFailed(e.error, errorMsg);
+ onSessionVerificationFailure(e.error, errorMsg);
+ }
+ });
+ }
+
private IntentSender getRemoteStatusReceiver() {
synchronized (mLock) {
return mRemoteStatusReceiver;
@@ -3072,6 +3096,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
}
}
+ @WorkerThread
private void extractNativeLibraries() throws PackageManagerException {
synchronized (mLock) {
if (mPackageLite != null) {