Merge "rename callingPackageResourceId to resourceIdInCallingPackage" into tm-dev

This commit is contained in:
Kholoud Mohamed
2022-02-24 16:18:09 +00:00
committed by Android (Google) Code Review
4 changed files with 43 additions and 43 deletions

View File

@@ -1059,10 +1059,10 @@ package android.app.admin {
ctor public DevicePolicyDrawableResource(@NonNull android.content.Context, @NonNull String, @NonNull String, @NonNull String, @DrawableRes int);
ctor public DevicePolicyDrawableResource(@NonNull android.content.Context, @NonNull String, @NonNull String, @DrawableRes int);
method public int describeContents();
method @DrawableRes public int getCallingPackageResourceId();
method @NonNull public String getDrawableId();
method @NonNull public String getDrawableSource();
method @NonNull public String getDrawableStyle();
method @DrawableRes public int getResourceIdInCallingPackage();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.DevicePolicyDrawableResource> CREATOR;
}
@@ -1239,7 +1239,7 @@ package android.app.admin {
public final class DevicePolicyStringResource implements android.os.Parcelable {
ctor public DevicePolicyStringResource(@NonNull android.content.Context, @NonNull String, @StringRes int);
method public int describeContents();
method public int getCallingPackageResourceId();
method public int getResourceIdInCallingPackage();
method @NonNull public String getStringId();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.DevicePolicyStringResource> CREATOR;

View File

@@ -38,7 +38,7 @@ public final class DevicePolicyDrawableResource implements Parcelable {
@NonNull private final @DevicePolicyResources.UpdatableDrawableId String mDrawableId;
@NonNull private final @DevicePolicyResources.UpdatableDrawableStyle String mDrawableStyle;
@NonNull private final @DevicePolicyResources.UpdatableDrawableSource String mDrawableSource;
private final @DrawableRes int mCallingPackageResourceId;
private final @DrawableRes int mResourceIdInCallingPackage;
@NonNull private ParcelableResource mResource;
/**
@@ -47,25 +47,25 @@ public final class DevicePolicyDrawableResource implements Parcelable {
*
* <p>It will be used to update the drawable defined by {@code drawableId} with style
* {@code drawableStyle} located in source {@code drawableSource} to the drawable with ID
* {@code callingPackageResourceId} in the calling package</p>
* {@code resourceIdInCallingPackage} in the calling package</p>
*
* @param drawableId The ID of the drawable to update.
* @param drawableStyle The style of the drawable to update.
* @param drawableSource The source of the drawable to update.
* @param callingPackageResourceId The ID of the drawable resource in the calling package to
* @param resourceIdInCallingPackage The ID of the drawable resource in the calling package to
* use as an updated resource.
*
* @throws IllegalStateException if the resource with ID
* {@code callingPackageResourceId} doesn't exist in the {@code context} package.
* {@code resourceIdInCallingPackage} doesn't exist in the {@code context} package.
*/
public DevicePolicyDrawableResource(
@NonNull Context context,
@NonNull @DevicePolicyResources.UpdatableDrawableId String drawableId,
@NonNull @DevicePolicyResources.UpdatableDrawableStyle String drawableStyle,
@NonNull @DevicePolicyResources.UpdatableDrawableSource String drawableSource,
@DrawableRes int callingPackageResourceId) {
this(drawableId, drawableStyle, drawableSource, callingPackageResourceId,
new ParcelableResource(context, callingPackageResourceId,
@DrawableRes int resourceIdInCallingPackage) {
this(drawableId, drawableStyle, drawableSource, resourceIdInCallingPackage,
new ParcelableResource(context, resourceIdInCallingPackage,
ParcelableResource.RESOURCE_TYPE_DRAWABLE));
}
@@ -73,7 +73,7 @@ public final class DevicePolicyDrawableResource implements Parcelable {
@NonNull @DevicePolicyResources.UpdatableDrawableId String drawableId,
@NonNull @DevicePolicyResources.UpdatableDrawableStyle String drawableStyle,
@NonNull @DevicePolicyResources.UpdatableDrawableSource String drawableSource,
@DrawableRes int callingPackageResourceId,
@DrawableRes int resourceIdInCallingPackage,
@NonNull ParcelableResource resource) {
Objects.requireNonNull(drawableId);
@@ -84,7 +84,7 @@ public final class DevicePolicyDrawableResource implements Parcelable {
this.mDrawableId = drawableId;
this.mDrawableStyle = drawableStyle;
this.mDrawableSource = drawableSource;
this.mCallingPackageResourceId = callingPackageResourceId;
this.mResourceIdInCallingPackage = resourceIdInCallingPackage;
this.mResource = resource;
}
@@ -92,24 +92,24 @@ public final class DevicePolicyDrawableResource implements Parcelable {
* Creates an object containing the required information for updating an enterprise drawable
* resource using {@link DevicePolicyManager#setDrawables}.
* <p>It will be used to update the drawable defined by {@code drawableId} with style
* {@code drawableStyle} to the drawable with ID {@code callingPackageResourceId} in the
* {@code drawableStyle} to the drawable with ID {@code resourceIdInCallingPackage} in the
* calling package</p>
*
* @param drawableId The ID of the drawable to update.
* @param drawableStyle The style of the drawable to update.
* @param callingPackageResourceId The ID of the drawable resource in the calling package to
* @param resourceIdInCallingPackage The ID of the drawable resource in the calling package to
* use as an updated resource.
*
* @throws IllegalStateException if the resource with ID
* {@code callingPackageResourceId} doesn't exist in the calling package.
* {@code resourceIdInCallingPackage} doesn't exist in the calling package.
*/
public DevicePolicyDrawableResource(
@NonNull Context context,
@NonNull @DevicePolicyResources.UpdatableDrawableId String drawableId,
@NonNull @DevicePolicyResources.UpdatableDrawableStyle String drawableStyle,
@DrawableRes int callingPackageResourceId) {
@DrawableRes int resourceIdInCallingPackage) {
this(context, drawableId, drawableStyle, Drawables.Source.UNDEFINED,
callingPackageResourceId);
resourceIdInCallingPackage);
}
/**
@@ -144,8 +144,8 @@ public final class DevicePolicyDrawableResource implements Parcelable {
* resource.
*/
@DrawableRes
public int getCallingPackageResourceId() {
return mCallingPackageResourceId;
public int getResourceIdInCallingPackage() {
return mResourceIdInCallingPackage;
}
/**
@@ -166,14 +166,14 @@ public final class DevicePolicyDrawableResource implements Parcelable {
return mDrawableId.equals(other.mDrawableId)
&& mDrawableStyle.equals(other.mDrawableStyle)
&& mDrawableSource.equals(other.mDrawableSource)
&& mCallingPackageResourceId == other.mCallingPackageResourceId
&& mResourceIdInCallingPackage == other.mResourceIdInCallingPackage
&& mResource.equals(other.mResource);
}
@Override
public int hashCode() {
return Objects.hash(
mDrawableId, mDrawableStyle, mDrawableSource, mCallingPackageResourceId, mResource);
return Objects.hash(mDrawableId, mDrawableStyle, mDrawableSource,
mResourceIdInCallingPackage, mResource);
}
@Override
@@ -186,7 +186,7 @@ public final class DevicePolicyDrawableResource implements Parcelable {
dest.writeString(mDrawableId);
dest.writeString(mDrawableStyle);
dest.writeString(mDrawableSource);
dest.writeInt(mCallingPackageResourceId);
dest.writeInt(mResourceIdInCallingPackage);
dest.writeTypedObject(mResource, flags);
}
@@ -197,11 +197,11 @@ public final class DevicePolicyDrawableResource implements Parcelable {
String drawableId = in.readString();
String drawableStyle = in.readString();
String drawableSource = in.readString();
int callingPackageResourceId = in.readInt();
int resourceIdInCallingPackage = in.readInt();
ParcelableResource resource = in.readTypedObject(ParcelableResource.CREATOR);
return new DevicePolicyDrawableResource(
drawableId, drawableStyle, drawableSource, callingPackageResourceId,
drawableId, drawableStyle, drawableSource, resourceIdInCallingPackage,
resource);
}

View File

@@ -15134,7 +15134,7 @@ public class DevicePolicyManager {
* the combination of {@link DevicePolicyDrawableResource#getDrawableId()} and
* {@link DevicePolicyDrawableResource#getDrawableStyle()}, (see
* {@link DevicePolicyResources.Drawables} and {@link DevicePolicyResources.Drawables.Style}) to
* the drawable with ID {@link DevicePolicyDrawableResource#getCallingPackageResourceId()},
* the drawable with ID {@link DevicePolicyDrawableResource#getResourceIdInCallingPackage()},
* meaning any system UI surface calling {@link #getDrawable}
* with {@code drawableId} and {@code drawableStyle} will get the new resource after this API
* is called.
@@ -15149,12 +15149,12 @@ public class DevicePolicyManager {
* <p>Important notes to consider when using this API:
* <ul>
* <li>{@link #getDrawable} references the resource
* {@link DevicePolicyDrawableResource#getCallingPackageResourceId()} in the
* {@link DevicePolicyDrawableResource#getResourceIdInCallingPackage()} in the
* calling package each time it gets called. You have to ensure that the resource is always
* available in the calling package as long as it is used as an updated resource.
* <li>You still have to re-call {@code setDrawables} even if you only make changes to the
* content of the resource with ID
* {@link DevicePolicyDrawableResource#getCallingPackageResourceId()} as the content might be
* {@link DevicePolicyDrawableResource#getResourceIdInCallingPackage()} as the content might be
* cached and would need updating.
* </ul>
*

View File

@@ -35,7 +35,7 @@ import java.util.Objects;
@SystemApi
public final class DevicePolicyStringResource implements Parcelable {
@NonNull private final @DevicePolicyResources.UpdatableStringId String mStringId;
private final @StringRes int mCallingPackageResourceId;
private final @StringRes int mResourceIdInCallingPackage;
@NonNull private ParcelableResource mResource;
/**
@@ -43,32 +43,32 @@ public final class DevicePolicyStringResource implements Parcelable {
* resource using {@link DevicePolicyManager#setStrings}.
*
* <p>It will be used to update the string defined by {@code stringId} to the string with ID
* {@code callingPackageResourceId} in the calling package</p>
* {@code resourceIdInCallingPackage} in the calling package</p>
*
* @param stringId The ID of the string to update.
* @param callingPackageResourceId The ID of the {@link StringRes} in the calling package to
* @param resourceIdInCallingPackage The ID of the {@link StringRes} in the calling package to
* use as an updated resource.
*
* @throws IllegalStateException if the resource with ID {@code callingPackageResourceId}
* @throws IllegalStateException if the resource with ID {@code resourceIdInCallingPackage}
* doesn't exist in the {@code context} package.
*/
public DevicePolicyStringResource(
@NonNull Context context,
@NonNull @DevicePolicyResources.UpdatableStringId String stringId,
@StringRes int callingPackageResourceId) {
this(stringId, callingPackageResourceId, new ParcelableResource(
context, callingPackageResourceId, ParcelableResource.RESOURCE_TYPE_STRING));
@StringRes int resourceIdInCallingPackage) {
this(stringId, resourceIdInCallingPackage, new ParcelableResource(
context, resourceIdInCallingPackage, ParcelableResource.RESOURCE_TYPE_STRING));
}
private DevicePolicyStringResource(
@NonNull @DevicePolicyResources.UpdatableStringId String stringId,
@StringRes int callingPackageResourceId,
@StringRes int resourceIdInCallingPackage,
@NonNull ParcelableResource resource) {
Objects.requireNonNull(stringId, "stringId must be provided.");
Objects.requireNonNull(resource, "ParcelableResource must be provided.");
this.mStringId = stringId;
this.mCallingPackageResourceId = callingPackageResourceId;
this.mResourceIdInCallingPackage = resourceIdInCallingPackage;
this.mResource = resource;
}
@@ -85,8 +85,8 @@ public final class DevicePolicyStringResource implements Parcelable {
* Returns the ID of the {@link StringRes} in the calling package to use as an updated
* resource.
*/
public int getCallingPackageResourceId() {
return mCallingPackageResourceId;
public int getResourceIdInCallingPackage() {
return mResourceIdInCallingPackage;
}
/**
@@ -105,13 +105,13 @@ public final class DevicePolicyStringResource implements Parcelable {
if (o == null || getClass() != o.getClass()) return false;
DevicePolicyStringResource other = (DevicePolicyStringResource) o;
return mStringId == other.mStringId
&& mCallingPackageResourceId == other.mCallingPackageResourceId
&& mResourceIdInCallingPackage == other.mResourceIdInCallingPackage
&& mResource.equals(other.mResource);
}
@Override
public int hashCode() {
return Objects.hash(mStringId, mCallingPackageResourceId, mResource);
return Objects.hash(mStringId, mResourceIdInCallingPackage, mResource);
}
@Override
@@ -122,7 +122,7 @@ public final class DevicePolicyStringResource implements Parcelable {
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(mStringId);
dest.writeInt(mCallingPackageResourceId);
dest.writeInt(mResourceIdInCallingPackage);
dest.writeTypedObject(mResource, flags);
}
@@ -131,10 +131,10 @@ public final class DevicePolicyStringResource implements Parcelable {
@Override
public DevicePolicyStringResource createFromParcel(Parcel in) {
String stringId = in.readString();
int callingPackageResourceId = in.readInt();
int resourceIdInCallingPackage = in.readInt();
ParcelableResource resource = in.readTypedObject(ParcelableResource.CREATOR);
return new DevicePolicyStringResource(stringId, callingPackageResourceId, resource);
return new DevicePolicyStringResource(stringId, resourceIdInCallingPackage, resource);
}
@Override