code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public ProcessBuilder redirectError(Redirect destination) {
if (destination.type() == Redirect.Type.READ)
throw new IllegalArgumentException(
"Redirect invalid for writing: " + destination);
redirects()[2] = destination;
return this;
} |
Sets this process builder's standard error destination.
Subprocesses subsequently started by this object's {@link #start()}
method send their standard error to this destination.
<p>If the destination is {@link Redirect#PIPE Redirect.PIPE}
(the initial value), then the error output of a subprocess
can be read using the input stream returned by {@link
Process#getErrorStream()}.
If the destination is set to any other value, then
{@link Process#getErrorStream()} will return a
<a href="#redirect-output">null input stream</a>.
<p>If the {@link #redirectErrorStream redirectErrorStream}
attribute has been set {@code true}, then the redirection set
by this method has no effect.
@param destination the new standard error destination
@return this process builder
@throws IllegalArgumentException
if the redirect does not correspond to a valid
destination of data, that is, has type
{@link ProcessBuilder.Redirect.Type#READ READ}
@since 1.7
| Redirect::redirectError | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public ProcessBuilder redirectInput(File file) {
return redirectInput(Redirect.from(file));
} |
Sets this process builder's standard input source to a file.
<p>This is a convenience method. An invocation of the form
{@code redirectInput(file)}
behaves in exactly the same way as the invocation
{@link #redirectInput(Redirect) redirectInput}
{@code (Redirect.from(file))}.
@param file the new standard input source
@return this process builder
@since 1.7
| Redirect::redirectInput | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public ProcessBuilder redirectOutput(File file) {
return redirectOutput(Redirect.to(file));
} |
Sets this process builder's standard output destination to a file.
<p>This is a convenience method. An invocation of the form
{@code redirectOutput(file)}
behaves in exactly the same way as the invocation
{@link #redirectOutput(Redirect) redirectOutput}
{@code (Redirect.to(file))}.
@param file the new standard output destination
@return this process builder
@since 1.7
| Redirect::redirectOutput | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public ProcessBuilder redirectError(File file) {
return redirectError(Redirect.to(file));
} |
Sets this process builder's standard error destination to a file.
<p>This is a convenience method. An invocation of the form
{@code redirectError(file)}
behaves in exactly the same way as the invocation
{@link #redirectError(Redirect) redirectError}
{@code (Redirect.to(file))}.
@param file the new standard error destination
@return this process builder
@since 1.7
| Redirect::redirectError | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public Redirect redirectInput() {
return (redirects == null) ? Redirect.PIPE : redirects[0];
} |
Returns this process builder's standard input source.
Subprocesses subsequently started by this object's {@link #start()}
method obtain their standard input from this source.
The initial value is {@link Redirect#PIPE Redirect.PIPE}.
@return this process builder's standard input source
@since 1.7
| Redirect::redirectInput | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public Redirect redirectOutput() {
return (redirects == null) ? Redirect.PIPE : redirects[1];
} |
Returns this process builder's standard output destination.
Subprocesses subsequently started by this object's {@link #start()}
method redirect their standard output to this destination.
The initial value is {@link Redirect#PIPE Redirect.PIPE}.
@return this process builder's standard output destination
@since 1.7
| Redirect::redirectOutput | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public Redirect redirectError() {
return (redirects == null) ? Redirect.PIPE : redirects[2];
} |
Returns this process builder's standard error destination.
Subprocesses subsequently started by this object's {@link #start()}
method redirect their standard error to this destination.
The initial value is {@link Redirect#PIPE Redirect.PIPE}.
@return this process builder's standard error destination
@since 1.7
| Redirect::redirectError | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public ProcessBuilder inheritIO() {
Arrays.fill(redirects(), Redirect.INHERIT);
return this;
} |
Sets the source and destination for subprocess standard I/O
to be the same as those of the current Java process.
<p>This is a convenience method. An invocation of the form
<pre> {@code
pb.inheritIO()
}</pre>
behaves in exactly the same way as the invocation
<pre> {@code
pb.redirectInput(Redirect.INHERIT)
.redirectOutput(Redirect.INHERIT)
.redirectError(Redirect.INHERIT)
}</pre>
This gives behavior equivalent to most operating system
command interpreters, or the standard C library function
{@code system()}.
@return this process builder
@since 1.7
| Redirect::inheritIO | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public boolean redirectErrorStream() {
return redirectErrorStream;
} |
Tells whether this process builder merges standard error and
standard output.
<p>If this property is {@code true}, then any error output
generated by subprocesses subsequently started by this object's
{@link #start()} method will be merged with the standard
output, so that both can be read using the
{@link Process#getInputStream()} method. This makes it easier
to correlate error messages with the corresponding output.
The initial value is {@code false}.
@return this process builder's {@code redirectErrorStream} property
| Redirect::redirectErrorStream | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public ProcessBuilder redirectErrorStream(boolean redirectErrorStream) {
this.redirectErrorStream = redirectErrorStream;
return this;
} |
Sets this process builder's {@code redirectErrorStream} property.
<p>If this property is {@code true}, then any error output
generated by subprocesses subsequently started by this object's
{@link #start()} method will be merged with the standard
output, so that both can be read using the
{@link Process#getInputStream()} method. This makes it easier
to correlate error messages with the corresponding output.
The initial value is {@code false}.
@param redirectErrorStream the new property value
@return this process builder
| Redirect::redirectErrorStream | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
public Process start() throws IOException {
// Must convert to array first -- a malicious user-supplied
// list might try to circumvent the security check.
String[] cmdarray = command.toArray(new String[command.size()]);
cmdarray = cmdarray.clone();
for (String arg : cmdarray)
if (arg == null)
throw new NullPointerException();
// Throws IndexOutOfBoundsException if command is empty
String prog = cmdarray[0];
SecurityManager security = System.getSecurityManager();
if (security != null)
security.checkExec(prog);
String dir = directory == null ? null : directory.toString();
for (int i = 1; i < cmdarray.length; i++) {
if (cmdarray[i].indexOf('\u0000') >= 0) {
throw new IOException("invalid null character in command");
}
}
try {
return ProcessImpl.start(cmdarray,
environment,
dir,
redirects,
redirectErrorStream);
} catch (IOException | IllegalArgumentException e) {
String exceptionInfo = ": " + e.getMessage();
Throwable cause = e;
if ((e instanceof IOException) && security != null) {
// Can not disclose the fail reason for read-protected files.
try {
security.checkRead(prog);
} catch (SecurityException se) {
exceptionInfo = "";
cause = se;
}
}
// It's much easier for us to create a high-quality error
// message than the low-level C code which found the problem.
throw new IOException(
"Cannot run program \"" + prog + "\""
+ (dir == null ? "" : " (in directory \"" + dir + "\")")
+ exceptionInfo,
cause);
}
} |
Starts a new process using the attributes of this process builder.
<p>The new process will
invoke the command and arguments given by {@link #command()},
in a working directory as given by {@link #directory()},
with a process environment as given by {@link #environment()}.
<p>This method checks that the command is a valid operating
system command. Which commands are valid is system-dependent,
but at the very least the command must be a non-empty list of
non-null strings.
<p>A minimal set of system dependent environment variables may
be required to start a process on some operating systems.
As a result, the subprocess may inherit additional environment variable
settings beyond those in the process builder's {@link #environment()}.
<p>If there is a security manager, its
{@link SecurityManager#checkExec checkExec}
method is called with the first component of this object's
{@code command} array as its argument. This may result in
a {@link SecurityException} being thrown.
<p>Starting an operating system process is highly system-dependent.
Among the many things that can go wrong are:
<ul>
<li>The operating system program file was not found.
<li>Access to the program file was denied.
<li>The working directory does not exist.
</ul>
<p>In such cases an exception will be thrown. The exact nature
of the exception is system-dependent, but it will always be a
subclass of {@link IOException}.
<p>Subsequent modifications to this process builder will not
affect the returned {@link Process}.
@return a new {@link Process} object for managing the subprocess
@throws NullPointerException
if an element of the command list is null
@throws IndexOutOfBoundsException
if the command is an empty list (has size {@code 0})
@throws SecurityException
if a security manager exists and
<ul>
<li>its
{@link SecurityManager#checkExec checkExec}
method doesn't allow creation of the subprocess, or
<li>the standard input to the subprocess was
{@linkplain #redirectInput redirected from a file}
and the security manager's
{@link SecurityManager#checkRead checkRead} method
denies read access to the file, or
<li>the standard output or standard error of the
subprocess was
{@linkplain #redirectOutput redirected to a file}
and the security manager's
{@link SecurityManager#checkWrite checkWrite} method
denies write access to the file
</ul>
@throws IOException if an I/O error occurs
@see Runtime#exec(String[], String[], java.io.File)
| Redirect::start | java | Reginer/aosp-android-jar | android-35/src/java/lang/ProcessBuilder.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessBuilder.java | MIT |
IkeVendorPayload(boolean critical, byte[] payloadBody) {
super(PAYLOAD_TYPE_VENDOR, critical);
vendorId = payloadBody;
} |
Construct an instance of IkeVendorPayload in the context of {@link IkePayloadFactory}.
@param critical indicates if it is a critical payload.
@param payloadBody the vendor ID.
| IkeVendorPayload::IkeVendorPayload | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/net/ipsec/ike/message/IkeVendorPayload.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/net/ipsec/ike/message/IkeVendorPayload.java | MIT |
public SensorPrivacyControllerImpl(@NonNull SensorPrivacyManager sensorPrivacyManager) {
mSensorPrivacyManager = sensorPrivacyManager;
} |
Public constructor.
| SensorPrivacyControllerImpl::SensorPrivacyControllerImpl | java | Reginer/aosp-android-jar | android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | MIT |
public boolean isSensorPrivacyEnabled() {
synchronized (mLock) {
return mSensorPrivacyEnabled;
}
} |
Returns whether sensor privacy is enabled.
| SensorPrivacyControllerImpl::isSensorPrivacyEnabled | java | Reginer/aosp-android-jar | android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | MIT |
public void addCallback(@NonNull OnSensorPrivacyChangedListener listener) {
synchronized (mLock) {
mListeners.add(listener);
notifyListenerLocked(listener);
}
} |
Adds the provided listener for callbacks when sensor privacy state changes.
| SensorPrivacyControllerImpl::addCallback | java | Reginer/aosp-android-jar | android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | MIT |
public void removeCallback(@NonNull OnSensorPrivacyChangedListener listener) {
synchronized (mLock) {
mListeners.remove(listener);
}
} |
Removes the provided listener from callbacks when sensor privacy state changes.
| SensorPrivacyControllerImpl::removeCallback | java | Reginer/aosp-android-jar | android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | MIT |
public void onAllSensorPrivacyChanged(boolean enabled) {
synchronized (mLock) {
mSensorPrivacyEnabled = enabled;
for (OnSensorPrivacyChangedListener listener : mListeners) {
notifyListenerLocked(listener);
}
}
} |
Callback invoked by the SensorPrivacyService when sensor privacy state changes.
| SensorPrivacyControllerImpl::onAllSensorPrivacyChanged | java | Reginer/aosp-android-jar | android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java | MIT |
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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/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-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public SystemConfigFileCommitEventLogger(@NonNull String name) {
mName = name;
} |
@param name The short name of the config file that is included in the event log event,
e.g. "jobs", "appops", "uri-grants" etc.
| SystemConfigFileCommitEventLogger::SystemConfigFileCommitEventLogger | java | Reginer/aosp-android-jar | android-35/src/android/util/SystemConfigFileCommitEventLogger.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SystemConfigFileCommitEventLogger.java | MIT |
public void setStartTime(@UptimeMillisLong long startTime) {
mStartTime = startTime;
} |
Override the start timestamp. Use this method when it's desired to include the time
taken by the preparation of the configuration data in the overall duration of the
"commitSysConfigFile" event.
@param startTime Overridden start time, in system uptime milliseconds
| SystemConfigFileCommitEventLogger::setStartTime | java | Reginer/aosp-android-jar | android-35/src/android/util/SystemConfigFileCommitEventLogger.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SystemConfigFileCommitEventLogger.java | MIT |
public void onStartWrite() {
if (mStartTime == 0) {
mStartTime = SystemClock.uptimeMillis();
}
} |
Invoked just before the configuration file writing begins.
@hide
| SystemConfigFileCommitEventLogger::onStartWrite | java | Reginer/aosp-android-jar | android-35/src/android/util/SystemConfigFileCommitEventLogger.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SystemConfigFileCommitEventLogger.java | MIT |
public void onFinishWrite() {
writeLogRecord(SystemClock.uptimeMillis() - mStartTime);
} |
Invoked just after the configuration file writing ends.
@hide
| SystemConfigFileCommitEventLogger::onFinishWrite | java | Reginer/aosp-android-jar | android-35/src/android/util/SystemConfigFileCommitEventLogger.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SystemConfigFileCommitEventLogger.java | MIT |
public boolean hasController() {
return mDisplayWindowPolicyController != null;
} |
Return {@code true} if there is DisplayWindowPolicyController.
| DisplayWindowPolicyControllerHelper::hasController | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | MIT |
public boolean canContainActivities(@NonNull List<ActivityInfo> activities,
@WindowConfiguration.WindowingMode int windowingMode) {
if (mDisplayWindowPolicyController == null) {
return true;
}
return mDisplayWindowPolicyController.canContainActivities(activities, windowingMode);
} |
@see DisplayWindowPolicyController#canContainActivities(List, int)
| DisplayWindowPolicyControllerHelper::canContainActivities | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | MIT |
public boolean canActivityBeLaunched(ActivityInfo activityInfo,
@WindowConfiguration.WindowingMode int windowingMode, int launchingFromDisplayId,
boolean isNewTask) {
if (mDisplayWindowPolicyController == null) {
return true;
}
return mDisplayWindowPolicyController.canActivityBeLaunched(activityInfo, windowingMode,
launchingFromDisplayId, isNewTask);
} |
@see DisplayWindowPolicyController#canActivityBeLaunched(ActivityInfo, int, int, boolean)
| DisplayWindowPolicyControllerHelper::canActivityBeLaunched | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | MIT |
boolean keepActivityOnWindowFlagsChanged(ActivityInfo aInfo, int flagChanges,
int privateFlagChanges) {
if (mDisplayWindowPolicyController == null) {
return true;
}
if (!mDisplayWindowPolicyController.isInterestedWindowFlags(
flagChanges, privateFlagChanges)) {
return true;
}
return mDisplayWindowPolicyController.keepActivityOnWindowFlagsChanged(
aInfo, flagChanges, privateFlagChanges);
} |
@see DisplayWindowPolicyController#keepActivityOnWindowFlagsChanged(ActivityInfo, int, int)
| DisplayWindowPolicyControllerHelper::keepActivityOnWindowFlagsChanged | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | MIT |
void onRunningActivityChanged() {
if (mDisplayWindowPolicyController == null) {
return;
}
// Update top activity.
ActivityRecord topActivity = mDisplayContent.getTopActivity(false /* includeFinishing */,
true /* includeOverlays */);
if (topActivity != mTopRunningActivity) {
mTopRunningActivity = topActivity;
mDisplayWindowPolicyController.onTopActivityChanged(
topActivity == null ? null : topActivity.info.getComponentName(),
topActivity == null
? UserHandle.USER_NULL : topActivity.info.applicationInfo.uid);
}
// Update running uid.
final boolean[] notifyChanged = {false};
ArraySet<Integer> runningUids = new ArraySet<>();
mDisplayContent.forAllActivities((r) -> {
if (!r.finishing) {
notifyChanged[0] |= runningUids.add(r.getUid());
}
});
// We need to compare the size because if it is the following case, we can't know the
// existence of 3 in the forAllActivities() loop.
// Old set: 1,2,3
// New set: 1,2
if (notifyChanged[0] || (mRunningUid.size() != runningUids.size())) {
mRunningUid = runningUids;
mDisplayWindowPolicyController.onRunningAppsChanged(runningUids);
}
} |
@see DisplayWindowPolicyController#keepActivityOnWindowFlagsChanged(ActivityInfo, int, int)
boolean keepActivityOnWindowFlagsChanged(ActivityInfo aInfo, int flagChanges,
int privateFlagChanges) {
if (mDisplayWindowPolicyController == null) {
return true;
}
if (!mDisplayWindowPolicyController.isInterestedWindowFlags(
flagChanges, privateFlagChanges)) {
return true;
}
return mDisplayWindowPolicyController.keepActivityOnWindowFlagsChanged(
aInfo, flagChanges, privateFlagChanges);
}
/** Update the top activity and the uids of non-finishing activity | DisplayWindowPolicyControllerHelper::onRunningActivityChanged | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | MIT |
public final boolean isWindowingModeSupported(
@WindowConfiguration.WindowingMode int windowingMode) {
if (mDisplayWindowPolicyController == null) {
return true;
}
return mDisplayWindowPolicyController.isWindowingModeSupported(windowingMode);
} |
@see DisplayWindowPolicyController#isWindowingModeSupported(int)
| DisplayWindowPolicyControllerHelper::isWindowingModeSupported | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | MIT |
public final boolean canShowTasksInRecents() {
if (mDisplayWindowPolicyController == null) {
return true;
}
return mDisplayWindowPolicyController.canShowTasksInRecents();
} |
@see DisplayWindowPolicyController#canShowTasksInRecents()
| DisplayWindowPolicyControllerHelper::canShowTasksInRecents | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/DisplayWindowPolicyControllerHelper.java | MIT |
DOM3TreeWalker(
SerializationHandler serialHandler,
DOMErrorHandler errHandler,
LSSerializerFilter filter,
String newLine) {
fSerializer = serialHandler;
//fErrorHandler = errHandler == null ? new DOMErrorHandlerImpl() : errHandler; // Should we be using the default?
fErrorHandler = errHandler;
fFilter = filter;
fLexicalHandler = null;
fNewLine = newLine;
fNSBinder = new NamespaceSupport();
fLocalNSBinder = new NamespaceSupport();
fDOMConfigProperties = fSerializer.getOutputFormat();
fSerializer.setDocumentLocator(fLocator);
initProperties(fDOMConfigProperties);
try {
// Bug see Bugzilla 26741
fLocator.setSystemId(
System.getProperty("user.dir") + File.separator + "dummy.xsl");
} catch (SecurityException se) { // user.dir not accessible from applet
}
} |
Constructor.
@param contentHandler serialHandler The implemention of the SerializationHandler interface
| DOM3TreeWalker::DOM3TreeWalker | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
public void traverse(Node pos) throws org.xml.sax.SAXException {
this.fSerializer.startDocument();
// Determine if the Node is a DOM Level 3 Core Node.
if (pos.getNodeType() != Node.DOCUMENT_NODE) {
Document ownerDoc = pos.getOwnerDocument();
if (ownerDoc != null
&& ownerDoc.getImplementation().hasFeature("Core", "3.0")) {
fIsLevel3DOM = true;
}
} else {
if (((Document) pos)
.getImplementation()
.hasFeature("Core", "3.0")) {
fIsLevel3DOM = true;
}
}
if (fSerializer instanceof LexicalHandler) {
fLexicalHandler = ((LexicalHandler) this.fSerializer);
}
if (fFilter != null)
fWhatToShowFilter = fFilter.getWhatToShow();
Node top = pos;
while (null != pos) {
startNode(pos);
Node nextNode = null;
nextNode = pos.getFirstChild();
while (null == nextNode) {
endNode(pos);
if (top.equals(pos))
break;
nextNode = pos.getNextSibling();
if (null == nextNode) {
pos = pos.getParentNode();
if ((null == pos) || (top.equals(pos))) {
if (null != pos)
endNode(pos);
nextNode = null;
break;
}
}
}
pos = nextNode;
}
this.fSerializer.endDocument();
} |
Perform a pre-order traversal non-recursive style.
Note that TreeWalker assumes that the subtree is intended to represent
a complete (though not necessarily well-formed) document and, during a
traversal, startDocument and endDocument will always be issued to the
SAX listener.
@param pos Node in the tree where to start traversal
@throws TransformerException
| DOM3TreeWalker::traverse | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
public void traverse(Node pos, Node top) throws org.xml.sax.SAXException {
this.fSerializer.startDocument();
// Determine if the Node is a DOM Level 3 Core Node.
if (pos.getNodeType() != Node.DOCUMENT_NODE) {
Document ownerDoc = pos.getOwnerDocument();
if (ownerDoc != null
&& ownerDoc.getImplementation().hasFeature("Core", "3.0")) {
fIsLevel3DOM = true;
}
} else {
if (((Document) pos)
.getImplementation()
.hasFeature("Core", "3.0")) {
fIsLevel3DOM = true;
}
}
if (fSerializer instanceof LexicalHandler) {
fLexicalHandler = ((LexicalHandler) this.fSerializer);
}
if (fFilter != null)
fWhatToShowFilter = fFilter.getWhatToShow();
while (null != pos) {
startNode(pos);
Node nextNode = null;
nextNode = pos.getFirstChild();
while (null == nextNode) {
endNode(pos);
if ((null != top) && top.equals(pos))
break;
nextNode = pos.getNextSibling();
if (null == nextNode) {
pos = pos.getParentNode();
if ((null == pos) || ((null != top) && top.equals(pos))) {
nextNode = null;
break;
}
}
}
pos = nextNode;
}
this.fSerializer.endDocument();
} |
Perform a pre-order traversal non-recursive style.
Note that TreeWalker assumes that the subtree is intended to represent
a complete (though not necessarily well-formed) document and, during a
traversal, startDocument and endDocument will always be issued to the
SAX listener.
@param pos Node in the tree where to start traversal
@param top Node in the tree where to end traversal
@throws TransformerException
| DOM3TreeWalker::traverse | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
private final void dispatachChars(Node node)
throws org.xml.sax.SAXException {
if (fSerializer != null) {
this.fSerializer.characters(node);
} else {
String data = ((Text) node).getData();
this.fSerializer.characters(data.toCharArray(), 0, data.length());
}
} |
Optimized dispatch of characters.
| DOM3TreeWalker::dispatachChars | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void startNode(Node node) throws org.xml.sax.SAXException {
if (node instanceof Locator) {
Locator loc = (Locator) node;
fLocator.setColumnNumber(loc.getColumnNumber());
fLocator.setLineNumber(loc.getLineNumber());
fLocator.setPublicId(loc.getPublicId());
fLocator.setSystemId(loc.getSystemId());
} else {
fLocator.setColumnNumber(0);
fLocator.setLineNumber(0);
}
switch (node.getNodeType()) {
case Node.DOCUMENT_TYPE_NODE :
serializeDocType((DocumentType) node, true);
break;
case Node.COMMENT_NODE :
serializeComment((Comment) node);
break;
case Node.DOCUMENT_FRAGMENT_NODE :
// Children are traversed
break;
case Node.DOCUMENT_NODE :
break;
case Node.ELEMENT_NODE :
serializeElement((Element) node, true);
break;
case Node.PROCESSING_INSTRUCTION_NODE :
serializePI((ProcessingInstruction) node);
break;
case Node.CDATA_SECTION_NODE :
serializeCDATASection((CDATASection) node);
break;
case Node.TEXT_NODE :
serializeText((Text) node);
break;
case Node.ENTITY_REFERENCE_NODE :
serializeEntityReference((EntityReference) node, true);
break;
default :
}
} |
Start processing given node
@param node Node to process
@throws org.xml.sax.SAXException
| DOM3TreeWalker::startNode | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void endNode(Node node) throws org.xml.sax.SAXException {
switch (node.getNodeType()) {
case Node.DOCUMENT_NODE :
break;
case Node.DOCUMENT_TYPE_NODE :
serializeDocType((DocumentType) node, false);
break;
case Node.ELEMENT_NODE :
serializeElement((Element) node, false);
break;
case Node.CDATA_SECTION_NODE :
break;
case Node.ENTITY_REFERENCE_NODE :
serializeEntityReference((EntityReference) node, false);
break;
default :
}
} |
End processing of given node
@param node Node we just finished processing
@throws org.xml.sax.SAXException
| DOM3TreeWalker::endNode | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected boolean applyFilter(Node node, int nodeType) {
if (fFilter != null && (fWhatToShowFilter & nodeType) != 0) {
short code = fFilter.acceptNode(node);
switch (code) {
case NodeFilter.FILTER_REJECT :
case NodeFilter.FILTER_SKIP :
return false; // skip the node
default : // fall through..
}
}
return true;
} |
Applies a filter on the node to serialize
@param node The Node to serialize
@return True if the node is to be serialized else false if the node
is to be rejected or skipped.
| DOM3TreeWalker::applyFilter | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void serializeDocType(DocumentType node, boolean bStart)
throws SAXException {
// The DocType and internalSubset can not be modified in DOM and is
// considered to be well-formed as the outcome of successful parsing.
String docTypeName = node.getNodeName();
String publicId = node.getPublicId();
String systemId = node.getSystemId();
String internalSubset = node.getInternalSubset();
//DocumentType nodes are never passed to the filter
if (internalSubset != null && !"".equals(internalSubset)) {
if (bStart) {
try {
// The Serializer does not provide a way to write out the
// DOCTYPE internal subset via an event call, so we write it
// out here.
Writer writer = fSerializer.getWriter();
StringBuffer dtd = new StringBuffer();
dtd.append("<!DOCTYPE ");
dtd.append(docTypeName);
if (null != publicId) {
dtd.append(" PUBLIC \"");
dtd.append(publicId);
dtd.append('\"');
}
if (null != systemId) {
if (null == publicId) {
dtd.append(" SYSTEM \"");
} else {
dtd.append(" \"");
}
dtd.append(systemId);
dtd.append('\"');
}
dtd.append(" [ ");
dtd.append(fNewLine);
dtd.append(internalSubset);
dtd.append("]>");
dtd.append(new String(fNewLine));
writer.write(dtd.toString());
writer.flush();
} catch (IOException e) {
throw new SAXException(Utils.messages.createMessage(
MsgKey.ER_WRITING_INTERNAL_SUBSET, null), e);
}
} // else if !bStart do nothing
} else {
if (bStart) {
if (fLexicalHandler != null) {
fLexicalHandler.startDTD(docTypeName, publicId, systemId);
}
} else {
if (fLexicalHandler != null) {
fLexicalHandler.endDTD();
}
}
}
} |
Serializes a Document Type Node.
@param node The Docuemnt Type Node to serialize
@param bStart Invoked at the start or end of node. Default true.
| DOM3TreeWalker::serializeDocType | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void serializeComment(Comment node) throws SAXException {
// comments=true
if ((fFeatures & COMMENTS) != 0) {
String data = node.getData();
// well-formed=true
if ((fFeatures & WELLFORMED) != 0) {
isCommentWellFormed(data);
}
if (fLexicalHandler != null) {
// apply the LSSerializer filter after the operations requested by the
// DOMConfiguration parameters have been applied
if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) {
return;
}
fLexicalHandler.comment(data.toCharArray(), 0, data.length());
}
}
} |
Serializes a Comment Node.
@param node The Comment Node to serialize
| DOM3TreeWalker::serializeComment | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void serializeElement(Element node, boolean bStart)
throws SAXException {
if (bStart) {
fElementDepth++;
// We use the Xalan specific startElement and starPrefixMapping calls
// (and addAttribute and namespaceAfterStartElement) as opposed to
// SAX specific, for performance reasons as they reduce the overhead
// of creating an AttList object upfront.
// well-formed=true
if ((fFeatures & WELLFORMED) != 0) {
isElementWellFormed(node);
}
// REVISIT: We apply the LSSerializer filter for elements before
// namesapce fixup
if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) {
return;
}
// namespaces=true, record and fixup namspaced element
if ((fFeatures & NAMESPACES) != 0) {
fNSBinder.pushContext();
fLocalNSBinder.reset();
recordLocalNSDecl(node);
fixupElementNS(node);
}
// Namespace normalization
fSerializer.startElement(
node.getNamespaceURI(),
node.getLocalName(),
node.getNodeName());
serializeAttList(node);
} else {
fElementDepth--;
// apply the LSSerializer filter
if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) {
return;
}
this.fSerializer.endElement(
node.getNamespaceURI(),
node.getLocalName(),
node.getNodeName());
// since endPrefixMapping was not used by SerializationHandler it was removed
// for performance reasons.
if ((fFeatures & NAMESPACES) != 0 ) {
fNSBinder.popContext();
}
}
} |
Serializes an Element Node.
@param node The Element Node to serialize
@param bStart Invoked at the start or end of node.
| DOM3TreeWalker::serializeElement | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void serializeAttList(Element node) throws SAXException {
NamedNodeMap atts = node.getAttributes();
int nAttrs = atts.getLength();
for (int i = 0; i < nAttrs; i++) {
Node attr = atts.item(i);
String localName = attr.getLocalName();
String attrName = attr.getNodeName();
String attrPrefix = attr.getPrefix() == null ? "" : attr.getPrefix();
String attrValue = attr.getNodeValue();
// Determine the Attr's type.
String type = null;
if (fIsLevel3DOM) {
type = ((Attr) attr).getSchemaTypeInfo().getTypeName();
}
type = type == null ? "CDATA" : type;
String attrNS = attr.getNamespaceURI();
if (attrNS !=null && attrNS.length() == 0) {
attrNS=null;
// we must remove prefix for this attribute
attrName=attr.getLocalName();
}
boolean isSpecified = ((Attr) attr).getSpecified();
boolean addAttr = true;
boolean applyFilter = false;
boolean xmlnsAttr =
attrName.equals("xmlns") || attrName.startsWith("xmlns:");
// well-formed=true
if ((fFeatures & WELLFORMED) != 0) {
isAttributeWellFormed(attr);
}
//-----------------------------------------------------------------
// start Attribute namespace fixup
//-----------------------------------------------------------------
// namespaces=true, normalize all non-namespace attributes
// Step 3. Attribute
if ((fFeatures & NAMESPACES) != 0 && !xmlnsAttr) {
// If the Attr has a namespace URI
if (attrNS != null) {
attrPrefix = attrPrefix == null ? "" : attrPrefix;
String declAttrPrefix = fNSBinder.getPrefix(attrNS);
String declAttrNS = fNSBinder.getURI(attrPrefix);
// attribute has no prefix (default namespace decl does not apply to
// attributes)
// OR
// attribute prefix is not declared
// OR
// conflict: attribute has a prefix that conflicts with a binding
if ("".equals(attrPrefix) || "".equals(declAttrPrefix)
|| !attrPrefix.equals(declAttrPrefix)) {
// namespaceURI matches an in scope declaration of one or
// more prefixes
if (declAttrPrefix != null && !"".equals(declAttrPrefix)) {
// pick the prefix that was found and change attribute's
// prefix and nodeName.
attrPrefix = declAttrPrefix;
if (declAttrPrefix.length() > 0 ) {
attrName = declAttrPrefix + ":" + localName;
} else {
attrName = localName;
}
} else {
// The current prefix is not null and it has no in scope
// declaration
if (attrPrefix != null && !"".equals(attrPrefix)
&& declAttrNS == null) {
// declare this prefix
if ((fFeatures & NAMESPACEDECLS) != 0) {
fSerializer.addAttribute(XMLNS_URI, attrPrefix,
XMLNS_PREFIX + ":" + attrPrefix, "CDATA",
attrNS);
fNSBinder.declarePrefix(attrPrefix, attrNS);
fLocalNSBinder.declarePrefix(attrPrefix, attrNS);
}
} else {
// find a prefix following the pattern "NS" +index
// (starting at 1)
// make sure this prefix is not declared in the current
// scope.
int counter = 1;
attrPrefix = "NS" + counter++;
while (fLocalNSBinder.getURI(attrPrefix) != null) {
attrPrefix = "NS" + counter++;
}
// change attribute's prefix and Name
attrName = attrPrefix + ":" + localName;
// create a local namespace declaration attribute
// Add the xmlns declaration attribute
if ((fFeatures & NAMESPACEDECLS) != 0) {
fSerializer.addAttribute(XMLNS_URI, attrPrefix,
XMLNS_PREFIX + ":" + attrPrefix, "CDATA",
attrNS);
fNSBinder.declarePrefix(attrPrefix, attrNS);
fLocalNSBinder.declarePrefix(attrPrefix, attrNS);
}
}
}
}
} else { // if the Attr has no namespace URI
// Attr has no localName
if (localName == null) {
// DOM Level 1 node!
String msg = Utils.messages.createMessage(
MsgKey.ER_NULL_LOCAL_ELEMENT_NAME,
new Object[] { attrName });
if (fErrorHandler != null) {
fErrorHandler
.handleError(new DOMErrorImpl(
DOMError.SEVERITY_ERROR, msg,
MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, null,
null, null));
}
} else { // uri=null and no colon
// attr has no namespace URI and no prefix
// no action is required, since attrs don't use default
}
}
}
// discard-default-content=true
// Default attr's are not passed to the filter and this contraint
// is applied only when discard-default-content=true
// What about default xmlns attributes???? check for xmlnsAttr
if ((((fFeatures & DISCARDDEFAULT) != 0) && isSpecified)
|| ((fFeatures & DISCARDDEFAULT) == 0)) {
applyFilter = true;
} else {
addAttr = false;
}
if (applyFilter) {
// apply the filter for Attributes that are not default attributes
// or namespace decl attributes
if (fFilter != null
&& (fFilter.getWhatToShow() & NodeFilter.SHOW_ATTRIBUTE)
!= 0) {
if (!xmlnsAttr) {
short code = fFilter.acceptNode(attr);
switch (code) {
case NodeFilter.FILTER_REJECT :
case NodeFilter.FILTER_SKIP :
addAttr = false;
break;
default : //fall through..
}
}
}
}
// if the node is a namespace node
if (addAttr && xmlnsAttr) {
// If namespace-declarations=true, add the node , else don't add it
if ((fFeatures & NAMESPACEDECLS) != 0) {
// The namespace may have been fixed up, in that case don't add it.
if (localName != null && !"".equals(localName)) {
fSerializer.addAttribute(attrNS, localName, attrName, type, attrValue);
}
}
} else if (
addAttr && !xmlnsAttr) { // if the node is not a namespace node
// If namespace-declarations=true, add the node with the Attr nodes namespaceURI
// else add the node setting it's namespace to null or else the serializer will later
// attempt to add a xmlns attr for the prefixed attribute
if (((fFeatures & NAMESPACEDECLS) != 0) && (attrNS != null)) {
fSerializer.addAttribute(
attrNS,
localName,
attrName,
type,
attrValue);
} else {
fSerializer.addAttribute(
"",
localName,
attrName,
type,
attrValue);
}
}
//
if (xmlnsAttr && ((fFeatures & NAMESPACEDECLS) != 0)) {
int index;
// Use "" instead of null, as Xerces likes "" for the
// name of the default namespace. Fix attributed
// to "Steven Murray" <[email protected]>.
String prefix =
(index = attrName.indexOf(":")) < 0
? ""
: attrName.substring(index + 1);
if (!"".equals(prefix)) {
fSerializer.namespaceAfterStartElement(prefix, attrValue);
}
}
}
} |
Serializes the Attr Nodes of an Element.
@param node The OwnerElement whose Attr Nodes are to be serialized.
| DOM3TreeWalker::serializeAttList | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void serializePI(ProcessingInstruction node)
throws SAXException {
ProcessingInstruction pi = node;
String name = pi.getNodeName();
// well-formed=true
if ((fFeatures & WELLFORMED) != 0) {
isPIWellFormed(node);
}
// apply the LSSerializer filter
if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) {
return;
}
// String data = pi.getData();
if (name.equals("xslt-next-is-raw")) {
fNextIsRaw = true;
} else {
this.fSerializer.processingInstruction(name, pi.getData());
}
} |
Serializes an ProcessingInstruction Node.
@param node The ProcessingInstruction Node to serialize
| DOM3TreeWalker::serializePI | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void serializeCDATASection(CDATASection node)
throws SAXException {
// well-formed=true
if ((fFeatures & WELLFORMED) != 0) {
isCDATASectionWellFormed(node);
}
// cdata-sections = true
if ((fFeatures & CDATA) != 0) {
// split-cdata-sections = true
// Assumption: This parameter has an effect only when
// cdata-sections=true
// ToStream, by default splits cdata-sections. Hence the check
// below.
String nodeValue = node.getNodeValue();
int endIndex = nodeValue.indexOf("]]>");
if ((fFeatures & SPLITCDATA) != 0) {
if (endIndex >= 0) {
// The first node split will contain the ]] markers
String relatedData = nodeValue.substring(0, endIndex + 2);
String msg =
Utils.messages.createMessage(
MsgKey.ER_CDATA_SECTIONS_SPLIT,
null);
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_WARNING,
msg,
MsgKey.ER_CDATA_SECTIONS_SPLIT,
null,
relatedData,
null));
}
}
} else {
if (endIndex >= 0) {
// The first node split will contain the ]] markers
String relatedData = nodeValue.substring(0, endIndex + 2);
String msg =
Utils.messages.createMessage(
MsgKey.ER_CDATA_SECTIONS_SPLIT,
null);
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_ERROR,
msg,
MsgKey.ER_CDATA_SECTIONS_SPLIT));
}
// Report an error and return. What error???
return;
}
}
// apply the LSSerializer filter
if (!applyFilter(node, NodeFilter.SHOW_CDATA_SECTION)) {
return;
}
// splits the cdata-section
if (fLexicalHandler != null) {
fLexicalHandler.startCDATA();
}
dispatachChars(node);
if (fLexicalHandler != null) {
fLexicalHandler.endCDATA();
}
} else {
dispatachChars(node);
}
} |
Serializes an CDATASection Node.
@param node The CDATASection Node to serialize
| DOM3TreeWalker::serializeCDATASection | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void serializeText(Text node) throws SAXException {
if (fNextIsRaw) {
fNextIsRaw = false;
fSerializer.processingInstruction(
javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING,
"");
dispatachChars(node);
fSerializer.processingInstruction(
javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING,
"");
} else {
// keep track of dispatch or not to avoid duplicaiton of filter code
boolean bDispatch = false;
// well-formed=true
if ((fFeatures & WELLFORMED) != 0) {
isTextWellFormed(node);
}
// if the node is whitespace
// Determine the Attr's type.
boolean isElementContentWhitespace = false;
if (fIsLevel3DOM) {
isElementContentWhitespace =
node.isElementContentWhitespace();
}
if (isElementContentWhitespace) {
// element-content-whitespace=true
if ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) {
bDispatch = true;
}
} else {
bDispatch = true;
}
// apply the LSSerializer filter
if (!applyFilter(node, NodeFilter.SHOW_TEXT)) {
return;
}
if (bDispatch) {
dispatachChars(node);
}
}
} |
Serializes an Text Node.
@param node The Text Node to serialize
| DOM3TreeWalker::serializeText | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void serializeEntityReference(
EntityReference node,
boolean bStart)
throws SAXException {
if (bStart) {
EntityReference eref = node;
// entities=true
if ((fFeatures & ENTITIES) != 0) {
// perform well-formedness and other checking only if
// entities = true
// well-formed=true
if ((fFeatures & WELLFORMED) != 0) {
isEntityReferneceWellFormed(node);
}
// check "unbound-prefix-in-entity-reference" [fatal]
// Raised if the configuration parameter "namespaces" is set to true
if ((fFeatures & NAMESPACES) != 0) {
checkUnboundPrefixInEntRef(node);
}
// The filter should not apply in this case, since the
// EntityReference is not being expanded.
// should we pass entity reference nodes to the filter???
}
if (fLexicalHandler != null) {
// startEntity outputs only Text but not Element, Attr, Comment
// and PI child nodes. It does so by setting the m_inEntityRef
// in ToStream and using this to decide if a node is to be
// serialized or not.
fLexicalHandler.startEntity(eref.getNodeName());
}
} else {
EntityReference eref = node;
// entities=true or false,
if (fLexicalHandler != null) {
fLexicalHandler.endEntity(eref.getNodeName());
}
}
} |
Serializes an EntityReference Node.
@param node The EntityReference Node to serialize
@param bStart Inicates if called from start or endNode
| DOM3TreeWalker::serializeEntityReference | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected boolean isXMLName(String s, boolean xml11Version) {
if (s == null) {
return false;
}
if (!xml11Version)
return XMLChar.isValidName(s);
else
return XML11Char.isXML11ValidName(s);
} |
Taken from org.apache.xerces.dom.CoreDocumentImpl
Check the string against XML's definition of acceptable names for
elements and attributes and so on using the XMLCharacterProperties
utility class
| DOM3TreeWalker::isXMLName | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected boolean isValidQName(
String prefix,
String local,
boolean xml11Version) {
// check that both prefix and local part match NCName
if (local == null)
return false;
boolean validNCName = false;
if (!xml11Version) {
validNCName =
(prefix == null || XMLChar.isValidNCName(prefix))
&& XMLChar.isValidNCName(local);
} else {
validNCName =
(prefix == null || XML11Char.isXML11ValidNCName(prefix))
&& XML11Char.isXML11ValidNCName(local);
}
return validNCName;
} |
Taken from org.apache.xerces.dom.CoreDocumentImpl
Checks if the given qualified name is legal with respect
to the version of XML to which this document must conform.
@param prefix prefix of qualified name
@param local local part of qualified name
| DOM3TreeWalker::isValidQName | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected boolean isWFXMLChar(String chardata, Character refInvalidChar) {
if (chardata == null || (chardata.length() == 0)) {
return true;
}
char[] dataarray = chardata.toCharArray();
int datalength = dataarray.length;
// version of the document is XML 1.1
if (fIsXMLVersion11) {
//we need to check all characters as per production rules of XML11
int i = 0;
while (i < datalength) {
if (XML11Char.isXML11Invalid(dataarray[i++])) {
// check if this is a supplemental character
char ch = dataarray[i - 1];
if (XMLChar.isHighSurrogate(ch) && i < datalength) {
char ch2 = dataarray[i++];
if (XMLChar.isLowSurrogate(ch2)
&& XMLChar.isSupplemental(
XMLChar.supplemental(ch, ch2))) {
continue;
}
}
// Reference to invalid character which is returned
refInvalidChar = new Character(ch);
return false;
}
}
} // version of the document is XML 1.0
else {
// we need to check all characters as per production rules of XML 1.0
int i = 0;
while (i < datalength) {
if (XMLChar.isInvalid(dataarray[i++])) {
// check if this is a supplemental character
char ch = dataarray[i - 1];
if (XMLChar.isHighSurrogate(ch) && i < datalength) {
char ch2 = dataarray[i++];
if (XMLChar.isLowSurrogate(ch2)
&& XMLChar.isSupplemental(
XMLChar.supplemental(ch, ch2))) {
continue;
}
}
// Reference to invalid character which is returned
refInvalidChar = new Character(ch);
return false;
}
}
} // end-else fDocument.isXMLVersion()
return true;
} // isXMLCharWF |
Checks if a XML character is well-formed
@param characters A String of characters to be checked for Well-Formedness
@param refInvalidChar A reference to the character to be returned that was determined invalid.
| DOM3TreeWalker::isWFXMLChar | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected Character isWFXMLChar(String chardata) {
Character refInvalidChar;
if (chardata == null || (chardata.length() == 0)) {
return null;
}
char[] dataarray = chardata.toCharArray();
int datalength = dataarray.length;
// version of the document is XML 1.1
if (fIsXMLVersion11) {
//we need to check all characters as per production rules of XML11
int i = 0;
while (i < datalength) {
if (XML11Char.isXML11Invalid(dataarray[i++])) {
// check if this is a supplemental character
char ch = dataarray[i - 1];
if (XMLChar.isHighSurrogate(ch) && i < datalength) {
char ch2 = dataarray[i++];
if (XMLChar.isLowSurrogate(ch2)
&& XMLChar.isSupplemental(
XMLChar.supplemental(ch, ch2))) {
continue;
}
}
// Reference to invalid character which is returned
refInvalidChar = new Character(ch);
return refInvalidChar;
}
}
} // version of the document is XML 1.0
else {
// we need to check all characters as per production rules of XML 1.0
int i = 0;
while (i < datalength) {
if (XMLChar.isInvalid(dataarray[i++])) {
// check if this is a supplemental character
char ch = dataarray[i - 1];
if (XMLChar.isHighSurrogate(ch) && i < datalength) {
char ch2 = dataarray[i++];
if (XMLChar.isLowSurrogate(ch2)
&& XMLChar.isSupplemental(
XMLChar.supplemental(ch, ch2))) {
continue;
}
}
// Reference to invalid character which is returned
refInvalidChar = new Character(ch);
return refInvalidChar;
}
}
} // end-else fDocument.isXMLVersion()
return null;
} // isXMLCharWF |
Checks if a XML character is well-formed. If there is a problem with
the character a non-null Character is returned else null is returned.
@param characters A String of characters to be checked for Well-Formedness
@return Character A reference to the character to be returned that was determined invalid.
| DOM3TreeWalker::isWFXMLChar | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void isCommentWellFormed(String data) {
if (data == null || (data.length() == 0)) {
return;
}
char[] dataarray = data.toCharArray();
int datalength = dataarray.length;
// version of the document is XML 1.1
if (fIsXMLVersion11) {
// we need to check all chracters as per production rules of XML11
int i = 0;
while (i < datalength) {
char c = dataarray[i++];
if (XML11Char.isXML11Invalid(c)) {
// check if this is a supplemental character
if (XMLChar.isHighSurrogate(c) && i < datalength) {
char c2 = dataarray[i++];
if (XMLChar.isLowSurrogate(c2)
&& XMLChar.isSupplemental(
XMLChar.supplemental(c, c2))) {
continue;
}
}
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT,
new Object[] { new Character(c)});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER,
null,
null,
null));
}
} else if (c == '-' && i < datalength && dataarray[i] == '-') {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_DASH_IN_COMMENT,
null);
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER,
null,
null,
null));
}
}
}
} // version of the document is XML 1.0
else {
// we need to check all chracters as per production rules of XML 1.0
int i = 0;
while (i < datalength) {
char c = dataarray[i++];
if (XMLChar.isInvalid(c)) {
// check if this is a supplemental character
if (XMLChar.isHighSurrogate(c) && i < datalength) {
char c2 = dataarray[i++];
if (XMLChar.isLowSurrogate(c2)
&& XMLChar.isSupplemental(
XMLChar.supplemental(c, c2))) {
continue;
}
}
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT,
new Object[] { new Character(c)});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER,
null,
null,
null));
}
} else if (c == '-' && i < datalength && dataarray[i] == '-') {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_DASH_IN_COMMENT,
null);
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER,
null,
null,
null));
}
}
}
}
return;
} |
Checks if a comment node is well-formed
@param data The contents of the comment node
@return a boolean indiacating if the comment is well-formed or not.
| DOM3TreeWalker::isCommentWellFormed | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void isElementWellFormed(Node node) {
boolean isNameWF = false;
if ((fFeatures & NAMESPACES) != 0) {
isNameWF =
isValidQName(
node.getPrefix(),
node.getLocalName(),
fIsXMLVersion11);
} else {
isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11);
}
if (!isNameWF) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
new Object[] { "Element", node.getNodeName()});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
null,
null,
null));
}
}
} |
Checks if an element node is well-formed, by checking its Name for well-formedness.
@param data The contents of the comment node
@return a boolean indiacating if the comment is well-formed or not.
| DOM3TreeWalker::isElementWellFormed | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void isAttributeWellFormed(Node node) {
boolean isNameWF = false;
if ((fFeatures & NAMESPACES) != 0) {
isNameWF =
isValidQName(
node.getPrefix(),
node.getLocalName(),
fIsXMLVersion11);
} else {
isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11);
}
if (!isNameWF) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
new Object[] { "Attr", node.getNodeName()});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
null,
null,
null));
}
}
// Check the Attr's node value
// WFC: No < in Attribute Values
String value = node.getNodeValue();
if (value.indexOf('<') >= 0) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_LT_IN_ATTVAL,
new Object[] {
((Attr) node).getOwnerElement().getNodeName(),
node.getNodeName()});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_LT_IN_ATTVAL,
null,
null,
null));
}
}
// we need to loop through the children of attr nodes and check their values for
// well-formedness
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
// An attribute node with no text or entity ref child for example
// doc.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:ns");
// followes by
// element.setAttributeNodeNS(attribute);
// can potentially lead to this situation. If the attribute
// was a prefix Namespace attribute declaration then then DOM Core
// should have some exception defined for this.
if (child == null) {
// we should probably report an error
continue;
}
switch (child.getNodeType()) {
case Node.TEXT_NODE :
isTextWellFormed((Text) child);
break;
case Node.ENTITY_REFERENCE_NODE :
isEntityReferneceWellFormed((EntityReference) child);
break;
default :
}
}
// TODO:
// WFC: Check if the attribute prefix is bound to
// http://www.w3.org/2000/xmlns/
// WFC: Unique Att Spec
// Perhaps pass a seen boolean value to this method. serializeAttList will determine
// if the attr was seen before.
} |
Checks if an attr node is well-formed, by checking it's Name and value
for well-formedness.
@param data The contents of the comment node
@return a boolean indiacating if the comment is well-formed or not.
| DOM3TreeWalker::isAttributeWellFormed | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void isPIWellFormed(ProcessingInstruction node) {
// Is the PI Target a valid XML name
if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
new Object[] { "ProcessingInstruction", node.getTarget()});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
null,
null,
null));
}
}
// Does the PI Data carry valid XML characters
// REVISIT: Should we check if the PI DATA contains a ?> ???
Character invalidChar = isWFXMLChar(node.getData());
if (invalidChar != null) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_PI,
new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) });
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER,
null,
null,
null));
}
}
} |
Checks if a PI node is well-formed, by checking it's Name and data
for well-formedness.
@param data The contents of the comment node
| DOM3TreeWalker::isPIWellFormed | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void isCDATASectionWellFormed(CDATASection node) {
// Does the data valid XML character data
Character invalidChar = isWFXMLChar(node.getData());
//if (!isWFXMLChar(node.getData(), invalidChar)) {
if (invalidChar != null) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA,
new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) });
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER,
null,
null,
null));
}
}
} |
Checks if an CDATASection node is well-formed, by checking it's data
for well-formedness. Note that the presence of a CDATA termination mark
in the contents of a CDATASection is handled by the parameter
spli-cdata-sections
@param data The contents of the comment node
| DOM3TreeWalker::isCDATASectionWellFormed | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void isTextWellFormed(Text node) {
// Does the data valid XML character data
Character invalidChar = isWFXMLChar(node.getData());
if (invalidChar != null) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT,
new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) });
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER,
null,
null,
null));
}
}
} |
Checks if an Text node is well-formed, by checking if it contains invalid
XML characters.
@param data The contents of the comment node
| DOM3TreeWalker::isTextWellFormed | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void isEntityReferneceWellFormed(EntityReference node) {
// Is the EntityReference name a valid XML name
if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
new Object[] { "EntityReference", node.getNodeName()});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
null,
null,
null));
}
}
// determine the parent node
Node parent = node.getParentNode();
// Traverse the declared entities and check if the nodeName and namespaceURI
// of the EntityReference matches an Entity. If so, check the if the notationName
// is not null, if so, report an error.
DocumentType docType = node.getOwnerDocument().getDoctype();
if (docType != null) {
NamedNodeMap entities = docType.getEntities();
for (int i = 0; i < entities.getLength(); i++) {
Entity ent = (Entity) entities.item(i);
String nodeName =
node.getNodeName() == null ? "" : node.getNodeName();
String nodeNamespaceURI =
node.getNamespaceURI() == null
? ""
: node.getNamespaceURI();
String entName =
ent.getNodeName() == null ? "" : ent.getNodeName();
String entNamespaceURI =
ent.getNamespaceURI() == null ? "" : ent.getNamespaceURI();
// If referenced in Element content
// WFC: Parsed Entity
if (parent.getNodeType() == Node.ELEMENT_NODE) {
if (entNamespaceURI.equals(nodeNamespaceURI)
&& entName.equals(nodeName)) {
if (ent.getNotationName() != null) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_REF_TO_UNPARSED_ENT,
new Object[] { node.getNodeName()});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_REF_TO_UNPARSED_ENT,
null,
null,
null));
}
}
}
} // end if WFC: Parsed Entity
// If referenced in an Attr value
// WFC: No External Entity References
if (parent.getNodeType() == Node.ATTRIBUTE_NODE) {
if (entNamespaceURI.equals(nodeNamespaceURI)
&& entName.equals(nodeName)) {
if (ent.getPublicId() != null
|| ent.getSystemId() != null
|| ent.getNotationName() != null) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_WF_REF_TO_EXTERNAL_ENT,
new Object[] { node.getNodeName()});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_WF_REF_TO_EXTERNAL_ENT,
null,
null,
null));
}
}
}
} //end if WFC: No External Entity References
}
}
} // isEntityReferneceWellFormed |
Checks if an EntityRefernece node is well-formed, by checking it's node name. Then depending
on whether it is referenced in Element content or in an Attr Node, checks if the EntityReference
references an unparsed entity or a external entity and if so throws raises the
appropriate well-formedness error.
@param data The contents of the comment node
@parent The parent of the EntityReference Node
| DOM3TreeWalker::isEntityReferneceWellFormed | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void checkUnboundPrefixInEntRef(Node node) {
Node child, next;
for (child = node.getFirstChild(); child != null; child = next) {
next = child.getNextSibling();
if (child.getNodeType() == Node.ELEMENT_NODE) {
//If a NamespaceURI is not declared for the current
//node's prefix, raise a fatal error.
String prefix = child.getPrefix();
if (prefix != null
&& fNSBinder.getURI(prefix) == null) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF,
new Object[] {
node.getNodeName(),
child.getNodeName(),
prefix });
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF,
null,
null,
null));
}
}
NamedNodeMap attrs = child.getAttributes();
for (int i = 0; i < attrs.getLength(); i++) {
String attrPrefix = attrs.item(i).getPrefix();
if (attrPrefix != null
&& fNSBinder.getURI(attrPrefix) == null) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF,
new Object[] {
node.getNodeName(),
child.getNodeName(),
attrs.item(i)});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_FATAL_ERROR,
msg,
MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF,
null,
null,
null));
}
}
}
}
if (child.hasChildNodes()) {
checkUnboundPrefixInEntRef(child);
}
}
} |
If the configuration parameter "namespaces" is set to true, this methods
checks if an entity whose replacement text contains unbound namespace
prefixes is referenced in a location where there are no bindings for
the namespace prefixes and if so raises a LSException with the error-type
"unbound-prefix-in-entity-reference"
@param Node, The EntityReference nodes whose children are to be checked
| DOM3TreeWalker::checkUnboundPrefixInEntRef | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void recordLocalNSDecl(Node node) {
NamedNodeMap atts = ((Element) node).getAttributes();
int length = atts.getLength();
for (int i = 0; i < length; i++) {
Node attr = atts.item(i);
String localName = attr.getLocalName();
String attrPrefix = attr.getPrefix();
String attrValue = attr.getNodeValue();
String attrNS = attr.getNamespaceURI();
localName =
localName == null
|| XMLNS_PREFIX.equals(localName) ? "" : localName;
attrPrefix = attrPrefix == null ? "" : attrPrefix;
attrValue = attrValue == null ? "" : attrValue;
attrNS = attrNS == null ? "" : attrNS;
// check if attribute is a namespace decl
if (XMLNS_URI.equals(attrNS)) {
// No prefix may be bound to http://www.w3.org/2000/xmlns/.
if (XMLNS_URI.equals(attrValue)) {
String msg =
Utils.messages.createMessage(
MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND,
new Object[] { attrPrefix, XMLNS_URI });
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_ERROR,
msg,
MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND,
null,
null,
null));
}
} else {
// store the namespace-declaration
if (XMLNS_PREFIX.equals(attrPrefix) ) {
// record valid decl
if (attrValue.length() != 0) {
fNSBinder.declarePrefix(localName, attrValue);
} else {
// Error; xmlns:prefix=""
}
} else { // xmlns
// empty prefix is always bound ("" or some string)
fNSBinder.declarePrefix("", attrValue);
}
}
}
}
} |
Records local namespace declarations, to be used for normalization later
@param Node, The element node, whose namespace declarations are to be recorded
| DOM3TreeWalker::recordLocalNSDecl | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void fixupElementNS(Node node) throws SAXException {
String namespaceURI = ((Element) node).getNamespaceURI();
String prefix = ((Element) node).getPrefix();
String localName = ((Element) node).getLocalName();
if (namespaceURI != null) {
//if ( Element's prefix/namespace pair (or default namespace,
// if no prefix) are within the scope of a binding )
prefix = prefix == null ? "" : prefix;
String inScopeNamespaceURI = fNSBinder.getURI(prefix);
if ((inScopeNamespaceURI != null
&& inScopeNamespaceURI.equals(namespaceURI))) {
// do nothing, declaration in scope is inherited
} else {
// Create a local namespace declaration attr for this namespace,
// with Element's current prefix (or a default namespace, if
// no prefix). If there's a conflicting local declaration
// already present, change its value to use this namespace.
// Add the xmlns declaration attribute
//fNSBinder.pushNamespace(prefix, namespaceURI, fElementDepth);
if ((fFeatures & NAMESPACEDECLS) != 0) {
if ("".equals(prefix) || "".equals(namespaceURI)) {
((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, namespaceURI);
} else {
((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX + ":" + prefix, namespaceURI);
}
}
fLocalNSBinder.declarePrefix(prefix, namespaceURI);
fNSBinder.declarePrefix(prefix, namespaceURI);
}
} else {
// Element has no namespace
// DOM Level 1
if (localName == null || "".equals(localName)) {
// DOM Level 1 node!
String msg =
Utils.messages.createMessage(
MsgKey.ER_NULL_LOCAL_ELEMENT_NAME,
new Object[] { node.getNodeName()});
if (fErrorHandler != null) {
fErrorHandler.handleError(
new DOMErrorImpl(
DOMError.SEVERITY_ERROR,
msg,
MsgKey.ER_NULL_LOCAL_ELEMENT_NAME,
null,
null,
null));
}
} else {
namespaceURI = fNSBinder.getURI("");
if (namespaceURI !=null && namespaceURI.length() > 0) {
((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, "");
fLocalNSBinder.declarePrefix("", "");
fNSBinder.declarePrefix("", "");
}
}
}
} |
Fixes an element's namespace
@param Node, The element node, whose namespace is to be fixed
| DOM3TreeWalker::fixupElementNS | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
protected void initProperties(Properties properties) {
for (Enumeration keys = properties.keys(); keys.hasMoreElements();) {
final String key = (String) keys.nextElement();
// caonical-form
// Other features will be enabled or disabled when this is set to true or false.
// error-handler; set via the constructor
// infoset
// Other features will be enabled or disabled when this is set to true
// A quick lookup for the given set of properties (cdata-sections ...)
final Object iobj = s_propKeys.get(key);
if (iobj != null) {
if (iobj instanceof Integer) {
// Dealing with a property that has a simple bit value that
// we need to set
// cdata-sections
// comments
// element-content-whitespace
// entities
// namespaces
// namespace-declarations
// split-cdata-sections
// well-formed
// discard-default-content
final int BITFLAG = ((Integer) iobj).intValue();
if ((properties.getProperty(key).endsWith("yes"))) {
fFeatures = fFeatures | BITFLAG;
} else {
fFeatures = fFeatures & ~BITFLAG;
}
} else {
// We are interested in the property, but it is not
// a simple bit that we need to set.
if ((DOMConstants.S_DOM3_PROPERTIES_NS
+ DOMConstants.DOM_FORMAT_PRETTY_PRINT)
.equals(key)) {
// format-pretty-print; set internally on the serializers via xsl:output properties in LSSerializer
if ((properties.getProperty(key).endsWith("yes"))) {
fSerializer.setIndent(true);
fSerializer.setIndentAmount(3);
} else {
fSerializer.setIndent(false);
}
} else if (
(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL).equals(
key)) {
// omit-xml-declaration; set internally on the serializers via xsl:output properties in LSSerializer
if ((properties.getProperty(key).endsWith("yes"))) {
fSerializer.setOmitXMLDeclaration(true);
} else {
fSerializer.setOmitXMLDeclaration(false);
}
} else if (
(
DOMConstants.S_XERCES_PROPERTIES_NS
+ DOMConstants.S_XML_VERSION).equals(
key)) {
// Retreive the value of the XML Version attribute via the xml-version
String version = properties.getProperty(key);
if ("1.1".equals(version)) {
fIsXMLVersion11 = true;
fSerializer.setVersion(version);
} else {
fSerializer.setVersion("1.0");
}
} else if (
(DOMConstants.S_XSL_OUTPUT_ENCODING).equals(key)) {
// Retreive the value of the XML Encoding attribute
String encoding = properties.getProperty(key);
if (encoding != null) {
fSerializer.setEncoding(encoding);
}
} else if ((DOMConstants.S_XERCES_PROPERTIES_NS
+ DOMConstants.DOM_ENTITIES).equals(key)) {
// Preserve entity references in the document
if ((properties.getProperty(key).endsWith("yes"))) {
fSerializer.setDTDEntityExpansion(false);
}
else {
fSerializer.setDTDEntityExpansion(true);
}
} else {
// We shouldn't get here, ever, now what?
}
}
}
}
// Set the newLine character to use
if (fNewLine != null) {
fSerializer.setOutputProperty(OutputPropertiesFactory.S_KEY_LINE_SEPARATOR, fNewLine);
}
} |
Initializes fFeatures based on the DOMConfiguration Parameters set.
@param properties DOMConfiguraiton properties that were set and which are
to be used while serializing the DOM.
| DOM3TreeWalker::initProperties | java | Reginer/aosp-android-jar | android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | MIT |
public HardwareConfig(int type) {
this.type = type;
} |
default constructor.
| HardwareConfig::HardwareConfig | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/HardwareConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/HardwareConfig.java | MIT |
public HardwareConfig(String res) {
String split[] = res.split(",");
type = Integer.parseInt(split[0]);
switch (type) {
case DEV_HARDWARE_TYPE_MODEM: {
assignModem(
split[1].trim(), /* uuid */
Integer.parseInt(split[2]), /* state */
Integer.parseInt(split[3]), /* ril-model */
Integer.parseInt(split[4]), /* rat */
Integer.parseInt(split[5]), /* max-voice */
Integer.parseInt(split[6]), /* max-data */
Integer.parseInt(split[7]) /* max-standby */
);
break;
}
case DEV_HARDWARE_TYPE_SIM: {
assignSim(
split[1].trim(), /* uuid */
Integer.parseInt(split[2]), /* state */
split[3].trim() /* modem-uuid */
);
break;
}
}
} |
create from a resource string format.
| HardwareConfig::HardwareConfig | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/HardwareConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/HardwareConfig.java | MIT |
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
return new XNumber(getArg0AsNumber(xctxt));
} |
Execute the function. The function must return
a valid object.
@param xctxt The current execution context.
@return A valid XObject.
@throws javax.xml.transform.TransformerException
| FuncNumber::execute | java | Reginer/aosp-android-jar | android-34/src/org/apache/xpath/functions/FuncNumber.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xpath/functions/FuncNumber.java | MIT |
public static List<String> getAllCodePaths(AndroidPackage aPkg) {
PackageImpl pkg = (PackageImpl) aPkg;
ArrayList<String> paths = new ArrayList<>();
paths.add(pkg.getBaseApkPath());
String[] splitCodePaths = pkg.getSplitCodePaths();
if (!ArrayUtils.isEmpty(splitCodePaths)) {
Collections.addAll(paths, splitCodePaths);
}
return paths;
} |
@return a list of the base and split code paths.
| AndroidPackageUtils::getAllCodePaths | java | Reginer/aosp-android-jar | android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | MIT |
public static Map<String, String> getPackageDexMetadata(AndroidPackage pkg) {
return DexMetadataHelper.buildPackageApkToDexMetadataMap
(AndroidPackageUtils.getAllCodePaths(pkg));
} |
Return the dex metadata files for the given package as a map
[code path -> dex metadata path].
NOTE: involves I/O checks.
| AndroidPackageUtils::getPackageDexMetadata | java | Reginer/aosp-android-jar | android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | MIT |
public static void validatePackageDexMetadata(AndroidPackage pkg)
throws PackageParserException {
Collection<String> apkToDexMetadataList = getPackageDexMetadata(pkg).values();
String packageName = pkg.getPackageName();
long versionCode = pkg.getLongVersionCode();
final ParseTypeImpl input = ParseTypeImpl.forDefaultParsing();
for (String dexMetadata : apkToDexMetadataList) {
final ParseResult result = DexMetadataHelper.validateDexMetadataFile(
input.reset(), dexMetadata, packageName, versionCode);
if (result.isError()) {
throw new PackageParserException(
result.getErrorCode(), result.getErrorMessage(), result.getException());
}
}
} |
Validate the dex metadata files installed for the given package.
@throws PackageParserException in case of errors.
| AndroidPackageUtils::validatePackageDexMetadata | java | Reginer/aosp-android-jar | android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | MIT |
public static boolean isMatchForSystemOnly(@NonNull PackageState packageState, long flags) {
if ((flags & PackageManager.MATCH_SYSTEM_ONLY) != 0) {
return packageState.isSystem();
}
return true;
} |
Returns false iff the provided flags include the {@link PackageManager#MATCH_SYSTEM_ONLY}
flag and the provided package is not a system package. Otherwise returns {@code true}.
| AndroidPackageUtils::isMatchForSystemOnly | java | Reginer/aosp-android-jar | android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | MIT |
public static String getRawPrimaryCpuAbi(AndroidPackage pkg) {
return ((AndroidPackageHidden) pkg).getPrimaryCpuAbi();
} |
Returns the primary ABI as parsed from the package. Used only during parsing and derivation.
Otherwise prefer {@link PackageState#getPrimaryCpuAbi()}.
| AndroidPackageUtils::getRawPrimaryCpuAbi | java | Reginer/aosp-android-jar | android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | MIT |
public static String getRawSecondaryCpuAbi(@NonNull AndroidPackage pkg) {
return ((AndroidPackageHidden) pkg).getSecondaryCpuAbi();
} |
Returns the secondary ABI as parsed from the package. Used only during parsing and
derivation. Otherwise prefer {@link PackageState#getSecondaryCpuAbi()}.
| AndroidPackageUtils::getRawSecondaryCpuAbi | java | Reginer/aosp-android-jar | android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java | MIT |
static Comparator<ChronoLocalDate> timeLineOrder() {
return AbstractChronology.DATE_ORDER;
} |
Gets a comparator that compares {@code ChronoLocalDate} in
time-line order ignoring the chronology.
<p>
This comparator differs from the comparison in {@link #compareTo} in that it
only compares the underlying date and not the chronology.
This allows dates in different calendar systems to be compared based
on the position of the date on the local time-line.
The underlying comparison is equivalent to comparing the epoch-day.
@return a comparator that compares in time-line order ignoring the chronology
@see #isAfter
@see #isBefore
@see #isEqual
| timeLineOrder | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
static ChronoLocalDate from(TemporalAccessor temporal) {
if (temporal instanceof ChronoLocalDate) {
return (ChronoLocalDate) temporal;
}
Objects.requireNonNull(temporal, "temporal");
Chronology chrono = temporal.query(TemporalQueries.chronology());
if (chrono == null) {
throw new DateTimeException("Unable to obtain ChronoLocalDate from TemporalAccessor: " + temporal.getClass());
}
return chrono.date(temporal);
} |
Obtains an instance of {@code ChronoLocalDate} from a temporal object.
<p>
This obtains a local date based on the specified temporal.
A {@code TemporalAccessor} represents an arbitrary set of date and time information,
which this factory converts to an instance of {@code ChronoLocalDate}.
<p>
The conversion extracts and combines the chronology and the date
from the temporal object. The behavior is equivalent to using
{@link Chronology#date(TemporalAccessor)} with the extracted chronology.
Implementations are permitted to perform optimizations such as accessing
those fields that are equivalent to the relevant objects.
<p>
This method matches the signature of the functional interface {@link TemporalQuery}
allowing it to be used as a query via method reference, {@code ChronoLocalDate::from}.
@param temporal the temporal object to convert, not null
@return the date, not null
@throws DateTimeException if unable to convert to a {@code ChronoLocalDate}
@see Chronology#date(TemporalAccessor)
| from | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
default Era getEra() {
return getChronology().eraOf(get(ERA));
} |
Gets the era, as defined by the chronology.
<p>
The era is, conceptually, the largest division of the time-line.
Most calendar systems have a single epoch dividing the time-line into two eras.
However, some have multiple eras, such as one for the reign of each leader.
The exact meaning is determined by the {@code Chronology}.
<p>
All correctly implemented {@code Era} classes are singletons, thus it
is valid code to write {@code date.getEra() == SomeChrono.ERA_NAME)}.
<p>
This default implementation uses {@link Chronology#eraOf(int)}.
@return the chronology specific era constant applicable at this date, not null
| getEra | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
default boolean isLeapYear() {
return getChronology().isLeapYear(getLong(YEAR));
} |
Checks if the year is a leap year, as defined by the calendar system.
<p>
A leap-year is a year of a longer length than normal.
The exact meaning is determined by the chronology with the constraint that
a leap-year must imply a year-length longer than a non leap-year.
<p>
This default implementation uses {@link Chronology#isLeapYear(long)}.
@return true if this date is in a leap year, false otherwise
| isLeapYear | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
default int lengthOfYear() {
return (isLeapYear() ? 366 : 365);
} |
Returns the length of the year represented by this date, as defined by the calendar system.
<p>
This returns the length of the year in days.
<p>
The default implementation uses {@link #isLeapYear()} and returns 365 or 366.
@return the length of the year in days
| lengthOfYear | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
default String format(DateTimeFormatter formatter) {
Objects.requireNonNull(formatter, "formatter");
return formatter.format(this);
} |
Formats this date using the specified formatter.
<p>
This date will be passed to the formatter to produce a string.
<p>
The default implementation must behave as follows:
<pre>
return formatter.format(this);
</pre>
@param formatter the formatter to use, not null
@return the formatted date string, not null
@throws DateTimeException if an error occurs during printing
| format | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
default long toEpochDay() {
return getLong(EPOCH_DAY);
} |
Converts this date to the Epoch Day.
<p>
The {@link ChronoField#EPOCH_DAY Epoch Day count} is a simple
incrementing count of days where day 0 is 1970-01-01 (ISO).
This definition is the same for all chronologies, enabling conversion.
<p>
This default implementation queries the {@code EPOCH_DAY} field.
@return the Epoch Day equivalent to this date
| toEpochDay | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
default boolean isAfter(ChronoLocalDate other) {
return this.toEpochDay() > other.toEpochDay();
} |
Checks if this date is after the specified date ignoring the chronology.
<p>
This method differs from the comparison in {@link #compareTo} in that it
only compares the underlying date and not the chronology.
This allows dates in different calendar systems to be compared based
on the time-line position.
This is equivalent to using {@code date1.toEpochDay() > date2.toEpochDay()}.
<p>
This default implementation performs the comparison based on the epoch-day.
@param other the other date to compare to, not null
@return true if this is after the specified date
| isAfter | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
default boolean isBefore(ChronoLocalDate other) {
return this.toEpochDay() < other.toEpochDay();
} |
Checks if this date is before the specified date ignoring the chronology.
<p>
This method differs from the comparison in {@link #compareTo} in that it
only compares the underlying date and not the chronology.
This allows dates in different calendar systems to be compared based
on the time-line position.
This is equivalent to using {@code date1.toEpochDay() < date2.toEpochDay()}.
<p>
This default implementation performs the comparison based on the epoch-day.
@param other the other date to compare to, not null
@return true if this is before the specified date
| isBefore | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
default boolean isEqual(ChronoLocalDate other) {
return this.toEpochDay() == other.toEpochDay();
} |
Checks if this date is equal to the specified date ignoring the chronology.
<p>
This method differs from the comparison in {@link #compareTo} in that it
only compares the underlying date and not the chronology.
This allows dates in different calendar systems to be compared based
on the time-line position.
This is equivalent to using {@code date1.toEpochDay() == date2.toEpochDay()}.
<p>
This default implementation performs the comparison based on the epoch-day.
@param other the other date to compare to, not null
@return true if the underlying date is equal to the specified date
| isEqual | java | Reginer/aosp-android-jar | android-32/src/java/time/chrono/ChronoLocalDate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/time/chrono/ChronoLocalDate.java | MIT |
public hc_nodevalue02(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "hc_staff", true);
} |
Constructor.
@param factory document factory, may not be null
@throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
| hc_nodevalue02::hc_nodevalue02 | java | Reginer/aosp-android-jar | android-31/src/org/w3c/domts/level1/core/hc_nodevalue02.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/hc_nodevalue02.java | MIT |
public void runTest() throws Throwable {
Document doc;
Node newNode;
String newValue;
doc = (Document) load("hc_staff", true);
newNode = doc.createComment("This is a new Comment node");
newValue = newNode.getNodeValue();
assertEquals("initial", "This is a new Comment node", newValue);
newNode.setNodeValue("This should have an effect");
newValue = newNode.getNodeValue();
assertEquals("afterChange", "This should have an effect", newValue);
} |
Runs the test case.
@throws Throwable Any uncaught exception causes test to fail
| hc_nodevalue02::runTest | java | Reginer/aosp-android-jar | android-31/src/org/w3c/domts/level1/core/hc_nodevalue02.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/hc_nodevalue02.java | MIT |
public String getTargetURI() {
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue02";
} |
Gets URI that identifies the test.
@return uri identifier of test
| hc_nodevalue02::getTargetURI | java | Reginer/aosp-android-jar | android-31/src/org/w3c/domts/level1/core/hc_nodevalue02.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/hc_nodevalue02.java | MIT |
public static void main(final String[] args) {
DOMTestCase.doMain(hc_nodevalue02.class, args);
} |
Runs this test from the command line.
@param args command line arguments
| hc_nodevalue02::main | java | Reginer/aosp-android-jar | android-31/src/org/w3c/domts/level1/core/hc_nodevalue02.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/hc_nodevalue02.java | MIT |
public Enumeration<String> getKeys() {
ResourceBundle parent = this.parent;
return new ResourceBundleEnumeration(lookup.keySet(),
(parent != null) ? parent.getKeys() : null);
} |
Returns an <code>Enumeration</code> of the keys contained in
this <code>ResourceBundle</code> and its parent bundles.
@return an <code>Enumeration</code> of the keys contained in
this <code>ResourceBundle</code> and its parent bundles.
@see #keySet()
| PropertyResourceBundle::getKeys | java | Reginer/aosp-android-jar | android-31/src/java/util/PropertyResourceBundle.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/util/PropertyResourceBundle.java | MIT |
protected Set<String> handleKeySet() {
return lookup.keySet();
} |
Returns a <code>Set</code> of the keys contained
<em>only</em> in this <code>ResourceBundle</code>.
@return a <code>Set</code> of the keys contained only in this
<code>ResourceBundle</code>
@since 1.6
@see #keySet()
| PropertyResourceBundle::handleKeySet | java | Reginer/aosp-android-jar | android-31/src/java/util/PropertyResourceBundle.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/util/PropertyResourceBundle.java | MIT |
protected void start() {
// TODO: Think about ways to push these creation rules out of Dependency to cut down
// on imports.
mProviders.put(TIME_TICK_HANDLER, mTimeTickHandler::get);
mProviders.put(BG_LOOPER, mBgLooper::get);
mProviders.put(MAIN_LOOPER, mMainLooper::get);
mProviders.put(MAIN_HANDLER, mMainHandler::get);
mProviders.put(MAIN_EXECUTOR, mMainExecutor::get);
mProviders.put(BACKGROUND_EXECUTOR, mBackgroundExecutor::get);
mProviders.put(ActivityStarter.class, mActivityStarter::get);
mProviders.put(BroadcastDispatcher.class, mBroadcastDispatcher::get);
mProviders.put(AsyncSensorManager.class, mAsyncSensorManager::get);
mProviders.put(BluetoothController.class, mBluetoothController::get);
mProviders.put(SensorPrivacyManager.class, mSensorPrivacyManager::get);
mProviders.put(LocationController.class, mLocationController::get);
mProviders.put(RotationLockController.class, mRotationLockController::get);
mProviders.put(ZenModeController.class, mZenModeController::get);
mProviders.put(HotspotController.class, mHotspotController::get);
mProviders.put(CastController.class, mCastController::get);
mProviders.put(FlashlightController.class, mFlashlightController::get);
mProviders.put(KeyguardStateController.class, mKeyguardMonitor::get);
mProviders.put(KeyguardUpdateMonitor.class, mKeyguardUpdateMonitor::get);
mProviders.put(UserSwitcherController.class, mUserSwitcherController::get);
mProviders.put(UserInfoController.class, mUserInfoController::get);
mProviders.put(BatteryController.class, mBatteryController::get);
mProviders.put(NightDisplayListener.class, mNightDisplayListener::get);
mProviders.put(ReduceBrightColorsController.class, mReduceBrightColorsController::get);
mProviders.put(ManagedProfileController.class, mManagedProfileController::get);
mProviders.put(NextAlarmController.class, mNextAlarmController::get);
mProviders.put(DataSaverController.class, mDataSaverController::get);
mProviders.put(AccessibilityController.class, mAccessibilityController::get);
mProviders.put(DeviceProvisionedController.class, mDeviceProvisionedController::get);
mProviders.put(PluginManager.class, mPluginManager::get);
mProviders.put(AssistManager.class, mAssistManager::get);
mProviders.put(SecurityController.class, mSecurityController::get);
mProviders.put(LeakDetector.class, mLeakDetector::get);
mProviders.put(LEAK_REPORT_EMAIL, mLeakReportEmail::get);
mProviders.put(LeakReporter.class, mLeakReporter::get);
mProviders.put(GarbageMonitor.class, mGarbageMonitor::get);
mProviders.put(TunerService.class, mTunerService::get);
mProviders.put(NotificationShadeWindowController.class,
mNotificationShadeWindowController::get);
mProviders.put(StatusBarWindowController.class, mTempStatusBarWindowController::get);
mProviders.put(DarkIconDispatcher.class, mDarkIconDispatcher::get);
mProviders.put(ConfigurationController.class, mConfigurationController::get);
mProviders.put(StatusBarIconController.class, mStatusBarIconController::get);
mProviders.put(ScreenLifecycle.class, mScreenLifecycle::get);
mProviders.put(WakefulnessLifecycle.class, mWakefulnessLifecycle::get);
mProviders.put(FragmentService.class, mFragmentService::get);
mProviders.put(ExtensionController.class, mExtensionController::get);
mProviders.put(PluginDependencyProvider.class, mPluginDependencyProvider::get);
mProviders.put(LocalBluetoothManager.class, mLocalBluetoothManager::get);
mProviders.put(VolumeDialogController.class, mVolumeDialogController::get);
mProviders.put(MetricsLogger.class, mMetricsLogger::get);
mProviders.put(AccessibilityManagerWrapper.class, mAccessibilityManagerWrapper::get);
mProviders.put(SysuiColorExtractor.class, mSysuiColorExtractor::get);
mProviders.put(TunablePaddingService.class, mTunablePaddingService::get);
mProviders.put(ForegroundServiceController.class, mForegroundServiceController::get);
mProviders.put(UiOffloadThread.class, mUiOffloadThread::get);
mProviders.put(PowerUI.WarningsUI.class, mWarningsUI::get);
mProviders.put(LightBarController.class, mLightBarController::get);
mProviders.put(IWindowManager.class, mIWindowManager::get);
mProviders.put(OverviewProxyService.class, mOverviewProxyService::get);
mProviders.put(NavigationModeController.class, mNavBarModeController::get);
mProviders.put(AccessibilityButtonModeObserver.class,
mAccessibilityButtonModeObserver::get);
mProviders.put(AccessibilityButtonTargetsObserver.class,
mAccessibilityButtonListController::get);
mProviders.put(EnhancedEstimates.class, mEnhancedEstimates::get);
mProviders.put(VibratorHelper.class, mVibratorHelper::get);
mProviders.put(IStatusBarService.class, mIStatusBarService::get);
mProviders.put(DisplayMetrics.class, mDisplayMetrics::get);
mProviders.put(LockscreenGestureLogger.class, mLockscreenGestureLogger::get);
mProviders.put(KeyguardEnvironment.class, mKeyguardEnvironment::get);
mProviders.put(ShadeController.class, mShadeController::get);
mProviders.put(NotificationRemoteInputManager.Callback.class,
mNotificationRemoteInputManagerCallback::get);
mProviders.put(AppOpsController.class, mAppOpsController::get);
mProviders.put(NavigationBarController.class, mNavigationBarController::get);
mProviders.put(AccessibilityFloatingMenuController.class,
mAccessibilityFloatingMenuController::get);
mProviders.put(StatusBarStateController.class, mStatusBarStateController::get);
mProviders.put(NotificationLockscreenUserManager.class,
mNotificationLockscreenUserManager::get);
mProviders.put(VisualStabilityManager.class, mVisualStabilityManager::get);
mProviders.put(NotificationGroupManagerLegacy.class, mNotificationGroupManager::get);
mProviders.put(NotificationGroupAlertTransferHelper.class,
mNotificationGroupAlertTransferHelper::get);
mProviders.put(NotificationMediaManager.class, mNotificationMediaManager::get);
mProviders.put(NotificationGutsManager.class, mNotificationGutsManager::get);
mProviders.put(NotificationRemoteInputManager.class,
mNotificationRemoteInputManager::get);
mProviders.put(SmartReplyConstants.class, mSmartReplyConstants::get);
mProviders.put(NotificationListener.class, mNotificationListener::get);
mProviders.put(NotificationLogger.class, mNotificationLogger::get);
mProviders.put(NotificationViewHierarchyManager.class,
mNotificationViewHierarchyManager::get);
mProviders.put(NotificationFilter.class, mNotificationFilter::get);
mProviders.put(KeyguardDismissUtil.class, mKeyguardDismissUtil::get);
mProviders.put(SmartReplyController.class, mSmartReplyController::get);
mProviders.put(RemoteInputQuickSettingsDisabler.class,
mRemoteInputQuickSettingsDisabler::get);
mProviders.put(NotificationEntryManager.class, mNotificationEntryManager::get);
mProviders.put(ForegroundServiceNotificationListener.class,
mForegroundServiceNotificationListener::get);
mProviders.put(ClockManager.class, mClockManager::get);
mProviders.put(PrivacyItemController.class, mPrivacyItemController::get);
mProviders.put(ActivityManagerWrapper.class, mActivityManagerWrapper::get);
mProviders.put(DevicePolicyManagerWrapper.class, mDevicePolicyManagerWrapper::get);
mProviders.put(PackageManagerWrapper.class, mPackageManagerWrapper::get);
mProviders.put(SensorPrivacyController.class, mSensorPrivacyController::get);
mProviders.put(DockManager.class, mDockManager::get);
mProviders.put(INotificationManager.class, mINotificationManager::get);
mProviders.put(SysUiState.class, mSysUiStateFlagsContainer::get);
mProviders.put(AlarmManager.class, mAlarmManager::get);
mProviders.put(KeyguardSecurityModel.class, mKeyguardSecurityModel::get);
mProviders.put(DozeParameters.class, mDozeParameters::get);
mProviders.put(IWallpaperManager.class, mWallpaperManager::get);
mProviders.put(CommandQueue.class, mCommandQueue::get);
mProviders.put(ProtoTracer.class, mProtoTracer::get);
mProviders.put(DeviceConfigProxy.class, mDeviceConfigProxy::get);
mProviders.put(TelephonyListenerManager.class, mTelephonyListenerManager::get);
// TODO(b/118592525): to support multi-display , we start to add something which is
// per-display, while others may be global. I think it's time to add
// a new class maybe named DisplayDependency to solve per-display
// Dependency problem.
mProviders.put(AutoHideController.class, mAutoHideController::get);
mProviders.put(RecordingController.class, mRecordingController::get);
mProviders.put(MediaOutputDialogFactory.class, mMediaOutputDialogFactory::get);
mProviders.put(SystemStatusAnimationScheduler.class,
mSystemStatusAnimationSchedulerLazy::get);
mProviders.put(PrivacyDotViewController.class, mPrivacyDotViewControllerLazy::get);
mProviders.put(InternetDialogFactory.class, mInternetDialogFactory::get);
mProviders.put(EdgeBackGestureHandler.Factory.class,
mEdgeBackGestureHandlerFactoryLazy::get);
mProviders.put(UiEventLogger.class, mUiEventLogger::get);
mProviders.put(FeatureFlags.class, mFeatureFlagsLazy::get);
mProviders.put(StatusBarContentInsetsProvider.class, mContentInsetsProviderLazy::get);
mProviders.put(NotificationSectionsManager.class, mNotificationSectionsManagerLazy::get);
mProviders.put(ScreenOffAnimationController.class, mScreenOffAnimationController::get);
mProviders.put(AmbientState.class, mAmbientStateLazy::get);
mProviders.put(GroupMembershipManager.class, mGroupMembershipManagerLazy::get);
mProviders.put(GroupExpansionManager.class, mGroupExpansionManagerLazy::get);
mProviders.put(SystemUIDialogManager.class, mSystemUIDialogManagerLazy::get);
mProviders.put(DialogLaunchAnimator.class, mDialogLaunchAnimatorLazy::get);
Dependency.setInstance(this);
} |
Initialize Depenency.
| Dependency::start | java | Reginer/aosp-android-jar | android-33/src/com/android/systemui/Dependency.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/systemui/Dependency.java | MIT |
public @Nullable SliceSpec getSpec() {
return mSpec;
} |
@return The spec for this slice
| Slice::getSpec | java | Reginer/aosp-android-jar | android-31/src/android/app/slice/Slice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/slice/Slice.java | MIT |
public Uri getUri() {
return mUri;
} |
@return The Uri that this Slice represents.
| Slice::getUri | java | Reginer/aosp-android-jar | android-31/src/android/app/slice/Slice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/slice/Slice.java | MIT |
public List<SliceItem> getItems() {
return Arrays.asList(mItems);
} |
@return All child {@link SliceItem}s that this Slice contains.
| Slice::getItems | java | Reginer/aosp-android-jar | android-31/src/android/app/slice/Slice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/slice/Slice.java | MIT |
public @SliceHint List<String> getHints() {
return Arrays.asList(mHints);
} |
@return All hints associated with this Slice.
| Slice::getHints | java | Reginer/aosp-android-jar | android-31/src/android/app/slice/Slice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/slice/Slice.java | MIT |
public boolean hasHint(@SliceHint String hint) {
return ArrayUtils.contains(mHints, hint);
} |
@hide
| Slice::hasHint | java | Reginer/aosp-android-jar | android-31/src/android/app/slice/Slice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/slice/Slice.java | MIT |
public boolean isCallerNeeded() {
return hasHint(HINT_CALLER_NEEDED);
} |
Returns whether the caller for this slice matters.
@see Builder#setCallerNeeded
| Slice::isCallerNeeded | java | Reginer/aosp-android-jar | android-31/src/android/app/slice/Slice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/slice/Slice.java | MIT |
public Builder(@NonNull Uri uri, SliceSpec spec) {
mUri = uri;
mSpec = spec;
} |
Create a builder which will construct a {@link Slice} for the given Uri.
@param uri Uri to tag for this slice.
@param spec the spec for this slice.
| Builder::Builder | java | Reginer/aosp-android-jar | android-31/src/android/app/slice/Slice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/slice/Slice.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.