Merge "Address API council comments" into oc-dev

am: 57ed0ba69d

Change-Id: I28253a456f288da02506367a2b9039cffb1d0a25
This commit is contained in:
Svetoslav Ganov
2017-04-19 02:56:39 +00:00
committed by android-build-merger
8 changed files with 78 additions and 39 deletions

View File

@@ -10940,12 +10940,13 @@ package android.content.pm {
method public android.content.pm.VersionedPackage getDeclaringPackage();
method public java.util.List<android.content.pm.VersionedPackage> getDependentPackages();
method public java.lang.String getName();
method public int getVersion();
method public boolean isBuiltin();
method public boolean isDynamic();
method public boolean isStatic();
method public int getType();
method public long getVersion();
method public void writeToParcel(android.os.Parcel, int);
field 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_STATIC = 2; // 0x2
field public static final int VERSION_UNDEFINED = -1; // 0xffffffff
}

View File

@@ -63,6 +63,12 @@ package android.content.pm {
field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1
}
public final class SharedLibraryInfo implements android.os.Parcelable {
method public boolean isBuiltin();
method public boolean isDynamic();
method public boolean isStatic();
}
}
package android.database {

View File

@@ -11700,12 +11700,13 @@ package android.content.pm {
method public android.content.pm.VersionedPackage getDeclaringPackage();
method public java.util.List<android.content.pm.VersionedPackage> getDependentPackages();
method public java.lang.String getName();
method public int getVersion();
method public boolean isBuiltin();
method public boolean isDynamic();
method public boolean isStatic();
method public int getType();
method public long getVersion();
method public void writeToParcel(android.os.Parcel, int);
field 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_STATIC = 2; // 0x2
field public static final int VERSION_UNDEFINED = -1; // 0xffffffff
}

View File

@@ -61,6 +61,12 @@ package android.content.pm {
field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1
}
public final class SharedLibraryInfo implements android.os.Parcelable {
method public boolean isBuiltin();
method public boolean isDynamic();
method public boolean isStatic();
}
}
package android.database {

View File

@@ -10981,12 +10981,13 @@ package android.content.pm {
method public android.content.pm.VersionedPackage getDeclaringPackage();
method public java.util.List<android.content.pm.VersionedPackage> getDependentPackages();
method public java.lang.String getName();
method public int getVersion();
method public boolean isBuiltin();
method public boolean isDynamic();
method public boolean isStatic();
method public int getType();
method public long getVersion();
method public void writeToParcel(android.os.Parcel, int);
field 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_STATIC = 2; // 0x2
field public static final int VERSION_UNDEFINED = -1; // 0xffffffff
}

View File

@@ -63,6 +63,12 @@ package android.content.pm {
field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1
}
public final class SharedLibraryInfo implements android.os.Parcelable {
method public boolean isBuiltin();
method public boolean isDynamic();
method public boolean isStatic();
}
}
package android.database {

View File

@@ -16,11 +16,14 @@
package android.content.pm;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
import java.util.List;
@@ -31,28 +34,37 @@ import java.util.List;
* static - updatable non backwards-compatible emulating static linking.
*/
public final class SharedLibraryInfo implements Parcelable {
/** @hide */
@IntDef(
flag = true,
value = {
TYPE_BUILTIN,
TYPE_DYNAMIC,
TYPE_STATIC,
})
@Retention(RetentionPolicy.SOURCE)
@interface Type{}
/**
* Shared library type: this library is a part of the OS
* and cannot be updated or uninstalled.
* @hide
*/
public static final int TYPE_BUILTIN = 0x1<<0;
public static final int TYPE_BUILTIN = 0;
/**
* Shared library type: this library is backwards-compatible, can
* be updated, and updates can be uninstalled. Clients link against
* the latest version of the library.
* @hide
*/
public static final int TYPE_DYNAMIC = 0x1<<1;
public static final int TYPE_DYNAMIC = 1;
/**
* 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.
* @hide
*/
public static final int TYPE_STATIC = 0x1<<2;
public static final int TYPE_STATIC = 2;
/**
* Constant for referring to an undefined version.
@@ -60,8 +72,10 @@ public final class SharedLibraryInfo implements Parcelable {
public static final int VERSION_UNDEFINED = -1;
private final String mName;
// TODO: Make long when we change the paltform to use longs
private final int mVersion;
private final int mType;
private final @Type int mType;
private final VersionedPackage mDeclaringPackage;
private final List<VersionedPackage> mDependentPackages;
@@ -90,13 +104,18 @@ public final class SharedLibraryInfo implements Parcelable {
parcel.readParcelable(null), parcel.readArrayList(null));
}
/** @hide */
public int getType() {
/**
* Gets the type of this library.
*
* @return The library type.
*/
public @Type int getType() {
return mType;
}
/**
* Gets the library name.
* Gets the library name an app defines in its manifest
* to depend on the library.
*
* @return The name.
*/
@@ -105,40 +124,36 @@ public final class SharedLibraryInfo implements Parcelable {
}
/**
* Gets the version of the library. For {@link #isStatic()} static} libraries
* this is the declared version and for {@link #isDynamic()} dynamic} and
* {@link #isBuiltin()} builtin} it is {@link #VERSION_UNDEFINED} as these
* Gets the version of the library. For {@link #TYPE_STATIC static} libraries
* this is the declared version and for {@link #TYPE_DYNAMIC dynamic} and
* {@link #TYPE_BUILTIN builtin} it is {@link #VERSION_UNDEFINED} as these
* are not versioned.
*
* @return The version.
*/
public @IntRange(from = -1) int getVersion() {
public @IntRange(from = -1) long getVersion() {
return mVersion;
}
/**
* @return whether this library is builtin which means that it
* is a part of the OS and cannot be updated or uninstalled.
* @hide
* @removed
*/
public boolean isBuiltin() {
return mType == TYPE_BUILTIN;
}
/**
* @return whether this library is dynamic which means that it
* is backwards-compatible, can be updated, and updates can be
* uninstalled. Clients link against the latest version of the
* library.
* @hide
* @removed
*/
public boolean isDynamic() {
return mType == TYPE_DYNAMIC;
}
/**
* @return whether this library is dynamic which means that it
* is <strong>not</strong> backwards-compatible, can be updated
* and updates can be uninstalled. Clients link against a specific
* version of the library.
* @hide
* @removed
*/
public boolean isStatic() {
return mType == TYPE_STATIC;

View File

@@ -4218,8 +4218,10 @@ public class PackageManagerService extends IPackageManager.Stub
}
SharedLibraryInfo resLibInfo = new SharedLibraryInfo(libInfo.getName(),
libInfo.getVersion(), libInfo.getType(), libInfo.getDeclaringPackage(),
getPackagesUsingSharedLibraryLPr(libInfo, flags, userId));
// TODO: Remove cast for lib version once internally we support longs.
(int) libInfo.getVersion(), libInfo.getType(),
libInfo.getDeclaringPackage(), getPackagesUsingSharedLibraryLPr(libInfo,
flags, userId));
if (result == null) {
result = new ArrayList<>();
@@ -17593,7 +17595,8 @@ public class PackageManagerService extends IPackageManager.Stub
for (int i = 0; i < versionCount; i++) {
SharedLibraryEntry libEntry = versionedLib.valueAt(i);
if (versionsCallerCanSee != null && versionsCallerCanSee.indexOfKey(
libEntry.info.getVersion()) < 0) {
// TODO: Remove cast for lib version once internally we support longs.
(int) libEntry.info.getVersion()) < 0) {
continue;
}
// TODO: We will change version code to long, so in the new API it is long