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

Commit 221f3ec5 authored by Gavin Corkery's avatar Gavin Corkery
Browse files

Mark boot completion via apexservice

Use the StagingManager lifecycle class to call into ApexManager
when the boot completed broadcast is received. ApexManager will
then call into apexservice to inform apexd of the boot completion,
instead of apexd relying on the sys.boot_completed property.

Test: atest StagedInstallTest
Test: atest ApexRollbackTests
Bug: 158467962
Change-Id: Ibcb4cb784243530eb2cf8c2633651342e8115d14
parent 28cf84c0
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -349,6 +349,11 @@ public abstract class ApexManager {
     */
     */
    public abstract boolean destroyCeSnapshotsNotSpecified(int userId, int[] retainRollbackIds);
    public abstract boolean destroyCeSnapshotsNotSpecified(int userId, int[] retainRollbackIds);


    /**
     * Inform apexd that the boot has completed.
     */
    public abstract void markBootCompleted();

    /**
    /**
     * Dumps various state information to the provided {@link PrintWriter} object.
     * Dumps various state information to the provided {@link PrintWriter} object.
     *
     *
@@ -880,6 +885,15 @@ public abstract class ApexManager {
            }
            }
        }
        }


        @Override
        public void markBootCompleted() {
            try {
                waitForApexService().markBootCompleted();
            } catch (RemoteException re) {
                Slog.e(TAG, "Unable to contact apexservice", re);
            }
        }

        /**
        /**
         * Dump information about the packages contained in a particular cache
         * Dump information about the packages contained in a particular cache
         * @param packagesCache the cache to print information about.
         * @param packagesCache the cache to print information about.
@@ -1126,6 +1140,11 @@ public abstract class ApexManager {
            return true;
            return true;
        }
        }


        @Override
        public void markBootCompleted() {
            // No-op
        }

        @Override
        @Override
        void dump(PrintWriter pw, String packageName) {
        void dump(PrintWriter pw, String packageName) {
            // No-op
            // No-op
+5 −0
Original line number Original line Diff line number Diff line
@@ -164,6 +164,7 @@ public class StagingManager {
        public void onBootPhase(int phase) {
        public void onBootPhase(int phase) {
            if (phase == SystemService.PHASE_BOOT_COMPLETED && sStagingManager != null) {
            if (phase == SystemService.PHASE_BOOT_COMPLETED && sStagingManager != null) {
                sStagingManager.markStagedSessionsAsSuccessful();
                sStagingManager.markStagedSessionsAsSuccessful();
                sStagingManager.markBootCompleted();
            }
            }
        }
        }
    }
    }
@@ -179,6 +180,10 @@ public class StagingManager {
        }
        }
    }
    }


    private void markBootCompleted() {
        mApexManager.markBootCompleted();
    }

    ParceledListSlice<PackageInstaller.SessionInfo> getSessions(int callingUid) {
    ParceledListSlice<PackageInstaller.SessionInfo> getSessions(int callingUid) {
        final List<PackageInstaller.SessionInfo> result = new ArrayList<>();
        final List<PackageInstaller.SessionInfo> result = new ArrayList<>();
        synchronized (mStagedSessions) {
        synchronized (mStagedSessions) {