Loading services/core/java/com/android/server/pm/PackageInstallerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -640,7 +640,8 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements && params.installerPackageName.length() < SessionParams.MAX_PACKAGE_NAME_LENGTH) ? params.installerPackageName : installerPackageName; if ((callingUid == Process.SHELL_UID) || (callingUid == Process.ROOT_UID)) { if ((callingUid == Process.SHELL_UID) || (callingUid == Process.ROOT_UID) || PackageInstallerSession.isSystemDataLoaderInstallation(params)) { params.installFlags |= PackageManager.INSTALL_FROM_ADB; // adb installs can override the installingPackageName, but not the // initiatingPackageName Loading @@ -666,8 +667,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements && !mPm.isCallerVerifier(snapshot, callingUid)) { params.installFlags &= ~PackageManager.INSTALL_VIRTUAL_PRELOAD; } if (mContext.checkCallingOrSelfPermission( Manifest.permission.INSTALL_TEST_ONLY_PACKAGE) if (mContext.checkCallingOrSelfPermission(Manifest.permission.INSTALL_TEST_ONLY_PACKAGE) != PackageManager.PERMISSION_GRANTED) { params.installFlags &= ~PackageManager.INSTALL_ALLOW_TEST; } Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +31 −21 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import static android.content.pm.PackageManager.INSTALL_FAILED_INTERNAL_ERROR; import static android.content.pm.PackageManager.INSTALL_FAILED_INVALID_APK; import static android.content.pm.PackageManager.INSTALL_FAILED_MEDIA_UNAVAILABLE; import static android.content.pm.PackageManager.INSTALL_FAILED_MISSING_SPLIT; import static android.content.pm.PackageManager.INSTALL_FROM_ADB; import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_NO_CERTIFICATES; import static android.content.pm.PackageManager.INSTALL_STAGED; import static android.content.pm.PackageManager.INSTALL_SUCCEEDED; Loading Loading @@ -705,6 +704,18 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } }; static boolean isDataLoaderInstallation(SessionParams params) { return params.dataLoaderParams != null; } static boolean isSystemDataLoaderInstallation(SessionParams params) { if (!isDataLoaderInstallation(params)) { return false; } return SYSTEM_DATA_LOADER_PACKAGE.equals( params.dataLoaderParams.getComponentName().getPackageName()); } private final Handler.Callback mHandlerCallback = new Handler.Callback() { @Override public boolean handleMessage(Message msg) { Loading Loading @@ -744,7 +755,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { }; private boolean isDataLoaderInstallation() { return params.dataLoaderParams != null; return isDataLoaderInstallation(this.params); } private boolean isStreamingInstallation() { Loading @@ -756,11 +767,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } private boolean isSystemDataLoaderInstallation() { if (!isDataLoaderInstallation()) { return false; } return SYSTEM_DATA_LOADER_PACKAGE.equals( this.params.dataLoaderParams.getComponentName().getPackageName()); return isSystemDataLoaderInstallation(this.params); } /** Loading Loading @@ -957,18 +964,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { "DataLoader installation of APEX modules is not allowed."); } if (isSystemDataLoaderInstallation()) { if (mContext.checkCallingOrSelfPermission( if (isSystemDataLoaderInstallation() && mContext.checkCallingOrSelfPermission( Manifest.permission.USE_SYSTEM_DATA_LOADERS) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("You need the " + "com.android.permission.USE_SYSTEM_DATA_LOADERS permission " + "to use system data loaders"); } // All installations using system dataloaders marked as ADB. this.params.installFlags |= INSTALL_FROM_ADB; } } if (isIncrementalInstallation() && !IncrementalManager.isAllowed()) { Loading Loading @@ -1264,13 +1266,21 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { return; } final String initiatingPackageName = getInstallSource().initiatingPackageName; final String installerPackageName; if (!TextUtils.isEmpty(getInstallSource().initiatingPackageName)) { installerPackageName = getInstallSource().initiatingPackageName; } else { installerPackageName = getInstallSource().installerPackageName; } if (TextUtils.isEmpty(installerPackageName)) { throw new IllegalStateException("Installer package is empty."); } final AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class); appOps.checkPackage(Binder.getCallingUid(), initiatingPackageName); appOps.checkPackage(Binder.getCallingUid(), installerPackageName); final PackageManagerInternal pmi = LocalServices.getService(PackageManagerInternal.class); final AndroidPackage callingInstaller = pmi.getPackage(initiatingPackageName); final AndroidPackage callingInstaller = pmi.getPackage(installerPackageName); if (callingInstaller == null) { throw new IllegalStateException("Can't obtain calling installer's package."); } Loading services/core/java/com/android/server/pm/PackageManagerService.java +11 −2 Original line number Diff line number Diff line Loading @@ -1254,9 +1254,18 @@ public class PackageManagerService implements PackageSender, TestUtilityService if (applicationInfo == null) { throw new ParcelableException(new PackageManager.NameNotFoundException(packageName)); } final InstallSourceInfo installSourceInfo = snapshot.getInstallSourceInfo(packageName); final String installerPackageName = installSourceInfo != null ? installSourceInfo.getInitiatingPackageName() : null; final String installerPackageName; if (installSourceInfo != null) { if (!TextUtils.isEmpty(installSourceInfo.getInitiatingPackageName())) { installerPackageName = installSourceInfo.getInitiatingPackageName(); } else { installerPackageName = installSourceInfo.getInstallingPackageName(); } } else { installerPackageName = null; } List<Pair<String, File>> filesToChecksum = new ArrayList<>(); Loading services/incremental/IncrementalService.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,11 @@ static bool getAlwaysEnableReadTimeoutsForSystemDataLoaders() { true); } static bool getEnableReadTimeoutsAfterInstall() { return android::base::GetBoolProperty("debug.incremental.enable_read_timeouts_after_install", true); } static bool getEnforceReadLogsMaxIntervalForSystemDataLoaders() { return android::base::GetBoolProperty("debug.incremental.enforce_readlogs_max_interval_for_" "system_dataloaders", Loading Loading @@ -853,7 +858,7 @@ void IncrementalService::onInstallationComplete(StorageId storage) { // Always enable long read timeouts after installation is complete. std::unique_lock l(ifs->lock); ifs->setReadTimeoutsRequested(true); ifs->setReadTimeoutsRequested(getEnableReadTimeoutsAfterInstall()); applyStorageParamsLocked(*ifs); } Loading Loading
services/core/java/com/android/server/pm/PackageInstallerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -640,7 +640,8 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements && params.installerPackageName.length() < SessionParams.MAX_PACKAGE_NAME_LENGTH) ? params.installerPackageName : installerPackageName; if ((callingUid == Process.SHELL_UID) || (callingUid == Process.ROOT_UID)) { if ((callingUid == Process.SHELL_UID) || (callingUid == Process.ROOT_UID) || PackageInstallerSession.isSystemDataLoaderInstallation(params)) { params.installFlags |= PackageManager.INSTALL_FROM_ADB; // adb installs can override the installingPackageName, but not the // initiatingPackageName Loading @@ -666,8 +667,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements && !mPm.isCallerVerifier(snapshot, callingUid)) { params.installFlags &= ~PackageManager.INSTALL_VIRTUAL_PRELOAD; } if (mContext.checkCallingOrSelfPermission( Manifest.permission.INSTALL_TEST_ONLY_PACKAGE) if (mContext.checkCallingOrSelfPermission(Manifest.permission.INSTALL_TEST_ONLY_PACKAGE) != PackageManager.PERMISSION_GRANTED) { params.installFlags &= ~PackageManager.INSTALL_ALLOW_TEST; } Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +31 −21 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import static android.content.pm.PackageManager.INSTALL_FAILED_INTERNAL_ERROR; import static android.content.pm.PackageManager.INSTALL_FAILED_INVALID_APK; import static android.content.pm.PackageManager.INSTALL_FAILED_MEDIA_UNAVAILABLE; import static android.content.pm.PackageManager.INSTALL_FAILED_MISSING_SPLIT; import static android.content.pm.PackageManager.INSTALL_FROM_ADB; import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_NO_CERTIFICATES; import static android.content.pm.PackageManager.INSTALL_STAGED; import static android.content.pm.PackageManager.INSTALL_SUCCEEDED; Loading Loading @@ -705,6 +704,18 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } }; static boolean isDataLoaderInstallation(SessionParams params) { return params.dataLoaderParams != null; } static boolean isSystemDataLoaderInstallation(SessionParams params) { if (!isDataLoaderInstallation(params)) { return false; } return SYSTEM_DATA_LOADER_PACKAGE.equals( params.dataLoaderParams.getComponentName().getPackageName()); } private final Handler.Callback mHandlerCallback = new Handler.Callback() { @Override public boolean handleMessage(Message msg) { Loading Loading @@ -744,7 +755,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { }; private boolean isDataLoaderInstallation() { return params.dataLoaderParams != null; return isDataLoaderInstallation(this.params); } private boolean isStreamingInstallation() { Loading @@ -756,11 +767,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } private boolean isSystemDataLoaderInstallation() { if (!isDataLoaderInstallation()) { return false; } return SYSTEM_DATA_LOADER_PACKAGE.equals( this.params.dataLoaderParams.getComponentName().getPackageName()); return isSystemDataLoaderInstallation(this.params); } /** Loading Loading @@ -957,18 +964,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { "DataLoader installation of APEX modules is not allowed."); } if (isSystemDataLoaderInstallation()) { if (mContext.checkCallingOrSelfPermission( if (isSystemDataLoaderInstallation() && mContext.checkCallingOrSelfPermission( Manifest.permission.USE_SYSTEM_DATA_LOADERS) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("You need the " + "com.android.permission.USE_SYSTEM_DATA_LOADERS permission " + "to use system data loaders"); } // All installations using system dataloaders marked as ADB. this.params.installFlags |= INSTALL_FROM_ADB; } } if (isIncrementalInstallation() && !IncrementalManager.isAllowed()) { Loading Loading @@ -1264,13 +1266,21 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { return; } final String initiatingPackageName = getInstallSource().initiatingPackageName; final String installerPackageName; if (!TextUtils.isEmpty(getInstallSource().initiatingPackageName)) { installerPackageName = getInstallSource().initiatingPackageName; } else { installerPackageName = getInstallSource().installerPackageName; } if (TextUtils.isEmpty(installerPackageName)) { throw new IllegalStateException("Installer package is empty."); } final AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class); appOps.checkPackage(Binder.getCallingUid(), initiatingPackageName); appOps.checkPackage(Binder.getCallingUid(), installerPackageName); final PackageManagerInternal pmi = LocalServices.getService(PackageManagerInternal.class); final AndroidPackage callingInstaller = pmi.getPackage(initiatingPackageName); final AndroidPackage callingInstaller = pmi.getPackage(installerPackageName); if (callingInstaller == null) { throw new IllegalStateException("Can't obtain calling installer's package."); } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +11 −2 Original line number Diff line number Diff line Loading @@ -1254,9 +1254,18 @@ public class PackageManagerService implements PackageSender, TestUtilityService if (applicationInfo == null) { throw new ParcelableException(new PackageManager.NameNotFoundException(packageName)); } final InstallSourceInfo installSourceInfo = snapshot.getInstallSourceInfo(packageName); final String installerPackageName = installSourceInfo != null ? installSourceInfo.getInitiatingPackageName() : null; final String installerPackageName; if (installSourceInfo != null) { if (!TextUtils.isEmpty(installSourceInfo.getInitiatingPackageName())) { installerPackageName = installSourceInfo.getInitiatingPackageName(); } else { installerPackageName = installSourceInfo.getInstallingPackageName(); } } else { installerPackageName = null; } List<Pair<String, File>> filesToChecksum = new ArrayList<>(); Loading
services/incremental/IncrementalService.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,11 @@ static bool getAlwaysEnableReadTimeoutsForSystemDataLoaders() { true); } static bool getEnableReadTimeoutsAfterInstall() { return android::base::GetBoolProperty("debug.incremental.enable_read_timeouts_after_install", true); } static bool getEnforceReadLogsMaxIntervalForSystemDataLoaders() { return android::base::GetBoolProperty("debug.incremental.enforce_readlogs_max_interval_for_" "system_dataloaders", Loading Loading @@ -853,7 +858,7 @@ void IncrementalService::onInstallationComplete(StorageId storage) { // Always enable long read timeouts after installation is complete. std::unique_lock l(ifs->lock); ifs->setReadTimeoutsRequested(true); ifs->setReadTimeoutsRequested(getEnableReadTimeoutsAfterInstall()); applyStorageParamsLocked(*ifs); } Loading