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

Commit ec23c083 authored by Jooyung Han's avatar Jooyung Han
Browse files

Add stagedApexInfos to ApexStagedEvent

Previously, the event struct had the list of staged APEX names. This
leads to calling getStagedApexInfo(name), which in turn calls
getStagedApexInfos(session).

Note that StagingManager gets the list of APEX names by calling
getStagedApexInfos(session). Hence, the same method gets called
repeatedly.

getStagedApexInfos(session) is quite heavy because it involes mounting
APEXes in the session and running an external program.

Passing stagedApexInfos in ApexStagedEvent and providing
getStagedApexInfos() make apexd & observers happy. (no need to run the
same operation over and over.)

Bug: 370712193
Test: StagingManagerTest
Test: StagedInstallInternalTest
Change-Id: I8d6a0baf6caff453f22d87a694a9eae91361a490
parent 4811398e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.content.pm;

import android.content.pm.StagedApexInfo;

/**
 * This event is designed for notification to native code listener about
 * any changes to set of apex packages staged for installation on next boot.
@@ -23,5 +25,5 @@ package android.content.pm;
 * @hide
 */
parcelable ApexStagedEvent {
  @utf8InCpp String[] stagedApexModuleNames;
  StagedApexInfo[] stagedApexInfos;
}
+2 −8
Original line number Diff line number Diff line
@@ -135,13 +135,7 @@ interface IPackageManagerNative {
    void unregisterStagedApexObserver(in IStagedApexObserver observer);

    /**
     * Get APEX module names of all APEX that are staged ready for installation
     * Get information of staged APEXes.
     */
    @utf8InCpp String[] getStagedApexModuleNames();

    /**
     * Get information of APEX which is staged ready for installation.
     * Returns null if no such APEX is found.
     */
    @nullable StagedApexInfo getStagedApexInfo(in @utf8InCpp String moduleName);
    StagedApexInfo[] getStagedApexInfos();
}
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ package android.content.pm;
 *
 * @hide
 */
@JavaDerive(equals=true)
parcelable StagedApexInfo {
  @utf8InCpp String moduleName;
  @utf8InCpp String diskImagePath;