Merge "Remove old private constant from ResourceId."

This commit is contained in:
Aurimas Liutikas
2019-01-18 16:53:46 +00:00
committed by Android (Google) Code Review
11 changed files with 22 additions and 27 deletions

View File

@@ -25,6 +25,7 @@ import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ResourceId;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -465,7 +466,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
* @param context the parent context
*/
public Builder(Context context) {
this(context, resolveDialogTheme(context, ResourceId.ID_NULL));
this(context, resolveDialogTheme(context, Resources.ID_NULL));
}
/**

View File

@@ -31,7 +31,7 @@ import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.content.res.ResourceId;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
@@ -183,7 +183,7 @@ public class Dialog implements DialogInterface, Window.Callback,
Dialog(@NonNull Context context, @StyleRes int themeResId, boolean createContextThemeWrapper) {
if (createContextThemeWrapper) {
if (themeResId == ResourceId.ID_NULL) {
if (themeResId == Resources.ID_NULL) {
final TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.dialogTheme, outValue, true);
themeResId = outValue.resourceId;

View File

@@ -49,7 +49,7 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
* only access while in the foreground.
*
* From the "requestDetail" attribute or, if not set, {@link
* android.content.res.ResourceId#ID_NULL}.
* android.content.res.Resources#ID_NULL}.
*
* @hide
*/
@@ -61,7 +61,7 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
* access. Also used when requesting both foreground and background access.
*
* From the "backgroundRequest" attribute or, if not set, {@link
* android.content.res.ResourceId#ID_NULL}.
* android.content.res.Resources#ID_NULL}.
*
* @hide
*/
@@ -73,7 +73,7 @@ public class PermissionGroupInfo extends PackageItemInfo implements Parcelable {
* background access.
*
* From the "backgroundRequestDetail" attribute or, if not set, {@link
* android.content.res.ResourceId#ID_NULL}.
* android.content.res.Resources#ID_NULL}.
*
* @hide
*/

View File

@@ -16,7 +16,7 @@
package android.content.pm;
import static android.content.res.ResourceId.ID_NULL;
import static android.content.res.Resources.ID_NULL;
import android.annotation.DrawableRes;
import android.annotation.NonNull;

View File

@@ -22,12 +22,6 @@ import android.annotation.AnyRes;
* @hide
*/
public final class ResourceId {
/**
* The {@code null} resource ID.
*/
public static final @AnyRes int ID_NULL = 0;
/**
* Checks whether the integer {@code id} is a valid resource ID, as generated by AAPT.
* <p>Note that a negative integer is not necessarily an invalid resource ID, and custom

View File

@@ -174,7 +174,7 @@ public class Resources {
/** @hide */
public static int selectSystemTheme(int curTheme, int targetSdkVersion, int orig, int holo,
int dark, int deviceDefault) {
if (curTheme != ResourceId.ID_NULL) {
if (curTheme != ID_NULL) {
return curTheme;
}
if (targetSdkVersion < Build.VERSION_CODES.HONEYCOMB) {

View File

@@ -20,7 +20,7 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.content.res.ResourceId;
import android.content.res.Resources;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@@ -57,16 +57,16 @@ public @interface InspectableProperty {
* If left as {ID_NULL}, and {@link #hasAttributeId()} is true, the attribute ID will be
* inferred from {@link #name()}.
*
* @return The attribute ID of the property or {@link ResourceId#ID_NULL}
* @return The attribute ID of the property or {@link Resources#ID_NULL}
*/
int attributeId() default ResourceId.ID_NULL;
int attributeId() default Resources.ID_NULL;
/**
* If this property has an attribute ID.
*
* Set to false if the annotated property does not have an attribute ID, that is, it is not
* inflated from an XML attribute. This will prevent the automatic inference of the attribute
* ID if {@link #attributeId()} is set to {@link ResourceId#ID_NULL}.
* ID if {@link #attributeId()} is set to {@link Resources#ID_NULL}.
*
* @return Whether to infer an attribute ID if not supplied
*/

View File

@@ -48,7 +48,6 @@ import android.content.UndoManager;
import android.content.res.ColorStateList;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.content.res.ResourceId;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
@@ -889,7 +888,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
// sanitize autofill requests.
private boolean mTextSetFromXmlOrResourceId = false;
// Resource id used to set the text.
private @StringRes int mTextId = ResourceId.ID_NULL;
private @StringRes int mTextId = Resources.ID_NULL;
//
// End of autofill-related attributes
@@ -1180,7 +1179,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
case com.android.internal.R.styleable.TextView_text:
textIsSetFromXml = true;
mTextId = a.getResourceId(attr, ResourceId.ID_NULL);
mTextId = a.getResourceId(attr, Resources.ID_NULL);
text = a.getText(attr);
break;
@@ -11031,7 +11030,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (viewFor == VIEW_STRUCTURE_FOR_AUTOFILL) {
structure.setDataIsSensitive(!mTextSetFromXmlOrResourceId);
}
if (mTextId != ResourceId.ID_NULL) {
if (mTextId != Resources.ID_NULL) {
try {
structure.setTextIdEntry(getResources().getResourceEntryName(mTextId));
} catch (Resources.NotFoundException e) {

View File

@@ -16,7 +16,7 @@
package com.android.internal.app;
import static android.content.res.ResourceId.ID_NULL;
import static android.content.res.Resources.ID_NULL;
import android.Manifest;
import android.app.AlertDialog;

View File

@@ -65,6 +65,8 @@ import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpe
import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation;
import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation;
import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation;
import static com.android.server.wm.AppTransitionProto.APP_TRANSITION_STATE;
import static com.android.server.wm.AppTransitionProto.LAST_USED_APP_TRANSITION;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -73,8 +75,6 @@ import static com.android.server.wm.WindowManagerInternal.AppTransitionListener;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE;
import static com.android.server.wm.AppTransitionProto.APP_TRANSITION_STATE;
import static com.android.server.wm.AppTransitionProto.LAST_USED_APP_TRANSITION;
import android.annotation.DrawableRes;
import android.annotation.NonNull;
@@ -84,6 +84,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.ResourceId;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -547,7 +548,7 @@ public class AppTransition implements Dump {
}
Animation loadAnimationAttr(LayoutParams lp, int animAttr, int transit) {
int resId = ResourceId.ID_NULL;
int resId = Resources.ID_NULL;
Context context = mContext;
if (animAttr >= 0) {
AttributeCache.Entry ent = getCachedAnimations(lp);

View File

@@ -93,7 +93,7 @@ public final class InspectionCompanionGenerator {
/**
* The null resource ID.
*
* @see android.content.res.ResourceId#ID_NULL
* @see android.content.res.Resources#ID_NULL
*/
private static final int NO_ID = 0;