Merge "Introduce PreapprovalDetails class (1/n)"
This commit is contained in:
committed by
Android (Google) Code Review
commit
1df179f411
@@ -11613,6 +11613,25 @@ package android.content.pm {
|
||||
field public static final int STATUS_SUCCESS = 0; // 0x0
|
||||
}
|
||||
|
||||
public static final class PackageInstaller.PreapprovalDetails implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method @Nullable public android.graphics.Bitmap getIcon();
|
||||
method @NonNull public String getLabel();
|
||||
method @NonNull public android.icu.util.ULocale getLocale();
|
||||
method @NonNull public String getPackageName();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PackageInstaller.PreapprovalDetails> CREATOR;
|
||||
}
|
||||
|
||||
public static final class PackageInstaller.PreapprovalDetails.Builder {
|
||||
ctor public PackageInstaller.PreapprovalDetails.Builder();
|
||||
method @NonNull public android.content.pm.PackageInstaller.PreapprovalDetails build();
|
||||
method @NonNull public android.content.pm.PackageInstaller.PreapprovalDetails.Builder setIcon(@NonNull android.graphics.Bitmap);
|
||||
method @NonNull public android.content.pm.PackageInstaller.PreapprovalDetails.Builder setLabel(@NonNull String);
|
||||
method @NonNull public android.content.pm.PackageInstaller.PreapprovalDetails.Builder setLocale(@NonNull android.icu.util.ULocale);
|
||||
method @NonNull public android.content.pm.PackageInstaller.PreapprovalDetails.Builder setPackageName(@NonNull String);
|
||||
}
|
||||
|
||||
public static class PackageInstaller.Session implements java.io.Closeable {
|
||||
method public void abandon();
|
||||
method public void addChildSessionId(int);
|
||||
|
||||
@@ -18,3 +18,4 @@ package android.content.pm;
|
||||
|
||||
parcelable PackageInstaller.SessionParams;
|
||||
parcelable PackageInstaller.SessionInfo;
|
||||
parcelable PackageInstaller.PreapprovalDetails;
|
||||
|
||||
@@ -47,6 +47,7 @@ import android.content.pm.PackageManager.DeleteFlags;
|
||||
import android.content.pm.PackageManager.InstallReason;
|
||||
import android.content.pm.PackageManager.InstallScenario;
|
||||
import android.graphics.Bitmap;
|
||||
import android.icu.util.ULocale;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.FileBridge;
|
||||
@@ -65,6 +66,7 @@ import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.ExceptionUtils;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.internal.util.function.pooled.PooledLambda;
|
||||
@@ -3275,4 +3277,280 @@ public class PackageInstaller {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Details for requesting the pre-commit install approval.
|
||||
*/
|
||||
@DataClass(genParcelable = true, genHiddenConstructor = true, genBuilder = true,
|
||||
genToString = true)
|
||||
public static final class PreapprovalDetails implements Parcelable {
|
||||
/**
|
||||
* The icon representing the app to be installed.
|
||||
*/
|
||||
private final @Nullable Bitmap mIcon;
|
||||
/**
|
||||
* The label representing the app to be installed.
|
||||
*/
|
||||
private final @NonNull String mLabel;
|
||||
/**
|
||||
* The locale of the app label being used.
|
||||
*/
|
||||
private final @NonNull ULocale mLocale;
|
||||
/**
|
||||
* The package name of the app to be installed.
|
||||
*/
|
||||
private final @NonNull String mPackageName;
|
||||
|
||||
|
||||
|
||||
|
||||
// Code below generated by codegen v1.0.23.
|
||||
//
|
||||
// DO NOT MODIFY!
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
//
|
||||
// To regenerate run:
|
||||
// $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/PackageInstaller.java
|
||||
//
|
||||
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
|
||||
// Settings > Editor > Code Style > Formatter Control
|
||||
//@formatter:off
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new PreapprovalDetails.
|
||||
*
|
||||
* @param icon
|
||||
* The icon representing the app to be installed.
|
||||
* @param label
|
||||
* The label representing the app to be installed.
|
||||
* @param locale
|
||||
* The locale of the app label being used.
|
||||
* @param packageName
|
||||
* The package name of the app to be installed.
|
||||
* @hide
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public PreapprovalDetails(
|
||||
@Nullable Bitmap icon,
|
||||
@NonNull String label,
|
||||
@NonNull ULocale locale,
|
||||
@NonNull String packageName) {
|
||||
this.mIcon = icon;
|
||||
this.mLabel = label;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mLabel);
|
||||
this.mLocale = locale;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mLocale);
|
||||
this.mPackageName = packageName;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mPackageName);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
/**
|
||||
* The icon representing the app to be installed.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @Nullable Bitmap getIcon() {
|
||||
return mIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* The label representing the app to be installed.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull String getLabel() {
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* The locale of the app label being used.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull ULocale getLocale() {
|
||||
return mLocale;
|
||||
}
|
||||
|
||||
/**
|
||||
* The package name of the app to be installed.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull String getPackageName() {
|
||||
return mPackageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public String toString() {
|
||||
// You can override field toString logic by defining methods like:
|
||||
// String fieldNameToString() { ... }
|
||||
|
||||
return "PreapprovalDetails { " +
|
||||
"icon = " + mIcon + ", " +
|
||||
"label = " + mLabel + ", " +
|
||||
"locale = " + mLocale + ", " +
|
||||
"packageName = " + mPackageName +
|
||||
" }";
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
// You can override field parcelling by defining methods like:
|
||||
// void parcelFieldName(Parcel dest, int flags) { ... }
|
||||
|
||||
byte flg = 0;
|
||||
if (mIcon != null) flg |= 0x1;
|
||||
dest.writeByte(flg);
|
||||
if (mIcon != null) mIcon.writeToParcel(dest, flags);
|
||||
dest.writeString8(mLabel);
|
||||
dest.writeString8(mLocale.toString());
|
||||
dest.writeString8(mPackageName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public int describeContents() { return 0; }
|
||||
|
||||
/** @hide */
|
||||
@SuppressWarnings({"unchecked", "RedundantCast"})
|
||||
@DataClass.Generated.Member
|
||||
/* package-private */ PreapprovalDetails(@NonNull Parcel in) {
|
||||
// You can override field unparcelling by defining methods like:
|
||||
// static FieldType unparcelFieldName(Parcel in) { ... }
|
||||
|
||||
byte flg = in.readByte();
|
||||
Bitmap icon = (flg & 0x1) == 0 ? null : Bitmap.CREATOR.createFromParcel(in);
|
||||
String label = in.readString8();
|
||||
ULocale locale = new ULocale(in.readString8());
|
||||
String packageName = in.readString8();
|
||||
|
||||
this.mIcon = icon;
|
||||
this.mLabel = label;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mLabel);
|
||||
this.mLocale = locale;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mLocale);
|
||||
this.mPackageName = packageName;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mPackageName);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public static final @NonNull Parcelable.Creator<PreapprovalDetails> CREATOR
|
||||
= new Parcelable.Creator<PreapprovalDetails>() {
|
||||
@Override
|
||||
public PreapprovalDetails[] newArray(int size) {
|
||||
return new PreapprovalDetails[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreapprovalDetails createFromParcel(@NonNull Parcel in) {
|
||||
return new PreapprovalDetails(in);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A builder for {@link PreapprovalDetails}
|
||||
*/
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
@DataClass.Generated.Member
|
||||
public static final class Builder {
|
||||
|
||||
private @Nullable Bitmap mIcon;
|
||||
private @NonNull String mLabel;
|
||||
private @NonNull ULocale mLocale;
|
||||
private @NonNull String mPackageName;
|
||||
|
||||
private long mBuilderFieldsSet = 0L;
|
||||
|
||||
/**
|
||||
* Creates a new Builder.
|
||||
*/
|
||||
public Builder() {}
|
||||
|
||||
/**
|
||||
* The icon representing the app to be installed.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull Builder setIcon(@NonNull Bitmap value) {
|
||||
checkNotUsed();
|
||||
mBuilderFieldsSet |= 0x1;
|
||||
mIcon = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The label representing the app to be installed.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull Builder setLabel(@NonNull String value) {
|
||||
checkNotUsed();
|
||||
mBuilderFieldsSet |= 0x2;
|
||||
mLabel = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The locale of the app label being used.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull Builder setLocale(@NonNull ULocale value) {
|
||||
checkNotUsed();
|
||||
mBuilderFieldsSet |= 0x4;
|
||||
mLocale = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The package name of the app to be installed.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull Builder setPackageName(@NonNull String value) {
|
||||
checkNotUsed();
|
||||
mBuilderFieldsSet |= 0x8;
|
||||
mPackageName = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Builds the instance. This builder should not be touched after calling this! */
|
||||
public @NonNull PreapprovalDetails build() {
|
||||
checkNotUsed();
|
||||
mBuilderFieldsSet |= 0x10; // Mark builder used
|
||||
|
||||
PreapprovalDetails o = new PreapprovalDetails(
|
||||
mIcon,
|
||||
mLabel,
|
||||
mLocale,
|
||||
mPackageName);
|
||||
return o;
|
||||
}
|
||||
|
||||
private void checkNotUsed() {
|
||||
if ((mBuilderFieldsSet & 0x10) != 0) {
|
||||
throw new IllegalStateException(
|
||||
"This Builder should not be reused. Use a new Builder instance instead");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1664257135109L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/content/pm/PackageInstaller.java",
|
||||
inputSignatures = "private final @android.annotation.Nullable android.graphics.Bitmap mIcon\nprivate final @android.annotation.NonNull java.lang.String mLabel\nprivate final @android.annotation.NonNull android.icu.util.ULocale mLocale\nprivate final @android.annotation.NonNull java.lang.String mPackageName\nclass PreapprovalDetails extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genHiddenConstructor=true, genBuilder=true, genToString=true)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
//@formatter:on
|
||||
// End of generated code
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user