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

Commit 0630831a authored by Winson Chiu's avatar Winson Chiu
Browse files

Rename PackageState getUsesLibraries to getSharedLibraryDependencies

This better communicates what the method returns and prevents it from
being confused with the <uses-library> manifest tag, which is only
one of the 5 types of libraries returned by this method.

Also fixes a null vs empty check calling this method.

API-Coverage-Bug: 262593427

Bug: 265006762

Change-Id: Ia7ab400cfdb4dd9a9ff66cb9c102a21e3f2b95cb
parent 08c808e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -180,8 +180,8 @@ package com.android.server.pm.pkg {
    method @Nullable public String getPrimaryCpuAbi();
    method @Nullable public String getSeInfo();
    method @Nullable public String getSecondaryCpuAbi();
    method @NonNull public java.util.List<com.android.server.pm.pkg.SharedLibrary> getSharedLibraryDependencies();
    method @NonNull public com.android.server.pm.pkg.PackageUserState getStateForUser(@NonNull android.os.UserHandle);
    method @NonNull public java.util.List<com.android.server.pm.pkg.SharedLibrary> getUsesLibraries();
    method public boolean isApex();
    method public boolean isPrivileged();
    method public boolean isSystem();
+2 −1
Original line number Diff line number Diff line
@@ -388,7 +388,8 @@ final class InstallPackageHelper {
        }

        if (reconciledPkg.mCollectedSharedLibraryInfos != null
                || (oldPkgSetting != null && oldPkgSetting.getUsesLibraries() != null)) {
                || (oldPkgSetting != null
                && !oldPkgSetting.getSharedLibraryDependencies().isEmpty())) {
            // Reconcile if the new package or the old package uses shared libraries.
            // It is possible that the old package uses shared libraries but the new one doesn't.
            mSharedLibraries.executeSharedLibrariesUpdate(pkg, pkgSetting, null, null,
+1 −1
Original line number Diff line number Diff line
@@ -1219,7 +1219,7 @@ public class PackageSetting extends SettingBase implements PackageStateInternal

    @NonNull
    @Override
    public List<SharedLibrary> getUsesLibraries() {
    public List<SharedLibrary> getSharedLibraryDependencies() {
        return (List<SharedLibrary>) (List<?>) pkgState.getUsesLibraryInfos();
    }

+3 −2
Original line number Diff line number Diff line
@@ -158,10 +158,11 @@ public interface PackageState {
    PackageUserState getStateForUser(@NonNull UserHandle user);

    /**
     * @see R.styleable#AndroidManifestUsesLibrary
     * List of shared libraries that this package declares a dependency on. This includes all
     * types of libraries, system or app provided and Java or native.
     */
    @NonNull
    List<SharedLibrary> getUsesLibraries();
    List<SharedLibrary> getSharedLibraryDependencies();

    /** Whether this represents an APEX module. This is different from an APK inside an APEX. */
    boolean isApex();
+2 −2
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ public class PackageStateImpl implements PackageState {
        mUsesSdkLibrariesVersionsMajor = pkgState.getUsesSdkLibrariesVersionsMajor();
        mUsesStaticLibraries = pkgState.getUsesStaticLibraries();
        mUsesStaticLibrariesVersions = pkgState.getUsesStaticLibrariesVersions();
        mUsesLibraries = Collections.unmodifiableList(pkgState.getUsesLibraries());
        mUsesLibraries = Collections.unmodifiableList(pkgState.getSharedLibraryDependencies());
        mUsesLibraryFiles = Collections.unmodifiableList(pkgState.getUsesLibraryFiles());
        setBoolean(Booleans.FORCE_QUERYABLE_OVERRIDE, pkgState.isForceQueryableOverride());
        setBoolean(Booleans.HIDDEN_UNTIL_INSTALLED, pkgState.isHiddenUntilInstalled());
@@ -693,7 +693,7 @@ public class PackageStateImpl implements PackageState {
    }

    @DataClass.Generated.Member
    public @NonNull List<SharedLibrary> getUsesLibraries() {
    public @NonNull List<SharedLibrary> getSharedLibraryDependencies() {
        return mUsesLibraries;
    }