Added a GTS test flag for BICS.
Normally, we do not want to include apps installed by ADB, but because GTS host tests needs to assume shell identity to install packages, we need to create a check for GTS conditions to include ADB installed apps.
Change-Id: Iaad0ed4ef5f8640bbed21d48e23503d22cfd953a
Test: atest
Bug: 394380792, 395178773
Flag: EXEMPT test fix
diff --git a/services/core/java/com/android/server/pm/BackgroundInstallControlService.java b/services/core/java/com/android/server/pm/BackgroundInstallControlService.java
index 463989a..60d028b 100644
--- a/services/core/java/com/android/server/pm/BackgroundInstallControlService.java
+++ b/services/core/java/com/android/server/pm/BackgroundInstallControlService.java
@@ -390,10 +390,11 @@
.max(Comparator.comparingLong(PackageInstaller.SessionInfo::getCreatedMillis));
}
- // ADB sets installerPackageName to null, this creates a loophole to bypass BIC which will be
- // addressed with b/265203007
private boolean installedByAdb(String initiatingPackageName) {
- if(PackageManagerServiceUtils.isInstalledByAdb(initiatingPackageName)) {
+ // GTS tests needs to adopt shell identity to install apps.
+ if(!SystemProperties.get("gts.transparency.bg-install-apps").isEmpty()) {
+ Slog.d(TAG, "handlePackageAdd: is GTS tests, skipping ADB check");
+ } else if(PackageManagerServiceUtils.isInstalledByAdb(initiatingPackageName)) {
Slog.d(TAG, "handlePackageAdd: is installed by ADB, skipping");
return true;
}