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 |
---|---|---|---|---|---|---|---|
private void readEntityDeclaration() throws IOException, XmlPullParserException {
read(START_ENTITY);
boolean generalEntity = true;
skip();
if (peekCharacter() == '%') {
generalEntity = false;
position++;
skip();
}
String name = readName();
skip();
int quote = peekCharacter();
String entityValue;
if (quote == '"' || quote == '\'') {
position++;
entityValue = readValue((char) quote, true, false, ValueContext.ENTITY_DECLARATION);
if (peekCharacter() == quote) {
position++;
}
} else if (readExternalId(true, false)) {
/*
* Map external entities to the empty string. This is dishonest,
* but it's consistent with Android's Expat pull parser.
*/
entityValue = "";
skip();
if (peekCharacter() == NDATA[0]) {
read(NDATA);
skip();
readName();
}
} else {
throw new XmlPullParserException("Expected entity value or external ID", this, null);
}
if (generalEntity && processDocDecl) {
if (documentEntities == null) {
documentEntities = new HashMap<String, char[]>();
}
documentEntities.put(name, entityValue.toCharArray());
}
skip();
read('>');
} |
Read an entity declaration. The value of internal entities are inline:
<!ENTITY foo "bar">
The values of external entities must be retrieved by URL or path:
<!ENTITY foo SYSTEM "http://host/file">
<!ENTITY foo PUBLIC "-//Android//Foo//EN" "http://host/file">
<!ENTITY foo SYSTEM "../file.png" NDATA png>
Entities may be general or parameterized. Parameterized entities are
marked by a percent sign. Such entities may only be used in the DTD:
<!ENTITY % foo "bar">
| KXmlParser::readEntityDeclaration | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private int peekType(boolean inDeclaration) throws IOException, XmlPullParserException {
if (position >= limit && !fillBuffer(1)) {
return END_DOCUMENT;
}
switch (buffer[position]) {
case '&':
return ENTITY_REF; // &
case '<':
if (position + 3 >= limit && !fillBuffer(4)) {
throw new XmlPullParserException("Dangling <", this, null);
}
switch (buffer[position + 1]) {
case '/':
return END_TAG; // </
case '?':
// we're looking for "<?xml " with case insensitivity
if ((position + 5 < limit || fillBuffer(6))
&& (buffer[position + 2] == 'x' || buffer[position + 2] == 'X')
&& (buffer[position + 3] == 'm' || buffer[position + 3] == 'M')
&& (buffer[position + 4] == 'l' || buffer[position + 4] == 'L')
&& (buffer[position + 5] == ' ')) {
return XML_DECLARATION; // <?xml
} else {
return PROCESSING_INSTRUCTION; // <?
}
case '!':
switch (buffer[position + 2]) {
case 'D':
return DOCDECL; // <!D
case '[':
return CDSECT; // <![
case '-':
return COMMENT; // <!-
case 'E':
switch (buffer[position + 3]) {
case 'L':
return ELEMENTDECL; // <!EL
case 'N':
return ENTITYDECL; // <!EN
}
break;
case 'A':
return ATTLISTDECL; // <!A
case 'N':
return NOTATIONDECL; // <!N
}
throw new XmlPullParserException("Unexpected <!", this, null);
default:
return START_TAG; // <
}
case '%':
return inDeclaration ? PARAMETER_ENTITY_REF : TEXT;
default:
return TEXT;
}
} |
Returns the type of the next token.
| KXmlParser::peekType | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void parseStartTag(boolean xmldecl, boolean throwOnResolveFailure)
throws IOException, XmlPullParserException {
if (!xmldecl) {
read('<');
}
name = readName();
attributeCount = 0;
while (true) {
skip();
if (position >= limit && !fillBuffer(1)) {
checkRelaxed(UNEXPECTED_EOF);
return;
}
int c = buffer[position];
if (xmldecl) {
if (c == '?') {
position++;
read('>');
return;
}
} else {
if (c == '/') {
degenerated = true;
position++;
skip();
read('>');
break;
} else if (c == '>') {
position++;
break;
}
}
String attrName = readName();
int i = (attributeCount++) * 4;
attributes = ensureCapacity(attributes, i + 4);
attributes[i] = "";
attributes[i + 1] = null;
attributes[i + 2] = attrName;
skip();
if (position >= limit && !fillBuffer(1)) {
checkRelaxed(UNEXPECTED_EOF);
return;
}
if (buffer[position] == '=') {
position++;
skip();
if (position >= limit && !fillBuffer(1)) {
checkRelaxed(UNEXPECTED_EOF);
return;
}
char delimiter = buffer[position];
if (delimiter == '\'' || delimiter == '"') {
position++;
} else if (relaxed) {
delimiter = ' ';
} else {
throw new XmlPullParserException("attr value delimiter missing!", this, null);
}
attributes[i + 3] = readValue(delimiter, true, throwOnResolveFailure,
ValueContext.ATTRIBUTE);
if (delimiter != ' ' && peekCharacter() == delimiter) {
position++; // end quote
}
} else if (relaxed) {
attributes[i + 3] = attrName;
} else {
checkRelaxed("Attr.value missing f. " + attrName);
attributes[i + 3] = attrName;
}
}
int sp = depth++ * 4;
if (depth == 1) {
parsedTopLevelStartTag = true;
}
elementStack = ensureCapacity(elementStack, sp + 4);
elementStack[sp + 3] = name;
if (depth >= nspCounts.length) {
int[] bigger = new int[depth + 4];
System.arraycopy(nspCounts, 0, bigger, 0, nspCounts.length);
nspCounts = bigger;
}
nspCounts[depth] = nspCounts[depth - 1];
if (processNsp) {
adjustNsp();
} else {
namespace = "";
}
// For consistency with Expat, add default attributes after fixing namespaces.
if (defaultAttributes != null) {
Map<String, String> elementDefaultAttributes = defaultAttributes.get(name);
if (elementDefaultAttributes != null) {
for (Map.Entry<String, String> entry : elementDefaultAttributes.entrySet()) {
if (getAttributeValue(null, entry.getKey()) != null) {
continue; // an explicit value overrides the default
}
int i = (attributeCount++) * 4;
attributes = ensureCapacity(attributes, i + 4);
attributes[i] = "";
attributes[i + 1] = null;
attributes[i + 2] = entry.getKey();
attributes[i + 3] = entry.getValue();
}
}
}
elementStack[sp] = namespace;
elementStack[sp + 1] = prefix;
elementStack[sp + 2] = name;
} |
Sets name and attributes
| KXmlParser::parseStartTag | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void readEntity(StringBuilder out, boolean isEntityToken, boolean throwOnResolveFailure,
ValueContext valueContext) throws IOException, XmlPullParserException {
int start = out.length();
if (buffer[position++] != '&') {
throw new AssertionError();
}
out.append('&');
while (true) {
int c = peekCharacter();
if (c == ';') {
out.append(';');
position++;
break;
} else if (c >= 128
|| (c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
|| c == '_'
|| c == '-'
|| c == '#') {
position++;
out.append((char) c);
} else if (relaxed) {
// intentionally leave the partial reference in 'out'
return;
} else {
throw new XmlPullParserException("unterminated entity ref", this, null);
}
}
String code = out.substring(start + 1, out.length() - 1);
if (isEntityToken) {
name = code;
}
if (code.startsWith("#")) {
try {
int c = code.startsWith("#x")
? Integer.parseInt(code.substring(2), 16)
: Integer.parseInt(code.substring(1));
out.delete(start, out.length());
out.appendCodePoint(c);
unresolved = false;
return;
} catch (NumberFormatException notANumber) {
throw new XmlPullParserException("Invalid character reference: &" + code);
} catch (IllegalArgumentException invalidCodePoint) {
throw new XmlPullParserException("Invalid character reference: &" + code);
}
}
if (valueContext == ValueContext.ENTITY_DECLARATION) {
// keep the unresolved &code; in the text to resolve later
return;
}
String defaultEntity = DEFAULT_ENTITIES.get(code);
if (defaultEntity != null) {
out.delete(start, out.length());
unresolved = false;
out.append(defaultEntity);
return;
}
char[] resolved;
if (documentEntities != null && (resolved = documentEntities.get(code)) != null) {
out.delete(start, out.length());
unresolved = false;
if (processDocDecl) {
pushContentSource(resolved); // parse the entity as XML
} else {
out.append(resolved); // include the entity value as text
}
return;
}
/*
* The parser skipped an external DTD, and now we've encountered an
* unknown entity that could have been declared there. Map it to the
* empty string. This is dishonest, but it's consistent with Android's
* old ExpatPullParser.
*/
if (systemId != null) {
out.delete(start, out.length());
return;
}
// keep the unresolved entity "&code;" in the text for relaxed clients
unresolved = true;
if (throwOnResolveFailure) {
checkRelaxed("unresolved: &" + code + ";");
}
} |
Reads an entity reference from the buffer, resolves it, and writes the
resolved entity to {@code out}. If the entity cannot be read or resolved,
{@code out} will contain the partial entity reference.
| KXmlParser::readEntity | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private String readValue(char delimiter, boolean resolveEntities, boolean throwOnResolveFailure,
ValueContext valueContext) throws IOException, XmlPullParserException {
/*
* This method returns all of the characters from the current position
* through to an appropriate delimiter.
*
* If we're lucky (which we usually are), we'll return a single slice of
* the buffer. This fast path avoids allocating a string builder.
*
* There are 6 unlucky characters we could encounter:
* - "&": entities must be resolved.
* - "%": parameter entities are unsupported in entity values.
* - "<": this isn't permitted in attributes unless relaxed.
* - "]": this requires a lookahead to defend against the forbidden
* CDATA section delimiter "]]>".
* - "\r": If a "\r" is followed by a "\n", we discard the "\r". If it
* isn't followed by "\n", we replace "\r" with either a "\n"
* in text nodes or a space in attribute values.
* - "\n": In attribute values, "\n" must be replaced with a space.
*
* We could also get unlucky by needing to refill the buffer midway
* through the text.
*/
int start = position;
StringBuilder result = null;
// if a text section was already started, prefix the start
if (valueContext == ValueContext.TEXT && text != null) {
result = new StringBuilder();
result.append(text);
}
while (true) {
/*
* Make sure we have at least a single character to read from the
* buffer. This mutates the buffer, so save the partial result
* to the slow path string builder first.
*/
if (position >= limit) {
if (start < position) {
if (result == null) {
result = new StringBuilder();
}
result.append(buffer, start, position - start);
}
if (!fillBuffer(1)) {
return result != null ? result.toString() : "";
}
start = position;
}
char c = buffer[position];
if (c == delimiter
|| (delimiter == ' ' && (c <= ' ' || c == '>'))
|| c == '&' && !resolveEntities) {
break;
}
if (c != '\r'
&& (c != '\n' || valueContext != ValueContext.ATTRIBUTE)
&& c != '&'
&& c != '<'
&& (c != ']' || valueContext != ValueContext.TEXT)
&& (c != '%' || valueContext != ValueContext.ENTITY_DECLARATION)) {
isWhitespace &= (c <= ' ');
position++;
continue;
}
/*
* We've encountered an unlucky character! Convert from fast
* path to slow path if we haven't done so already.
*/
if (result == null) {
result = new StringBuilder();
}
result.append(buffer, start, position - start);
if (c == '\r') {
if ((position + 1 < limit || fillBuffer(2)) && buffer[position + 1] == '\n') {
position++;
}
c = (valueContext == ValueContext.ATTRIBUTE) ? ' ' : '\n';
} else if (c == '\n') {
c = ' ';
} else if (c == '&') {
isWhitespace = false; // TODO: what if the entity resolves to whitespace?
readEntity(result, false, throwOnResolveFailure, valueContext);
start = position;
continue;
} else if (c == '<') {
if (valueContext == ValueContext.ATTRIBUTE) {
checkRelaxed("Illegal: \"<\" inside attribute value");
}
isWhitespace = false;
} else if (c == ']') {
if ((position + 2 < limit || fillBuffer(3))
&& buffer[position + 1] == ']' && buffer[position + 2] == '>') {
checkRelaxed("Illegal: \"]]>\" outside CDATA section");
}
isWhitespace = false;
} else if (c == '%') {
throw new XmlPullParserException("This parser doesn't support parameter entities",
this, null);
} else {
throw new AssertionError();
}
position++;
result.append(c);
start = position;
}
if (result == null) {
return stringPool.get(buffer, start, position - start);
} else {
result.append(buffer, start, position - start);
return result.toString();
}
} |
Returns the current text or attribute value. This also has the side
effect of setting isWhitespace to false if a non-whitespace character is
encountered.
@param delimiter {@code <} for text, {@code "} and {@code '} for quoted
attributes, or a space for unquoted attributes.
| ValueContext::readValue | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private boolean fillBuffer(int minimum) throws IOException, XmlPullParserException {
// If we've exhausted the current content source, remove it
while (nextContentSource != null) {
if (position < limit) {
throw new XmlPullParserException("Unbalanced entity!", this, null);
}
popContentSource();
if (limit - position >= minimum) {
return true;
}
}
// Before clobbering the old characters, update where buffer starts
for (int i = 0; i < position; i++) {
if (buffer[i] == '\n') {
bufferStartLine++;
bufferStartColumn = 0;
} else {
bufferStartColumn++;
}
}
if (bufferCapture != null) {
bufferCapture.append(buffer, 0, position);
}
if (limit != position) {
limit -= position;
System.arraycopy(buffer, position, buffer, 0, limit);
} else {
limit = 0;
}
position = 0;
int total;
while ((total = reader.read(buffer, limit, buffer.length - limit)) != -1) {
limit += total;
if (limit >= minimum) {
return true;
}
}
return false;
} |
Returns true once {@code limit - position >= minimum}. If the data is
exhausted before that many characters are available, this returns
false.
| ValueContext::fillBuffer | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private String readName() throws IOException, XmlPullParserException {
if (position >= limit && !fillBuffer(1)) {
checkRelaxed("name expected");
return "";
}
int start = position;
StringBuilder result = null;
// read the first character
char c = buffer[position];
if ((c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
|| c == '_'
|| c == ':'
|| c >= '\u00c0' // TODO: check the XML spec
|| relaxed) {
position++;
} else {
checkRelaxed("name expected");
return "";
}
while (true) {
/*
* Make sure we have at least a single character to read from the
* buffer. This mutates the buffer, so save the partial result
* to the slow path string builder first.
*/
if (position >= limit) {
if (result == null) {
result = new StringBuilder();
}
result.append(buffer, start, position - start);
if (!fillBuffer(1)) {
return result.toString();
}
start = position;
}
// read another character
c = buffer[position];
if ((c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
|| (c >= '0' && c <= '9')
|| c == '_'
|| c == '-'
|| c == ':'
|| c == '.'
|| c >= '\u00b7') { // TODO: check the XML spec
position++;
continue;
}
// we encountered a non-name character. done!
if (result == null) {
return stringPool.get(buffer, start, position - start);
} else {
result.append(buffer, start, position - start);
return result.toString();
}
}
} |
Returns an element or attribute name. This is always non-empty for
non-relaxed parsers.
| ValueContext::readName | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
public String getRootElementName() {
return rootElementName;
} |
Returns the root element's name if it was declared in the DTD. This
equals the first tag's name for valid documents.
| ValueContext::getRootElementName | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
public String getSystemId() {
return systemId;
} |
Returns the document's system ID if it was declared. This is typically a
string like {@code http://www.w3.org/TR/html4/strict.dtd}.
| ValueContext::getSystemId | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
public String getPublicId() {
return publicId;
} |
Returns the document's public ID if it was declared. This is typically a
string like {@code -//W3C//DTD HTML 4.01//EN}.
| ValueContext::getPublicId | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void pushContentSource(char[] newBuffer) {
nextContentSource = new ContentSource(nextContentSource, buffer, position, limit);
buffer = newBuffer;
position = 0;
limit = newBuffer.length;
} |
Prepends the characters of {@code newBuffer} to be read before the
current buffer.
| ContentSource::pushContentSource | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void popContentSource() {
buffer = nextContentSource.buffer;
position = nextContentSource.position;
limit = nextContentSource.limit;
nextContentSource = nextContentSource.next;
} |
Replaces the current exhausted buffer with the next buffer in the chain.
| ContentSource::popContentSource | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
public TaskFragmentInfo(
@NonNull IBinder fragmentToken, @NonNull WindowContainerToken token,
@NonNull Configuration configuration, int runningActivityCount,
boolean isVisible, @NonNull List<IBinder> activities,
@NonNull List<IBinder> inRequestedTaskFragmentActivities,
@NonNull Point positionInParent, boolean isTaskClearedForReuse,
boolean isTaskFragmentClearedForPip, boolean isClearedForReorderActivityToFront,
@NonNull Point minimumDimensions) {
mFragmentToken = requireNonNull(fragmentToken);
mToken = requireNonNull(token);
mConfiguration.setTo(configuration);
mRunningActivityCount = runningActivityCount;
mIsVisible = isVisible;
mActivities.addAll(activities);
mInRequestedTaskFragmentActivities.addAll(inRequestedTaskFragmentActivities);
mPositionInParent.set(positionInParent);
mIsTaskClearedForReuse = isTaskClearedForReuse;
mIsTaskFragmentClearedForPip = isTaskFragmentClearedForPip;
mIsClearedForReorderActivityToFront = isClearedForReorderActivityToFront;
mMinimumDimensions.set(minimumDimensions);
} |
The maximum {@link android.content.pm.ActivityInfo.WindowLayout#minWidth} and
{@link android.content.pm.ActivityInfo.WindowLayout#minHeight} aggregated from the
TaskFragment's child activities.
@NonNull
private final Point mMinimumDimensions = new Point();
/** @hide | TaskFragmentInfo::TaskFragmentInfo | java | Reginer/aosp-android-jar | android-35/src/android/window/TaskFragmentInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/window/TaskFragmentInfo.java | MIT |
public boolean isTaskFragmentClearedForPip() {
return mIsTaskFragmentClearedForPip;
} |
The maximum {@link android.content.pm.ActivityInfo.WindowLayout#minWidth} and
{@link android.content.pm.ActivityInfo.WindowLayout#minHeight} aggregated from the
TaskFragment's child activities.
@NonNull
private final Point mMinimumDimensions = new Point();
/** @hide
public TaskFragmentInfo(
@NonNull IBinder fragmentToken, @NonNull WindowContainerToken token,
@NonNull Configuration configuration, int runningActivityCount,
boolean isVisible, @NonNull List<IBinder> activities,
@NonNull List<IBinder> inRequestedTaskFragmentActivities,
@NonNull Point positionInParent, boolean isTaskClearedForReuse,
boolean isTaskFragmentClearedForPip, boolean isClearedForReorderActivityToFront,
@NonNull Point minimumDimensions) {
mFragmentToken = requireNonNull(fragmentToken);
mToken = requireNonNull(token);
mConfiguration.setTo(configuration);
mRunningActivityCount = runningActivityCount;
mIsVisible = isVisible;
mActivities.addAll(activities);
mInRequestedTaskFragmentActivities.addAll(inRequestedTaskFragmentActivities);
mPositionInParent.set(positionInParent);
mIsTaskClearedForReuse = isTaskClearedForReuse;
mIsTaskFragmentClearedForPip = isTaskFragmentClearedForPip;
mIsClearedForReorderActivityToFront = isClearedForReorderActivityToFront;
mMinimumDimensions.set(minimumDimensions);
}
@NonNull
public IBinder getFragmentToken() {
return mFragmentToken;
}
@NonNull
public WindowContainerToken getToken() {
return mToken;
}
@NonNull
public Configuration getConfiguration() {
return mConfiguration;
}
public boolean isEmpty() {
return mRunningActivityCount == 0;
}
public boolean hasRunningActivity() {
return mRunningActivityCount > 0;
}
public int getRunningActivityCount() {
return mRunningActivityCount;
}
public boolean isVisible() {
return mIsVisible;
}
@NonNull
public List<IBinder> getActivities() {
return mActivities;
}
@NonNull
public List<IBinder> getActivitiesRequestedInTaskFragment() {
return mInRequestedTaskFragmentActivities;
}
/** Returns the relative position of the fragment's top left corner in the parent container.
@NonNull
public Point getPositionInParent() {
return mPositionInParent;
}
public boolean isTaskClearedForReuse() {
return mIsTaskClearedForReuse;
}
/** @hide | TaskFragmentInfo::isTaskFragmentClearedForPip | java | Reginer/aosp-android-jar | android-35/src/android/window/TaskFragmentInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/window/TaskFragmentInfo.java | MIT |
public boolean isClearedForReorderActivityToFront() {
return mIsClearedForReorderActivityToFront;
} |
The maximum {@link android.content.pm.ActivityInfo.WindowLayout#minWidth} and
{@link android.content.pm.ActivityInfo.WindowLayout#minHeight} aggregated from the
TaskFragment's child activities.
@NonNull
private final Point mMinimumDimensions = new Point();
/** @hide
public TaskFragmentInfo(
@NonNull IBinder fragmentToken, @NonNull WindowContainerToken token,
@NonNull Configuration configuration, int runningActivityCount,
boolean isVisible, @NonNull List<IBinder> activities,
@NonNull List<IBinder> inRequestedTaskFragmentActivities,
@NonNull Point positionInParent, boolean isTaskClearedForReuse,
boolean isTaskFragmentClearedForPip, boolean isClearedForReorderActivityToFront,
@NonNull Point minimumDimensions) {
mFragmentToken = requireNonNull(fragmentToken);
mToken = requireNonNull(token);
mConfiguration.setTo(configuration);
mRunningActivityCount = runningActivityCount;
mIsVisible = isVisible;
mActivities.addAll(activities);
mInRequestedTaskFragmentActivities.addAll(inRequestedTaskFragmentActivities);
mPositionInParent.set(positionInParent);
mIsTaskClearedForReuse = isTaskClearedForReuse;
mIsTaskFragmentClearedForPip = isTaskFragmentClearedForPip;
mIsClearedForReorderActivityToFront = isClearedForReorderActivityToFront;
mMinimumDimensions.set(minimumDimensions);
}
@NonNull
public IBinder getFragmentToken() {
return mFragmentToken;
}
@NonNull
public WindowContainerToken getToken() {
return mToken;
}
@NonNull
public Configuration getConfiguration() {
return mConfiguration;
}
public boolean isEmpty() {
return mRunningActivityCount == 0;
}
public boolean hasRunningActivity() {
return mRunningActivityCount > 0;
}
public int getRunningActivityCount() {
return mRunningActivityCount;
}
public boolean isVisible() {
return mIsVisible;
}
@NonNull
public List<IBinder> getActivities() {
return mActivities;
}
@NonNull
public List<IBinder> getActivitiesRequestedInTaskFragment() {
return mInRequestedTaskFragmentActivities;
}
/** Returns the relative position of the fragment's top left corner in the parent container.
@NonNull
public Point getPositionInParent() {
return mPositionInParent;
}
public boolean isTaskClearedForReuse() {
return mIsTaskClearedForReuse;
}
/** @hide
public boolean isTaskFragmentClearedForPip() {
return mIsTaskFragmentClearedForPip;
}
/** @hide | TaskFragmentInfo::isClearedForReorderActivityToFront | java | Reginer/aosp-android-jar | android-35/src/android/window/TaskFragmentInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/window/TaskFragmentInfo.java | MIT |
public int getMinimumWidth() {
return mMinimumDimensions.x;
} |
Returns the minimum width this TaskFragment can be resized to.
Client side must not {@link WindowContainerTransaction#setRelativeBounds}
that {@link Rect#width()} is shorter than the reported value.
@hide pending unhide
| TaskFragmentInfo::getMinimumWidth | java | Reginer/aosp-android-jar | android-35/src/android/window/TaskFragmentInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/window/TaskFragmentInfo.java | MIT |
public int getMinimumHeight() {
return mMinimumDimensions.y;
} |
Returns the minimum width this TaskFragment can be resized to.
Client side must not {@link WindowContainerTransaction#setRelativeBounds}
that {@link Rect#height()} is shorter than the reported value.
@hide pending unhide
| TaskFragmentInfo::getMinimumHeight | java | Reginer/aosp-android-jar | android-35/src/android/window/TaskFragmentInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/window/TaskFragmentInfo.java | MIT |
public boolean equalsForTaskFragmentOrganizer(@Nullable TaskFragmentInfo that) {
if (that == null) {
return false;
}
return mFragmentToken.equals(that.mFragmentToken)
&& mToken.equals(that.mToken)
&& mRunningActivityCount == that.mRunningActivityCount
&& mIsVisible == that.mIsVisible
&& getWindowingMode() == that.getWindowingMode()
&& mActivities.equals(that.mActivities)
&& mInRequestedTaskFragmentActivities.equals(
that.mInRequestedTaskFragmentActivities)
&& mPositionInParent.equals(that.mPositionInParent)
&& mIsTaskClearedForReuse == that.mIsTaskClearedForReuse
&& mIsTaskFragmentClearedForPip == that.mIsTaskFragmentClearedForPip
&& mIsClearedForReorderActivityToFront == that.mIsClearedForReorderActivityToFront
&& mMinimumDimensions.equals(that.mMinimumDimensions);
} |
Returns {@code true} if the parameters that are important for task fragment organizers are
equal between this {@link TaskFragmentInfo} and {@param that}.
Note that this method is usually called with
{@link com.android.server.wm.WindowOrganizerController#configurationsAreEqualForOrganizer(
Configuration, Configuration)} to determine if this {@link TaskFragmentInfo} should
be dispatched to the client.
| TaskFragmentInfo::equalsForTaskFragmentOrganizer | java | Reginer/aosp-android-jar | android-35/src/android/window/TaskFragmentInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/window/TaskFragmentInfo.java | MIT |
public static boolean isRemovePipDirection(@TransitionDirection int direction) {
return direction == TRANSITION_DIRECTION_REMOVE_STACK;
} |
Controller class of PiP animations (both from and to PiP mode).
public class PipAnimationController {
static final float FRACTION_START = 0f;
private static final float FRACTION_END = 1f;
public static final int ANIM_TYPE_BOUNDS = 0;
public static final int ANIM_TYPE_ALPHA = 1;
@IntDef(prefix = { "ANIM_TYPE_" }, value = {
ANIM_TYPE_BOUNDS,
ANIM_TYPE_ALPHA
})
@Retention(RetentionPolicy.SOURCE)
public @interface AnimationType {}
public static final int TRANSITION_DIRECTION_NONE = 0;
public static final int TRANSITION_DIRECTION_SAME = 1;
public static final int TRANSITION_DIRECTION_TO_PIP = 2;
public static final int TRANSITION_DIRECTION_LEAVE_PIP = 3;
public static final int TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN = 4;
public static final int TRANSITION_DIRECTION_REMOVE_STACK = 5;
public static final int TRANSITION_DIRECTION_SNAP_AFTER_RESIZE = 6;
public static final int TRANSITION_DIRECTION_USER_RESIZE = 7;
public static final int TRANSITION_DIRECTION_EXPAND_OR_UNEXPAND = 8;
@IntDef(prefix = { "TRANSITION_DIRECTION_" }, value = {
TRANSITION_DIRECTION_NONE,
TRANSITION_DIRECTION_SAME,
TRANSITION_DIRECTION_TO_PIP,
TRANSITION_DIRECTION_LEAVE_PIP,
TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN,
TRANSITION_DIRECTION_REMOVE_STACK,
TRANSITION_DIRECTION_SNAP_AFTER_RESIZE,
TRANSITION_DIRECTION_USER_RESIZE,
TRANSITION_DIRECTION_EXPAND_OR_UNEXPAND
})
@Retention(RetentionPolicy.SOURCE)
public @interface TransitionDirection {}
public static boolean isInPipDirection(@TransitionDirection int direction) {
return direction == TRANSITION_DIRECTION_TO_PIP;
}
public static boolean isOutPipDirection(@TransitionDirection int direction) {
return direction == TRANSITION_DIRECTION_LEAVE_PIP
|| direction == TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN;
}
/** Whether the given direction represents removing PIP. | PipAnimationController::isRemovePipDirection | java | Reginer/aosp-android-jar | android-32/src/com/android/wm/shell/pip/PipAnimationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/wm/shell/pip/PipAnimationController.java | MIT |
public void onPipAnimationStart(TaskInfo taskInfo, PipTransitionAnimator animator) {} |
Called when PiP animation is started.
| PipAnimationCallback::onPipAnimationStart | java | Reginer/aosp-android-jar | android-32/src/com/android/wm/shell/pip/PipAnimationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/wm/shell/pip/PipAnimationController.java | MIT |
public void onPipAnimationEnd(TaskInfo taskInfo, SurfaceControl.Transaction tx,
PipTransitionAnimator animator) {} |
Called when PiP animation is ended.
| PipAnimationCallback::onPipAnimationEnd | java | Reginer/aosp-android-jar | android-32/src/com/android/wm/shell/pip/PipAnimationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/wm/shell/pip/PipAnimationController.java | MIT |
public void onPipAnimationCancel(TaskInfo taskInfo, PipTransitionAnimator animator) {} |
Called when PiP animation is cancelled.
| PipAnimationCallback::onPipAnimationCancel | java | Reginer/aosp-android-jar | android-32/src/com/android/wm/shell/pip/PipAnimationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/wm/shell/pip/PipAnimationController.java | MIT |
public boolean handlePipTransaction(SurfaceControl leash, SurfaceControl.Transaction tx,
Rect destinationBounds) {
return false;
} |
Called when the animation controller is about to apply a transaction. Allow a registered
handler to apply the transaction instead.
@return true if handled by the handler, false otherwise.
| PipTransactionHandler::handlePipTransaction | java | Reginer/aosp-android-jar | android-32/src/com/android/wm/shell/pip/PipAnimationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/wm/shell/pip/PipAnimationController.java | MIT |
void clearContentOverlay() {
mContentOverlay = null;
} |
Clears the {@link #mContentOverlay}, this should be done after the content overlay is
faded out, such as in {@link PipTaskOrganizer#fadeOutAndRemoveOverlay}
| PipTransitionAnimator::clearContentOverlay | java | Reginer/aosp-android-jar | android-32/src/com/android/wm/shell/pip/PipAnimationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/wm/shell/pip/PipAnimationController.java | MIT |
public void updateEndValue(T endValue) {
mEndValue = endValue;
} |
Updates the {@link #mEndValue}.
NOTE: Do not forget to call {@link #setDestinationBounds(Rect)} for bounds animation.
This is typically used when we receive a shelf height adjustment during the bounds
animation. In which case we can update the end bounds and keep the existing animation
running instead of cancelling it.
| PipTransitionAnimator::updateEndValue | java | Reginer/aosp-android-jar | android-32/src/com/android/wm/shell/pip/PipAnimationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/wm/shell/pip/PipAnimationController.java | MIT |
protected SurfaceControl.Transaction newSurfaceControlTransaction() {
final SurfaceControl.Transaction tx =
mSurfaceControlTransactionFactory.getTransaction();
tx.setFrameTimelineVsync(Choreographer.getSfInstance().getVsyncId());
return tx;
} |
@return {@link SurfaceControl.Transaction} instance with vsync-id.
| PipTransitionAnimator::newSurfaceControlTransaction | java | Reginer/aosp-android-jar | android-32/src/com/android/wm/shell/pip/PipAnimationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/wm/shell/pip/PipAnimationController.java | MIT |
public void dumpInfo(IndentingPrintWriter pw) {
synchronized (mLock) {
pw.printf("Next module id available: %d\n", mNextModuleId);
pw.printf("ServiceName to module id map:\n");
pw.increaseIndent();
for (Map.Entry<String, Integer> entry : mServiceNameToModuleIdMap.entrySet()) {
pw.printf("Service name: %s, module id: %d\n", entry.getKey(), entry.getValue());
}
pw.decreaseIndent();
pw.printf("Radio modules:\n");
pw.increaseIndent();
for (Map.Entry<Integer, RadioModule> moduleEntry : mModules.entrySet()) {
pw.printf("Module id=%d:\n", moduleEntry.getKey());
pw.increaseIndent();
moduleEntry.getValue().dumpInfo(pw);
pw.decreaseIndent();
}
pw.decreaseIndent();
}
} |
Dump state of broadcastradio service for HIDL HAL 2.0.
@param pw The file to which BroadcastRadioService state is dumped.
| BroadcastRadioService::dumpInfo | java | Reginer/aosp-android-jar | android-35/src/com/android/server/broadcastradio/hal2/BroadcastRadioService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/broadcastradio/hal2/BroadcastRadioService.java | MIT |
public TimeCapabilitiesAndConfig(@NonNull TimeCapabilities timeCapabilities,
@NonNull TimeConfiguration timeConfiguration) {
mCapabilities = Objects.requireNonNull(timeCapabilities);
mConfiguration = Objects.requireNonNull(timeConfiguration);
} |
Creates a new instance.
@hide
| TimeCapabilitiesAndConfig::TimeCapabilitiesAndConfig | java | Reginer/aosp-android-jar | android-34/src/android/app/time/TimeCapabilitiesAndConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/time/TimeCapabilitiesAndConfig.java | MIT |
public String toShortString() {
if (mShortString == null) {
StringBuilder sb = new StringBuilder();
sb.append(powerComponentIdToString(powerComponent));
if (processState != PROCESS_STATE_UNSPECIFIED) {
sb.append(':');
sb.append(processStateToString(processState));
}
mShortString = sb.toString();
}
return mShortString;
} |
Returns a string suitable for use in dumpsys.
| Key::toShortString | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public double getConsumedPower() {
return mPowerComponents.getConsumedPower(UNSPECIFIED_DIMENSIONS);
} |
Total power consumed by this consumer, in mAh.
| Key::getConsumedPower | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public double getConsumedPower(Dimensions dimensions) {
return mPowerComponents.getConsumedPower(dimensions);
} |
Returns power consumed aggregated over the specified dimensions, in mAh.
| Key::getConsumedPower | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public Key[] getKeys(@PowerComponent int componentId) {
return mData.getKeys(componentId);
} |
Returns keys for various power values attributed to the specified component
held by this BatteryUsageStats object.
| Key::getKeys | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public Key getKey(@PowerComponent int componentId) {
return mData.getKey(componentId, PROCESS_STATE_UNSPECIFIED);
} |
Returns the key for the power attributed to the specified component,
for all values of other dimensions such as process state.
| Key::getKey | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public Key getKey(@PowerComponent int componentId, @ProcessState int processState) {
return mData.getKey(componentId, processState);
} |
Returns the key for the power attributed to the specified component and process state.
| Key::getKey | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public double getConsumedPower(@PowerComponent int componentId) {
return mPowerComponents.getConsumedPower(
mData.getKeyOrThrow(componentId, PROCESS_STATE_UNSPECIFIED));
} |
Returns the amount of drain attributed to the specified drain type, e.g. CPU, WiFi etc.
@param componentId The ID of the power component, e.g.
{@link BatteryConsumer#POWER_COMPONENT_CPU}.
@return Amount of consumed power in mAh.
| Key::getConsumedPower | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public double getConsumedPower(@NonNull Key key) {
return mPowerComponents.getConsumedPower(key);
} |
Returns the amount of drain attributed to the specified drain type, e.g. CPU, WiFi etc.
@param key The key of the power component, obtained by calling {@link #getKey} or
{@link #getKeys} method.
@return Amount of consumed power in mAh.
| Key::getConsumedPower | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public @PowerModel int getPowerModel(@BatteryConsumer.PowerComponent int componentId) {
return mPowerComponents.getPowerModel(
mData.getKeyOrThrow(componentId, PROCESS_STATE_UNSPECIFIED));
} |
Returns the ID of the model that was used for power estimation.
@param componentId The ID of the power component, e.g.
{@link BatteryConsumer#POWER_COMPONENT_CPU}.
| Key::getPowerModel | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public @PowerModel int getPowerModel(@NonNull BatteryConsumer.Key key) {
return mPowerComponents.getPowerModel(key);
} |
Returns the ID of the model that was used for power estimation.
@param key The key of the power component, obtained by calling {@link #getKey} or
{@link #getKeys} method.
| Key::getPowerModel | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public double getConsumedPowerForCustomComponent(int componentId) {
return mPowerComponents.getConsumedPowerForCustomComponent(componentId);
} |
Returns the amount of drain attributed to the specified custom drain type.
@param componentId The ID of the custom power component.
@return Amount of consumed power in mAh.
| Key::getConsumedPowerForCustomComponent | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public String getCustomPowerComponentName(int componentId) {
return mPowerComponents.getCustomPowerComponentName(componentId);
} |
Returns the name of the specified power component.
@param componentId The ID of the custom power component.
| Key::getCustomPowerComponentName | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public long getUsageDurationMillis(@PowerComponent int componentId) {
return mPowerComponents.getUsageDurationMillis(getKey(componentId));
} |
Returns the amount of time since BatteryStats reset used by the specified component, e.g.
CPU, WiFi etc.
@param componentId The ID of the power component, e.g.
{@link UidBatteryConsumer#POWER_COMPONENT_CPU}.
@return Amount of time in milliseconds.
| Key::getUsageDurationMillis | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public long getUsageDurationMillis(@NonNull Key key) {
return mPowerComponents.getUsageDurationMillis(key);
} |
Returns the amount of time since BatteryStats reset used by the specified component, e.g.
CPU, WiFi etc.
@param key The key of the power component, obtained by calling {@link #getKey} or
{@link #getKeys} method.
@return Amount of time in milliseconds.
| Key::getUsageDurationMillis | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public long getUsageDurationForCustomComponentMillis(int componentId) {
return mPowerComponents.getUsageDurationForCustomComponentMillis(componentId);
} |
Returns the amount of usage time attributed to the specified custom component
since BatteryStats reset.
@param componentId The ID of the custom power component.
@return Amount of time in milliseconds.
| Key::getUsageDurationForCustomComponentMillis | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public static String powerComponentIdToString(@BatteryConsumer.PowerComponent int componentId) {
if (componentId == POWER_COMPONENT_ANY) {
return "all";
}
return sPowerComponentNames[componentId];
} |
Returns the name of the specified component. Intended for logging and debugging.
| Key::powerComponentIdToString | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public static String powerModelToString(@BatteryConsumer.PowerModel int powerModel) {
switch (powerModel) {
case BatteryConsumer.POWER_MODEL_ENERGY_CONSUMPTION:
return "energy consumption";
case BatteryConsumer.POWER_MODEL_POWER_PROFILE:
return "power profile";
default:
return "";
}
} |
Returns the name of the specified power model. Intended for logging and debugging.
| Key::powerModelToString | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public static int powerModelToProtoEnum(@BatteryConsumer.PowerModel int powerModel) {
switch (powerModel) {
case BatteryConsumer.POWER_MODEL_ENERGY_CONSUMPTION:
return BatteryUsageStatsAtomsProto.PowerComponentModel.MEASURED_ENERGY;
case BatteryConsumer.POWER_MODEL_POWER_PROFILE:
return BatteryUsageStatsAtomsProto.PowerComponentModel.POWER_PROFILE;
default:
return BatteryUsageStatsAtomsProto.PowerComponentModel.UNDEFINED;
}
} |
Returns the equivalent PowerModel enum for the specified power model.
{@see BatteryUsageStatsAtomsProto.BatteryConsumerData.PowerComponentUsage.PowerModel}
| Key::powerModelToProtoEnum | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public static String processStateToString(@BatteryConsumer.ProcessState int processState) {
return sProcessStateNames[processState];
} |
Returns the name of the specified process state. Intended for logging and debugging.
| Key::processStateToString | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public void dump(PrintWriter pw) {
dump(pw, true);
} |
Prints the stats in a human-readable format.
| Key::dump | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
boolean hasStatsProtoData() {
return writeStatsProtoImpl(null, /* Irrelevant fieldId: */ 0);
} |
Prints the stats in a human-readable format.
@param skipEmptyComponents if true, omit any power components with a zero amount.
public abstract void dump(PrintWriter pw, boolean skipEmptyComponents);
/** Returns whether there are any atoms.proto BATTERY_CONSUMER_DATA data to write to a proto. | Key::hasStatsProtoData | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
void writeStatsProto(@NonNull ProtoOutputStream proto, long fieldId) {
writeStatsProtoImpl(proto, fieldId);
} |
Prints the stats in a human-readable format.
@param skipEmptyComponents if true, omit any power components with a zero amount.
public abstract void dump(PrintWriter pw, boolean skipEmptyComponents);
/** Returns whether there are any atoms.proto BATTERY_CONSUMER_DATA data to write to a proto.
boolean hasStatsProtoData() {
return writeStatsProtoImpl(null, /* Irrelevant fieldId: */ 0);
}
/** Writes the atoms.proto BATTERY_CONSUMER_DATA for this BatteryConsumer to the given proto. | Key::writeStatsProto | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
private boolean writeStatsProtoImpl(@Nullable ProtoOutputStream proto, long fieldId) {
final long totalConsumedPowerDeciCoulombs = convertMahToDeciCoulombs(getConsumedPower());
if (totalConsumedPowerDeciCoulombs == 0) {
// NOTE: Strictly speaking we should also check !mPowerComponents.hasStatsProtoData().
// However, that call is a bit expensive (a for loop). And the only way that
// totalConsumedPower can be 0 while mPowerComponents.hasStatsProtoData() is true is
// if POWER_COMPONENT_REATTRIBUTED_TO_OTHER_CONSUMERS (which is the only negative
// allowed) happens to exactly equal the sum of all other components, which
// can't really happen in practice.
// So we'll just adopt the rule "if total==0, don't write any details".
// If negative values are used for other things in the future, this can be revisited.
return false;
}
if (proto == null) {
// We're just asked whether there is data, not to actually write it. And there is.
return true;
}
final long token = proto.start(fieldId);
proto.write(
BatteryUsageStatsAtomsProto.BatteryConsumerData.TOTAL_CONSUMED_POWER_DECI_COULOMBS,
totalConsumedPowerDeciCoulombs);
mPowerComponents.writeStatsProto(proto);
proto.end(token);
return true;
} |
Returns whether there are any atoms.proto BATTERY_CONSUMER_DATA data to write to a proto,
and writes it to the given proto if it is non-null.
| Key::writeStatsProtoImpl | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
static long convertMahToDeciCoulombs(double powerMah) {
return (long) (powerMah * (10 * 3600 / 1000) + 0.5);
} |
Returns whether there are any atoms.proto BATTERY_CONSUMER_DATA data to write to a proto,
and writes it to the given proto if it is non-null.
private boolean writeStatsProtoImpl(@Nullable ProtoOutputStream proto, long fieldId) {
final long totalConsumedPowerDeciCoulombs = convertMahToDeciCoulombs(getConsumedPower());
if (totalConsumedPowerDeciCoulombs == 0) {
// NOTE: Strictly speaking we should also check !mPowerComponents.hasStatsProtoData().
// However, that call is a bit expensive (a for loop). And the only way that
// totalConsumedPower can be 0 while mPowerComponents.hasStatsProtoData() is true is
// if POWER_COMPONENT_REATTRIBUTED_TO_OTHER_CONSUMERS (which is the only negative
// allowed) happens to exactly equal the sum of all other components, which
// can't really happen in practice.
// So we'll just adopt the rule "if total==0, don't write any details".
// If negative values are used for other things in the future, this can be revisited.
return false;
}
if (proto == null) {
// We're just asked whether there is data, not to actually write it. And there is.
return true;
}
final long token = proto.start(fieldId);
proto.write(
BatteryUsageStatsAtomsProto.BatteryConsumerData.TOTAL_CONSUMED_POWER_DECI_COULOMBS,
totalConsumedPowerDeciCoulombs);
mPowerComponents.writeStatsProto(proto);
proto.end(token);
return true;
}
/** Converts charge from milliamp hours (mAh) to decicoulombs (dC). | Key::convertMahToDeciCoulombs | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
public double getTotalPower() {
return mPowerComponentsBuilder.getTotalPower();
} |
Returns the total power accumulated by this builder so far. It may change
by the time the {@code build()} method is called.
| BaseBuilder::getTotalPower | java | Reginer/aosp-android-jar | android-35/src/android/os/BatteryConsumer.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/BatteryConsumer.java | MIT |
static Notification buildSuccessNotification(Context context, String contentText,
String basePackageName, int userId) {
PackageInfo packageInfo = null;
try {
packageInfo = AppGlobals.getPackageManager().getPackageInfo(
basePackageName, PackageManager.MATCH_STATIC_SHARED_AND_SDK_LIBRARIES, userId);
} catch (RemoteException ignored) {
}
if (packageInfo == null || packageInfo.applicationInfo == null) {
Slog.w(TAG, "Notification not built for package: " + basePackageName);
return null;
}
PackageManager pm = context.getPackageManager();
Bitmap packageIcon = ImageUtils.buildScaledBitmap(
packageInfo.applicationInfo.loadIcon(pm),
context.getResources().getDimensionPixelSize(
android.R.dimen.notification_large_icon_width),
context.getResources().getDimensionPixelSize(
android.R.dimen.notification_large_icon_height));
CharSequence packageLabel = packageInfo.applicationInfo.loadLabel(pm);
return new Notification.Builder(context, SystemNotificationChannels.DEVICE_ADMIN)
.setSmallIcon(R.drawable.ic_check_circle_24px)
.setColor(context.getResources().getColor(
R.color.system_notification_accent_color))
.setContentTitle(packageLabel)
.setContentText(contentText)
.setStyle(new Notification.BigTextStyle().bigText(contentText))
.setLargeIcon(packageIcon)
.build();
} |
Build a notification for package installation / deletion by device owners that is shown if
the operation succeeds.
| PackageDeleteObserverAdapter::buildSuccessNotification | java | Reginer/aosp-android-jar | android-33/src/com/android/server/pm/PackageInstallerService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/pm/PackageInstallerService.java | MIT |
private void sendSessionUpdatedBroadcast(PackageInstaller.SessionInfo sessionInfo,
int userId) {
if (TextUtils.isEmpty(sessionInfo.installerPackageName)) {
return;
}
Intent sessionUpdatedIntent = new Intent(PackageInstaller.ACTION_SESSION_UPDATED)
.putExtra(PackageInstaller.EXTRA_SESSION, sessionInfo)
.setPackage(sessionInfo.installerPackageName);
mContext.sendBroadcastAsUser(sessionUpdatedIntent, UserHandle.of(userId));
} |
Send a {@code PackageInstaller.ACTION_SESSION_UPDATED} broadcast intent, containing
the {@code sessionInfo} in the extra field {@code PackageInstaller.EXTRA_SESSION}.
| InternalCallback::sendSessionUpdatedBroadcast | java | Reginer/aosp-android-jar | android-33/src/com/android/server/pm/PackageInstallerService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/pm/PackageInstallerService.java | MIT |
void onInstallerPackageDeleted(int installerAppId, int userId) {
synchronized (mSessions) {
for (int i = 0; i < mSessions.size(); i++) {
final PackageInstallerSession session = mSessions.valueAt(i);
if (!matchesInstaller(session, installerAppId, userId)) {
continue;
}
// Find parent session and only abandon parent session if installer matches
PackageInstallerSession root = !session.hasParentSessionId()
? session : mSessions.get(session.getParentSessionId());
if (root != null && matchesInstaller(root, installerAppId, userId)
&& !root.isDestroyed()) {
root.abandon();
}
}
}
} |
Abandon unfinished sessions if the installer package has been uninstalled.
@param installerAppId the app ID of the installer package that has been uninstalled.
@param userId the user that has the installer package uninstalled.
| InternalCallback::onInstallerPackageDeleted | java | Reginer/aosp-android-jar | android-33/src/com/android/server/pm/PackageInstallerService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/pm/PackageInstallerService.java | MIT |
public void makeExistingFilesAndDbsAccessible() {
String[] databaseList = mFileContext.databaseList();
for (String diskName : databaseList) {
if (shouldDiskNameBeVisible(diskName)) {
mDatabaseNames.add(publicNameFromDiskName(diskName));
}
}
String[] fileList = mFileContext.fileList();
for (String diskName : fileList) {
if (shouldDiskNameBeVisible(diskName)) {
mFileNames.add(publicNameFromDiskName(diskName));
}
}
} |
Makes accessible all files and databases whose names match the filePrefix that was passed to
the constructor. Normally only files and databases that were created through this context are
accessible.
| RenamingDelegatingContext::makeExistingFilesAndDbsAccessible | java | Reginer/aosp-android-jar | android-34/src/android/test/RenamingDelegatingContext.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/test/RenamingDelegatingContext.java | MIT |
boolean shouldDiskNameBeVisible(String diskName) {
return diskName.startsWith(mFilePrefix);
} |
Returns if the given diskName starts with the given prefix or not.
@param diskName name of the database/file.
| RenamingDelegatingContext::shouldDiskNameBeVisible | java | Reginer/aosp-android-jar | android-34/src/android/test/RenamingDelegatingContext.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/test/RenamingDelegatingContext.java | MIT |
String publicNameFromDiskName(String diskName) {
if (!shouldDiskNameBeVisible(diskName)) {
throw new IllegalArgumentException("disk file should not be visible: " + diskName);
}
return diskName.substring(mFilePrefix.length(), diskName.length());
} |
Returns the public name (everything following the prefix) of the given diskName.
@param diskName name of the database/file.
| RenamingDelegatingContext::publicNameFromDiskName | java | Reginer/aosp-android-jar | android-34/src/android/test/RenamingDelegatingContext.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/test/RenamingDelegatingContext.java | MIT |
public RenamingDelegatingContext(Context context, String filePrefix) {
super(context);
mFileContext = context;
mFilePrefix = filePrefix;
} |
@param context : the context that will be delegated.
@param filePrefix : a prefix with which database and file names will be
prefixed.
| RenamingDelegatingContext::RenamingDelegatingContext | java | Reginer/aosp-android-jar | android-34/src/android/test/RenamingDelegatingContext.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/test/RenamingDelegatingContext.java | MIT |
public RenamingDelegatingContext(Context context, Context fileContext, String filePrefix) {
super(context);
mFileContext = fileContext;
mFilePrefix = filePrefix;
} |
@param context : the context that will be delegated.
@param fileContext : the context that file and db methods will be delegated to
@param filePrefix : a prefix with which database and file names will be
prefixed.
| RenamingDelegatingContext::RenamingDelegatingContext | java | Reginer/aosp-android-jar | android-34/src/android/test/RenamingDelegatingContext.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/test/RenamingDelegatingContext.java | MIT |
public static Set<ComponentName> getEnabledServicesFromSettings(Context context, int userId) {
final String enabledServicesSetting = Settings.Secure.getStringForUser(
context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
userId);
if (TextUtils.isEmpty(enabledServicesSetting)) {
return Collections.emptySet();
}
final Set<ComponentName> enabledServices = new HashSet<>();
final TextUtils.StringSplitter colonSplitter =
new TextUtils.SimpleStringSplitter(SERVICES_SEPARATOR);
colonSplitter.setString(enabledServicesSetting);
for (String componentNameString : colonSplitter) {
final ComponentName enabledService = ComponentName.unflattenFromString(
componentNameString);
if (enabledService != null) {
enabledServices.add(enabledService);
}
}
return enabledServices;
} |
Returns the set of enabled accessibility services for userId. If there are no
services, it returns the unmodifiable {@link Collections#emptySet()}.
| AccessibilityUtils::getEnabledServicesFromSettings | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | MIT |
public static void setAccessibilityServiceState(Context context, ComponentName componentName,
boolean enabled) {
setAccessibilityServiceState(context, componentName, enabled, UserHandle.myUserId());
} |
Changes an accessibility component's state.
| AccessibilityUtils::setAccessibilityServiceState | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | MIT |
public static void setAccessibilityServiceState(Context context, ComponentName componentName,
boolean enabled, int userId) {
Set<ComponentName> enabledServices = getEnabledServicesFromSettings(
context, userId);
if (enabledServices.isEmpty()) {
enabledServices = new ArraySet<>(/* capacity= */ 1);
}
if (enabled) {
enabledServices.add(componentName);
} else {
enabledServices.remove(componentName);
}
final StringBuilder enabledServicesBuilder = new StringBuilder();
for (ComponentName enabledService : enabledServices) {
enabledServicesBuilder.append(enabledService.flattenToString());
enabledServicesBuilder.append(
SERVICES_SEPARATOR);
}
final int enabledServicesBuilderLength = enabledServicesBuilder.length();
if (enabledServicesBuilderLength > 0) {
enabledServicesBuilder.deleteCharAt(enabledServicesBuilderLength - 1);
}
Settings.Secure.putStringForUser(context.getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
enabledServicesBuilder.toString(), userId);
} |
Changes an accessibility component's state for {@param userId}.
| AccessibilityUtils::setAccessibilityServiceState | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | MIT |
public static @AccessibilityFragmentType int getAccessibilityServiceFragmentType(
@NonNull AccessibilityServiceInfo accessibilityServiceInfo) {
final int targetSdk = accessibilityServiceInfo.getResolveInfo()
.serviceInfo.applicationInfo.targetSdkVersion;
final boolean requestA11yButton = (accessibilityServiceInfo.flags
& AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON) != 0;
if (targetSdk <= Build.VERSION_CODES.Q) {
return AccessibilityFragmentType.VOLUME_SHORTCUT_TOGGLE;
}
return requestA11yButton
? AccessibilityFragmentType.INVISIBLE_TOGGLE
: AccessibilityFragmentType.TOGGLE;
} |
Gets the corresponding fragment type of a given accessibility service.
@param accessibilityServiceInfo The accessibilityService's info.
@return int from {@link AccessibilityFragmentType}.
| AccessibilityUtils::getAccessibilityServiceFragmentType | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | MIT |
public static boolean isAccessibilityServiceEnabled(Context context,
@NonNull String componentId) {
final AccessibilityManager am = (AccessibilityManager) context.getSystemService(
Context.ACCESSIBILITY_SERVICE);
final List<AccessibilityServiceInfo> enabledServices =
am.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
for (AccessibilityServiceInfo info : enabledServices) {
final String id = info.getComponentName().flattenToString();
if (id.equals(componentId)) {
return true;
}
}
return false;
} |
Returns if a {@code componentId} service is enabled.
@param context The current context.
@param componentId The component id that need to be checked.
@return {@code true} if a {@code componentId} service is enabled.
| AccessibilityUtils::isAccessibilityServiceEnabled | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | MIT |
public static boolean isUserSetupCompleted(Context context) {
return Settings.Secure.getIntForUser(context.getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE, /* def= */ 0, UserHandle.USER_CURRENT)
!= /* false */ 0;
} |
Indicates whether the current user has completed setup via the setup wizard.
{@link android.provider.Settings.Secure#USER_SETUP_COMPLETE}
@return {@code true} if the setup is completed.
| AccessibilityUtils::isUserSetupCompleted | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/accessibility/util/AccessibilityUtils.java | MIT |
boolean isNextThumbnailTransitionAspectScaled() {
return mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP ||
mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN;
} |
Refers to the transition to activity started by using {@link
android.content.pm.crossprofile.CrossProfileApps#startMainActivity(ComponentName, UserHandle)
}.
private static final int NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS = 9;
private static final int NEXT_TRANSIT_TYPE_REMOTE = 10;
private int mNextAppTransitionType = NEXT_TRANSIT_TYPE_NONE;
private boolean mNextAppTransitionOverrideRequested;
private String mNextAppTransitionPackage;
// Used for thumbnail transitions. True if we're scaling up, false if scaling down
private boolean mNextAppTransitionScaleUp;
private IRemoteCallback mNextAppTransitionCallback;
private IRemoteCallback mNextAppTransitionFutureCallback;
private IRemoteCallback mAnimationFinishedCallback;
private int mNextAppTransitionEnter;
private int mNextAppTransitionExit;
private @ColorInt int mNextAppTransitionBackgroundColor;
private int mNextAppTransitionInPlace;
private boolean mNextAppTransitionIsSync;
// Keyed by WindowContainer hashCode.
private final SparseArray<AppTransitionAnimationSpec> mNextAppTransitionAnimationsSpecs
= new SparseArray<>();
private IAppTransitionAnimationSpecsFuture mNextAppTransitionAnimationsSpecsFuture;
private boolean mNextAppTransitionAnimationsSpecsPending;
private AppTransitionAnimationSpec mDefaultNextAppTransitionAnimationSpec;
private final Rect mTmpRect = new Rect();
private final static int APP_STATE_IDLE = 0;
private final static int APP_STATE_READY = 1;
private final static int APP_STATE_RUNNING = 2;
private final static int APP_STATE_TIMEOUT = 3;
private int mAppTransitionState = APP_STATE_IDLE;
private final ArrayList<AppTransitionListener> mListeners = new ArrayList<>();
private KeyguardExitAnimationStartListener mKeyguardExitAnimationStartListener;
private final ExecutorService mDefaultExecutor = Executors.newSingleThreadExecutor();
private final boolean mGridLayoutRecentsEnabled;
private final int mDefaultWindowAnimationStyleResId;
private boolean mOverrideTaskTransition;
private RemoteAnimationController mRemoteAnimationController;
final Handler mHandler;
final Runnable mHandleAppTransitionTimeoutRunnable = () -> handleAppTransitionTimeout();
AppTransition(Context context, WindowManagerService service, DisplayContent displayContent) {
mContext = context;
mService = service;
mHandler = new Handler(service.mH.getLooper());
mDisplayContent = displayContent;
mTransitionAnimation = new TransitionAnimation(
context, ProtoLogImpl.isEnabled(WM_DEBUG_ANIM), TAG);
mGridLayoutRecentsEnabled = SystemProperties.getBoolean("ro.recents.grid", false);
final TypedArray windowStyle = mContext.getTheme().obtainStyledAttributes(
com.android.internal.R.styleable.Window);
mDefaultWindowAnimationStyleResId = windowStyle.getResourceId(
com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
windowStyle.recycle();
}
boolean isTransitionSet() {
return !mNextAppTransitionRequests.isEmpty();
}
boolean isUnoccluding() {
return mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_UNOCCLUDE);
}
boolean transferFrom(AppTransition other) {
mNextAppTransitionRequests.addAll(other.mNextAppTransitionRequests);
return prepare();
}
void setLastAppTransition(@TransitionOldType int transit, ActivityRecord openingApp,
ActivityRecord closingApp, ActivityRecord changingApp) {
mLastUsedAppTransition = transit;
mLastOpeningApp = "" + openingApp;
mLastClosingApp = "" + closingApp;
mLastChangingApp = "" + changingApp;
}
boolean isReady() {
return mAppTransitionState == APP_STATE_READY
|| mAppTransitionState == APP_STATE_TIMEOUT;
}
void setReady() {
setAppTransitionState(APP_STATE_READY);
fetchAppTransitionSpecsFromFuture();
}
void abort() {
if (mRemoteAnimationController != null) {
mRemoteAnimationController.cancelAnimation("aborted");
}
clear();
}
boolean isRunning() {
return mAppTransitionState == APP_STATE_RUNNING;
}
void setIdle() {
setAppTransitionState(APP_STATE_IDLE);
}
boolean isIdle() {
return mAppTransitionState == APP_STATE_IDLE;
}
boolean isTimeout() {
return mAppTransitionState == APP_STATE_TIMEOUT;
}
void setTimeout() {
setAppTransitionState(APP_STATE_TIMEOUT);
}
HardwareBuffer getAppTransitionThumbnailHeader(WindowContainer container) {
AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(
container.hashCode());
if (spec == null) {
spec = mDefaultNextAppTransitionAnimationSpec;
}
return spec != null ? spec.buffer : null;
}
/** Returns whether the next thumbnail transition is aspect scaled up. | AppTransition::isNextThumbnailTransitionAspectScaled | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/AppTransition.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/AppTransition.java | MIT |
boolean isNextThumbnailTransitionScaleUp() {
return mNextAppTransitionScaleUp;
} |
Refers to the transition to activity started by using {@link
android.content.pm.crossprofile.CrossProfileApps#startMainActivity(ComponentName, UserHandle)
}.
private static final int NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS = 9;
private static final int NEXT_TRANSIT_TYPE_REMOTE = 10;
private int mNextAppTransitionType = NEXT_TRANSIT_TYPE_NONE;
private boolean mNextAppTransitionOverrideRequested;
private String mNextAppTransitionPackage;
// Used for thumbnail transitions. True if we're scaling up, false if scaling down
private boolean mNextAppTransitionScaleUp;
private IRemoteCallback mNextAppTransitionCallback;
private IRemoteCallback mNextAppTransitionFutureCallback;
private IRemoteCallback mAnimationFinishedCallback;
private int mNextAppTransitionEnter;
private int mNextAppTransitionExit;
private @ColorInt int mNextAppTransitionBackgroundColor;
private int mNextAppTransitionInPlace;
private boolean mNextAppTransitionIsSync;
// Keyed by WindowContainer hashCode.
private final SparseArray<AppTransitionAnimationSpec> mNextAppTransitionAnimationsSpecs
= new SparseArray<>();
private IAppTransitionAnimationSpecsFuture mNextAppTransitionAnimationsSpecsFuture;
private boolean mNextAppTransitionAnimationsSpecsPending;
private AppTransitionAnimationSpec mDefaultNextAppTransitionAnimationSpec;
private final Rect mTmpRect = new Rect();
private final static int APP_STATE_IDLE = 0;
private final static int APP_STATE_READY = 1;
private final static int APP_STATE_RUNNING = 2;
private final static int APP_STATE_TIMEOUT = 3;
private int mAppTransitionState = APP_STATE_IDLE;
private final ArrayList<AppTransitionListener> mListeners = new ArrayList<>();
private KeyguardExitAnimationStartListener mKeyguardExitAnimationStartListener;
private final ExecutorService mDefaultExecutor = Executors.newSingleThreadExecutor();
private final boolean mGridLayoutRecentsEnabled;
private final int mDefaultWindowAnimationStyleResId;
private boolean mOverrideTaskTransition;
private RemoteAnimationController mRemoteAnimationController;
final Handler mHandler;
final Runnable mHandleAppTransitionTimeoutRunnable = () -> handleAppTransitionTimeout();
AppTransition(Context context, WindowManagerService service, DisplayContent displayContent) {
mContext = context;
mService = service;
mHandler = new Handler(service.mH.getLooper());
mDisplayContent = displayContent;
mTransitionAnimation = new TransitionAnimation(
context, ProtoLogImpl.isEnabled(WM_DEBUG_ANIM), TAG);
mGridLayoutRecentsEnabled = SystemProperties.getBoolean("ro.recents.grid", false);
final TypedArray windowStyle = mContext.getTheme().obtainStyledAttributes(
com.android.internal.R.styleable.Window);
mDefaultWindowAnimationStyleResId = windowStyle.getResourceId(
com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
windowStyle.recycle();
}
boolean isTransitionSet() {
return !mNextAppTransitionRequests.isEmpty();
}
boolean isUnoccluding() {
return mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_UNOCCLUDE);
}
boolean transferFrom(AppTransition other) {
mNextAppTransitionRequests.addAll(other.mNextAppTransitionRequests);
return prepare();
}
void setLastAppTransition(@TransitionOldType int transit, ActivityRecord openingApp,
ActivityRecord closingApp, ActivityRecord changingApp) {
mLastUsedAppTransition = transit;
mLastOpeningApp = "" + openingApp;
mLastClosingApp = "" + closingApp;
mLastChangingApp = "" + changingApp;
}
boolean isReady() {
return mAppTransitionState == APP_STATE_READY
|| mAppTransitionState == APP_STATE_TIMEOUT;
}
void setReady() {
setAppTransitionState(APP_STATE_READY);
fetchAppTransitionSpecsFromFuture();
}
void abort() {
if (mRemoteAnimationController != null) {
mRemoteAnimationController.cancelAnimation("aborted");
}
clear();
}
boolean isRunning() {
return mAppTransitionState == APP_STATE_RUNNING;
}
void setIdle() {
setAppTransitionState(APP_STATE_IDLE);
}
boolean isIdle() {
return mAppTransitionState == APP_STATE_IDLE;
}
boolean isTimeout() {
return mAppTransitionState == APP_STATE_TIMEOUT;
}
void setTimeout() {
setAppTransitionState(APP_STATE_TIMEOUT);
}
HardwareBuffer getAppTransitionThumbnailHeader(WindowContainer container) {
AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(
container.hashCode());
if (spec == null) {
spec = mDefaultNextAppTransitionAnimationSpec;
}
return spec != null ? spec.buffer : null;
}
/** Returns whether the next thumbnail transition is aspect scaled up.
boolean isNextThumbnailTransitionAspectScaled() {
return mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP ||
mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN;
}
/** Returns whether the next thumbnail transition is scaling up. | AppTransition::isNextThumbnailTransitionScaleUp | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/AppTransition.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/AppTransition.java | MIT |
boolean isFetchingAppTransitionsSpecs() {
return mNextAppTransitionAnimationsSpecsPending;
} |
@return true if and only if we are currently fetching app transition specs from the future
passed into {@link #overridePendingAppTransitionMultiThumbFuture}
| AppTransition::isFetchingAppTransitionsSpecs | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/AppTransition.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/AppTransition.java | MIT |
int goodToGo(@TransitionOldType int transit, ActivityRecord topOpeningApp) {
mNextAppTransitionFlags = 0;
mNextAppTransitionRequests.clear();
setAppTransitionState(APP_STATE_RUNNING);
final WindowContainer wc =
topOpeningApp != null ? topOpeningApp.getAnimatingContainer() : null;
final AnimationAdapter topOpeningAnim = wc != null ? wc.getAnimation() : null;
int redoLayout = notifyAppTransitionStartingLocked(
AppTransition.isKeyguardGoingAwayTransitOld(transit),
AppTransition.isKeyguardOccludeTransitOld(transit),
topOpeningAnim != null ? topOpeningAnim.getDurationHint() : 0,
topOpeningAnim != null
? topOpeningAnim.getStatusBarTransitionsStartTime()
: SystemClock.uptimeMillis(),
AnimationAdapter.STATUS_BAR_TRANSITION_DURATION);
if (mRemoteAnimationController != null) {
mRemoteAnimationController.goodToGo(transit);
} else if ((isTaskOpenTransitOld(transit) || transit == TRANSIT_OLD_WALLPAPER_CLOSE)
&& topOpeningAnim != null) {
if (mDisplayContent.getDisplayPolicy().shouldAttachNavBarToAppDuringTransition()
&& mService.getRecentsAnimationController() == null) {
final NavBarFadeAnimationController controller =
new NavBarFadeAnimationController(mDisplayContent);
// For remote animation case, the nav bar fades out and in is controlled by the
// remote side. For non-remote animation case, we play the fade out/in animation
// here. We play the nav bar fade-out animation when the app transition animation
// starts and play the fade-in animation sequentially once the fade-out is finished.
controller.fadeOutAndInSequentially(topOpeningAnim.getDurationHint(),
null /* fadeOutParent */, topOpeningApp.getSurfaceControl());
}
}
return redoLayout;
} |
@return bit-map of WindowManagerPolicy#FINISH_LAYOUT_REDO_* to indicate whether another
layout pass needs to be done
| AppTransition::goodToGo | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/AppTransition.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/AppTransition.java | MIT |
void updateBooster() {
WindowManagerService.sThreadPriorityBooster.setAppTransitionRunning(needsBoosting());
} |
Updates whether we currently boost wm locked sections and the animation thread. We want to
boost the priorities to a more important value whenever an app transition is going to happen
soon or an app transition is running.
| AppTransition::updateBooster | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/AppTransition.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/AppTransition.java | MIT |
HardwareBuffer createCrossProfileAppsThumbnail(
Drawable thumbnailDrawable, Rect frame) {
return mTransitionAnimation.createCrossProfileAppsThumbnail(thumbnailDrawable, frame);
} |
Creates an overlay with a background color and a thumbnail for the cross profile apps
animation.
| AppTransition::createCrossProfileAppsThumbnail | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/AppTransition.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/AppTransition.java | MIT |
Animation createThumbnailAspectScaleAnimationLocked(Rect appRect, @Nullable Rect contentInsets,
HardwareBuffer thumbnailHeader, WindowContainer container, int orientation) {
AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(
container.hashCode());
return mTransitionAnimation.createThumbnailAspectScaleAnimationLocked(appRect,
contentInsets, thumbnailHeader, orientation, spec != null ? spec.rect : null,
mDefaultNextAppTransitionAnimationSpec != null
? mDefaultNextAppTransitionAnimationSpec.rect : null,
mNextAppTransitionScaleUp);
} |
This animation runs for the thumbnail that gets cross faded with the enter/exit activity
when a thumbnail is specified with the pending animation override.
| AppTransition::createThumbnailAspectScaleAnimationLocked | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/AppTransition.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/AppTransition.java | MIT |
boolean canSkipFirstFrame() {
return mNextAppTransitionType != NEXT_TRANSIT_TYPE_CUSTOM
&& !mNextAppTransitionOverrideRequested
&& mNextAppTransitionType != NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE
&& mNextAppTransitionType != NEXT_TRANSIT_TYPE_CLIP_REVEAL
&& !mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_GOING_AWAY);
} |
@return true if and only if the first frame of the transition can be skipped, i.e. the first
frame of the transition doesn't change the visuals on screen, so we can start
directly with the second one
| AppTransition::canSkipFirstFrame | java | Reginer/aosp-android-jar | android-33/src/com/android/server/wm/AppTransition.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/AppTransition.java | MIT |
public nodesetprefix02(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
org.w3c.domts.DocumentBuilderSetting[] settings =
new org.w3c.domts.DocumentBuilderSetting[] {
org.w3c.domts.DocumentBuilderSetting.namespaceAware
};
DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings);
setFactory(testFactory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "staffNS", true);
} |
Constructor.
@param factory document factory, may not be null
@throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
| nodesetprefix02::nodesetprefix02 | java | Reginer/aosp-android-jar | android-32/src/org/w3c/domts/level2/core/nodesetprefix02.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level2/core/nodesetprefix02.java | MIT |
public void runTest() throws Throwable {
Document doc;
Element element;
Attr attribute;
Attr newAttribute;
Node setNode;
NodeList elementList;
String attrName;
String newAttrName;
doc = (Document) load("staffNS", true);
elementList = doc.getElementsByTagName("address");
element = (Element) elementList.item(1);
newAttribute = doc.createAttributeNS("http://www.w3.org/DOM/Test", "test:address");
setNode = element.setAttributeNodeNS(newAttribute);
newAttribute.setPrefix("dom");
attribute = element.getAttributeNodeNS("http://www.usa.com", "domestic");
attrName = attribute.getNodeName();
newAttrName = newAttribute.getNodeName();
assertEquals("nodesetprefix02_attrName", "dmstc:domestic", attrName);
assertEquals("nodesetprefix02_newAttrName", "dom:address", newAttrName);
} |
Runs the test case.
@throws Throwable Any uncaught exception causes test to fail
| nodesetprefix02::runTest | java | Reginer/aosp-android-jar | android-32/src/org/w3c/domts/level2/core/nodesetprefix02.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level2/core/nodesetprefix02.java | MIT |
public String getTargetURI() {
return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodesetprefix02";
} |
Gets URI that identifies the test.
@return uri identifier of test
| nodesetprefix02::getTargetURI | java | Reginer/aosp-android-jar | android-32/src/org/w3c/domts/level2/core/nodesetprefix02.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level2/core/nodesetprefix02.java | MIT |
public static void main(final String[] args) {
DOMTestCase.doMain(nodesetprefix02.class, args);
} |
Runs this test from the command line.
@param args command line arguments
| nodesetprefix02::main | java | Reginer/aosp-android-jar | android-32/src/org/w3c/domts/level2/core/nodesetprefix02.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level2/core/nodesetprefix02.java | MIT |
public void onPause() {
mAdminSecondaryLockScreenController.hide();
if (mCurrentSecurityMode != SecurityMode.None) {
getCurrentSecurityController().onPause();
}
mView.onPause();
} | /*
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
package com.android.keyguard;
import static com.android.keyguard.KeyguardSecurityContainer.BOUNCER_DISMISS_BIOMETRIC;
import static com.android.keyguard.KeyguardSecurityContainer.BOUNCER_DISMISS_EXTENDED_ACCESS;
import static com.android.keyguard.KeyguardSecurityContainer.BOUNCER_DISMISS_NONE_SECURITY;
import static com.android.keyguard.KeyguardSecurityContainer.BOUNCER_DISMISS_PASSWORD;
import static com.android.keyguard.KeyguardSecurityContainer.BOUNCER_DISMISS_SIM;
import static com.android.keyguard.KeyguardSecurityContainer.USER_TYPE_PRIMARY;
import static com.android.keyguard.KeyguardSecurityContainer.USER_TYPE_SECONDARY_USER;
import static com.android.keyguard.KeyguardSecurityContainer.USER_TYPE_WORK_PROFILE;
import static com.android.systemui.DejankUtils.whitelistIpcs;
import android.app.admin.DevicePolicyManager;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.metrics.LogMaker;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
import android.util.Slog;
import android.view.MotionEvent;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityContainer.BouncerUiEvent;
import com.android.keyguard.KeyguardSecurityContainer.SecurityCallback;
import com.android.keyguard.KeyguardSecurityContainer.SwipeListener;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.dagger.KeyguardBouncerScope;
import com.android.settingslib.utils.ThreadUtils;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.ViewController;
import javax.inject.Inject;
/** Controller for {@link KeyguardSecurityContainer}
@KeyguardBouncerScope
public class KeyguardSecurityContainerController extends ViewController<KeyguardSecurityContainer>
implements KeyguardSecurityView {
private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final String TAG = "KeyguardSecurityView";
private final AdminSecondaryLockScreenController mAdminSecondaryLockScreenController;
private final LockPatternUtils mLockPatternUtils;
private final KeyguardUpdateMonitor mUpdateMonitor;
private final KeyguardSecurityModel mSecurityModel;
private final MetricsLogger mMetricsLogger;
private final UiEventLogger mUiEventLogger;
private final KeyguardStateController mKeyguardStateController;
private final KeyguardSecurityViewFlipperController mSecurityViewFlipperController;
private final SecurityCallback mSecurityCallback;
private final ConfigurationController mConfigurationController;
private final FalsingCollector mFalsingCollector;
private int mLastOrientation = Configuration.ORIENTATION_UNDEFINED;
private SecurityMode mCurrentSecurityMode = SecurityMode.Invalid;
@VisibleForTesting
final Gefingerpoken mGlobalTouchListener = new Gefingerpoken() {
private MotionEvent mTouchDown;
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
// Do just a bit of our own falsing. People should only be tapping on the input, not
// swiping.
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
// If we're in one handed mode, the user can tap on the opposite side of the screen
// to move the bouncer across. In that case, inhibit the falsing (otherwise the taps
// to move the bouncer to each screen side can end up closing it instead).
if (mView.isOneHandedMode()) {
if ((mView.isOneHandedModeLeftAligned() && ev.getX() > mView.getWidth() / 2f)
|| (!mView.isOneHandedModeLeftAligned()
&& ev.getX() <= mView.getWidth() / 2f)) {
mFalsingCollector.avoidGesture();
}
}
if (mTouchDown != null) {
mTouchDown.recycle();
mTouchDown = null;
}
mTouchDown = MotionEvent.obtain(ev);
} else if (mTouchDown != null) {
if (ev.getActionMasked() == MotionEvent.ACTION_UP
|| ev.getActionMasked() == MotionEvent.ACTION_CANCEL) {
mTouchDown.recycle();
mTouchDown = null;
}
}
return false;
}
};
private KeyguardSecurityCallback mKeyguardSecurityCallback = new KeyguardSecurityCallback() {
public void userActivity() {
if (mSecurityCallback != null) {
mSecurityCallback.userActivity();
}
}
@Override
public void onUserInput() {
mUpdateMonitor.cancelFaceAuth();
}
@Override
public void dismiss(boolean authenticated, int targetId) {
dismiss(authenticated, targetId, /* bypassSecondaryLockScreen */ false);
}
@Override
public void dismiss(boolean authenticated, int targetId,
boolean bypassSecondaryLockScreen) {
mSecurityCallback.dismiss(authenticated, targetId, bypassSecondaryLockScreen);
}
public boolean isVerifyUnlockOnly() {
return false;
}
public void reportUnlockAttempt(int userId, boolean success, int timeoutMs) {
int bouncerSide = SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__SIDE__DEFAULT;
if (canUseOneHandedBouncer()) {
bouncerSide = isOneHandedKeyguardLeftAligned()
? SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__SIDE__LEFT
: SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__SIDE__RIGHT;
}
if (success) {
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED,
SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__SUCCESS,
bouncerSide);
mLockPatternUtils.reportSuccessfulPasswordAttempt(userId);
// Force a garbage collection in an attempt to erase any lockscreen password left in
// memory. Do it asynchronously with a 5-sec delay to avoid making the keyguard
// dismiss animation janky.
ThreadUtils.postOnBackgroundThread(() -> {
try {
Thread.sleep(5000);
} catch (InterruptedException ignored) { }
System.gc();
System.runFinalization();
System.gc();
});
} else {
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED,
SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__FAILURE,
bouncerSide);
reportFailedUnlockAttempt(userId, timeoutMs);
}
mMetricsLogger.write(new LogMaker(MetricsEvent.BOUNCER)
.setType(success ? MetricsEvent.TYPE_SUCCESS : MetricsEvent.TYPE_FAILURE));
mUiEventLogger.log(success ? BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS
: BouncerUiEvent.BOUNCER_PASSWORD_FAILURE);
}
public void reset() {
mSecurityCallback.reset();
}
public void onCancelClicked() {
mSecurityCallback.onCancelClicked();
}
};
private SwipeListener mSwipeListener = new SwipeListener() {
@Override
public void onSwipeUp() {
if (!mUpdateMonitor.isFaceDetectionRunning()) {
mUpdateMonitor.requestFaceAuth(true);
mKeyguardSecurityCallback.userActivity();
showMessage(null, null);
}
}
};
private ConfigurationController.ConfigurationListener mConfigurationListener =
new ConfigurationController.ConfigurationListener() {
@Override
public void onThemeChanged() {
mSecurityViewFlipperController.reloadColors();
}
@Override
public void onUiModeChanged() {
mSecurityViewFlipperController.reloadColors();
}
};
private KeyguardSecurityContainerController(KeyguardSecurityContainer view,
AdminSecondaryLockScreenController.Factory adminSecondaryLockScreenControllerFactory,
LockPatternUtils lockPatternUtils,
KeyguardUpdateMonitor keyguardUpdateMonitor,
KeyguardSecurityModel keyguardSecurityModel,
MetricsLogger metricsLogger,
UiEventLogger uiEventLogger,
KeyguardStateController keyguardStateController,
SecurityCallback securityCallback,
KeyguardSecurityViewFlipperController securityViewFlipperController,
ConfigurationController configurationController,
FalsingCollector falsingCollector) {
super(view);
mLockPatternUtils = lockPatternUtils;
mUpdateMonitor = keyguardUpdateMonitor;
mSecurityModel = keyguardSecurityModel;
mMetricsLogger = metricsLogger;
mUiEventLogger = uiEventLogger;
mKeyguardStateController = keyguardStateController;
mSecurityCallback = securityCallback;
mSecurityViewFlipperController = securityViewFlipperController;
mAdminSecondaryLockScreenController = adminSecondaryLockScreenControllerFactory.create(
mKeyguardSecurityCallback);
mConfigurationController = configurationController;
mLastOrientation = getResources().getConfiguration().orientation;
mFalsingCollector = falsingCollector;
}
@Override
public void onInit() {
mSecurityViewFlipperController.init();
}
@Override
protected void onViewAttached() {
mView.setSwipeListener(mSwipeListener);
mView.addMotionEventListener(mGlobalTouchListener);
mConfigurationController.addCallback(mConfigurationListener);
}
@Override
protected void onViewDetached() {
mConfigurationController.removeCallback(mConfigurationListener);
mView.removeMotionEventListener(mGlobalTouchListener);
}
/** | KeyguardSecurityContainerController::onPause | java | Reginer/aosp-android-jar | android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | MIT |
public void showPrimarySecurityScreen(boolean turningOff) {
SecurityMode securityMode = whitelistIpcs(() -> mSecurityModel.getSecurityMode(
KeyguardUpdateMonitor.getCurrentUser()));
if (DEBUG) Log.v(TAG, "showPrimarySecurityScreen(turningOff=" + turningOff + ")");
showSecurityScreen(securityMode);
} |
Shows the primary security screen for the user. This will be either the multi-selector
or the user's security method.
@param turningOff true if the device is being turned off
| KeyguardSecurityContainerController::showPrimarySecurityScreen | java | Reginer/aosp-android-jar | android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | MIT |
public boolean showNextSecurityScreenOrFinish(boolean authenticated, int targetUserId,
boolean bypassSecondaryLockScreen) {
if (DEBUG) Log.d(TAG, "showNextSecurityScreenOrFinish(" + authenticated + ")");
boolean finish = false;
boolean strongAuth = false;
int eventSubtype = -1;
BouncerUiEvent uiEvent = BouncerUiEvent.UNKNOWN;
if (mUpdateMonitor.getUserHasTrust(targetUserId)) {
finish = true;
eventSubtype = BOUNCER_DISMISS_EXTENDED_ACCESS;
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_EXTENDED_ACCESS;
} else if (mUpdateMonitor.getUserUnlockedWithBiometric(targetUserId)) {
finish = true;
eventSubtype = BOUNCER_DISMISS_BIOMETRIC;
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_BIOMETRIC;
} else if (SecurityMode.None == getCurrentSecurityMode()) {
SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId);
if (SecurityMode.None == securityMode) {
finish = true; // no security required
eventSubtype = BOUNCER_DISMISS_NONE_SECURITY;
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_NONE_SECURITY;
} else {
showSecurityScreen(securityMode); // switch to the alternate security view
}
} else if (authenticated) {
switch (getCurrentSecurityMode()) {
case Pattern:
case Password:
case PIN:
strongAuth = true;
finish = true;
eventSubtype = BOUNCER_DISMISS_PASSWORD;
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_PASSWORD;
break;
case SimPin:
case SimPuk:
// Shortcut for SIM PIN/PUK to go to directly to user's security screen or home
SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId);
if (securityMode == SecurityMode.None && mLockPatternUtils.isLockScreenDisabled(
KeyguardUpdateMonitor.getCurrentUser())) {
finish = true;
eventSubtype = BOUNCER_DISMISS_SIM;
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_SIM;
} else {
showSecurityScreen(securityMode);
}
break;
default:
Log.v(TAG, "Bad security screen " + getCurrentSecurityMode()
+ ", fail safe");
showPrimarySecurityScreen(false);
break;
}
}
// Check for device admin specified additional security measures.
if (finish && !bypassSecondaryLockScreen) {
Intent secondaryLockscreenIntent =
mUpdateMonitor.getSecondaryLockscreenRequirement(targetUserId);
if (secondaryLockscreenIntent != null) {
mAdminSecondaryLockScreenController.show(secondaryLockscreenIntent);
return false;
}
}
if (eventSubtype != -1) {
mMetricsLogger.write(new LogMaker(MetricsProto.MetricsEvent.BOUNCER)
.setType(MetricsProto.MetricsEvent.TYPE_DISMISS).setSubtype(eventSubtype));
}
if (uiEvent != BouncerUiEvent.UNKNOWN) {
mUiEventLogger.log(uiEvent);
}
if (finish) {
mSecurityCallback.finish(strongAuth, targetUserId);
}
return finish;
} |
Shows the next security screen if there is one.
@param authenticated true if the user entered the correct authentication
@param targetUserId a user that needs to be the foreground user at the finish (if called)
completion.
@param bypassSecondaryLockScreen true if the user is allowed to bypass the secondary
secondary lock screen requirement, if any.
@return true if keyguard is done
| KeyguardSecurityContainerController::showNextSecurityScreenOrFinish | java | Reginer/aosp-android-jar | android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | MIT |
private boolean isOneHandedKeyguardLeftAligned() {
try {
return Settings.Global.getInt(mView.getContext().getContentResolver(),
Settings.Global.ONE_HANDED_KEYGUARD_SIDE)
== Settings.Global.ONE_HANDED_KEYGUARD_SIDE_LEFT;
} catch (Settings.SettingNotFoundException ex) {
return true;
}
} |
Switches to the given security view unless it's already being shown, in which case
this is a no-op.
@param securityMode
@VisibleForTesting
void showSecurityScreen(SecurityMode securityMode) {
if (DEBUG) Log.d(TAG, "showSecurityScreen(" + securityMode + ")");
if (securityMode == SecurityMode.Invalid || securityMode == mCurrentSecurityMode) {
return;
}
KeyguardInputViewController<KeyguardInputView> oldView = getCurrentSecurityController();
// Emulate Activity life cycle
if (oldView != null) {
oldView.onPause();
}
KeyguardInputViewController<KeyguardInputView> newView = changeSecurityMode(securityMode);
if (newView != null) {
newView.onResume(KeyguardSecurityView.VIEW_REVEALED);
mSecurityViewFlipperController.show(newView);
configureOneHandedMode();
}
mSecurityCallback.onSecurityModeChanged(
securityMode, newView != null && newView.needsInput());
}
/** Read whether the one-handed keyguard should be on the left/right from settings. | KeyguardSecurityContainerController::isOneHandedKeyguardLeftAligned | java | Reginer/aosp-android-jar | android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | MIT |
public void updateResources() {
int newOrientation = getResources().getConfiguration().orientation;
if (newOrientation != mLastOrientation) {
mLastOrientation = newOrientation;
configureOneHandedMode();
}
} |
Apply keyguard configuration from the currently active resources. This can be called when the
device configuration changes, to re-apply some resources that are qualified on the device
configuration.
| KeyguardSecurityContainerController::updateResources | java | Reginer/aosp-android-jar | android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | MIT |
public void updateKeyguardPosition(float x) {
if (mView.isOneHandedMode()) {
mView.setOneHandedModeLeftAligned(x <= mView.getWidth() / 2f, false);
}
} |
Apply keyguard configuration from the currently active resources. This can be called when the
device configuration changes, to re-apply some resources that are qualified on the device
configuration.
public void updateResources() {
int newOrientation = getResources().getConfiguration().orientation;
if (newOrientation != mLastOrientation) {
mLastOrientation = newOrientation;
configureOneHandedMode();
}
}
/** Update keyguard position based on a tapped X coordinate. | KeyguardSecurityContainerController::updateKeyguardPosition | java | Reginer/aosp-android-jar | android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/keyguard/KeyguardSecurityContainerController.java | MIT |
public TsUnacceptableException() {
super(ERROR_TYPE_TS_UNACCEPTABLE);
} |
Construct an instance of TsUnacceptableException.
<p>Except for testing, IKE library users normally do not instantiate this object themselves
but instead get a reference via {@link IkeSessionCallback} or {@link ChildSessionCallback}.
| TsUnacceptableException::TsUnacceptableException | java | Reginer/aosp-android-jar | android-34/src/android/net/ipsec/ike/exceptions/TsUnacceptableException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/ipsec/ike/exceptions/TsUnacceptableException.java | MIT |
public TsUnacceptableException(byte[] notifyData) {
super(ERROR_TYPE_TS_UNACCEPTABLE, notifyData);
} |
Construct a instance of TsUnacceptableException from a notify payload.
@param notifyData the notify data included in the payload.
@hide
| TsUnacceptableException::TsUnacceptableException | java | Reginer/aosp-android-jar | android-34/src/android/net/ipsec/ike/exceptions/TsUnacceptableException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/ipsec/ike/exceptions/TsUnacceptableException.java | MIT |
public GestureStroke(ArrayList<GesturePoint> points) {
final int count = points.size();
final float[] tmpPoints = new float[count * 2];
final long[] times = new long[count];
RectF bx = null;
float len = 0;
int index = 0;
for (int i = 0; i < count; i++) {
final GesturePoint p = points.get(i);
tmpPoints[i * 2] = p.x;
tmpPoints[i * 2 + 1] = p.y;
times[index] = p.timestamp;
if (bx == null) {
bx = new RectF();
bx.top = p.y;
bx.left = p.x;
bx.right = p.x;
bx.bottom = p.y;
len = 0;
} else {
len += Math.hypot(p.x - tmpPoints[(i - 1) * 2], p.y - tmpPoints[(i -1) * 2 + 1]);
bx.union(p.x, p.y);
}
index++;
}
timestamps = times;
this.points = tmpPoints;
boundingBox = bx;
length = len;
} |
A constructor that constructs a gesture stroke from a list of gesture points.
@param points
| GestureStroke::GestureStroke | java | Reginer/aosp-android-jar | android-32/src/android/gesture/GestureStroke.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/gesture/GestureStroke.java | MIT |
private GestureStroke(RectF bbx, float len, float[] pts, long[] times) {
boundingBox = new RectF(bbx.left, bbx.top, bbx.right, bbx.bottom);
length = len;
points = pts.clone();
timestamps = times.clone();
} |
A faster constructor specially for cloning a stroke.
| GestureStroke::GestureStroke | java | Reginer/aosp-android-jar | android-32/src/android/gesture/GestureStroke.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/gesture/GestureStroke.java | MIT |
void draw(Canvas canvas, Paint paint) {
if (mCachedPath == null) {
makePath();
}
canvas.drawPath(mCachedPath, paint);
} |
Draws the stroke with a given canvas and paint.
@param canvas
| GestureStroke::draw | java | Reginer/aosp-android-jar | android-32/src/android/gesture/GestureStroke.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/gesture/GestureStroke.java | MIT |
public Path toPath(float width, float height, int numSample) {
final float[] pts = GestureUtils.temporalSampling(this, numSample);
final RectF rect = boundingBox;
GestureUtils.translate(pts, -rect.left, -rect.top);
float sx = width / rect.width();
float sy = height / rect.height();
float scale = sx > sy ? sy : sx;
GestureUtils.scale(pts, scale, scale);
float mX = 0;
float mY = 0;
Path path = null;
final int count = pts.length;
for (int i = 0; i < count; i += 2) {
float x = pts[i];
float y = pts[i + 1];
if (path == null) {
path = new Path();
path.moveTo(x, y);
mX = x;
mY = y;
} else {
float dx = Math.abs(x - mX);
float dy = Math.abs(y - mY);
if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
path.quadTo(mX, mY, (x + mX) / 2, (y + mY) / 2);
mX = x;
mY = y;
}
}
}
return path;
} |
Converts the stroke to a Path of a given number of points.
@param width the width of the bounding box of the target path
@param height the height of the bounding box of the target path
@param numSample the number of points needed
@return the path
| GestureStroke::toPath | java | Reginer/aosp-android-jar | android-32/src/android/gesture/GestureStroke.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/gesture/GestureStroke.java | MIT |
public void clearPath() {
if (mCachedPath != null) mCachedPath.rewind();
} |
Invalidates the cached path that is used to render the stroke.
| GestureStroke::clearPath | java | Reginer/aosp-android-jar | android-32/src/android/gesture/GestureStroke.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/gesture/GestureStroke.java | MIT |
public OrientedBoundingBox computeOrientedBoundingBox() {
return GestureUtils.computeOrientedBoundingBox(points);
} |
Computes an oriented bounding box of the stroke.
@return OrientedBoundingBox
| GestureStroke::computeOrientedBoundingBox | java | Reginer/aosp-android-jar | android-32/src/android/gesture/GestureStroke.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/gesture/GestureStroke.java | MIT |
public static void setHttpProxyConfiguration(String host, String port, String exclList,
Uri pacFileUrl) {
if (exclList != null) exclList = exclList.replace(",", "|");
if (false) Log.d(TAG, "setHttpProxySystemProperty :"+host+":"+port+" - "+exclList);
if (host != null) {
System.setProperty("http.proxyHost", host);
System.setProperty("https.proxyHost", host);
} else {
System.clearProperty("http.proxyHost");
System.clearProperty("https.proxyHost");
}
if (port != null) {
System.setProperty("http.proxyPort", port);
System.setProperty("https.proxyPort", port);
} else {
System.clearProperty("http.proxyPort");
System.clearProperty("https.proxyPort");
}
if (exclList != null) {
System.setProperty("http.nonProxyHosts", exclList);
System.setProperty("https.nonProxyHosts", exclList);
} else {
System.clearProperty("http.nonProxyHosts");
System.clearProperty("https.nonProxyHosts");
}
if (!Uri.EMPTY.equals(pacFileUrl)) {
ProxySelector.setDefault(new PacProxySelector());
} else {
ProxySelector.setDefault(sDefaultProxySelector);
}
} |
Set HTTP proxy configuration for the process to match the provided ProxyInfo.
If the provided ProxyInfo is null, the proxy configuration will be cleared.
@hide
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public static void setHttpProxyConfiguration(@Nullable ProxyInfo p) {
String host = null;
String port = null;
String exclList = null;
Uri pacFileUrl = Uri.EMPTY;
if (p != null) {
host = p.getHost();
port = Integer.toString(p.getPort());
exclList = ProxyUtils.exclusionListAsString(p.getExclusionList());
pacFileUrl = p.getPacFileUrl();
}
setHttpProxyConfiguration(host, port, exclList, pacFileUrl);
}
/** @hide | Proxy::setHttpProxyConfiguration | java | Reginer/aosp-android-jar | android-34/src/android/net/Proxy.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/Proxy.java | MIT |
public DevicePolicyStringResource(
@NonNull Context context,
@NonNull String stringId,
@StringRes int resourceIdInCallingPackage) {
this(stringId, resourceIdInCallingPackage, new ParcelableResource(
context, resourceIdInCallingPackage, ParcelableResource.RESOURCE_TYPE_STRING));
} |
Creates an object containing the required information for updating an enterprise string
resource using {@link DevicePolicyResourcesManager#setStrings}.
<p>It will be used to update the string defined by {@code stringId} to the string with ID
{@code resourceIdInCallingPackage} in the calling package</p>
@param stringId The ID of the string to update.
@param resourceIdInCallingPackage The ID of the {@link StringRes} in the calling package to
use as an updated resource.
@throws IllegalStateException if the resource with ID {@code resourceIdInCallingPackage}
doesn't exist in the {@code context} package.
| DevicePolicyStringResource::DevicePolicyStringResource | java | Reginer/aosp-android-jar | android-35/src/android/app/admin/DevicePolicyStringResource.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/app/admin/DevicePolicyStringResource.java | MIT |
public int getResourceIdInCallingPackage() {
return mResourceIdInCallingPackage;
} |
Returns the ID of the {@link StringRes} in the calling package to use as an updated
resource.
| DevicePolicyStringResource::getResourceIdInCallingPackage | java | Reginer/aosp-android-jar | android-35/src/android/app/admin/DevicePolicyStringResource.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/app/admin/DevicePolicyStringResource.java | MIT |
public void setListener(com.android.ims.internal.IImsCallSessionListener listener) {
} |
Sets the listener to listen to the session events. An {@link ImsCallSession}
can only hold one listener at a time. Subsequent calls to this method
override the previous listener.
@param listener to listen to the session events of this object
| ImsCallSessionImplBase::setListener | java | Reginer/aosp-android-jar | android-35/src/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java | MIT |
protected static Pair<IkePayload, Integer> getIkePayload(
int payloadType, boolean isResp, ByteBuffer input) throws IkeProtocolException {
int nextPayloadType = (int) input.get();
// read critical bit
boolean isCritical = isCriticalPayload(input.get());
int payloadLength = Short.toUnsignedInt(input.getShort());
if (payloadLength <= IkePayload.GENERIC_HEADER_LENGTH) {
throw new InvalidSyntaxException(
"Invalid Payload Length: Payload length is too short.");
}
int bodyLength = payloadLength - IkePayload.GENERIC_HEADER_LENGTH;
if (bodyLength > input.remaining()) {
// It is not clear whether previous payloads or current payload has invalid payload
// length.
throw new InvalidSyntaxException("Invalid Payload Length: Payload length is too long.");
}
byte[] payloadBody = new byte[bodyLength];
input.get(payloadBody);
IkePayload payload =
sDecoderInstance.decodeIkePayload(payloadType, isCritical, isResp, payloadBody);
return new Pair(payload, nextPayloadType);
} |
Construct an instance of IkePayload according to its payload type.
@param payloadType the current payload type. All supported types will fall in {@link
IkePayload.PayloadType}
@param input the encoded IKE message body containing all payloads. Position of it will
increment.
@return a Pair including IkePayload and next payload type.
| IkePayloadDecoder::getIkePayload | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/net/ipsec/ike/message/IkePayloadFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/net/ipsec/ike/message/IkePayloadFactory.java | MIT |
protected static Pair<IkeSkPayload, Integer> getIkeSkPayload(
boolean isSkf,
byte[] message,
IkeMacIntegrity integrityMac,
IkeCipher decryptCipher,
byte[] integrityKey,
byte[] decryptionKey)
throws IkeProtocolException, GeneralSecurityException {
ByteBuffer input =
ByteBuffer.wrap(
message,
IkeHeader.IKE_HEADER_LENGTH,
message.length - IkeHeader.IKE_HEADER_LENGTH);
int nextPayloadType = (int) input.get();
// read critical bit
boolean isCritical = isCriticalPayload(input.get());
int payloadLength = Short.toUnsignedInt(input.getShort());
int bodyLength = message.length - IkeHeader.IKE_HEADER_LENGTH;
if (bodyLength < payloadLength) {
throw new InvalidSyntaxException(
"Invalid length of SK Payload: Payload length is too long.");
} else if (bodyLength > payloadLength) {
// According to RFC 7296, SK Payload must be the last payload and for CREATE_CHILD_SA,
// IKE_AUTH and INFORMATIONAL exchanges, message following the header is encrypted. Thus
// this implementaion only accepts that SK Payload to be the only payload. Any IKE
// packet violating this format will be treated as invalid. A request violating this
// format will be rejected and replied with an error notification.
throw new InvalidSyntaxException(
"Invalid length of SK Payload: Payload length is too short"
+ " or SK Payload is not the only payload.");
}
IkeSkPayload payload =
sDecoderInstance.decodeIkeSkPayload(
isSkf,
isCritical,
message,
integrityMac,
decryptCipher,
integrityKey,
decryptionKey);
return new Pair(payload, nextPayloadType);
} |
Construct an instance of IkeSkPayload by decrypting the received message.
@param isSkf indicates if this is a SKF Payload.
@param message the byte array contains the whole IKE message.
@param integrityMac the negotiated integrity algorithm.
@param decryptCipher the negotiated encryption algorithm.
@param integrityKey the negotiated integrity algorithm key.
@param decryptionKey the negotiated decryption key.
@return a pair including IkePayload and next payload type.
@throws IkeProtocolException for decoding errors.
@throws GeneralSecurityException if there is any error during integrity check or decryption.
| IkePayloadDecoder::getIkeSkPayload | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/net/ipsec/ike/message/IkePayloadFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/net/ipsec/ike/message/IkePayloadFactory.java | MIT |
public HdmiPortInfo(int id, int type, int address, boolean cec, boolean mhl, boolean arc) {
mId = id;
mType = type;
mAddress = address;
mCecSupported = cec;
mArcSupported = arc;
mMhlSupported = mhl;
} |
Constructor.
@param id identifier assigned to each port. 1 for HDMI port 1
@param type HDMI port input/output type
@param address physical address of the port
@param cec {@code true} if HDMI-CEC is supported on the port
@param mhl {@code true} if MHL is supported on the port
@param arc {@code true} if audio return channel is supported on the port
| HdmiPortInfo::HdmiPortInfo | java | Reginer/aosp-android-jar | android-31/src/android/hardware/hdmi/HdmiPortInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/hdmi/HdmiPortInfo.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.