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

Commit 556114ba authored by Ivan Chiang's avatar Ivan Chiang
Browse files

[PM] Add more logs to debug the flaky test

The CtsPackageInstallerCUJUpdateOwnerShipTestCases is flaky. We found
it seems to be related to getInstallSourceInfo. Add more logs to
debug it. After we find the root cause, revert this patch.

Flag: EXEMPT log only update
Bug: 360755710
Test: atest CtsPackageInstallerCUJUpdateOwnerShipTestCases
Change-Id: I9a6f305c217b9216a8027c7eb56fede9f3d9c96f
parent b02f8680
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -5144,10 +5144,28 @@ public class ComputerEngine implements Computer {
        }

        updateOwnerPackageName = installSource.mUpdateOwnerPackageName;

        if (DEBUG_INSTALL) {
            Log.d(TAG, "ComputerEngine getInstallSourceInfo updateOwnerPackageName = "
                    + updateOwnerPackageName + ", callingUid = " + callingUid + ", packageName = "
                    + packageName + ", userId = " + userId);
        }

        if (updateOwnerPackageName != null) {
            final PackageStateInternal ps = mSettings.getPackage(updateOwnerPackageName);
            final boolean isCallerSystemOrUpdateOwner = callingUid == Process.SYSTEM_UID
                            || isCallerSameApp(updateOwnerPackageName, callingUid);

            if (DEBUG_INSTALL) {
                Log.d(TAG, "ComputerEngine getInstallSourceInfo ps = "
                        + ps + ", isCallerSystemOrUpdateOwner =" + isCallerSystemOrUpdateOwner
                        + ", isCallerSameApp = "
                        + isCallerSameApp(updateOwnerPackageName, callingUid) + ", filter = "
                        + shouldFilterApplicationIncludingUninstalled(ps, callingUid, userId)
                        + ", FromManagedUserOrProfile = "
                        + isCallerFromManagedUserOrProfile(userId));
            }

            // Except for package visibility filtering, we also hide update owner if the installer
            // is in the managed user or profile. As we don't enforce the update ownership for the
            // managed user and profile, knowing there's an update owner is meaningless in that
@@ -5159,6 +5177,11 @@ public class ComputerEngine implements Computer {
            }
        }

        if (DEBUG_INSTALL) {
            Log.d(TAG, "ComputerEngine getInstallSourceInfo updateOwnerPackageName = "
                    + updateOwnerPackageName);
        }

        if (installSource.mIsInitiatingPackageUninstalled) {
            // We can't check visibility in the usual way, since the initiating package is no
            // longer present. So we apply simpler rules to whether to expose the info: