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

Commit 5b5be651 authored by Jiakai Zhang's avatar Jiakai Zhang
Browse files

Don't clear profile on otapreopt.

`maybe_open_reference_profile` installs a hook that clears the profile
on destruction. This behavior is not expected. Fortunately, the cleanup
is blocked by a permission check, so it doesn't cause any damage.
However, it should not be attempted in the first place.

Bug: 300941544
Test: Run system/update_engine/scripts/update_device.py and see no more
  "Permission denied" error.

Change-Id: I4d98d33a305de2487669ae3d7d69bbc4b9f2615b
parent 92db70b6
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -437,6 +437,9 @@ private:
                    maybe_open_reference_profile(parameters_.pkgName, parameters_.apk_path,
                    maybe_open_reference_profile(parameters_.pkgName, parameters_.apk_path,
                                                 parameters_.profile_name, profile_guided,
                                                 parameters_.profile_name, profile_guided,
                                                 is_public, parameters_.uid, is_secondary_dex);
                                                 is_public, parameters_.uid, is_secondary_dex);
            // `maybe_open_reference_profile` installs a hook that clears the profile on
            // destruction. Disable it.
            reference_profile.DisableCleanup();
            struct stat sbuf;
            struct stat sbuf;
            if (reference_profile.fd() == -1 ||
            if (reference_profile.fd() == -1 ||
                (fstat(reference_profile.fd(), &sbuf) != -1 && sbuf.st_size == 0)) {
                (fstat(reference_profile.fd(), &sbuf) != -1 && sbuf.st_size == 0)) {