Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f0ecabf authored by George Chan's avatar George Chan
Browse files

Updated collectAppInfo to handle case where Android package removed...

Updated collectAppInfo to handle case where Android package removed uninstalled before BTS has a chance to measure the package split.

In the original flow, apps were not measured until the next time the device has downtime (ie. charging.) so apps that were installed then quickly uninstalled were not measured. With the new callback, measurements are immediate. This means apps that were installed and immediately removed (ie. for testing, suspicious behavior) are now being measured as well, meaning there is a race condition between measurement and uninstallation of the app.

Change-Id: I7306d6c88ebb7c78373d8a781e028c3fd17b0f70
Test: atest
Bug: 383365281
Flag: EXEMPT low complexity bug fix
parent 619d7124
Loading
Loading
Loading
Loading
+20 −9
Original line number Original line Diff line number Diff line
@@ -228,6 +228,7 @@ public class BinaryTransparencyService extends SystemService {
                    computePackageSignerSha256Digests(packageState.getSigningInfo());
                    computePackageSignerSha256Digests(packageState.getSigningInfo());


            AndroidPackage pkg = packageState.getAndroidPackage();
            AndroidPackage pkg = packageState.getAndroidPackage();
            if(pkg != null) {
                for (AndroidPackageSplit split : pkg.getSplits()) {
                for (AndroidPackageSplit split : pkg.getSplits()) {
                    var appInfo = new IBinaryTransparencyService.AppInfo();
                    var appInfo = new IBinaryTransparencyService.AppInfo();
                    appInfo.packageName = packageName;
                    appInfo.packageName = packageName;
@@ -244,6 +245,16 @@ public class BinaryTransparencyService extends SystemService {


                    results.add(appInfo);
                    results.add(appInfo);
                }
                }
            } else {
                Slog.w(TAG, packageName + " APK file is not physically present,"
                    + " skipping split and digest measurement");
                var appInfo = new IBinaryTransparencyService.AppInfo();
                appInfo.packageName = packageName;
                appInfo.longVersion = versionCode;
                appInfo.signerDigests = signerDigests;
                appInfo.mbaStatus = mbaStatus;
                results.add(appInfo);
            }


            // InstallSourceInfo is only available per package name, so store it only on the base
            // InstallSourceInfo is only available per package name, so store it only on the base
            // APK. It's not current currently available in PackageState (there's a TODO), to we
            // APK. It's not current currently available in PackageState (there's a TODO), to we