In BitmapFactory.decodeStream method :
public static Bitmap decodeStream(InputStream is, Rect outPadding, Options opts) {
// we don't throw in this case, thus allowing the caller to only check
// the cache, and not force the image to be decoded.
if (is == null) {
return null;
}
Bitmap bm = null;
Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "decodeBitmap");
try {
if (is instanceof AssetManager.AssetInputStream) {
final int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
bm = nativeDecodeAsset(asset, outPadding, opts);
} else {
bm = decodeStreamInternal(is, outPadding, opts);
}
if (bm == null && opts != null && opts.inBitmap != null) {
throw new IllegalArgumentException("Problem decoding into existing bitmap");
}
setDensityFromOptions(bm, opts);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_GRAPHICS); // THAT IS COLLISION LINE
}
return bm;
}
we see a usage Trace.TRACE_TAG_GRAPHICS
. Ok, let's look at Trace.java :
public final class Trace {
/*
* Writes trace events to the kernel trace buffer. These trace events can be
* collected using the "atrace" program for offline analysis.
*/
private static final String TAG = "Trace";
// These tags must be kept in sync with system/core/include/cutils/trace.h.
/** @hide */
public static final long TRACE_TAG_NEVER = 0;
/** @hide */
public static final long TRACE_TAG_ALWAYS = 1L << 0;
/** @hide */
public static final long TRACE_TAG_GRAPHICS = 1L << 1;
...
And when i try to use Trace.TRACE_TAG_GRAPHICS
flag compiler give me error that this tag not responsible for me. I agree with him.
But the question - Why BitmapFactory have access to @hide
variables and why me not?