code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 833
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public static ScriptIntrinsicHistogram create(RenderScript rs, Element e) {
if ((!e.isCompatible(Element.U8_4(rs))) &&
(!e.isCompatible(Element.U8_3(rs))) &&
(!e.isCompatible(Element.U8_2(rs))) &&
(!e.isCompatible(Element.U8(rs)))) {
throw new RSIllegalArgumentException("Unsupported element type.");
}
long id;
boolean mUseIncSupp = rs.isUseNative() &&
android.os.Build.VERSION.SDK_INT < INTRINSIC_API_LEVEL;
id = rs.nScriptIntrinsicCreate(9, e.getID(rs), mUseIncSupp);
ScriptIntrinsicHistogram si = new ScriptIntrinsicHistogram(id, rs);
si.setIncSupp(mUseIncSupp);
return si;
} |
Create an intrinsic for calculating the histogram of an uchar
or uchar4 image.
Supported elements types are
{@link Element#U8_4}, {@link Element#U8_3},
{@link Element#U8_2}, {@link Element#U8}
@param rs The RenderScript context
@param e Element type for inputs
@return ScriptIntrinsicHistogram
| ScriptIntrinsicHistogram::create | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void forEach(Allocation ain) {
forEach(ain, null);
} |
Process an input buffer and place the histogram into the
output allocation. The output allocation may be a narrower
vector size than the input. In this case the vector size of
the output is used to determine how many of the input
channels are used in the computation. This is useful if you
have an RGBA input buffer but only want the histogram for
RGB.
1D and 2D input allocations are supported.
@param ain The input image
| ScriptIntrinsicHistogram::forEach | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void forEach(Allocation ain, Script.LaunchOptions opt) {
if (ain.getType().getElement().getVectorSize() <
mOut.getType().getElement().getVectorSize()) {
throw new RSIllegalArgumentException(
"Input vector size must be >= output vector size.");
}
if (!ain.getType().getElement().isCompatible(Element.U8(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_2(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_3(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_4(mRS))) {
throw new RSIllegalArgumentException("Input type must be U8, U8_1, U8_2 or U8_4.");
}
forEach(0, ain, null, null, opt);
} |
Process an input buffer and place the histogram into the
output allocation. The output allocation may be a narrower
vector size than the input. In this case the vector size of
the output is used to determine how many of the input
channels are used in the computation. This is useful if you
have an RGBA input buffer but only want the histogram for
RGB.
1D and 2D input allocations are supported.
@param ain The input image
@param opt LaunchOptions for clipping
| ScriptIntrinsicHistogram::forEach | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void setDotCoefficients(float r, float g, float b, float a) {
if ((r < 0.f) || (g < 0.f) || (b < 0.f) || (a < 0.f)) {
throw new RSIllegalArgumentException("Coefficient may not be negative.");
}
if ((r + g + b + a) > 1.f) {
throw new RSIllegalArgumentException("Sum of coefficients must be 1.0 or less.");
}
FieldPacker fp = new FieldPacker(16);
fp.addF32(r);
fp.addF32(g);
fp.addF32(b);
fp.addF32(a);
setVar(0, fp);
} |
Set the coefficients used for the RGBA to Luminocity
calculation. The default is {0.299f, 0.587f, 0.114f, 0.f}.
Coefficients must be >= 0 and sum to 1.0 or less.
@param r Red coefficient
@param g Green coefficient
@param b Blue coefficient
@param a Alpha coefficient
| ScriptIntrinsicHistogram::setDotCoefficients | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void setOutput(Allocation aout) {
mOut = aout;
if (mOut.getType().getElement() != Element.U32(mRS) &&
mOut.getType().getElement() != Element.U32_2(mRS) &&
mOut.getType().getElement() != Element.U32_3(mRS) &&
mOut.getType().getElement() != Element.U32_4(mRS) &&
mOut.getType().getElement() != Element.I32(mRS) &&
mOut.getType().getElement() != Element.I32_2(mRS) &&
mOut.getType().getElement() != Element.I32_3(mRS) &&
mOut.getType().getElement() != Element.I32_4(mRS)) {
throw new RSIllegalArgumentException("Output type must be U32 or I32.");
}
if ((mOut.getType().getX() != 256) ||
(mOut.getType().getY() != 0) ||
mOut.getType().hasMipmaps() ||
(mOut.getType().getYuv() != 0)) {
throw new RSIllegalArgumentException("Output must be 1D, 256 elements.");
}
setVar(1, aout);
} |
Set the output of the histogram. 32 bit integer types are
supported.
@param aout The output allocation
| ScriptIntrinsicHistogram::setOutput | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void forEach_Dot(Allocation ain) {
forEach_Dot(ain, null);
} |
Process an input buffer and place the histogram into the
output allocation. The dot product of the input channel and
the coefficients from 'setDotCoefficients' are used to
calculate the output values.
1D and 2D input allocations are supported.
@param ain The input image
| ScriptIntrinsicHistogram::forEach_Dot | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void forEach_Dot(Allocation ain, Script.LaunchOptions opt) {
if (mOut.getType().getElement().getVectorSize() != 1) {
throw new RSIllegalArgumentException("Output vector size must be one.");
}
if (!ain.getType().getElement().isCompatible(Element.U8(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_2(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_3(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_4(mRS))) {
throw new RSIllegalArgumentException("Input type must be U8, U8_1, U8_2 or U8_4.");
}
forEach(1, ain, null, null, opt);
} |
Process an input buffer and place the histogram into the
output allocation. The dot product of the input channel and
the coefficients from 'setDotCoefficients' are used to
calculate the output values.
1D and 2D input allocations are supported.
@param ain The input image
@param opt LaunchOptions for clipping
| ScriptIntrinsicHistogram::forEach_Dot | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public Script.KernelID getKernelID_Separate() {
return createKernelID(0, 3, null, null);
} |
Get a KernelID for this intrinsic kernel.
@return Script.KernelID The KernelID object.
| ScriptIntrinsicHistogram::getKernelID_Separate | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public Script.FieldID getFieldID_Input() {
return createFieldID(1, null);
} |
Get a FieldID for the input field of this intrinsic.
@return Script.FieldID The FieldID object.
| ScriptIntrinsicHistogram::getFieldID_Input | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
boolean hasForegroundServices() {
return mHasForegroundServices;
} |
@return true if this process has any foreground services (even timed-out short-FGS)
| ProcessServiceRecord::hasForegroundServices | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
private int getForegroundServiceTypes() {
return mHasForegroundServices ? mFgServiceTypes : 0;
} |
Returns the FGS typps, but it doesn't tell if the types include "NONE" or not, so
do not use it outside of this class.
| ProcessServiceRecord::getForegroundServiceTypes | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
boolean containsAnyForegroundServiceTypes(@ServiceInfo.ForegroundServiceType int types) {
return (getForegroundServiceTypes() & types) != 0;
} |
@return true if the fgs types includes any of the given types.
(wouldn't work for TYPE_NONE, which is 0)
| ProcessServiceRecord::containsAnyForegroundServiceTypes | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
boolean hasNonShortForegroundServices() {
if (!mHasForegroundServices) {
return false; // Process has no FGS running.
}
// Does the process has any FGS of TYPE_NONE?
if (mHasTypeNoneFgs) {
return true;
}
// If not, we can just check mFgServiceTypes.
return mFgServiceTypes != ServiceInfo.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE;
} |
@return true if the process has any FGS that are _not_ a "short" FGS.
| ProcessServiceRecord::hasNonShortForegroundServices | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
boolean areAllShortForegroundServicesProcstateTimedOut(long nowUptime) {
if (!mHasForegroundServices) { // Process has no FGS?
return false;
}
if (hasNonShortForegroundServices()) { // Any non-short FGS running?
return false;
}
// Now we need to look at all short-FGS within the process and see if all of them are
// procstate-timed-out or not.
for (int i = mServices.size() - 1; i >= 0; i--) {
final ServiceRecord sr = mServices.valueAt(i);
if (!sr.isShortFgs() || !sr.hasShortFgsInfo()) {
continue;
}
if (sr.getShortFgsInfo().getProcStateDemoteTime() >= nowUptime) {
return false;
}
}
return true;
} |
@return if this process:
- has at least one short-FGS
- has no other types of FGS
- and all the short-FGSes are procstate-timed out.
| ProcessServiceRecord::areAllShortForegroundServicesProcstateTimedOut | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
void abort(int id) {
mActiveSyncs.get(id).finishNow();
} |
Aborts the sync (ie. it doesn't wait for ready or anything to finish)
| SyncGroup::abort | java | Reginer/aosp-android-jar | android-32/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
public ZipFile(String name) throws IOException {
this(new File(name), OPEN_READ);
} |
Opens a zip file for reading.
<p>First, if there is a security manager, its <code>checkRead</code>
method is called with the <code>name</code> argument as its argument
to ensure the read is allowed.
<p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
decode the entry names and comments.
@param name the name of the zip file
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws SecurityException if a security manager exists and its
<code>checkRead</code> method doesn't allow read access to the file.
@see SecurityManager#checkRead(java.lang.String)
| ZipFile::ZipFile | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public ZipFile(File file, int mode) throws IOException {
this(file, mode, StandardCharsets.UTF_8);
} |
Opens a new <code>ZipFile</code> to read from the specified
<code>File</code> object in the specified mode. The mode argument
must be either <tt>OPEN_READ</tt> or <tt>OPEN_READ | OPEN_DELETE</tt>.
<p>First, if there is a security manager, its <code>checkRead</code>
method is called with the <code>name</code> argument as its argument to
ensure the read is allowed.
<p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
decode the entry names and comments
@param file the ZIP file to be opened for reading
@param mode the mode in which the file is to be opened
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws SecurityException if a security manager exists and
its <code>checkRead</code> method
doesn't allow read access to the file,
or its <code>checkDelete</code> method doesn't allow deleting
the file when the <tt>OPEN_DELETE</tt> flag is set.
@throws IllegalArgumentException if the <tt>mode</tt> argument is invalid
@see SecurityManager#checkRead(java.lang.String)
@since 1.3
| ZipFile::ZipFile | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public ZipFile(File file) throws ZipException, IOException {
this(file, OPEN_READ);
} |
Opens a ZIP file for reading given the specified File object.
<p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
decode the entry names and comments.
@param file the ZIP file to be opened for reading
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
| ZipFile::ZipFile | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public ZipFile(File file, Charset charset) throws IOException
{
this(file, OPEN_READ, charset);
} |
Opens a ZIP file for reading given the specified File object.
@param file the ZIP file to be opened for reading
@param charset
The {@linkplain java.nio.charset.Charset charset} to be
used to decode the ZIP entry name and comment (ignored if
the <a href="package-summary.html#lang_encoding"> language
encoding bit</a> of the ZIP entry's general purpose bit
flag is set).
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@since 1.7
| ZipFile::ZipFile | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public String getComment() {
synchronized (this) {
ensureOpen();
byte[] bcomm = getCommentBytes(jzfile);
if (bcomm == null)
return null;
return zc.toString(bcomm, bcomm.length);
}
} |
Returns the zip file comment, or null if none.
@return the comment string for the zip file, or null if none
@throws IllegalStateException if the zip file has been closed
Since 1.7
| ZipFile::getComment | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public ZipEntry getEntry(String name) {
if (name == null) {
throw new NullPointerException("name");
}
long jzentry = 0;
synchronized (this) {
ensureOpen();
jzentry = getEntry(jzfile, zc.getBytes(name), true);
if (jzentry != 0) {
ZipEntry ze = getZipEntry(name, jzentry);
freeEntry(jzfile, jzentry);
return ze;
}
}
return null;
} |
Returns the zip file entry for the specified name, or null
if not found.
@param name the name of the entry
@return the zip file entry, or null if not found
@throws IllegalStateException if the zip file has been closed
| ZipFile::getEntry | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");
}
long jzentry = 0;
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
if (!zc.isUTF8() && (entry.flag & USE_UTF8) != 0) {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// Needed for ClassPathURLStreamHandler handling of URLs without trailing slashes.
// This was added as part of the work to move StrictJarFile from libcore to
// framework, see http://b/111293098 for more details.
// It should be possible to revert this after upgrading to OpenJDK 8u144 or above.
// jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), true);
} else {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// jzentry = getEntry(jzfile, zc.getBytes(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytes(entry.name), true);
}
if (jzentry == 0) {
return null;
}
in = new ZipFileInputStream(jzentry);
switch (getEntryMethod(jzentry)) {
case STORED:
synchronized (streams) {
streams.put(in, null);
}
return in;
case DEFLATED:
// MORE: Compute good size for inflater stream:
long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
// Android-changed: Use 64k buffer size, performs better than 8k.
// See http://b/65491407.
// if (size > 65536) size = 8192;
if (size > 65536) size = 65536;
if (size <= 0) size = 4096;
Inflater inf = getInflater();
InputStream is =
new ZipFileInflaterInputStream(in, inf, (int)size);
synchronized (streams) {
streams.put(is, inf);
}
return is;
default:
throw new ZipException("invalid compression method");
}
}
} |
Returns an input stream for reading the contents of the specified
zip file entry.
<p> Closing this ZIP file will, in turn, close all input
streams that have been returned by invocations of this method.
@param entry the zip file entry
@return the input stream for reading the contents of the specified
zip file entry.
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws IllegalStateException if the zip file has been closed
| ZipFile::getInputStream | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
private Inflater getInflater() {
Inflater inf;
synchronized (inflaterCache) {
while (null != (inf = inflaterCache.poll())) {
if (false == inf.ended()) {
return inf;
}
}
}
return new Inflater(true);
} |
Returns an input stream for reading the contents of the specified
zip file entry.
<p> Closing this ZIP file will, in turn, close all input
streams that have been returned by invocations of this method.
@param entry the zip file entry
@return the input stream for reading the contents of the specified
zip file entry.
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws IllegalStateException if the zip file has been closed
public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");
}
long jzentry = 0;
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
if (!zc.isUTF8() && (entry.flag & USE_UTF8) != 0) {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// Needed for ClassPathURLStreamHandler handling of URLs without trailing slashes.
// This was added as part of the work to move StrictJarFile from libcore to
// framework, see http://b/111293098 for more details.
// It should be possible to revert this after upgrading to OpenJDK 8u144 or above.
// jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), true);
} else {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// jzentry = getEntry(jzfile, zc.getBytes(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytes(entry.name), true);
}
if (jzentry == 0) {
return null;
}
in = new ZipFileInputStream(jzentry);
switch (getEntryMethod(jzentry)) {
case STORED:
synchronized (streams) {
streams.put(in, null);
}
return in;
case DEFLATED:
// MORE: Compute good size for inflater stream:
long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
// Android-changed: Use 64k buffer size, performs better than 8k.
// See http://b/65491407.
// if (size > 65536) size = 8192;
if (size > 65536) size = 65536;
if (size <= 0) size = 4096;
Inflater inf = getInflater();
InputStream is =
new ZipFileInflaterInputStream(in, inf, (int)size);
synchronized (streams) {
streams.put(is, inf);
}
return is;
default:
throw new ZipException("invalid compression method");
}
}
}
private class ZipFileInflaterInputStream extends InflaterInputStream {
private volatile boolean closeRequested = false;
private boolean eof = false;
private final ZipFileInputStream zfin;
ZipFileInflaterInputStream(ZipFileInputStream zfin, Inflater inf,
int size) {
super(zfin, inf, size);
this.zfin = zfin;
}
public void close() throws IOException {
if (closeRequested)
return;
closeRequested = true;
super.close();
Inflater inf;
synchronized (streams) {
inf = streams.remove(this);
}
if (inf != null) {
releaseInflater(inf);
}
}
// Override fill() method to provide an extra "dummy" byte
// at the end of the input stream. This is required when
// using the "nowrap" Inflater option.
protected void fill() throws IOException {
if (eof) {
throw new EOFException("Unexpected end of ZLIB input stream");
}
len = in.read(buf, 0, buf.length);
if (len == -1) {
buf[0] = 0;
len = 1;
eof = true;
}
inf.setInput(buf, 0, len);
}
public int available() throws IOException {
if (closeRequested)
return 0;
long avail = zfin.size() - inf.getBytesWritten();
return (avail > (long) Integer.MAX_VALUE ?
Integer.MAX_VALUE : (int) avail);
}
protected void finalize() throws Throwable {
close();
}
}
/*
Gets an inflater from the list of available inflaters or allocates
a new one.
| ZipFileInflaterInputStream::getInflater | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
private void releaseInflater(Inflater inf) {
if (false == inf.ended()) {
inf.reset();
synchronized (inflaterCache) {
inflaterCache.add(inf);
}
}
} |
Returns an input stream for reading the contents of the specified
zip file entry.
<p> Closing this ZIP file will, in turn, close all input
streams that have been returned by invocations of this method.
@param entry the zip file entry
@return the input stream for reading the contents of the specified
zip file entry.
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws IllegalStateException if the zip file has been closed
public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");
}
long jzentry = 0;
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
if (!zc.isUTF8() && (entry.flag & USE_UTF8) != 0) {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// Needed for ClassPathURLStreamHandler handling of URLs without trailing slashes.
// This was added as part of the work to move StrictJarFile from libcore to
// framework, see http://b/111293098 for more details.
// It should be possible to revert this after upgrading to OpenJDK 8u144 or above.
// jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), true);
} else {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// jzentry = getEntry(jzfile, zc.getBytes(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytes(entry.name), true);
}
if (jzentry == 0) {
return null;
}
in = new ZipFileInputStream(jzentry);
switch (getEntryMethod(jzentry)) {
case STORED:
synchronized (streams) {
streams.put(in, null);
}
return in;
case DEFLATED:
// MORE: Compute good size for inflater stream:
long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
// Android-changed: Use 64k buffer size, performs better than 8k.
// See http://b/65491407.
// if (size > 65536) size = 8192;
if (size > 65536) size = 65536;
if (size <= 0) size = 4096;
Inflater inf = getInflater();
InputStream is =
new ZipFileInflaterInputStream(in, inf, (int)size);
synchronized (streams) {
streams.put(is, inf);
}
return is;
default:
throw new ZipException("invalid compression method");
}
}
}
private class ZipFileInflaterInputStream extends InflaterInputStream {
private volatile boolean closeRequested = false;
private boolean eof = false;
private final ZipFileInputStream zfin;
ZipFileInflaterInputStream(ZipFileInputStream zfin, Inflater inf,
int size) {
super(zfin, inf, size);
this.zfin = zfin;
}
public void close() throws IOException {
if (closeRequested)
return;
closeRequested = true;
super.close();
Inflater inf;
synchronized (streams) {
inf = streams.remove(this);
}
if (inf != null) {
releaseInflater(inf);
}
}
// Override fill() method to provide an extra "dummy" byte
// at the end of the input stream. This is required when
// using the "nowrap" Inflater option.
protected void fill() throws IOException {
if (eof) {
throw new EOFException("Unexpected end of ZLIB input stream");
}
len = in.read(buf, 0, buf.length);
if (len == -1) {
buf[0] = 0;
len = 1;
eof = true;
}
inf.setInput(buf, 0, len);
}
public int available() throws IOException {
if (closeRequested)
return 0;
long avail = zfin.size() - inf.getBytesWritten();
return (avail > (long) Integer.MAX_VALUE ?
Integer.MAX_VALUE : (int) avail);
}
protected void finalize() throws Throwable {
close();
}
}
/*
Gets an inflater from the list of available inflaters or allocates
a new one.
private Inflater getInflater() {
Inflater inf;
synchronized (inflaterCache) {
while (null != (inf = inflaterCache.poll())) {
if (false == inf.ended()) {
return inf;
}
}
}
return new Inflater(true);
}
/*
Releases the specified inflater to the list of available inflaters.
| ZipFileInflaterInputStream::releaseInflater | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public String getName() {
return name;
} |
Returns the path name of the ZIP file.
@return the path name of the ZIP file
| ZipFileInflaterInputStream::getName | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public Enumeration<? extends ZipEntry> entries() {
return new ZipEntryIterator();
} |
Returns an enumeration of the ZIP file entries.
@return an enumeration of the ZIP file entries
@throws IllegalStateException if the zip file has been closed
| ZipEntryIterator::entries | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public Stream<? extends ZipEntry> stream() {
return StreamSupport.stream(Spliterators.spliterator(
new ZipEntryIterator(), size(),
Spliterator.ORDERED | Spliterator.DISTINCT |
Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
} |
Return an ordered {@code Stream} over the ZIP file entries.
Entries appear in the {@code Stream} in the order they appear in
the central directory of the ZIP file.
@return an ordered {@code Stream} of entries in this ZIP file
@throws IllegalStateException if the zip file has been closed
@since 1.8
| ZipEntryIterator::stream | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public int size() {
ensureOpen();
return total;
} |
Returns the number of entries in the ZIP file.
@return the number of entries in the ZIP file
@throws IllegalStateException if the zip file has been closed
| ZipEntryIterator::size | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public void close() throws IOException {
if (closeRequested)
return;
// Android-added: CloseGuard support.
if (guard != null) {
guard.close();
}
closeRequested = true;
synchronized (this) {
// Close streams, release their inflaters
// BEGIN Android-added: null field check to avoid NullPointerException during finalize.
// If the constructor threw an exception then the streams / inflaterCache fields can
// be null and close() can be called by the finalizer.
if (streams != null) {
// END Android-added: null field check to avoid NullPointerException during finalize.
synchronized (streams) {
if (false == streams.isEmpty()) {
Map<InputStream, Inflater> copy = new HashMap<>(streams);
streams.clear();
for (Map.Entry<InputStream, Inflater> e : copy.entrySet()) {
e.getKey().close();
Inflater inf = e.getValue();
if (inf != null) {
inf.end();
}
}
}
}
// BEGIN Android-added: null field check to avoid NullPointerException during finalize.
}
if (inflaterCache != null) {
// END Android-added: null field check to avoid NullPointerException during finalize.
// Release cached inflaters
Inflater inf;
synchronized (inflaterCache) {
while (null != (inf = inflaterCache.poll())) {
inf.end();
}
}
// BEGIN Android-added: null field check to avoid NullPointerException during finalize.
}
// END Android-added: null field check to avoid NullPointerException during finalize.
if (jzfile != 0) {
// Close the zip file
long zf = this.jzfile;
jzfile = 0;
close(zf);
}
// Android-added: Do not use unlink() to implement OPEN_DELETE.
if (fileToRemoveOnClose != null) {
fileToRemoveOnClose.delete();
}
}
} |
Closes the ZIP file.
<p> Closing this ZIP file will close all of the input streams
previously returned by invocations of the {@link #getInputStream
getInputStream} method.
@throws IOException if an I/O error has occurred
| ZipEntryIterator::close | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
protected void finalize() throws IOException {
// Android-added: CloseGuard support.
if (guard != null) {
guard.warnIfOpen();
}
close();
} |
Ensures that the system resources held by this ZipFile object are
released when there are no more references to it.
<p>
Since the time when GC would invoke this method is undetermined,
it is strongly recommended that applications invoke the <code>close</code>
method as soon they have finished accessing this <code>ZipFile</code>.
This will prevent holding up system resources for an undetermined
length of time.
@throws IOException if an I/O error has occurred
@see java.util.zip.ZipFile#close()
| ZipEntryIterator::finalize | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public Button(Context context) {
this(context, null);
} |
Simple constructor to use when creating a button from code.
@param context The Context the Button is running in, through which it can
access the current theme, resources, etc.
@see #Button(Context, AttributeSet)
| Button::Button | java | Reginer/aosp-android-jar | android-34/src/android/widget/Button.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/widget/Button.java | MIT |
public Button(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.buttonStyle);
} |
{@link LayoutInflater} calls this constructor when inflating a Button from XML.
The attributes defined by the current theme's
{@link android.R.attr#buttonStyle android:buttonStyle}
override base view attributes.
You typically do not call this constructor to create your own button instance in code.
However, you must override this constructor when
<a href="{@docRoot}training/custom-views/index.html">creating custom views</a>.
@param context The Context the view is running in, through which it can
access the current theme, resources, etc.
@param attrs The attributes of the XML Button tag being used to inflate the view.
@see #Button(Context, AttributeSet, int)
@see android.view.View#View(Context, AttributeSet)
| Button::Button | java | Reginer/aosp-android-jar | android-34/src/android/widget/Button.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/widget/Button.java | MIT |
public Button(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
} |
This constructor allows a Button subclass to use its own class-specific base style from a
theme attribute when inflating. The attributes defined by the current theme's
{@code defStyleAttr} override base view attributes.
<p>For Button's base view attributes see
{@link android.R.styleable#Button Button Attributes},
{@link android.R.styleable#TextView TextView Attributes},
{@link android.R.styleable#View View Attributes}.
@param context The Context the Button is running in, through which it can
access the current theme, resources, etc.
@param attrs The attributes of the XML Button tag that is inflating the view.
@param defStyleAttr The resource identifier of an attribute in the current theme
whose value is the the resource id of a style. The specified style’s
attribute values serve as default values for the button. Set this parameter
to 0 to avoid use of default values.
@see #Button(Context, AttributeSet, int, int)
@see android.view.View#View(Context, AttributeSet, int)
| Button::Button | java | Reginer/aosp-android-jar | android-34/src/android/widget/Button.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/widget/Button.java | MIT |
public Button(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
} |
This constructor allows a Button subclass to use its own class-specific base style from
either a theme attribute or style resource when inflating. To see how the final value of a
particular attribute is resolved based on your inputs to this constructor, see
{@link android.view.View#View(Context, AttributeSet, int, int)}.
@param context The Context the Button is running in, through which it can
access the current theme, resources, etc.
@param attrs The attributes of the XML Button tag that is inflating the view.
@param defStyleAttr The resource identifier of an attribute in the current theme
whose value is the the resource id of a style. The specified style’s
attribute values serve as default values for the button. Set this parameter
to 0 to avoid use of default values.
@param defStyleRes The identifier of a style resource that
supplies default values for the button, used only if
defStyleAttr is 0 or cannot be found in the theme.
Set this parameter to 0 to avoid use of default values.
@see #Button(Context, AttributeSet, int)
@see android.view.View#View(Context, AttributeSet, int, int)
| Button::Button | java | Reginer/aosp-android-jar | android-34/src/android/widget/Button.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/widget/Button.java | MIT |
static void enforcePermissionForPreflight(@NonNull Context context,
@NonNull Identity identity, @NonNull String permission) {
final int status = PermissionUtil.checkPermissionForPreflight(context, identity,
permission);
switch (status) {
case PermissionChecker.PERMISSION_GRANTED:
case PermissionChecker.PERMISSION_SOFT_DENIED:
return;
case PermissionChecker.PERMISSION_HARD_DENIED:
throw new SecurityException(
TextUtils.formatSimple("Failed to obtain permission %s for identity %s",
permission, toString(identity)));
default:
throw new RuntimeException("Unexpected permission check result.");
}
} |
Throws a {@link SecurityException} if originator permanently doesn't have the given
permission.
Soft (temporary) denials are considered OK for preflight purposes.
@param context A {@link Context}, used for permission checks.
@param identity The identity to check.
@param permission The identifier of the permission we want to check.
| SoundTriggerSessionPermissionsDecorator::enforcePermissionForPreflight | java | Reginer/aosp-android-jar | android-32/src/com/android/server/voiceinteraction/SoundTriggerSessionPermissionsDecorator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/voiceinteraction/SoundTriggerSessionPermissionsDecorator.java | MIT |
public X509V1CertImpl(byte[] certData)
throws CertificateException {
try {
ByteArrayInputStream bs;
bs = new ByteArrayInputStream(certData);
wrappedCert = (java.security.cert.X509Certificate)
getFactory().generateCertificate(bs);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
} |
Unmarshals a certificate from its encoded form, parsing the
encoded bytes. This form of constructor is used by agents which
need to examine and use certificate contents. That is, this is
one of the more commonly used constructors. Note that the buffer
must include only a certificate, and no "garbage" may be left at
the end. If you need to ignore data at the end of a certificate,
use another constructor.
@param certData the encoded bytes, with no trailing padding.
@exception CertificateException on parsing errors.
| X509V1CertImpl::X509V1CertImpl | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public X509V1CertImpl(InputStream in)
throws CertificateException {
try {
wrappedCert = (java.security.cert.X509Certificate)
getFactory().generateCertificate(in);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
} |
unmarshals an X.509 certificate from an input stream.
@param in an input stream holding at least one certificate
@exception CertificateException on parsing errors.
| X509V1CertImpl::X509V1CertImpl | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public byte[] getEncoded() throws CertificateEncodingException {
try {
return wrappedCert.getEncoded();
} catch (java.security.cert.CertificateEncodingException e) {
throw new CertificateEncodingException(e.getMessage());
}
} |
Returns the encoded form of this certificate. It is
assumed that each certificate type would have only a single
form of encoding; for example, X.509 certificates would
be encoded as ASN.1 DER.
| X509V1CertImpl::getEncoded | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public void verify(PublicKey key)
throws CertificateException, NoSuchAlgorithmException,
InvalidKeyException, NoSuchProviderException,
SignatureException
{
try {
wrappedCert.verify(key);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
} |
Throws an exception if the certificate was not signed using the
verification key provided. Successfully verifying a certificate
does <em>not</em> indicate that one should trust the entity which
it represents.
@param key the public key used for verification.
| X509V1CertImpl::verify | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public void verify(PublicKey key, String sigProvider)
throws CertificateException, NoSuchAlgorithmException,
InvalidKeyException, NoSuchProviderException,
SignatureException
{
try {
wrappedCert.verify(key, sigProvider);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
} |
Throws an exception if the certificate was not signed using the
verification key provided. Successfully verifying a certificate
does <em>not</em> indicate that one should trust the entity which
it represents.
@param key the public key used for verification.
@param sigProvider the name of the provider.
| X509V1CertImpl::verify | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public void checkValidity() throws
CertificateExpiredException, CertificateNotYetValidException {
checkValidity(new Date());
} |
Checks that the certificate is currently valid, i.e. the current
time is within the specified validity period.
| X509V1CertImpl::checkValidity | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public void checkValidity(Date date) throws
CertificateExpiredException, CertificateNotYetValidException {
try {
wrappedCert.checkValidity(date);
} catch (java.security.cert.CertificateNotYetValidException e) {
throw new CertificateNotYetValidException(e.getMessage());
} catch (java.security.cert.CertificateExpiredException e) {
throw new CertificateExpiredException(e.getMessage());
}
} |
Checks that the specified date is within the certificate's
validity period, or basically if the certificate would be
valid at the specified date/time.
@param date the Date to check against to see if this certificate
is valid at that date/time.
| X509V1CertImpl::checkValidity | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public String toString() {
return wrappedCert.toString();
} |
Returns a printable representation of the certificate. This does not
contain all the information available to distinguish this from any
other certificate. The certificate must be fully constructed
before this function may be called.
| X509V1CertImpl::toString | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public PublicKey getPublicKey() {
PublicKey key = wrappedCert.getPublicKey();
return key;
} |
Gets the publickey from this certificate.
@return the publickey.
| X509V1CertImpl::getPublicKey | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public int getVersion() {
return wrappedCert.getVersion() - 1;
} |
Gets the publickey from this certificate.
@return the publickey.
public PublicKey getPublicKey() {
PublicKey key = wrappedCert.getPublicKey();
return key;
}
/*
Gets the version number from the certificate.
@return the version number.
| X509V1CertImpl::getVersion | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public BigInteger getSerialNumber() {
return wrappedCert.getSerialNumber();
} |
Gets the serial number from the certificate.
@return the serial number.
| X509V1CertImpl::getSerialNumber | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public Principal getSubjectDN() {
return wrappedCert.getSubjectDN();
} |
Gets the subject distinguished name from the certificate.
@return the subject name.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getSubjectDN | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public Principal getIssuerDN() {
return wrappedCert.getIssuerDN();
} |
Gets the issuer distinguished name from the certificate.
@return the issuer name.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getIssuerDN | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public Date getNotBefore() {
return wrappedCert.getNotBefore();
} |
Gets the notBefore date from the validity period of the certificate.
@return the start date of the validity period.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getNotBefore | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public Date getNotAfter() {
return wrappedCert.getNotAfter();
} |
Gets the notAfter date from the validity period of the certificate.
@return the end date of the validity period.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getNotAfter | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public String getSigAlgName() {
return wrappedCert.getSigAlgName();
} |
Gets the signature algorithm name for the certificate
signature algorithm.
For example, the string "SHA1/DSA".
@return the signature algorithm name.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getSigAlgName | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public String getSigAlgOID() {
return wrappedCert.getSigAlgOID();
} |
Gets the signature algorithm OID string from the certificate.
For example, the string "1.2.840.10040.4.3"
@return the signature algorithm oid string.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getSigAlgOID | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public byte[] getSigAlgParams() {
return wrappedCert.getSigAlgParams();
} |
Gets the DER encoded signature algorithm parameters from this
certificate's signature algorithm.
@return the DER encoded signature algorithm parameters, or
null if no parameters are present.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getSigAlgParams | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public final void addUidToObserverImpl(@NonNull IBinder observerToken, int uid) {
int i = mUidObservers.beginBroadcast();
while (i-- > 0) {
var reg = (UidObserverRegistration) mUidObservers.getBroadcastCookie(i);
if (reg.getToken().equals(observerToken)) {
reg.addUid(uid);
break;
}
if (i == 0) {
Slog.e(TAG_UID_OBSERVERS, "Unable to find UidObserver by token");
}
}
mUidObservers.finishBroadcast();
} |
Add a uid to the list of uids an observer is interested in. Must be run on the same thread
as mDispatchRunnable.
@param observerToken The token identifier for a UidObserver
@param uid The uid to add to the list of watched uids
| UidObserverController::addUidToObserverImpl | java | Reginer/aosp-android-jar | android-35/src/com/android/server/am/UidObserverController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/am/UidObserverController.java | MIT |
public final void removeUidFromObserverImpl(@NonNull IBinder observerToken, int uid) {
int i = mUidObservers.beginBroadcast();
while (i-- > 0) {
var reg = (UidObserverRegistration) mUidObservers.getBroadcastCookie(i);
if (reg.getToken().equals(observerToken)) {
reg.removeUid(uid);
break;
}
if (i == 0) {
Slog.e(TAG_UID_OBSERVERS, "Unable to find UidObserver by token");
}
}
mUidObservers.finishBroadcast();
} |
Remove a uid from the list of uids an observer is interested in. Must be run on the same
thread as mDispatchRunnable.
@param observerToken The token identifier for a UidObserver
@param uid The uid to remove from the list of watched uids
| UidObserverController::removeUidFromObserverImpl | java | Reginer/aosp-android-jar | android-35/src/com/android/server/am/UidObserverController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/am/UidObserverController.java | MIT |
public Attributes() {
this(11);
} |
Constructs a new, empty Attributes object with default size.
| Attributes::Attributes | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Attributes(int size) {
map = new LinkedHashMap<>(size);
} |
Constructs a new, empty Attributes object with the specified
initial size.
@param size the initial number of attributes
| Attributes::Attributes | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Attributes(Attributes attr) {
map = new LinkedHashMap<>(attr);
} |
Constructs a new Attributes object with the same attribute name-value
mappings as in the specified Attributes.
@param attr the specified Attributes
| Attributes::Attributes | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Object get(Object name) {
return map.get(name);
} |
Returns the value of the specified attribute name, or null if the
attribute name was not found.
@param name the attribute name
@return the value of the specified attribute name, or null if
not found.
| Attributes::get | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public String getValue(String name) {
return (String)get(Name.of(name));
} |
Returns the value of the specified attribute name, specified as
a string, or null if the attribute was not found. The attribute
name is case-insensitive.
<p>
This method is defined as:
<pre>
return (String)get(new Attributes.Name((String)name));
</pre>
@param name the attribute name as a string
@return the String value of the specified attribute name, or null if
not found.
@throws IllegalArgumentException if the attribute name is invalid
| Attributes::getValue | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public String getValue(Name name) {
return (String)get(name);
} |
Returns the value of the specified Attributes.Name, or null if the
attribute was not found.
<p>
This method is defined as:
<pre>
return (String)get(name);
</pre>
@param name the Attributes.Name object
@return the String value of the specified Attribute.Name, or null if
not found.
| Attributes::getValue | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Object put(Object name, Object value) {
return map.put((Attributes.Name)name, (String)value);
} |
Associates the specified value with the specified attribute name
(key) in this Map. If the Map previously contained a mapping for
the attribute name, the old value is replaced.
@param name the attribute name
@param value the attribute value
@return the previous value of the attribute, or null if none
@throws ClassCastException if the name is not a Attributes.Name
or the value is not a String
| Attributes::put | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public String putValue(String name, String value) {
return (String)put(Name.of(name), value);
} |
Associates the specified value with the specified attribute name,
specified as a String. The attributes name is case-insensitive.
If the Map previously contained a mapping for the attribute name,
the old value is replaced.
<p>
This method is defined as:
<pre>
return (String)put(new Attributes.Name(name), value);
</pre>
@param name the attribute name as a string
@param value the attribute value
@return the previous value of the attribute, or null if none
@throws IllegalArgumentException if the attribute name is invalid
| Attributes::putValue | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Object remove(Object name) {
return map.remove(name);
} |
Removes the attribute with the specified name (key) from this Map.
Returns the previous attribute value, or null if none.
@param name attribute name
@return the previous value of the attribute, or null if none
| Attributes::remove | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public boolean containsValue(Object value) {
return map.containsValue(value);
} |
Returns true if this Map maps one or more attribute names (keys)
to the specified value.
@param value the attribute value
@return true if this Map maps one or more attribute names to
the specified value
| Attributes::containsValue | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public boolean containsKey(Object name) {
return map.containsKey(name);
} |
Returns true if this Map contains the specified attribute name (key).
@param name the attribute name
@return true if this Map contains the specified attribute name
| Attributes::containsKey | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public void putAll(Map<?,?> attr) {
// ## javac bug?
if (!Attributes.class.isInstance(attr))
throw new ClassCastException();
for (Map.Entry<?,?> me : (attr).entrySet())
put(me.getKey(), me.getValue());
} |
Copies all of the attribute name-value mappings from the specified
Attributes to this Map. Duplicate mappings will be replaced.
@param attr the Attributes to be stored in this map
@throws ClassCastException if attr is not an Attributes
| Attributes::putAll | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Name(String name) {
this.hashCode = hash(name);
this.name = name.intern();
} |
Constructs a new attribute name using the given string name.
@param name the attribute string name
@throws IllegalArgumentException if the attribute name was
invalid
@throws NullPointerException if the attribute name was null
| Name::Name | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public boolean equals(Object o) {
if (this == o) {
return true;
}
// TODO(b/248243024) revert this.
/*
return o instanceof Name other
&& other.name.equalsIgnoreCase(name);
*/
if (o instanceof Name) {
return ((Name) o).name.equalsIgnoreCase(name);
}
return false;
} |
Compares this attribute name to another for equality.
@param o the object to compare
@return true if this attribute name is equal to the
specified attribute object
| Name::equals | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public int hashCode() {
return hashCode;
} |
Computes the hash value for this attribute name.
| Name::hashCode | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public String toString() {
return name;
} |
Returns the attribute name as a String.
| Name::toString | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public @DetectionAlgorithmStatus int getAlgorithmStatus() {
return mAlgorithmStatus;
} |
Returns the status of the detection algorithm.
| TelephonyTimeZoneAlgorithmStatus::getAlgorithmStatus | java | Reginer/aosp-android-jar | android-35/src/android/app/time/TelephonyTimeZoneAlgorithmStatus.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/app/time/TelephonyTimeZoneAlgorithmStatus.java | MIT |
public RadialGradient(float centerX, float centerY, float radius,
@NonNull @ColorInt int[] colors, @Nullable float[] stops,
@NonNull TileMode tileMode) {
this(centerX, centerY, 0f, centerX, centerY, radius, convertColors(colors),
stops, tileMode, ColorSpace.get(ColorSpace.Named.SRGB));
} |
Create a shader that draws a radial gradient given the center and radius.
@param centerX The x-coordinate of the center of the radius
@param centerY The y-coordinate of the center of the radius
@param radius Must be positive. The radius of the circle for this gradient.
@param colors The sRGB colors to be distributed between the center and edge of the circle
@param stops May be <code>null</code>. Valid values are between <code>0.0f</code> and
<code>1.0f</code>. The relative position of each corresponding color in
the colors array. If <code>null</code>, colors are distributed evenly
between the center and edge of the circle.
@param tileMode The Shader tiling mode
| RadialGradient::RadialGradient | java | Reginer/aosp-android-jar | android-32/src/android/graphics/RadialGradient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/RadialGradient.java | MIT |
public RadialGradient(float centerX, float centerY, float radius,
@NonNull @ColorLong long[] colors, @Nullable float[] stops,
@NonNull TileMode tileMode) {
this(centerX, centerY, 0f, centerX, centerY, radius, colors.clone(), stops,
tileMode, detectColorSpace(colors));
} |
Create a shader that draws a radial gradient given the center and radius.
@param centerX The x-coordinate of the center of the radius
@param centerY The y-coordinate of the center of the radius
@param radius Must be positive. The radius of the circle for this gradient.
@param colors The colors to be distributed between the center and edge of the circle
@param stops May be <code>null</code>. Valid values are between <code>0.0f</code> and
<code>1.0f</code>. The relative position of each corresponding color in
the colors array. If <code>null</code>, colors are distributed evenly
between the center and edge of the circle.
@param tileMode The Shader tiling mode
@throws IllegalArgumentException if there are less than two colors, the colors do
not share the same {@link ColorSpace} or do not use a valid one, or {@code stops}
is not {@code null} and has a different length from {@code colors}.
| RadialGradient::RadialGradient | java | Reginer/aosp-android-jar | android-32/src/android/graphics/RadialGradient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/RadialGradient.java | MIT |
public RadialGradient(float startX, float startY, @FloatRange(from = 0.0f) float startRadius,
float endX, float endY, @FloatRange(from = 0.0f, fromInclusive = false) float endRadius,
@NonNull @ColorLong long[] colors, @Nullable float[] stops,
@NonNull TileMode tileMode) {
this(startX, startY, startRadius, endX, endY, endRadius, colors.clone(), stops, tileMode,
detectColorSpace(colors));
} |
Create a shader that draws a radial gradient given the start and end points as well as
starting and ending radii. The starting point is often referred to as the focal center and
represents the starting circle of the radial gradient.
@param startX The x-coordinate of the center of the starting circle of the radial gradient,
often referred to as the focal point.
@param startY The y-coordinate of the center of the starting circle of the radial gradient,
often referred to as the focal point.
@param startRadius The radius of the starting circle of the radial gradient, often referred
to as the focal radius. Must be greater than or equal to zero.
@param endX The x-coordinate of the center of the radius for the end circle of the
radial gradient
@param endY The y-coordinate of the center of the radius for the end circle of the
radial gradient
@param endRadius The radius of the ending circle for this gradient. This must be strictly
greater than zero. A radius value equal to zero is not allowed.
@param colors The colors to be distributed between the center and edge of the circle
@param stops May be <code>null</code>. Valid values are between <code>0.0f</code> and
<code>1.0f</code>. The relative position of each corresponding color in
the colors array. If <code>null</code>, colors are distributed evenly
between the center and edge of the circle.
@param tileMode The Shader tiling mode
@throws IllegalArgumentException In one of the following circumstances:
<ul>
<li>There are less than two colors</li>
<li>The colors do not share the same {@link ColorSpace}</li>
<li>The colors do not use a valid {@link ColorSpace}</li>
<li>
The {@code stops} parameter is not {@code null} and has a different length from
{@code colors}.
</li>
<li>The {@code startRadius} is negative</li>
<li>The {@code endRadius} is less than or equal to zero</li>
</ul>
| RadialGradient::RadialGradient | java | Reginer/aosp-android-jar | android-32/src/android/graphics/RadialGradient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/RadialGradient.java | MIT |
private RadialGradient(float startX, float startY, float startRadius, float endX, float endY,
float endRadius, @NonNull @ColorLong long[] colors, @Nullable float[] stops,
@NonNull TileMode tileMode, ColorSpace colorSpace
) {
super(colorSpace);
// A focal or starting radius of zero with a focal point that matches the center is
// identical to a regular radial gradient
if (startRadius < 0) {
throw new IllegalArgumentException("starting/focal radius must be >= 0");
}
if (endRadius <= 0) {
throw new IllegalArgumentException("ending radius must be > 0");
}
if (stops != null && colors.length != stops.length) {
throw new IllegalArgumentException("color and position arrays must be of equal length");
}
mX = endX;
mY = endY;
mRadius = endRadius;
mFocalX = startX;
mFocalY = startY;
mFocalRadius = startRadius;
mColorLongs = colors;
mPositions = stops != null ? stops.clone() : null;
mTileMode = tileMode;
} |
Base constructor. Assumes @param colors is a copy that this object can hold onto,
and all colors share @param colorSpace.
| RadialGradient::RadialGradient | java | Reginer/aosp-android-jar | android-32/src/android/graphics/RadialGradient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/RadialGradient.java | MIT |
public RadialGradient(float centerX, float centerY, float radius,
@ColorInt int centerColor, @ColorInt int edgeColor, @NonNull TileMode tileMode) {
this(centerX, centerY, radius, Color.pack(centerColor), Color.pack(edgeColor), tileMode);
} |
Create a shader that draws a radial gradient given the center and radius.
@param centerX The x-coordinate of the center of the radius
@param centerY The y-coordinate of the center of the radius
@param radius Must be positive. The radius of the circle for this gradient
@param centerColor The sRGB color at the center of the circle.
@param edgeColor The sRGB color at the edge of the circle.
@param tileMode The Shader tiling mode
| RadialGradient::RadialGradient | java | Reginer/aosp-android-jar | android-32/src/android/graphics/RadialGradient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/RadialGradient.java | MIT |
public RadialGradient(float centerX, float centerY, float radius,
@ColorLong long centerColor, @ColorLong long edgeColor, @NonNull TileMode tileMode) {
this(centerX, centerY, radius, new long[] {centerColor, edgeColor}, null, tileMode);
} |
Create a shader that draws a radial gradient given the center and radius.
@param centerX The x-coordinate of the center of the radius
@param centerY The y-coordinate of the center of the radius
@param radius Must be positive. The radius of the circle for this gradient
@param centerColor The color at the center of the circle.
@param edgeColor The color at the edge of the circle.
@param tileMode The Shader tiling mode
@throws IllegalArgumentException if the colors do
not share the same {@link ColorSpace} or do not use a valid one.
| RadialGradient::RadialGradient | java | Reginer/aosp-android-jar | android-32/src/android/graphics/RadialGradient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/RadialGradient.java | MIT |
PictureInPictureUiState(Parcel in) {
mIsStashed = in.readBoolean();
} |
Used by {@link Activity#onPictureInPictureUiStateChanged(PictureInPictureUiState)}.
public final class PictureInPictureUiState implements Parcelable {
private boolean mIsStashed;
/** {@hide} | PictureInPictureUiState::PictureInPictureUiState | java | Reginer/aosp-android-jar | android-33/src/android/app/PictureInPictureUiState.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/app/PictureInPictureUiState.java | MIT |
public boolean isStashed() {
return mIsStashed;
} |
Returns whether Picture-in-Picture is stashed or not. A stashed PiP means it is only
partially visible to the user, with some parts of it being off-screen. This is usually
an UI state that is triggered by the user, such as flinging the PiP to the edge or letting go
of PiP while dragging partially off-screen.
Developers can use this in conjunction with
{@link Activity#onPictureInPictureUiStateChanged(PictureInPictureUiState)} to get a signal
when the PiP stash state has changed. For example, if the state changed from {@code false} to
{@code true}, developers can choose to temporarily pause video playback if PiP is of video
content. Vice versa, if changing from {@code true} to {@code false} and video content is
paused, developers can resumevideo playback.
@see <a href="http://developer.android.com/about/versions/12/features/pip-improvements">
Picture in Picture (PiP) improvements</a>
| PictureInPictureUiState::isStashed | java | Reginer/aosp-android-jar | android-33/src/android/app/PictureInPictureUiState.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/app/PictureInPictureUiState.java | MIT |
public IkeKeyIdIdentification(@NonNull byte[] keyId) {
super(ID_TYPE_KEY_ID);
this.keyId = keyId;
} |
Construct an instance of {@link IkeKeyIdIdentification} with a Key ID.
@param keyId the Key ID in bytes.
| IkeKeyIdIdentification::IkeKeyIdIdentification | java | Reginer/aosp-android-jar | android-35/src/android/net/ipsec/ike/IkeKeyIdIdentification.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/net/ipsec/ike/IkeKeyIdIdentification.java | MIT |
public synchronized void schedule(long when) {
mAlarmManager.setExact(
AlarmManager.ELAPSED_REALTIME_WAKEUP, when, mCmdName, this, mHandler);
mScheduled = true;
} |
Schedule the message to be delivered at the time in milliseconds of the
{@link android.os.SystemClock#elapsedRealtime SystemClock.elapsedRealtime()} clock and wakeup
the device when it goes off. If schedule is called multiple times without the message being
dispatched then the alarm is rescheduled to the new time.
| WakeupMessage::schedule | java | Reginer/aosp-android-jar | android-31/src/com/android/internal/util/WakeupMessage.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/internal/util/WakeupMessage.java | MIT |
public synchronized void cancel() {
if (mScheduled) {
mAlarmManager.cancel(this);
mScheduled = false;
}
} |
Cancel all pending messages. This includes alarms that may have been fired, but have not been
run on the handler yet.
| WakeupMessage::cancel | java | Reginer/aosp-android-jar | android-31/src/com/android/internal/util/WakeupMessage.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/internal/util/WakeupMessage.java | MIT |
public void addProperty(@NonNull Property property) {
this.mProperties = CollectionUtils.add(this.mProperties, property.getName(), property);
} |
Add a property to the component
| private::addProperty | java | Reginer/aosp-android-jar | android-34/src/com/android/server/pm/pkg/component/ParsedComponentImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/pm/pkg/component/ParsedComponentImpl.java | MIT |
public InvalidParameterException() {
super();
} |
Constructs an InvalidParameterException with no detail message.
A detail message is a String that describes this particular
exception.
| InvalidParameterException::InvalidParameterException | java | Reginer/aosp-android-jar | android-35/src/java/security/InvalidParameterException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/InvalidParameterException.java | MIT |
public InvalidParameterException(String msg) {
super(msg);
} |
Constructs an InvalidParameterException with the specified
detail message. A detail message is a String that describes
this particular exception.
@param msg the detail message.
| InvalidParameterException::InvalidParameterException | java | Reginer/aosp-android-jar | android-35/src/java/security/InvalidParameterException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/InvalidParameterException.java | MIT |
ReduceOp(StreamShape shape) {
inputShape = shape;
} |
Create a {@code ReduceOp} of the specified stream shape which uses
the specified {@code Supplier} to create accumulating sinks.
@param shape The shape of the stream pipeline
| ReduceOp::ReduceOp | java | Reginer/aosp-android-jar | android-31/src/java/util/stream/ReduceOps.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/util/stream/ReduceOps.java | MIT |
public void writePid(HealthStatsWriter pidWriter, BatteryStats.Uid.Pid pid) {
if (pid == null) {
return;
}
// MEASUREMENT_WAKE_NESTING_COUNT
pidWriter.addMeasurement(PidHealthStats.MEASUREMENT_WAKE_NESTING_COUNT, pid.mWakeNesting);
// MEASUREMENT_WAKE_SUM_MS
pidWriter.addMeasurement(PidHealthStats.MEASUREMENT_WAKE_SUM_MS, pid.mWakeSumMs);
// MEASUREMENT_WAKE_START_MS
pidWriter.addMeasurement(PidHealthStats.MEASUREMENT_WAKE_SUM_MS, pid.mWakeStartMs);
} |
Writes the contents of a BatteryStats.Uid.Pid into a HealthStatsWriter.
| HealthStatsBatteryStatsWriter::writePid | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | MIT |
public void writeProc(HealthStatsWriter procWriter, BatteryStats.Uid.Proc proc) {
// MEASUREMENT_USER_TIME_MS
procWriter.addMeasurement(ProcessHealthStats.MEASUREMENT_USER_TIME_MS,
proc.getUserTime(STATS_SINCE_CHARGED));
// MEASUREMENT_SYSTEM_TIME_MS
procWriter.addMeasurement(ProcessHealthStats.MEASUREMENT_SYSTEM_TIME_MS,
proc.getSystemTime(STATS_SINCE_CHARGED));
// MEASUREMENT_STARTS_COUNT
procWriter.addMeasurement(ProcessHealthStats.MEASUREMENT_STARTS_COUNT,
proc.getStarts(STATS_SINCE_CHARGED));
// MEASUREMENT_CRASHES_COUNT
procWriter.addMeasurement(ProcessHealthStats.MEASUREMENT_CRASHES_COUNT,
proc.getNumCrashes(STATS_SINCE_CHARGED));
// MEASUREMENT_ANR_COUNT
procWriter.addMeasurement(ProcessHealthStats.MEASUREMENT_ANR_COUNT,
proc.getNumAnrs(STATS_SINCE_CHARGED));
// MEASUREMENT_FOREGROUND_MS
procWriter.addMeasurement(ProcessHealthStats.MEASUREMENT_FOREGROUND_MS,
proc.getForegroundTime(STATS_SINCE_CHARGED));
} |
Writes the contents of a BatteryStats.Uid.Proc into a HealthStatsWriter.
| HealthStatsBatteryStatsWriter::writeProc | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | MIT |
public void writePkg(HealthStatsWriter pkgWriter, BatteryStats.Uid.Pkg pkg) {
// STATS_SERVICES
for (final Map.Entry<String,? extends BatteryStats.Uid.Pkg.Serv> entry:
pkg.getServiceStats().entrySet()) {
final HealthStatsWriter writer = new HealthStatsWriter(ServiceHealthStats.CONSTANTS);
writeServ(writer, entry.getValue());
pkgWriter.addStats(PackageHealthStats.STATS_SERVICES, entry.getKey(), writer);
}
// MEASUREMENTS_WAKEUP_ALARMS_COUNT
for (final Map.Entry<String,? extends BatteryStats.Counter> entry:
pkg.getWakeupAlarmStats().entrySet()) {
final BatteryStats.Counter counter = entry.getValue();
if (counter != null) {
pkgWriter.addMeasurements(PackageHealthStats.MEASUREMENTS_WAKEUP_ALARMS_COUNT,
entry.getKey(), counter.getCountLocked(STATS_SINCE_CHARGED));
}
}
} |
Writes the contents of a BatteryStats.Uid.Pkg into a HealthStatsWriter.
| HealthStatsBatteryStatsWriter::writePkg | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | MIT |
public void writeServ(HealthStatsWriter servWriter, BatteryStats.Uid.Pkg.Serv serv) {
// MEASUREMENT_START_SERVICE_COUNT
servWriter.addMeasurement(ServiceHealthStats.MEASUREMENT_START_SERVICE_COUNT,
serv.getStarts(STATS_SINCE_CHARGED));
// MEASUREMENT_LAUNCH_COUNT
servWriter.addMeasurement(ServiceHealthStats.MEASUREMENT_LAUNCH_COUNT,
serv.getLaunches(STATS_SINCE_CHARGED));
} |
Writes the contents of a BatteryStats.Uid.Pkg.Serv into a HealthStatsWriter.
| HealthStatsBatteryStatsWriter::writeServ | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | MIT |
private void addTimer(HealthStatsWriter writer, int key, BatteryStats.Timer timer) {
if (timer != null) {
writer.addTimer(key, timer.getCountLocked(STATS_SINCE_CHARGED),
timer.getTotalTimeLocked(mNowRealtimeMs*1000, STATS_SINCE_CHARGED) / 1000);
}
} |
Adds a BatteryStats.Timer into a HealthStatsWriter. Safe to pass a null timer.
| HealthStatsBatteryStatsWriter::addTimer | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | MIT |
private void addTimers(HealthStatsWriter writer, int key, String name,
BatteryStats.Timer timer) {
if (timer != null) {
writer.addTimers(key, name, new TimerStat(timer.getCountLocked(STATS_SINCE_CHARGED),
timer.getTotalTimeLocked(mNowRealtimeMs*1000, STATS_SINCE_CHARGED) / 1000));
}
} |
Adds a named BatteryStats.Timer into a HealthStatsWriter. Safe to pass a null timer.
| HealthStatsBatteryStatsWriter::addTimers | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/HealthStatsBatteryStatsWriter.java | MIT |
public DOM2DTM(DTMManager mgr, DOMSource domSource,
int dtmIdentity, DTMWSFilter whiteSpaceFilter,
XMLStringFactory xstringfactory,
boolean doIndexing)
{
super(mgr, domSource, dtmIdentity, whiteSpaceFilter,
xstringfactory, doIndexing);
// Initialize DOM navigation
m_pos=m_root = domSource.getNode();
// Initialize DTM navigation
m_last_parent=m_last_kid=NULL;
m_last_kid=addNode(m_root, m_last_parent,m_last_kid, NULL);
// Apparently the domSource root may not actually be the
// Document node. If it's an Element node, we need to immediately
// add its attributes. Adapted from nextNode().
// %REVIEW% Move this logic into addNode and recurse? Cleaner!
//
// (If it's an EntityReference node, we're probably in
// seriously bad trouble. For now
// I'm just hoping nobody is ever quite that foolish... %REVIEW%)
//
// %ISSUE% What about inherited namespaces in this case?
// Do we need to special-case initialize them into the DTM model?
if(ELEMENT_NODE == m_root.getNodeType())
{
NamedNodeMap attrs=m_root.getAttributes();
int attrsize=(attrs==null) ? 0 : attrs.getLength();
if(attrsize>0)
{
int attrIndex=NULL; // start with no previous sib
for(int i=0;i<attrsize;++i)
{
// No need to force nodetype in this case;
// addNode() will take care of switching it from
// Attr to Namespace if necessary.
attrIndex=addNode(attrs.item(i),0,attrIndex,NULL);
m_firstch.setElementAt(DTM.NULL,attrIndex);
}
// Terminate list of attrs, and make sure they aren't
// considered children of the element
m_nextsib.setElementAt(DTM.NULL,attrIndex);
// IMPORTANT: This does NOT change m_last_parent or m_last_kid!
} // if attrs exist
} //if(ELEMENT_NODE)
// Initialize DTM-completed status
m_nodesAreProcessed = false;
} |
Construct a DOM2DTM object from a DOM node.
@param mgr The DTMManager who owns this DTM.
@param domSource the DOM source that this DTM will wrap.
@param dtmIdentity The DTM identity ID for this DTM.
@param whiteSpaceFilter The white space filter for this DTM, which may
be null.
@param xstringfactory XMLString factory for creating character content.
@param doIndexing true if the caller considers it worth it to use
indexing schemes.
| DOM2DTM::DOM2DTM | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | MIT |
protected int addNode(Node node, int parentIndex,
int previousSibling, int forceNodeType)
{
int nodeIndex = m_nodes.size();
// Have we overflowed a DTM Identity's addressing range?
if(m_dtmIdent.size() == (nodeIndex>>>DTMManager.IDENT_DTM_NODE_BITS))
{
try
{
if(m_mgr==null)
throw new ClassCastException();
// Handle as Extended Addressing
DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr;
int id=mgrD.getFirstFreeDTMID();
mgrD.addDTM(this,id,nodeIndex);
m_dtmIdent.addElement(id<<DTMManager.IDENT_DTM_NODE_BITS);
}
catch(ClassCastException e)
{
// %REVIEW% Wrong error message, but I've been told we're trying
// not to add messages right not for I18N reasons.
// %REVIEW% Should this be a Fatal Error?
error(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null));//"No more DTM IDs are available";
}
}
m_size++;
// ensureSize(nodeIndex);
int type;
if(NULL==forceNodeType)
type = node.getNodeType();
else
type=forceNodeType;
// %REVIEW% The Namespace Spec currently says that Namespaces are
// processed in a non-namespace-aware manner, by matching the
// QName, even though there is in fact a namespace assigned to
// these nodes in the DOM. If and when that changes, we will have
// to consider whether we check the namespace-for-namespaces
// rather than the node name.
//
// %TBD% Note that the DOM does not necessarily explicitly declare
// all the namespaces it uses. DOM Level 3 will introduce a
// namespace-normalization operation which reconciles that, and we
// can request that users invoke it or otherwise ensure that the
// tree is namespace-well-formed before passing the DOM to Xalan.
// But if they don't, what should we do about it? We probably
// don't want to alter the source DOM (and may not be able to do
// so if it's read-only). The best available answer might be to
// synthesize additional DTM Namespace Nodes that don't correspond
// to DOM Attr Nodes.
if (Node.ATTRIBUTE_NODE == type)
{
String name = node.getNodeName();
if (name.startsWith("xmlns:") || name.equals("xmlns"))
{
type = DTM.NAMESPACE_NODE;
}
}
m_nodes.addElement(node);
m_firstch.setElementAt(NOTPROCESSED,nodeIndex);
m_nextsib.setElementAt(NOTPROCESSED,nodeIndex);
m_prevsib.setElementAt(previousSibling,nodeIndex);
m_parent.setElementAt(parentIndex,nodeIndex);
if(DTM.NULL != parentIndex &&
type != DTM.ATTRIBUTE_NODE &&
type != DTM.NAMESPACE_NODE)
{
// If the DTM parent had no children, this becomes its first child.
if(NOTPROCESSED == m_firstch.elementAt(parentIndex))
m_firstch.setElementAt(nodeIndex,parentIndex);
}
String nsURI = node.getNamespaceURI();
// Deal with the difference between Namespace spec and XSLT
// definitions of local name. (The former says PIs don't have
// localnames; the latter says they do.)
String localName = (type == Node.PROCESSING_INSTRUCTION_NODE) ?
node.getNodeName() :
node.getLocalName();
// Hack to make DOM1 sort of work...
if(((type == Node.ELEMENT_NODE) || (type == Node.ATTRIBUTE_NODE))
&& null == localName)
localName = node.getNodeName(); // -sb
ExpandedNameTable exnt = m_expandedNameTable;
// %TBD% Nodes created with the old non-namespace-aware DOM
// calls createElement() and createAttribute() will never have a
// localname. That will cause their expandedNameID to be just the
// nodeType... which will keep them from being matched
// successfully by name. Since the DOM makes no promise that
// those will participate in namespace processing, this is
// officially accepted as Not Our Fault. But it might be nice to
// issue a diagnostic message!
if(node.getLocalName()==null &&
(type==Node.ELEMENT_NODE || type==Node.ATTRIBUTE_NODE))
{
// warning("DOM 'level 1' node "+node.getNodeName()+" won't be mapped properly in DOM2DTM.");
}
int expandedNameID = (null != localName)
? exnt.getExpandedTypeID(nsURI, localName, type) :
exnt.getExpandedTypeID(type);
m_exptype.setElementAt(expandedNameID,nodeIndex);
indexNode(expandedNameID, nodeIndex);
if (DTM.NULL != previousSibling)
m_nextsib.setElementAt(nodeIndex,previousSibling);
// This should be done after m_exptype has been set, and probably should
// always be the last thing we do
if (type == DTM.NAMESPACE_NODE)
declareNamespaceInContext(parentIndex,nodeIndex);
return nodeIndex;
} |
Construct the node map from the node.
@param node The node that is to be added to the DTM.
@param parentIndex The current parent index.
@param previousSibling The previous sibling index.
@param forceNodeType If not DTM.NULL, overrides the DOM node type.
Used to force nodes to Text rather than CDATASection when their
coalesced value includes ordinary Text nodes (current DTM behavior).
@return The index identity of the node that was added.
| DOM2DTM::addNode | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | MIT |
public int getNumberOfNodes()
{
return m_nodes.size();
} |
Get the number of nodes that have been added.
| DOM2DTM::getNumberOfNodes | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | MIT |
protected boolean nextNode()
{
// Non-recursive one-fetch-at-a-time depth-first traversal with
// attribute/namespace nodes and white-space stripping.
// Navigating the DOM is simple, navigating the DTM is simple;
// keeping track of both at once is a trifle baroque but at least
// we've avoided most of the special cases.
if (m_nodesAreProcessed)
return false;
// %REVIEW% Is this local copy Really Useful from a performance
// point of view? Or is this a false microoptimization?
Node pos=m_pos;
Node next=null;
int nexttype=NULL;
// Navigate DOM tree
do
{
// Look down to first child.
if (pos.hasChildNodes())
{
next = pos.getFirstChild();
// %REVIEW% There's probably a more elegant way to skip
// the doctype. (Just let it go and Suppress it?
if(next!=null && DOCUMENT_TYPE_NODE==next.getNodeType())
next=next.getNextSibling();
// Push DTM context -- except for children of Entity References,
// which have no DTM equivalent and cause no DTM navigation.
if(ENTITY_REFERENCE_NODE!=pos.getNodeType())
{
m_last_parent=m_last_kid;
m_last_kid=NULL;
// Whitespace-handler context stacking
if(null != m_wsfilter)
{
short wsv =
m_wsfilter.getShouldStripSpace(makeNodeHandle(m_last_parent),this);
boolean shouldStrip = (DTMWSFilter.INHERIT == wsv)
? getShouldStripWhitespace()
: (DTMWSFilter.STRIP == wsv);
pushShouldStripWhitespace(shouldStrip);
} // if(m_wsfilter)
}
}
// If that fails, look up and right (but not past root!)
else
{
if(m_last_kid!=NULL)
{
// Last node posted at this level had no more children
// If it has _no_ children, we need to record that.
if(m_firstch.elementAt(m_last_kid)==NOTPROCESSED)
m_firstch.setElementAt(NULL,m_last_kid);
}
while(m_last_parent != NULL)
{
// %REVIEW% There's probably a more elegant way to
// skip the doctype. (Just let it go and Suppress it?
next = pos.getNextSibling();
if(next!=null && DOCUMENT_TYPE_NODE==next.getNodeType())
next=next.getNextSibling();
if(next!=null)
break; // Found it!
// No next-sibling found. Pop the DOM.
pos=pos.getParentNode();
if(pos==null)
{
// %TBD% Should never arise, but I want to be sure of that...
if(JJK_DEBUG)
{
System.out.println("***** DOM2DTM Pop Control Flow problem");
for(;;); // Freeze right here!
}
}
// The only parents in the DTM are Elements. However,
// the DOM could contain EntityReferences. If we
// encounter one, pop it _without_ popping DTM.
if(pos!=null && ENTITY_REFERENCE_NODE == pos.getNodeType())
{
// Nothing needs doing
if(JJK_DEBUG)
System.out.println("***** DOM2DTM popping EntRef");
}
else
{
popShouldStripWhitespace();
// Fix and pop DTM
if(m_last_kid==NULL)
m_firstch.setElementAt(NULL,m_last_parent); // Popping from an element
else
m_nextsib.setElementAt(NULL,m_last_kid); // Popping from anything else
m_last_parent=m_parent.elementAt(m_last_kid=m_last_parent);
}
}
if(m_last_parent==NULL)
next=null;
}
if(next!=null)
nexttype=next.getNodeType();
// If it's an entity ref, advance past it.
//
// %REVIEW% Should we let this out the door and just suppress it?
// More work, but simpler code, more likely to be correct, and
// it doesn't happen very often. We'd get rid of the loop too.
if (ENTITY_REFERENCE_NODE == nexttype)
pos=next;
}
while (ENTITY_REFERENCE_NODE == nexttype);
// Did we run out of the tree?
if(next==null)
{
m_nextsib.setElementAt(NULL,0);
m_nodesAreProcessed = true;
m_pos=null;
if(JJK_DEBUG)
{
System.out.println("***** DOM2DTM Crosscheck:");
for(int i=0;i<m_nodes.size();++i)
System.out.println(i+":\t"+m_firstch.elementAt(i)+"\t"+m_nextsib.elementAt(i));
}
return false;
}
// Text needs some special handling:
//
// DTM may skip whitespace. This is handled by the suppressNode flag, which
// when true will keep the DTM node from being created.
//
// DTM only directly records the first DOM node of any logically-contiguous
// sequence. The lastTextNode value will be set to the last node in the
// contiguous sequence, and -- AFTER the DTM addNode -- can be used to
// advance next over this whole block. Should be simpler than special-casing
// the above loop for "Was the logically-preceeding sibling a text node".
//
// Finally, a DTM node should be considered a CDATASection only if all the
// contiguous text it covers is CDATASections. The first Text should
// force DTM to Text.
boolean suppressNode=false;
Node lastTextNode=null;
nexttype=next.getNodeType();
// nexttype=pos.getNodeType();
if(TEXT_NODE == nexttype || CDATA_SECTION_NODE == nexttype)
{
// If filtering, initially assume we're going to suppress the node
suppressNode=((null != m_wsfilter) && getShouldStripWhitespace());
// Scan logically contiguous text (siblings, plus "flattening"
// of entity reference boundaries).
Node n=next;
while(n!=null)
{
lastTextNode=n;
// Any Text node means DTM considers it all Text
if(TEXT_NODE == n.getNodeType())
nexttype=TEXT_NODE;
// Any non-whitespace in this sequence blocks whitespace
// suppression
suppressNode &=
XMLCharacterRecognizer.isWhiteSpace(n.getNodeValue());
n=logicalNextDOMTextNode(n);
}
}
// Special handling for PIs: Some DOMs represent the XML
// Declaration as a PI. This is officially incorrect, per the DOM
// spec, but is considered a "wrong but tolerable" temporary
// workaround pending proper handling of these fields in DOM Level
// 3. We want to recognize and reject that case.
else if(PROCESSING_INSTRUCTION_NODE==nexttype)
{
suppressNode = (pos.getNodeName().toLowerCase().equals("xml"));
}
if(!suppressNode)
{
// Inserting next. NOTE that we force the node type; for
// coalesced Text, this records CDATASections adjacent to
// ordinary Text as Text.
int nextindex=addNode(next,m_last_parent,m_last_kid,
nexttype);
m_last_kid=nextindex;
if(ELEMENT_NODE == nexttype)
{
int attrIndex=NULL; // start with no previous sib
// Process attributes _now_, rather than waiting.
// Simpler control flow, makes NS cache available immediately.
NamedNodeMap attrs=next.getAttributes();
int attrsize=(attrs==null) ? 0 : attrs.getLength();
if(attrsize>0)
{
for(int i=0;i<attrsize;++i)
{
// No need to force nodetype in this case;
// addNode() will take care of switching it from
// Attr to Namespace if necessary.
attrIndex=addNode(attrs.item(i),
nextindex,attrIndex,NULL);
m_firstch.setElementAt(DTM.NULL,attrIndex);
// If the xml: prefix is explicitly declared
// we don't need to synthesize one.
//
// NOTE that XML Namespaces were not originally
// defined as being namespace-aware (grrr), and
// while the W3C is planning to fix this it's
// safer for now to test the QName and trust the
// parsers to prevent anyone from redefining the
// reserved xmlns: prefix
if(!m_processedFirstElement
&& "xmlns:xml".equals(attrs.item(i).getNodeName()))
m_processedFirstElement=true;
}
// Terminate list of attrs, and make sure they aren't
// considered children of the element
} // if attrs exist
if(!m_processedFirstElement)
{
// The DOM might not have an explicit declaration for the
// implicit "xml:" prefix, but the XPath data model
// requires that this appear as a Namespace Node so we
// have to synthesize one. You can think of this as
// being a default attribute defined by the XML
// Namespaces spec rather than by the DTD.
attrIndex=addNode(new DOM2DTMdefaultNamespaceDeclarationNode(
(Element)next,"xml",NAMESPACE_DECL_NS,
makeNodeHandle(((attrIndex==NULL)?nextindex:attrIndex)+1)
),
nextindex,attrIndex,NULL);
m_firstch.setElementAt(DTM.NULL,attrIndex);
m_processedFirstElement=true;
}
if(attrIndex!=NULL)
m_nextsib.setElementAt(DTM.NULL,attrIndex);
} //if(ELEMENT_NODE)
} // (if !suppressNode)
// Text postprocessing: Act on values stored above
if(TEXT_NODE == nexttype || CDATA_SECTION_NODE == nexttype)
{
// %TBD% If nexttype was forced to TEXT, patch the DTM node
next=lastTextNode; // Advance the DOM cursor over contiguous text
}
// Remember where we left off.
m_pos=next;
return true;
} |
This method iterates to the next node that will be added to the table.
Each call to this method adds a new node to the table, unless the end
is reached, in which case it returns null.
@return The true if a next node is found or false if
there are no more nodes.
| DOM2DTM::nextNode | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | MIT |
public Node getNode(int nodeHandle)
{
int identity = makeNodeIdentity(nodeHandle);
return (Node) m_nodes.elementAt(identity);
} |
Return an DOM node for the given node.
@param nodeHandle The node ID.
@return A node representation of the DTM node.
| DOM2DTM::getNode | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | MIT |
protected Node lookupNode(int nodeIdentity)
{
return (Node) m_nodes.elementAt(nodeIdentity);
} |
Get a Node from an identity index.
NEEDSDOC @param nodeIdentity
NEEDSDOC ($objectName$) @return
| DOM2DTM::lookupNode | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | MIT |
protected int getNextNodeIdentity(int identity)
{
identity += 1;
if (identity >= m_nodes.size())
{
if (!nextNode())
identity = DTM.NULL;
}
return identity;
} |
Get the next node identity value in the list, and call the iterator
if it hasn't been added yet.
@param identity The node identity (index).
@return identity+1, or DTM.NULL.
| DOM2DTM::getNextNodeIdentity | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.