Loading core/java/android/os/incremental/IIncrementalService.aidl +5 −0 Original line number Original line Diff line number Diff line Loading @@ -109,4 +109,9 @@ interface IIncrementalService { * Setting up native library directories and extract native libs onto a storage. * Setting up native library directories and extract native libs onto a storage. */ */ boolean configureNativeBinaries(int storageId, in @utf8InCpp String apkFullPath, in @utf8InCpp String libDirRelativePath, in @utf8InCpp String abi); boolean configureNativeBinaries(int storageId, in @utf8InCpp String apkFullPath, in @utf8InCpp String libDirRelativePath, in @utf8InCpp String abi); /** * Waits until all native library extraction is done for the storage */ boolean waitForNativeBinariesExtraction(int storageId); } } core/java/android/os/incremental/IncrementalStorage.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -480,4 +480,18 @@ public final class IncrementalStorage { return false; return false; } } } } /** * Waits for all native binary extraction operations to complete on the storage. * * @return Success of not. */ public boolean waitForNativeBinariesExtraction() { try { return mService.waitForNativeBinariesExtraction(mId); } catch (RemoteException e) { e.rethrowFromSystemServer(); return false; } } } } core/java/com/android/internal/content/NativeLibraryHelper.java +15 −1 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,6 @@ import static android.system.OsConstants.S_IXGRP; import static android.system.OsConstants.S_IXOTH; import static android.system.OsConstants.S_IXOTH; import android.content.Context; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageParser; import android.content.pm.PackageParser; import android.content.pm.PackageParser.PackageLite; import android.content.pm.PackageParser.PackageLite; Loading @@ -40,6 +39,7 @@ import android.os.incremental.IncrementalManager; import android.os.incremental.IncrementalStorage; import android.os.incremental.IncrementalStorage; import android.system.ErrnoException; import android.system.ErrnoException; import android.system.Os; import android.system.Os; import android.util.ArraySet; import android.util.Slog; import android.util.Slog; import dalvik.system.CloseGuard; import dalvik.system.CloseGuard; Loading Loading @@ -545,4 +545,18 @@ public class NativeLibraryHelper { } } return false; return false; } } /** * Wait for all native library extraction to complete for the passed storages. * * @param incrementalStorages A list of the storages to wait for. */ public static void waitForNativeBinariesExtraction( ArraySet<IncrementalStorage> incrementalStorages) { for (int i = 0; i < incrementalStorages.size(); ++i) { IncrementalStorage storage = incrementalStorages.valueAtUnchecked(i); storage.waitForNativeBinariesExtraction(); } } } } services/core/java/com/android/server/pm/PackageManagerService.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -263,6 +263,7 @@ import android.os.UserHandle; import android.os.UserManager; import android.os.UserManager; import android.os.UserManagerInternal; import android.os.UserManagerInternal; import android.os.incremental.IncrementalManager; import android.os.incremental.IncrementalManager; import android.os.incremental.IncrementalStorage; import android.os.storage.DiskInfo; import android.os.storage.DiskInfo; import android.os.storage.IStorageManager; import android.os.storage.IStorageManager; import android.os.storage.StorageEventListener; import android.os.storage.StorageEventListener; Loading Loading @@ -16596,6 +16597,7 @@ public class PackageManagerService extends IPackageManager.Stub * locks on {@link #mLock}. * locks on {@link #mLock}. */ */ private void executePostCommitSteps(CommitRequest commitRequest) { private void executePostCommitSteps(CommitRequest commitRequest) { final ArraySet<IncrementalStorage> incrementalStorages = new ArraySet<>(); for (ReconciledPackage reconciledPkg : commitRequest.reconciledPackages.values()) { for (ReconciledPackage reconciledPkg : commitRequest.reconciledPackages.values()) { final boolean instantApp = ((reconciledPkg.scanResult.request.scanFlags final boolean instantApp = ((reconciledPkg.scanResult.request.scanFlags & PackageManagerService.SCAN_AS_INSTANT_APP) != 0); & PackageManagerService.SCAN_AS_INSTANT_APP) != 0); Loading @@ -16603,6 +16605,14 @@ public class PackageManagerService extends IPackageManager.Stub final String packageName = pkg.getPackageName(); final String packageName = pkg.getPackageName(); final boolean onIncremental = mIncrementalManager != null final boolean onIncremental = mIncrementalManager != null && isIncrementalPath(pkg.getCodePath()); && isIncrementalPath(pkg.getCodePath()); if (onIncremental) { IncrementalStorage storage = mIncrementalManager.openStorage(pkg.getCodePath()); if (storage == null) { throw new IllegalArgumentException( "Install: null storage for incremental package " + packageName); } incrementalStorages.add(storage); } prepareAppDataAfterInstallLIF(pkg); prepareAppDataAfterInstallLIF(pkg); if (reconciledPkg.prepareResult.clearCodeCache) { if (reconciledPkg.prepareResult.clearCodeCache) { clearAppDataLIF(pkg, UserHandle.USER_ALL, FLAG_STORAGE_DE | FLAG_STORAGE_CE clearAppDataLIF(pkg, UserHandle.USER_ALL, FLAG_STORAGE_DE | FLAG_STORAGE_CE Loading Loading @@ -16700,6 +16710,7 @@ public class PackageManagerService extends IPackageManager.Stub notifyPackageChangeObserversOnUpdate(reconciledPkg); notifyPackageChangeObserversOnUpdate(reconciledPkg); } } NativeLibraryHelper.waitForNativeBinariesExtraction(incrementalStorages); } } private void notifyPackageChangeObserversOnUpdate(ReconciledPackage reconciledPkg) { private void notifyPackageChangeObserversOnUpdate(ReconciledPackage reconciledPkg) { services/core/jni/com_android_server_SystemServer.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -135,7 +135,7 @@ static void android_server_SystemServer_spawnFdLeakCheckThread(JNIEnv*, jobject) static jlong android_server_SystemServer_startIncrementalService(JNIEnv* env, jclass klass, static jlong android_server_SystemServer_startIncrementalService(JNIEnv* env, jclass klass, jobject self) { jobject self) { return Incremental_IncrementalService_Start(); return Incremental_IncrementalService_Start(env); } } static void android_server_SystemServer_setIncrementalServiceSystemReady(JNIEnv* env, jclass klass, static void android_server_SystemServer_setIncrementalServiceSystemReady(JNIEnv* env, jclass klass, Loading Loading
core/java/android/os/incremental/IIncrementalService.aidl +5 −0 Original line number Original line Diff line number Diff line Loading @@ -109,4 +109,9 @@ interface IIncrementalService { * Setting up native library directories and extract native libs onto a storage. * Setting up native library directories and extract native libs onto a storage. */ */ boolean configureNativeBinaries(int storageId, in @utf8InCpp String apkFullPath, in @utf8InCpp String libDirRelativePath, in @utf8InCpp String abi); boolean configureNativeBinaries(int storageId, in @utf8InCpp String apkFullPath, in @utf8InCpp String libDirRelativePath, in @utf8InCpp String abi); /** * Waits until all native library extraction is done for the storage */ boolean waitForNativeBinariesExtraction(int storageId); } }
core/java/android/os/incremental/IncrementalStorage.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -480,4 +480,18 @@ public final class IncrementalStorage { return false; return false; } } } } /** * Waits for all native binary extraction operations to complete on the storage. * * @return Success of not. */ public boolean waitForNativeBinariesExtraction() { try { return mService.waitForNativeBinariesExtraction(mId); } catch (RemoteException e) { e.rethrowFromSystemServer(); return false; } } } }
core/java/com/android/internal/content/NativeLibraryHelper.java +15 −1 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,6 @@ import static android.system.OsConstants.S_IXGRP; import static android.system.OsConstants.S_IXOTH; import static android.system.OsConstants.S_IXOTH; import android.content.Context; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageParser; import android.content.pm.PackageParser; import android.content.pm.PackageParser.PackageLite; import android.content.pm.PackageParser.PackageLite; Loading @@ -40,6 +39,7 @@ import android.os.incremental.IncrementalManager; import android.os.incremental.IncrementalStorage; import android.os.incremental.IncrementalStorage; import android.system.ErrnoException; import android.system.ErrnoException; import android.system.Os; import android.system.Os; import android.util.ArraySet; import android.util.Slog; import android.util.Slog; import dalvik.system.CloseGuard; import dalvik.system.CloseGuard; Loading Loading @@ -545,4 +545,18 @@ public class NativeLibraryHelper { } } return false; return false; } } /** * Wait for all native library extraction to complete for the passed storages. * * @param incrementalStorages A list of the storages to wait for. */ public static void waitForNativeBinariesExtraction( ArraySet<IncrementalStorage> incrementalStorages) { for (int i = 0; i < incrementalStorages.size(); ++i) { IncrementalStorage storage = incrementalStorages.valueAtUnchecked(i); storage.waitForNativeBinariesExtraction(); } } } }
services/core/java/com/android/server/pm/PackageManagerService.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -263,6 +263,7 @@ import android.os.UserHandle; import android.os.UserManager; import android.os.UserManager; import android.os.UserManagerInternal; import android.os.UserManagerInternal; import android.os.incremental.IncrementalManager; import android.os.incremental.IncrementalManager; import android.os.incremental.IncrementalStorage; import android.os.storage.DiskInfo; import android.os.storage.DiskInfo; import android.os.storage.IStorageManager; import android.os.storage.IStorageManager; import android.os.storage.StorageEventListener; import android.os.storage.StorageEventListener; Loading Loading @@ -16596,6 +16597,7 @@ public class PackageManagerService extends IPackageManager.Stub * locks on {@link #mLock}. * locks on {@link #mLock}. */ */ private void executePostCommitSteps(CommitRequest commitRequest) { private void executePostCommitSteps(CommitRequest commitRequest) { final ArraySet<IncrementalStorage> incrementalStorages = new ArraySet<>(); for (ReconciledPackage reconciledPkg : commitRequest.reconciledPackages.values()) { for (ReconciledPackage reconciledPkg : commitRequest.reconciledPackages.values()) { final boolean instantApp = ((reconciledPkg.scanResult.request.scanFlags final boolean instantApp = ((reconciledPkg.scanResult.request.scanFlags & PackageManagerService.SCAN_AS_INSTANT_APP) != 0); & PackageManagerService.SCAN_AS_INSTANT_APP) != 0); Loading @@ -16603,6 +16605,14 @@ public class PackageManagerService extends IPackageManager.Stub final String packageName = pkg.getPackageName(); final String packageName = pkg.getPackageName(); final boolean onIncremental = mIncrementalManager != null final boolean onIncremental = mIncrementalManager != null && isIncrementalPath(pkg.getCodePath()); && isIncrementalPath(pkg.getCodePath()); if (onIncremental) { IncrementalStorage storage = mIncrementalManager.openStorage(pkg.getCodePath()); if (storage == null) { throw new IllegalArgumentException( "Install: null storage for incremental package " + packageName); } incrementalStorages.add(storage); } prepareAppDataAfterInstallLIF(pkg); prepareAppDataAfterInstallLIF(pkg); if (reconciledPkg.prepareResult.clearCodeCache) { if (reconciledPkg.prepareResult.clearCodeCache) { clearAppDataLIF(pkg, UserHandle.USER_ALL, FLAG_STORAGE_DE | FLAG_STORAGE_CE clearAppDataLIF(pkg, UserHandle.USER_ALL, FLAG_STORAGE_DE | FLAG_STORAGE_CE Loading Loading @@ -16700,6 +16710,7 @@ public class PackageManagerService extends IPackageManager.Stub notifyPackageChangeObserversOnUpdate(reconciledPkg); notifyPackageChangeObserversOnUpdate(reconciledPkg); } } NativeLibraryHelper.waitForNativeBinariesExtraction(incrementalStorages); } } private void notifyPackageChangeObserversOnUpdate(ReconciledPackage reconciledPkg) { private void notifyPackageChangeObserversOnUpdate(ReconciledPackage reconciledPkg) {
services/core/jni/com_android_server_SystemServer.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -135,7 +135,7 @@ static void android_server_SystemServer_spawnFdLeakCheckThread(JNIEnv*, jobject) static jlong android_server_SystemServer_startIncrementalService(JNIEnv* env, jclass klass, static jlong android_server_SystemServer_startIncrementalService(JNIEnv* env, jclass klass, jobject self) { jobject self) { return Incremental_IncrementalService_Start(); return Incremental_IncrementalService_Start(env); } } static void android_server_SystemServer_setIncrementalServiceSystemReady(JNIEnv* env, jclass klass, static void android_server_SystemServer_setIncrementalServiceSystemReady(JNIEnv* env, jclass klass, Loading