Merge "SDK -> SDK_PACKAGE to address API feedback."

This commit is contained in:
Alex Buynytskyy
2022-01-30 01:26:08 +00:00
committed by Android (Google) Code Review
6 changed files with 22 additions and 12 deletions

View File

@@ -12225,7 +12225,7 @@ package android.content.pm {
field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.SharedLibraryInfo> CREATOR;
field public static final int TYPE_BUILTIN = 0; // 0x0
field public static final int TYPE_DYNAMIC = 1; // 0x1
field public static final int TYPE_SDK = 3; // 0x3
field public static final int TYPE_SDK_PACKAGE = 3; // 0x3
field public static final int TYPE_STATIC = 2; // 0x2
field public static final int VERSION_UNDEFINED = -1; // 0xffffffff
}

View File

@@ -746,6 +746,10 @@ public final class LoadedApk {
// default linker namespace.
continue;
}
if (info.isSdk()) {
// SDKs are not loaded automatically.
continue;
}
if (libsToLoadAfter.contains(info.getName())) {
if (DEBUG) {
Slog.v(ActivityThread.TAG,

View File

@@ -46,7 +46,7 @@ public final class SharedLibraryInfo implements Parcelable {
TYPE_BUILTIN,
TYPE_DYNAMIC,
TYPE_STATIC,
TYPE_SDK,
TYPE_SDK_PACKAGE,
})
@Retention(RetentionPolicy.SOURCE)
@interface Type{}
@@ -68,15 +68,21 @@ public final class SharedLibraryInfo implements Parcelable {
* Shared library type: this library is <strong>not</strong> backwards
* -compatible, can be updated and updates can be uninstalled. Clients
* link against a specific version of the library.
*
* Static shared libraries simulate static linking while allowing for
* multiple clients to reuse the same instance of the library.
*/
public static final int TYPE_STATIC = 2;
/**
* SDK library type: this library is <strong>not</strong> backwards
* -compatible, can be updated and updates can be uninstalled. Clients
* depend on a specific version of the library.
* SDK package shared library type: this library is <strong>not</strong>
* compatible between versions, can be updated and updates can be
* uninstalled. Clients depend on a specific version of the library.
*
* SDK packages are not loaded automatically by the OS and rely
* e.g. on 3P libraries to make them available for the clients.
*/
public static final int TYPE_SDK = 3;
public static final int TYPE_SDK_PACKAGE = 3;
/**
* Constant for referring to an undefined version.
@@ -301,7 +307,7 @@ public final class SharedLibraryInfo implements Parcelable {
* @hide
*/
public boolean isSdk() {
return mType == TYPE_SDK;
return mType == TYPE_SDK_PACKAGE;
}
/**
@@ -367,7 +373,7 @@ public final class SharedLibraryInfo implements Parcelable {
case TYPE_STATIC: {
return "static";
}
case TYPE_SDK: {
case TYPE_SDK_PACKAGE: {
return "sdk";
}
default: {

View File

@@ -922,7 +922,7 @@ class PackageManagerShellCommand extends ShellCommand {
final List<SharedLibraryInfo> libs = libsSlice.getList();
for (int l = 0, lsize = libs.size(); l < lsize; ++l) {
SharedLibraryInfo lib = libs.get(l);
if (lib.getType() == SharedLibraryInfo.TYPE_SDK) {
if (lib.getType() == SharedLibraryInfo.TYPE_SDK_PACKAGE) {
name = lib.getName() + ":" + lib.getLongVersion();
break;
}

View File

@@ -92,7 +92,7 @@ public class AndroidPackageUtils {
AndroidPackageUtils.getAllCodePaths(pkg),
pkg.getSdkLibName(),
pkg.getSdkLibVersionMajor(),
SharedLibraryInfo.TYPE_SDK,
SharedLibraryInfo.TYPE_SDK_PACKAGE,
new VersionedPackage(pkg.getManifestPackageName(),
pkg.getLongVersionCode()),
null, null, false /* isNative */);

View File

@@ -17,7 +17,7 @@
package com.android.server.pm;
import static android.content.pm.SharedLibraryInfo.TYPE_DYNAMIC;
import static android.content.pm.SharedLibraryInfo.TYPE_SDK;
import static android.content.pm.SharedLibraryInfo.TYPE_SDK_PACKAGE;
import static android.content.pm.SharedLibraryInfo.TYPE_STATIC;
import static android.content.pm.SharedLibraryInfo.VERSION_UNDEFINED;
@@ -258,7 +258,7 @@ public class ScanTests {
assertThat(scanResult.mSdkSharedLibraryInfo.getPackageName(), is("ogl.sdk_123"));
assertThat(scanResult.mSdkSharedLibraryInfo.getName(), is("ogl.sdk"));
assertThat(scanResult.mSdkSharedLibraryInfo.getLongVersion(), is(123L));
assertThat(scanResult.mSdkSharedLibraryInfo.getType(), is(TYPE_SDK));
assertThat(scanResult.mSdkSharedLibraryInfo.getType(), is(TYPE_SDK_PACKAGE));
assertThat(scanResult.mSdkSharedLibraryInfo.getDeclaringPackage().getPackageName(),
is("ogl.sdk_123"));
assertThat(scanResult.mSdkSharedLibraryInfo.getDeclaringPackage().getLongVersionCode(),