code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public int breakText(String text, boolean measureForwards, float maxWidth, float[] measuredWidth) { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } if (text.length() == 0) { return 0; } if (!mHasCompatScaling) { return nBreakText(mNativePaint, text, measureForwards, maxWidth, mBidiFlags, measuredWidth); } final float oldSize = getTextSize(); setTextSize(oldSize*mCompatScaling); final int res = nBreakText(mNativePaint, text, measureForwards, maxWidth*mCompatScaling, mBidiFlags, measuredWidth); setTextSize(oldSize); if (measuredWidth != null) measuredWidth[0] *= mInvCompatScaling; return res; }
Measure the text, stopping early if the measured width exceeds maxWidth. Return the number of chars that were measured, and if measuredWidth is not null, return in it the actual width measured. @param text The text to measure. Cannot be null. @param measureForwards If true, measure forwards, starting with the first character in the string. Otherwise, measure backwards, starting with the last character in the string. @param maxWidth The maximum width to accumulate. @param measuredWidth Optional. If not null, returns the actual width measured. @return The number of chars that were measured. Will always be <= abs(count).
FontMetricsInt::breakText
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getTextWidths(char[] text, int index, int count, float[] widths) { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } if ((index | count) < 0 || index + count > text.length || count > widths.length) { throw new ArrayIndexOutOfBoundsException(); } if (text.length == 0 || count == 0) { return 0; } if (!mHasCompatScaling) { nGetTextAdvances(mNativePaint, text, index, count, index, count, mBidiFlags, widths, 0); return count; } final float oldSize = getTextSize(); setTextSize(oldSize * mCompatScaling); nGetTextAdvances(mNativePaint, text, index, count, index, count, mBidiFlags, widths, 0); setTextSize(oldSize); for (int i = 0; i < count; i++) { widths[i] *= mInvCompatScaling; } return count; }
Return the advance widths for the characters in the string. @param text The text to measure. Cannot be null. @param index The index of the first char to to measure @param count The number of chars starting with index to measure @param widths array to receive the advance widths of the characters. Must be at least a large as count. @return the actual number of widths returned.
FontMetricsInt::getTextWidths
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getTextWidths(CharSequence text, int start, int end, float[] widths) { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } if ((start | end | (end - start) | (text.length() - end)) < 0) { throw new IndexOutOfBoundsException(); } if (end - start > widths.length) { throw new ArrayIndexOutOfBoundsException(); } if (text.length() == 0 || start == end) { return 0; } if (text instanceof String) { return getTextWidths((String) text, start, end, widths); } if (text instanceof SpannedString || text instanceof SpannableString) { return getTextWidths(text.toString(), start, end, widths); } if (text instanceof GraphicsOperations) { return ((GraphicsOperations) text).getTextWidths(start, end, widths, this); } char[] buf = TemporaryBuffer.obtain(end - start); TextUtils.getChars(text, start, end, buf, 0); int result = getTextWidths(buf, 0, end - start, widths); TemporaryBuffer.recycle(buf); return result; }
Return the advance widths for the characters in the string. @param text The text to measure. Cannot be null. @param start The index of the first char to to measure @param end The end of the text slice to measure @param widths array to receive the advance widths of the characters. Must be at least a large as (end - start). @return the actual number of widths returned.
FontMetricsInt::getTextWidths
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getTextWidths(String text, int start, int end, float[] widths) { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } if ((start | end | (end - start) | (text.length() - end)) < 0) { throw new IndexOutOfBoundsException(); } if (end - start > widths.length) { throw new ArrayIndexOutOfBoundsException(); } if (text.length() == 0 || start == end) { return 0; } if (!mHasCompatScaling) { nGetTextAdvances(mNativePaint, text, start, end, start, end, mBidiFlags, widths, 0); return end - start; } final float oldSize = getTextSize(); setTextSize(oldSize * mCompatScaling); nGetTextAdvances(mNativePaint, text, start, end, start, end, mBidiFlags, widths, 0); setTextSize(oldSize); for (int i = 0; i < end - start; i++) { widths[i] *= mInvCompatScaling; } return end - start; }
Return the advance widths for the characters in the string. @param text The text to measure. Cannot be null. @param start The index of the first char to to measure @param end The end of the text slice to measure @param widths array to receive the advance widths of the characters. Must be at least a large as the text. @return the number of code units in the specified text.
FontMetricsInt::getTextWidths
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getTextWidths(String text, float[] widths) { return getTextWidths(text, 0, text.length(), widths); }
Return the advance widths for the characters in the string. @param text The text to measure @param widths array to receive the advance widths of the characters. Must be at least a large as the text. @return the number of code units in the specified text.
FontMetricsInt::getTextWidths
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public float getTextRunAdvances(@NonNull char[] chars, @IntRange(from = 0) int index, @IntRange(from = 0) int count, @IntRange(from = 0) int contextIndex, @IntRange(from = 0) int contextCount, boolean isRtl, @Nullable float[] advances, @IntRange(from = 0) int advancesIndex) { if (chars == null) { throw new IllegalArgumentException("text cannot be null"); } if ((index | count | contextIndex | contextCount | advancesIndex | (index - contextIndex) | (contextCount - count) | ((contextIndex + contextCount) - (index + count)) | (chars.length - (contextIndex + contextCount)) | (advances == null ? 0 : (advances.length - (advancesIndex + count)))) < 0) { throw new IndexOutOfBoundsException(); } if (chars.length == 0 || count == 0){ return 0f; } if (!mHasCompatScaling) { return nGetTextAdvances(mNativePaint, chars, index, count, contextIndex, contextCount, isRtl ? BIDI_FORCE_RTL : BIDI_FORCE_LTR, advances, advancesIndex); } final float oldSize = getTextSize(); setTextSize(oldSize * mCompatScaling); final float res = nGetTextAdvances(mNativePaint, chars, index, count, contextIndex, contextCount, isRtl ? BIDI_FORCE_RTL : BIDI_FORCE_LTR, advances, advancesIndex); setTextSize(oldSize); if (advances != null) { for (int i = advancesIndex, e = i + count; i < e; i++) { advances[i] *= mInvCompatScaling; } } return res * mInvCompatScaling; // assume errors are not significant }
Retrieve the character advances of the text. Returns the total advance width for the characters in the run from {@code index} for {@code count} of chars, and if {@code advances} is not null, the advance assigned to each of these characters (java chars). <p> The trailing surrogate in a valid surrogate pair is assigned an advance of 0. Thus the number of returned advances is always equal to count, not to the number of unicode codepoints represented by the run. </p> <p> In the case of conjuncts or combining marks, the total advance is assigned to the first logical character, and the following characters are assigned an advance of 0. </p> <p> This generates the sum of the advances of glyphs for characters in a reordered cluster as the width of the first logical character in the cluster, and 0 for the widths of all other characters in the cluster. In effect, such clusters are treated like conjuncts. </p> <p> The shaping bounds limit the amount of context available outside start and end that can be used for shaping analysis. These bounds typically reflect changes in bidi level or font metrics across which shaping does not occur. </p> @param chars the text to measure. @param index the index of the first character to measure @param count the number of characters to measure @param contextIndex the index of the first character to use for shaping context. Context must cover the measureing target. @param contextCount the number of character to use for shaping context. Context must cover the measureing target. @param isRtl whether the run is in RTL direction @param advances array to receive the advances, must have room for all advances. This can be null if only total advance is needed @param advancesIndex the position in advances at which to put the advance corresponding to the character at start @return the total advance in pixels
FontMetricsInt::getTextRunAdvances
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getTextRunCursor(@NonNull char[] text, @IntRange(from = 0) int contextStart, @IntRange(from = 0) int contextLength, boolean isRtl, @IntRange(from = 0) int offset, @CursorOption int cursorOpt) { int contextEnd = contextStart + contextLength; if (((contextStart | contextEnd | offset | (contextEnd - contextStart) | (offset - contextStart) | (contextEnd - offset) | (text.length - contextEnd) | cursorOpt) < 0) || cursorOpt > CURSOR_OPT_MAX_VALUE) { throw new IndexOutOfBoundsException(); } return nGetTextRunCursor(mNativePaint, text, contextStart, contextLength, isRtl ? DIRECTION_RTL : DIRECTION_LTR, offset, cursorOpt); }
Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster. <p> ContextStart and offset are relative to the start of text. The context is the shaping context for cursor movement, generally the bounds of the metric span enclosing the cursor in the direction of movement. <p> If cursorOpt is {@link #CURSOR_AT} and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextStart + contextLength. @param text the text @param contextStart the start of the context @param contextLength the length of the context @param isRtl true if the paragraph context is RTL, otherwise false @param offset the cursor position to move from @param cursorOpt how to move the cursor @return the offset of the next position, or -1
FontMetricsInt::getTextRunCursor
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getTextRunCursor(@NonNull CharSequence text, @IntRange(from = 0) int contextStart, @IntRange(from = 0) int contextEnd, boolean isRtl, @IntRange(from = 0) int offset, @CursorOption int cursorOpt) { if (text instanceof String || text instanceof SpannedString || text instanceof SpannableString) { return getTextRunCursor(text.toString(), contextStart, contextEnd, isRtl, offset, cursorOpt); } if (text instanceof GraphicsOperations) { return ((GraphicsOperations) text).getTextRunCursor( contextStart, contextEnd, isRtl, offset, cursorOpt, this); } int contextLen = contextEnd - contextStart; char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); int relPos = getTextRunCursor(buf, 0, contextLen, isRtl, offset - contextStart, cursorOpt); TemporaryBuffer.recycle(buf); return (relPos == -1) ? -1 : relPos + contextStart; }
Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster. <p> ContextStart, contextEnd, and offset are relative to the start of text. The context is the shaping context for cursor movement, generally the bounds of the metric span enclosing the cursor in the direction of movement. <p> If cursorOpt is {@link #CURSOR_AT} and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextEnd. @param text the text @param contextStart the start of the context @param contextEnd the end of the context @param isRtl true if the paragraph context is RTL, otherwise false @param offset the cursor position to move from @param cursorOpt how to move the cursor @return the offset of the next position, or -1
FontMetricsInt::getTextRunCursor
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getTextRunCursor(@NonNull String text, @IntRange(from = 0) int contextStart, @IntRange(from = 0) int contextEnd, boolean isRtl, @IntRange(from = 0) int offset, @CursorOption int cursorOpt) { if (((contextStart | contextEnd | offset | (contextEnd - contextStart) | (offset - contextStart) | (contextEnd - offset) | (text.length() - contextEnd) | cursorOpt) < 0) || cursorOpt > CURSOR_OPT_MAX_VALUE) { throw new IndexOutOfBoundsException(); } return nGetTextRunCursor(mNativePaint, text, contextStart, contextEnd, isRtl ? DIRECTION_RTL : DIRECTION_LTR, offset, cursorOpt); }
Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster. <p> ContextStart, contextEnd, and offset are relative to the start of text. The context is the shaping context for cursor movement, generally the bounds of the metric span enclosing the cursor in the direction of movement. </p> <p> If cursorOpt is {@link #CURSOR_AT} and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextEnd. </p> @param text the text @param contextStart the start of the context @param contextEnd the end of the context @param isRtl true if the paragraph context is RTL, otherwise false. @param offset the cursor position to move from @param cursorOpt how to move the cursor @return the offset of the next position, or -1 @hide
FontMetricsInt::getTextRunCursor
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public void getTextPath(char[] text, int index, int count, float x, float y, Path path) { if ((index | count) < 0 || index + count > text.length) { throw new ArrayIndexOutOfBoundsException(); } nGetTextPath(mNativePaint, mBidiFlags, text, index, count, x, y, path.mutateNI()); }
Return the path (outline) for the specified text. Note: just like Canvas.drawText, this will respect the Align setting in the paint. @param text the text to retrieve the path from @param index the index of the first character in text @param count the number of characters starting with index @param x the x coordinate of the text's origin @param y the y coordinate of the text's origin @param path the path to receive the data describing the text. Must be allocated by the caller
FontMetricsInt::getTextPath
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public void getTextPath(String text, int start, int end, float x, float y, Path path) { if ((start | end | (end - start) | (text.length() - end)) < 0) { throw new IndexOutOfBoundsException(); } nGetTextPath(mNativePaint, mBidiFlags, text, start, end, x, y, path.mutateNI()); }
Return the path (outline) for the specified text. Note: just like Canvas.drawText, this will respect the Align setting in the paint. @param text the text to retrieve the path from @param start the first character in the text @param end 1 past the last character in the text @param x the x coordinate of the text's origin @param y the y coordinate of the text's origin @param path the path to receive the data describing the text. Must be allocated by the caller
FontMetricsInt::getTextPath
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public void getTextBounds(String text, int start, int end, Rect bounds) { if ((start | end | (end - start) | (text.length() - end)) < 0) { throw new IndexOutOfBoundsException(); } if (bounds == null) { throw new NullPointerException("need bounds Rect"); } nGetStringBounds(mNativePaint, text, start, end, mBidiFlags, bounds); }
Retrieve the text boundary box and store to bounds. Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0). @param text string to measure and return its bounds @param start index of the first char in the string to measure @param end 1 past the last char in the string to measure @param bounds returns the unioned bounds of all the text. Must be allocated by the caller
FontMetricsInt::getTextBounds
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public void getTextBounds(@NonNull CharSequence text, int start, int end, @NonNull Rect bounds) { if ((start | end | (end - start) | (text.length() - end)) < 0) { throw new IndexOutOfBoundsException(); } if (bounds == null) { throw new NullPointerException("need bounds Rect"); } char[] buf = TemporaryBuffer.obtain(end - start); TextUtils.getChars(text, start, end, buf, 0); getTextBounds(buf, 0, end - start, bounds); TemporaryBuffer.recycle(buf); }
Retrieve the text boundary box and store to bounds. Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0). Note that styles are ignored even if you pass {@link android.text.Spanned} instance. Use {@link android.text.StaticLayout} for measuring bounds of {@link android.text.Spanned}. @param text text to measure and return its bounds @param start index of the first char in the text to measure @param end 1 past the last char in the text to measure @param bounds returns the unioned bounds of all the text. Must be allocated by the caller
FontMetricsInt::getTextBounds
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public void getTextBounds(char[] text, int index, int count, Rect bounds) { if ((index | count) < 0 || index + count > text.length) { throw new ArrayIndexOutOfBoundsException(); } if (bounds == null) { throw new NullPointerException("need bounds Rect"); } nGetCharArrayBounds(mNativePaint, text, index, count, mBidiFlags, bounds); }
Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0). @param text array of chars to measure and return their unioned bounds @param index index of the first char in the array to measure @param count the number of chars, beginning at index, to measure @param bounds returns the unioned bounds of all the text. Must be allocated by the caller
FontMetricsInt::getTextBounds
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public boolean hasGlyph(String string) { return nHasGlyph(mNativePaint, mBidiFlags, string); }
Determine whether the typeface set on the paint has a glyph supporting the string. The simplest case is when the string contains a single character, in which this method determines whether the font has the character. In the case of multiple characters, the method returns true if there is a single glyph representing the ligature. For example, if the input is a pair of regional indicator symbols, determine whether there is an emoji flag for the pair. <p>Finally, if the string contains a variation selector, the method only returns true if the fonts contains a glyph specific to that variation. <p>Checking is done on the entire fallback chain, not just the immediate font referenced. @param string the string to test whether there is glyph support @return true if the typeface has a glyph for the string
FontMetricsInt::hasGlyph
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public float getRunAdvance(char[] text, int start, int end, int contextStart, int contextEnd, boolean isRtl, int offset) { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } if ((contextStart | start | offset | end | contextEnd | start - contextStart | offset - start | end - offset | contextEnd - end | text.length - contextEnd) < 0) { throw new IndexOutOfBoundsException(); } if (end == start) { return 0.0f; } // TODO: take mCompatScaling into account (or eliminate compat scaling)? return nGetRunAdvance(mNativePaint, text, start, end, contextStart, contextEnd, isRtl, offset); }
Measure cursor position within a run of text. <p>The run of text includes the characters from {@code start} to {@code end} in the text. In addition, the range {@code contextStart} to {@code contextEnd} is used as context for the purpose of complex text shaping, such as Arabic text potentially shaped differently based on the text next to it. <p>All text outside the range {@code contextStart..contextEnd} is ignored. The text between {@code start} and {@code end} will be laid out to be measured. <p>The returned width measurement is the advance from {@code start} to {@code offset}. It is generally a positive value, no matter the direction of the run. If {@code offset == end}, the return value is simply the width of the whole run from {@code start} to {@code end}. <p>Ligatures are formed for characters in the range {@code start..end} (but not for {@code start..contextStart} or {@code end..contextEnd}). If {@code offset} points to a character in the middle of such a formed ligature, but at a grapheme cluster boundary, the return value will also reflect an advance in the middle of the ligature. See {@link #getOffsetForAdvance} for more discussion of grapheme cluster boundaries. <p>The direction of the run is explicitly specified by {@code isRtl}. Thus, this method is suitable only for runs of a single direction. <p>All indices are relative to the start of {@code text}. Further, {@code 0 <= contextStart <= start <= offset <= end <= contextEnd <= text.length} must hold on entry. @param text the text to measure. Cannot be null. @param start the index of the start of the range to measure @param end the index + 1 of the end of the range to measure @param contextStart the index of the start of the shaping context @param contextEnd the index + 1 of the end of the shaping context @param isRtl whether the run is in RTL direction @param offset index of caret position @return width measurement between start and offset
FontMetricsInt::getRunAdvance
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public float getRunAdvance(CharSequence text, int start, int end, int contextStart, int contextEnd, boolean isRtl, int offset) { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } if ((contextStart | start | offset | end | contextEnd | start - contextStart | offset - start | end - offset | contextEnd - end | text.length() - contextEnd) < 0) { throw new IndexOutOfBoundsException(); } if (end == start) { return 0.0f; } // TODO performance: specialized alternatives to avoid buffer copy, if win is significant char[] buf = TemporaryBuffer.obtain(contextEnd - contextStart); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); float result = getRunAdvance(buf, start - contextStart, end - contextStart, 0, contextEnd - contextStart, isRtl, offset - contextStart); TemporaryBuffer.recycle(buf); return result; }
@see #getRunAdvance(char[], int, int, int, int, boolean, int) @param text the text to measure. Cannot be null. @param start the index of the start of the range to measure @param end the index + 1 of the end of the range to measure @param contextStart the index of the start of the shaping context @param contextEnd the index + 1 of the end of the shaping context @param isRtl whether the run is in RTL direction @param offset index of caret position @return width measurement between start and offset
FontMetricsInt::getRunAdvance
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getOffsetForAdvance(char[] text, int start, int end, int contextStart, int contextEnd, boolean isRtl, float advance) { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } if ((contextStart | start | end | contextEnd | start - contextStart | end - start | contextEnd - end | text.length - contextEnd) < 0) { throw new IndexOutOfBoundsException(); } // TODO: take mCompatScaling into account (or eliminate compat scaling)? return nGetOffsetForAdvance(mNativePaint, text, start, end, contextStart, contextEnd, isRtl, advance); }
Get the character offset within the string whose position is closest to the specified horizontal position. <p>The returned value is generally the value of {@code offset} for which {@link #getRunAdvance} yields a result most closely approximating {@code advance}, and which is also on a grapheme cluster boundary. As such, it is the preferred method for positioning a cursor in response to a touch or pointer event. The grapheme cluster boundaries are based on <a href="http://unicode.org/reports/tr29/">Unicode Standard Annex #29</a> but with some tailoring for better user experience. <p>Note that {@code advance} is a (generally positive) width measurement relative to the start of the run. Thus, for RTL runs it the distance from the point to the right edge. <p>All indices are relative to the start of {@code text}. Further, {@code 0 <= contextStart <= start <= end <= contextEnd <= text.length} must hold on entry, and {@code start <= result <= end} will hold on return. @param text the text to measure. Cannot be null. @param start the index of the start of the range to measure @param end the index + 1 of the end of the range to measure @param contextStart the index of the start of the shaping context @param contextEnd the index + 1 of the end of the range to measure @param isRtl whether the run is in RTL direction @param advance width relative to start of run @return index of offset
FontMetricsInt::getOffsetForAdvance
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public int getOffsetForAdvance(CharSequence text, int start, int end, int contextStart, int contextEnd, boolean isRtl, float advance) { if (text == null) { throw new IllegalArgumentException("text cannot be null"); } if ((contextStart | start | end | contextEnd | start - contextStart | end - start | contextEnd - end | text.length() - contextEnd) < 0) { throw new IndexOutOfBoundsException(); } // TODO performance: specialized alternatives to avoid buffer copy, if win is significant char[] buf = TemporaryBuffer.obtain(contextEnd - contextStart); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); int result = getOffsetForAdvance(buf, start - contextStart, end - contextStart, 0, contextEnd - contextStart, isRtl, advance) + contextStart; TemporaryBuffer.recycle(buf); return result; }
@see #getOffsetForAdvance(char[], int, int, int, int, boolean, float) @param text the text to measure. Cannot be null. @param start the index of the start of the range to measure @param end the index + 1 of the end of the range to measure @param contextStart the index of the start of the shaping context @param contextEnd the index + 1 of the end of the range to measure @param isRtl whether the run is in RTL direction @param advance width relative to start of run @return index of offset
FontMetricsInt::getOffsetForAdvance
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public boolean equalsForTextMeasurement(@NonNull Paint other) { return nEqualsForTextMeasurement(mNativePaint, other.mNativePaint); }
Returns true of the passed {@link Paint} will have the same effect on text measurement @param other A {@link Paint} object. @return true if the other {@link Paint} has the same effect on text measurement.
FontMetricsInt::equalsForTextMeasurement
java
Reginer/aosp-android-jar
android-32/src/android/graphics/Paint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java
MIT
public void setNotDisplayedBySystem( @NonNull String packageName, @NonNull String databaseName, @NonNull Set<String> prefixedSchemas) { Map<String, Set<String>> databaseToSchemas = mMap.get(packageName); if (databaseToSchemas == null) { databaseToSchemas = new ArrayMap<>(); mMap.put(packageName, databaseToSchemas); } databaseToSchemas.put(databaseName, prefixedSchemas); }
Sets the prefixed schemas that are opted out of platform surfacing for the database. <p>Any existing mappings for this prefix are overwritten.
NotDisplayedBySystemMap::setNotDisplayedBySystem
java
Reginer/aosp-android-jar
android-32/src/com/android/server/appsearch/visibilitystore/NotDisplayedBySystemMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/appsearch/visibilitystore/NotDisplayedBySystemMap.java
MIT
public boolean isSchemaDisplayedBySystem( @NonNull String packageName, @NonNull String databaseName, @NonNull String prefixedSchema) { Map<String, Set<String>> databaseToSchemaType = mMap.get(packageName); if (databaseToSchemaType == null) { // No opt-outs for this package return true; } Set<String> schemaTypes = databaseToSchemaType.get(databaseName); if (schemaTypes == null) { // No opt-outs for this database return true; } // Some schemas were opted out of being platform-surfaced. As long as this schema // isn't one of those opt-outs, it's surfaceable. return !schemaTypes.contains(prefixedSchema); }
Returns whether the given prefixed schema is platform surfaceable (has not opted out) in the given database.
NotDisplayedBySystemMap::isSchemaDisplayedBySystem
java
Reginer/aosp-android-jar
android-32/src/com/android/server/appsearch/visibilitystore/NotDisplayedBySystemMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/appsearch/visibilitystore/NotDisplayedBySystemMap.java
MIT
public Learner getLearner() { return mStore.getLearner(); }
/* Copyright (C) 2009 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 android.gesture; import java.util.Set; import java.util.ArrayList; public abstract class GestureLibrary { protected final GestureStore mStore; protected GestureLibrary() { mStore = new GestureStore(); } public abstract boolean save(); public abstract boolean load(); public boolean isReadOnly() { return false; } /** @hide
GestureLibrary::getLearner
java
Reginer/aosp-android-jar
android-33/src/android/gesture/GestureLibrary.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/gesture/GestureLibrary.java
MIT
public LegacyPermissionManager() throws ServiceManager.ServiceNotFoundException { this(ILegacyPermissionManager.Stub.asInterface(ServiceManager.getServiceOrThrow( "legacy_permission"))); }
Creates a new instance. @hide
LegacyPermissionManager::LegacyPermissionManager
java
Reginer/aosp-android-jar
android-35/src/android/permission/LegacyPermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/permission/LegacyPermissionManager.java
MIT
public int checkPhoneNumberAccess(@Nullable String packageName, @Nullable String message, @Nullable String callingFeatureId, int pid, int uid) { try { return mLegacyPermissionManager.checkPhoneNumberAccess(packageName, message, callingFeatureId, pid, uid); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Checks whether the package with the given pid/uid can read the device phone number. @param packageName the name of the package to be checked for phone number access @param message the message to be used for logging during phone number access verification @param callingFeatureId the feature in the package @param pid the process id of the package to be checked @param uid the uid of the package to be checked @return <ul> <li>{@link PackageManager#PERMISSION_GRANTED} if the package is allowed phone number access</li> <li>{@link android.app.AppOpsManager#MODE_IGNORED} if the package does not have phone number access but for appcompat reasons this should be a silent failure (ie return empty or null data)</li> <li>{@link PackageManager#PERMISSION_DENIED} if the package does not have phone number access</li> </ul> @hide
LegacyPermissionManager::checkPhoneNumberAccess
java
Reginer/aosp-android-jar
android-35/src/android/permission/LegacyPermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/permission/LegacyPermissionManager.java
MIT
public void grantDefaultPermissionsToCarrierServiceApp(@NonNull String packageName, @UserIdInt int userId) { try { mLegacyPermissionManager.grantDefaultPermissionsToCarrierServiceApp(packageName, userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Grant permissions to a newly set Carrier Services app. @param packageName The newly set Carrier Services app @param userId The user for which to grant the permissions. @hide
LegacyPermissionManager::grantDefaultPermissionsToCarrierServiceApp
java
Reginer/aosp-android-jar
android-35/src/android/permission/LegacyPermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/permission/LegacyPermissionManager.java
MIT
public MessageDigest createDigest(String algorithm) throws NoSuchAlgorithmException { return MessageDigest.getInstance(algorithm); }
{@link JcaJceHelper} that obtains all algorithms using the default JCA/JCE mechanism (i.e. without specifying a provider). @hide This class is not part of the Android public SDK API public class DefaultJcaJceHelper implements JcaJceHelper { public Cipher createCipher( String algorithm) throws NoSuchAlgorithmException, NoSuchPaddingException { return Cipher.getInstance(algorithm); } public Mac createMac(String algorithm) throws NoSuchAlgorithmException { return Mac.getInstance(algorithm); } public KeyAgreement createKeyAgreement(String algorithm) throws NoSuchAlgorithmException { return KeyAgreement.getInstance(algorithm); } public AlgorithmParameterGenerator createAlgorithmParameterGenerator(String algorithm) throws NoSuchAlgorithmException { return AlgorithmParameterGenerator.getInstance(algorithm); } public AlgorithmParameters createAlgorithmParameters(String algorithm) throws NoSuchAlgorithmException { return AlgorithmParameters.getInstance(algorithm); } public KeyGenerator createKeyGenerator(String algorithm) throws NoSuchAlgorithmException { return KeyGenerator.getInstance(algorithm); } public KeyFactory createKeyFactory(String algorithm) throws NoSuchAlgorithmException { return KeyFactory.getInstance(algorithm); } public SecretKeyFactory createSecretKeyFactory(String algorithm) throws NoSuchAlgorithmException { return SecretKeyFactory.getInstance(algorithm); } public KeyPairGenerator createKeyPairGenerator(String algorithm) throws NoSuchAlgorithmException { return KeyPairGenerator.getInstance(algorithm); } /** @deprecated Use createMessageDigest instead
DefaultJcaJceHelper::createDigest
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/org/bouncycastle/jcajce/util/DefaultJcaJceHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/jcajce/util/DefaultJcaJceHelper.java
MIT
default void onConsolidatedPolicyChanged(NotificationManager.Policy policy) {}
/* Copyright (C) 2014 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.systemui.statusbar.policy; import android.app.NotificationManager; import android.content.ComponentName; import android.net.Uri; import android.service.notification.Condition; import android.service.notification.ZenModeConfig; import android.service.notification.ZenModeConfig.ZenRule; import com.android.systemui.statusbar.policy.ZenModeController.Callback; public interface ZenModeController extends CallbackController<Callback> { void setZen(int zen, Uri conditionId, String reason); int getZen(); ZenRule getManualRule(); ZenModeConfig getConfig(); /** Gets consolidated zen policy that will apply when DND is on in priority only mode NotificationManager.Policy getConsolidatedPolicy(); long getNextAlarm(); boolean isZenAvailable(); ComponentName getEffectsSuppressor(); boolean isCountdownConditionSupported(); int getCurrentUser(); boolean isVolumeRestricted(); boolean areNotificationsHiddenInShade(); public static interface Callback { default void onZenChanged(int zen) {} default void onConditionsChanged(Condition[] conditions) {} default void onNextAlarmChanged() {} default void onZenAvailableChanged(boolean available) {} default void onEffectsSupressorChanged() {} default void onManualRuleChanged(ZenRule rule) {} default void onConfigChanged(ZenModeConfig config) {} /** Called when the consolidated zen policy changes
onConsolidatedPolicyChanged
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/policy/ZenModeController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/policy/ZenModeController.java
MIT
public void validate() throws IllegalArgumentException { if (mMasterPreference < 0) { throw new IllegalArgumentException( "Master Preference specification must be non-negative"); } if (mMasterPreference == 1 || mMasterPreference == 255 || mMasterPreference > 255) { throw new IllegalArgumentException("Master Preference specification must not " + "exceed 255 or use 1 or 255 (reserved values)"); } if (mClusterLow < CLUSTER_ID_MIN) { throw new IllegalArgumentException("Cluster specification must be non-negative"); } if (mClusterLow > CLUSTER_ID_MAX) { throw new IllegalArgumentException("Cluster specification must not exceed 0xFFFF"); } if (mClusterHigh < CLUSTER_ID_MIN) { throw new IllegalArgumentException("Cluster specification must be non-negative"); } if (mClusterHigh > CLUSTER_ID_MAX) { throw new IllegalArgumentException("Cluster specification must not exceed 0xFFFF"); } if (mClusterLow > mClusterHigh) { throw new IllegalArgumentException( "Invalid argument combination - must have Cluster Low <= Cluster High"); } if (mDiscoveryWindowInterval.length != 3) { throw new IllegalArgumentException( "Invalid discovery window interval: must have 3 elements (2.4 & 5 & 6"); } if (mDiscoveryWindowInterval[NAN_BAND_24GHZ] != DW_INTERVAL_NOT_INIT && (mDiscoveryWindowInterval[NAN_BAND_24GHZ] < 1 // valid for 2.4GHz: [1-5] || mDiscoveryWindowInterval[NAN_BAND_24GHZ] > 5)) { throw new IllegalArgumentException( "Invalid discovery window interval for 2.4GHz: valid is UNSET or [1,5]"); } if (mDiscoveryWindowInterval[NAN_BAND_5GHZ] != DW_INTERVAL_NOT_INIT && (mDiscoveryWindowInterval[NAN_BAND_5GHZ] < 0 // valid for 5GHz: [0-5] || mDiscoveryWindowInterval[NAN_BAND_5GHZ] > 5)) { throw new IllegalArgumentException( "Invalid discovery window interval for 5GHz: valid is UNSET or [0,5]"); } if (mDiscoveryWindowInterval[NAN_BAND_6GHZ] != DW_INTERVAL_NOT_INIT && (mDiscoveryWindowInterval[NAN_BAND_6GHZ] < 0 // valid for 6GHz: [0-5] || mDiscoveryWindowInterval[NAN_BAND_6GHZ] > 5)) { throw new IllegalArgumentException( "Invalid discovery window interval for 6GHz: valid is UNSET or [0,5]"); } }
Verifies that the contents of the ConfigRequest are valid. Otherwise throws an IllegalArgumentException.
ConfigRequest::validate
java
Reginer/aosp-android-jar
android-31/src/android/net/wifi/aware/ConfigRequest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/aware/ConfigRequest.java
MIT
public Builder setSupport5gBand(boolean support5gBand) { mSupport5gBand = support5gBand; return this; }
Specify whether 5G band support is required in this request. Disabled by default. @param support5gBand Support for 5G band is required. @return The builder to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
Builder::setSupport5gBand
java
Reginer/aosp-android-jar
android-31/src/android/net/wifi/aware/ConfigRequest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/aware/ConfigRequest.java
MIT
public Builder setSupport6gBand(boolean support6gBand) { mSupport6gBand = support6gBand; return this; }
Specify whether 6G band support is required in this request. Disabled by default. @param support6gBand Support for 6G band is required. @return The builder to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
Builder::setSupport6gBand
java
Reginer/aosp-android-jar
android-31/src/android/net/wifi/aware/ConfigRequest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/aware/ConfigRequest.java
MIT
public Builder setMasterPreference(int masterPreference) { if (masterPreference < 0) { throw new IllegalArgumentException( "Master Preference specification must be non-negative"); } if (masterPreference == 1 || masterPreference == 255 || masterPreference > 255) { throw new IllegalArgumentException("Master Preference specification must not " + "exceed 255 or use 1 or 255 (reserved values)"); } mMasterPreference = masterPreference; return this; }
Specify the Master Preference requested. The permitted range is 0 (the default) to 255 with 1 and 255 excluded (reserved). @param masterPreference The requested master preference @return The builder to facilitate chaining {@code builder.setXXX(..).setXXX(..)}.
Builder::setMasterPreference
java
Reginer/aosp-android-jar
android-31/src/android/net/wifi/aware/ConfigRequest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/aware/ConfigRequest.java
MIT
public Builder setClusterLow(int clusterLow) { if (clusterLow < CLUSTER_ID_MIN) { throw new IllegalArgumentException("Cluster specification must be non-negative"); } if (clusterLow > CLUSTER_ID_MAX) { throw new IllegalArgumentException("Cluster specification must not exceed 0xFFFF"); } mClusterLow = clusterLow; return this; }
The Cluster ID is generated randomly for new Aware networks. Specify the lower range of the cluster ID. The upper range is specified using the {@link ConfigRequest.Builder#setClusterHigh(int)}. The permitted range is 0 (the default) to the value specified by {@link ConfigRequest.Builder#setClusterHigh(int)}. Equality of Low and High is permitted which restricts the Cluster ID to the specified value. @param clusterLow The lower range of the generated cluster ID. @return The builder to facilitate chaining {@code builder.setClusterLow(..).setClusterHigh(..)}.
Builder::setClusterLow
java
Reginer/aosp-android-jar
android-31/src/android/net/wifi/aware/ConfigRequest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/aware/ConfigRequest.java
MIT
public Builder setClusterHigh(int clusterHigh) { if (clusterHigh < CLUSTER_ID_MIN) { throw new IllegalArgumentException("Cluster specification must be non-negative"); } if (clusterHigh > CLUSTER_ID_MAX) { throw new IllegalArgumentException("Cluster specification must not exceed 0xFFFF"); } mClusterHigh = clusterHigh; return this; }
The Cluster ID is generated randomly for new Aware networks. Specify the lower upper of the cluster ID. The lower range is specified using the {@link ConfigRequest.Builder#setClusterLow(int)}. The permitted range is the value specified by {@link ConfigRequest.Builder#setClusterLow(int)} to 0xFFFF (the default). Equality of Low and High is permitted which restricts the Cluster ID to the specified value. @param clusterHigh The upper range of the generated cluster ID. @return The builder to facilitate chaining {@code builder.setClusterLow(..).setClusterHigh(..)}.
Builder::setClusterHigh
java
Reginer/aosp-android-jar
android-31/src/android/net/wifi/aware/ConfigRequest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/aware/ConfigRequest.java
MIT
public Builder setDiscoveryWindowInterval(int band, int interval) { if (band != NAN_BAND_24GHZ && band != NAN_BAND_5GHZ && band != NAN_BAND_6GHZ) { throw new IllegalArgumentException("Invalid band value"); } if ((band == NAN_BAND_24GHZ && (interval < 1 || interval > 5)) || (band == NAN_BAND_5GHZ && (interval < 0 || interval > 5)) || (band == NAN_BAND_6GHZ && (interval < 0 || interval > 5))) { throw new IllegalArgumentException( "Invalid interval value: 2.4 GHz [1,5] or 5GHz/6GHz [0,5]"); } mDiscoveryWindowInterval[band] = interval; return this; }
The discovery window interval specifies the discovery windows in which the device will be awake. The configuration enables trading off latency vs. power (higher interval means higher discovery latency but lower power). @param band Either {@link #NAN_BAND_24GHZ} or {@link #NAN_BAND_5GHZ} or {@link #NAN_BAND_6GHZ}. @param interval A value of 1, 2, 3, 4, or 5 indicating an interval of 2^(interval-1). For the 5GHz band a value of 0 indicates that the device will not be awake for any discovery windows. @return The builder itself to facilitate chaining operations {@code builder.setDiscoveryWindowInterval(...).setMasterPreference(...)}.
Builder::setDiscoveryWindowInterval
java
Reginer/aosp-android-jar
android-31/src/android/net/wifi/aware/ConfigRequest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/aware/ConfigRequest.java
MIT
public ConfigRequest build() { if (mClusterLow > mClusterHigh) { throw new IllegalArgumentException( "Invalid argument combination - must have Cluster Low <= Cluster High"); } return new ConfigRequest(mSupport5gBand, mSupport6gBand, mMasterPreference, mClusterLow, mClusterHigh, mDiscoveryWindowInterval); }
Build {@link ConfigRequest} given the current requests made on the builder.
Builder::build
java
Reginer/aosp-android-jar
android-31/src/android/net/wifi/aware/ConfigRequest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/net/wifi/aware/ConfigRequest.java
MIT
public RoundRectangle(float x, float y, float width, float height, float[] cornerDimensions) { assert cornerDimensions.length == 8 : "The array of corner dimensions must have eight " + "elements"; this.x = x; this.y = y; this.width = width; this.height = height; float[] dimensions = cornerDimensions.clone(); // If a value is negative, the corresponding corner is squared for (int i = 0; i < dimensions.length; i += 2) { if (dimensions[i] < 0 || dimensions[i + 1] < 0) { dimensions[i] = 0; dimensions[i + 1] = 0; } } double topCornerWidth = (dimensions[0] + dimensions[2]) / 2d; double bottomCornerWidth = (dimensions[4] + dimensions[6]) / 2d; double leftCornerHeight = (dimensions[1] + dimensions[7]) / 2d; double rightCornerHeight = (dimensions[3] + dimensions[5]) / 2d; // Rescale the corner dimensions if they are bigger than the rectangle double scale = Math.min(1.0, width / topCornerWidth); scale = Math.min(scale, width / bottomCornerWidth); scale = Math.min(scale, height / leftCornerHeight); scale = Math.min(scale, height / rightCornerHeight); this.ulWidth = dimensions[0] * scale; this.ulHeight = dimensions[1] * scale; this.urWidth = dimensions[2] * scale; this.urHeight = dimensions[3] * scale; this.lrWidth = dimensions[4] * scale; this.lrHeight = dimensions[5] * scale; this.llWidth = dimensions[6] * scale; this.llHeight = dimensions[7] * scale; }
@param cornerDimensions array of 8 floating-point number corresponding to the width and the height of each corner in the following order: upper-left, upper-right, lower-right, lower-left. It assumes for the size the same convention as {@link RoundRectangle2D}, that is that the width and height of a corner correspond to the total width and height of the ellipse that corner is a quarter of.
Zone::RoundRectangle
java
Reginer/aosp-android-jar
android-31/src/android/graphics/RoundRectangle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/graphics/RoundRectangle.java
MIT
public AllocationLimitError() { super(); }
Creates a new exception instance and initializes it with default values.
AllocationLimitError::AllocationLimitError
java
Reginer/aosp-android-jar
android-34/src/dalvik/system/AllocationLimitError.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/dalvik/system/AllocationLimitError.java
MIT
public AllocationLimitError(String detailMessage) { super(detailMessage); }
Creates a new exception instance and initializes it with a given message. @param detailMessage the error message
AllocationLimitError::AllocationLimitError
java
Reginer/aosp-android-jar
android-34/src/dalvik/system/AllocationLimitError.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/dalvik/system/AllocationLimitError.java
MIT
public static boolean canTakePhoto(Context context) { return context.getPackageManager().queryIntentActivities( new Intent(MediaStore.ACTION_IMAGE_CAPTURE), PackageManager.MATCH_DEFAULT_ONLY).size() > 0; }
Check if the current user can perform any activity for android.media.action.IMAGE_CAPTURE action.
PhotoCapabilityUtils::canTakePhoto
java
Reginer/aosp-android-jar
android-33/src/com/android/settingslib/users/PhotoCapabilityUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/settingslib/users/PhotoCapabilityUtils.java
MIT
public static boolean canChoosePhoto(Context context) { Intent intent = new Intent(MediaStore.ACTION_PICK_IMAGES); intent.setType("image/*"); boolean canPerformActivityForGetImage = context.getPackageManager().queryIntentActivities(intent, 0).size() > 0; // on locked device we can't access the images return canPerformActivityForGetImage && !isDeviceLocked(context); }
Check if the current user can perform any activity for ACTION_PICK_IMAGES action for images. Returns false if the device is currently locked and requires a PIN, pattern or password to unlock.
PhotoCapabilityUtils::canChoosePhoto
java
Reginer/aosp-android-jar
android-33/src/com/android/settingslib/users/PhotoCapabilityUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/settingslib/users/PhotoCapabilityUtils.java
MIT
public static boolean canCropPhoto(Context context) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setType("image/*"); boolean canPerformActivityForCropping = context.getPackageManager().queryIntentActivities(intent, 0).size() > 0; // on locked device we can't start a cropping activity return canPerformActivityForCropping && !isDeviceLocked(context); }
Check if the current user can perform any activity for com.android.camera.action.CROP action for images. Returns false if the device is currently locked and requires a PIN, pattern or password to unlock.
PhotoCapabilityUtils::canCropPhoto
java
Reginer/aosp-android-jar
android-33/src/com/android/settingslib/users/PhotoCapabilityUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/settingslib/users/PhotoCapabilityUtils.java
MIT
public PrivilegedActionException(Exception exception) { super((Throwable)null); // Disallow initCause this.exception = exception; }
Constructs a new PrivilegedActionException &quot;wrapping&quot; the specific Exception. @param exception The exception thrown
PrivilegedActionException::PrivilegedActionException
java
Reginer/aosp-android-jar
android-33/src/java/security/PrivilegedActionException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/security/PrivilegedActionException.java
MIT
public Exception getException() { return exception; }
Returns the exception thrown by the privileged computation that resulted in this {@code PrivilegedActionException}. <p>This method predates the general-purpose exception chaining facility. The {@link Throwable#getCause()} method is now the preferred means of obtaining this information. @return the exception thrown by the privileged computation that resulted in this {@code PrivilegedActionException}. @see PrivilegedExceptionAction @see AccessController#doPrivileged(PrivilegedExceptionAction) @see AccessController#doPrivileged(PrivilegedExceptionAction, AccessControlContext)
PrivilegedActionException::getException
java
Reginer/aosp-android-jar
android-33/src/java/security/PrivilegedActionException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/security/PrivilegedActionException.java
MIT
public Throwable getCause() { return exception; }
Returns the cause of this exception (the exception thrown by the privileged computation that resulted in this {@code PrivilegedActionException}). @return the cause of this exception. @since 1.4
PrivilegedActionException::getCause
java
Reginer/aosp-android-jar
android-33/src/java/security/PrivilegedActionException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/security/PrivilegedActionException.java
MIT
private void notifyStateChanged() { Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED); intent.setPackage(sDeviceProvisioningPackage); try { mContext.sendBroadcast(intent); } catch (Exception e) { Log.e(TAG, e.toString()); } }
Send an explicit intent to device provisioning package.
getName::notifyStateChanged
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/uicc/UiccStateChangedLauncher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/uicc/UiccStateChangedLauncher.java
MIT
protected SourceChannel(SelectorProvider provider) { super(provider); }
Constructs a new instance of this class. @param provider The selector provider
SourceChannel::SourceChannel
java
Reginer/aosp-android-jar
android-32/src/java/nio/channels/Pipe.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/channels/Pipe.java
MIT
public final int validOps() { return SelectionKey.OP_READ; }
Returns an operation set identifying this channel's supported operations. <p> Pipe-source channels only support reading, so this method returns {@link SelectionKey#OP_READ}. </p> @return The valid-operation set
SourceChannel::validOps
java
Reginer/aosp-android-jar
android-32/src/java/nio/channels/Pipe.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/channels/Pipe.java
MIT
protected SinkChannel(SelectorProvider provider) { super(provider); }
Initializes a new instance of this class. @param provider The selector provider
SinkChannel::SinkChannel
java
Reginer/aosp-android-jar
android-32/src/java/nio/channels/Pipe.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/channels/Pipe.java
MIT
public final int validOps() { return SelectionKey.OP_WRITE; }
Returns an operation set identifying this channel's supported operations. <p> Pipe-sink channels only support writing, so this method returns {@link SelectionKey#OP_WRITE}. </p> @return The valid-operation set
SinkChannel::validOps
java
Reginer/aosp-android-jar
android-32/src/java/nio/channels/Pipe.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/channels/Pipe.java
MIT
protected Pipe() { }
Initializes a new instance of this class.
SinkChannel::Pipe
java
Reginer/aosp-android-jar
android-32/src/java/nio/channels/Pipe.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/channels/Pipe.java
MIT
public static Pipe open() throws IOException { return SelectorProvider.provider().openPipe(); }
Opens a pipe. <p> The new pipe is created by invoking the {@link java.nio.channels.spi.SelectorProvider#openPipe openPipe} method of the system-wide default {@link java.nio.channels.spi.SelectorProvider} object. </p> @return A new pipe @throws IOException If an I/O error occurs
SinkChannel::open
java
Reginer/aosp-android-jar
android-32/src/java/nio/channels/Pipe.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/channels/Pipe.java
MIT
private static void recycle(@NonNull Builder b) { b.mBase = null; b.mDisplay = null; b.mPaint = null; sPool.release(b); }
This method should be called after the layout is finished getting constructed and the builder needs to be cleaned up and returned to the pool.
Builder::recycle
java
Reginer/aosp-android-jar
android-35/src/android/text/DynamicLayout.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/DynamicLayout.java
MIT
public Builder setEllipsize(@Nullable TextUtils.TruncateAt ellipsize) { mEllipsize = ellipsize; return this; }
Set ellipsizing on the layout. Causes words that are longer than the view is wide, or exceeding the number of lines (see #setMaxLines) in the case of {@link android.text.TextUtils.TruncateAt#END} or {@link android.text.TextUtils.TruncateAt#MARQUEE}, to be ellipsized instead of broken. The default is {@code null}, indicating no ellipsis is to be applied. @param ellipsize type of ellipsis behavior @return this builder, useful for chaining @see android.widget.TextView#setEllipsize
Builder::setEllipsize
java
Reginer/aosp-android-jar
android-35/src/android/text/DynamicLayout.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/DynamicLayout.java
MIT
private void transformAndReflow(Spannable s, int start, int end) { final DynamicLayout dynamicLayout = mLayout.get(); if (dynamicLayout != null && dynamicLayout.mDisplay instanceof OffsetMapping) { final OffsetMapping transformedText = (OffsetMapping) dynamicLayout.mDisplay; start = transformedText.originalToTransformed(start, OffsetMapping.MAP_STRATEGY_CHARACTER); end = transformedText.originalToTransformed(end, OffsetMapping.MAP_STRATEGY_CHARACTER); } reflow(s, start, end - start, end - start); }
Reflow the {@link DynamicLayout} at the given range from {@code start} to the {@code end}. If the display text in this {@link DynamicLayout} is a {@link OffsetMapping} instance (which means it's also a transformed text), it will transform the given range first and then reflow.
ChangeWatcher::transformAndReflow
java
Reginer/aosp-android-jar
android-35/src/android/text/DynamicLayout.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/DynamicLayout.java
MIT
public static <T> boolean isEmpty(@Nullable T[] array) { return array == null || array.length == 0; }
@return True if the array is null or 0-length.
CollectionUtils::isEmpty
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
public static <T> boolean isEmpty(@Nullable Collection<T> collection) { return collection == null || collection.isEmpty(); }
@return True if the collection is null or 0-length.
CollectionUtils::isEmpty
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
public static <T> boolean all(@NonNull Collection<T> elem, @NonNull Predicate<T> predicate) { for (final T e : elem) { if (!predicate.test(e)) return false; } return true; }
@return True if all elements satisfy the predicate, false otherwise. Note that means this always returns true for empty collections.
CollectionUtils::all
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
public static <T> boolean any(@NonNull Collection<T> elem, @NonNull Predicate<T> predicate) { return indexOf(elem, predicate) >= 0; }
@return True if any element satisfies the predicate, false otherwise. Note that means this always returns false for empty collections.
CollectionUtils::any
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
public static <T> boolean any(@NonNull SparseArray<T> array, @NonNull Predicate<T> predicate) { for (int i = 0; i < array.size(); ++i) { if (predicate.test(array.valueAt(i))) { return true; } } return false; }
@return True if there exists at least one element in the sparse array for which condition {@code predicate}
CollectionUtils::any
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
public static boolean contains(@Nullable int[] array, int value) { if (array == null) return false; for (int element : array) { if (element == value) { return true; } } return false; }
@return true if the array contains the specified value.
CollectionUtils::contains
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
public static <T> boolean contains(@Nullable T[] array, @Nullable T value) { return indexOf(array, value) != -1; }
@return true if the array contains the specified value.
CollectionUtils::contains
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
public static <T> int indexOf(@Nullable T[] array, @Nullable T value) { if (array == null) return -1; for (int i = 0; i < array.length; i++) { if (Objects.equals(array[i], value)) return i; } return -1; }
Return first index of value in given array, or -1 if not found.
CollectionUtils::indexOf
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
@NonNull public static <T> ArrayList<T> filter(@NonNull final Collection<T> source, @NonNull final Predicate<T> test) { final ArrayList<T> matches = new ArrayList<>(); for (final T e : source) { if (test.test(e)) { matches.add(e); } } return matches; }
Returns a new collection of elements that match the passed predicate. @param source the elements to filter. @param test the predicate to test for. @return a new collection containing only the source elements that satisfy the predicate.
CollectionUtils::filter
java
Reginer/aosp-android-jar
android-32/src/com/android/net/module/util/CollectionUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/net/module/util/CollectionUtils.java
MIT
public static void schedule(Context context) { if (!selinuxSdkSandboxAudit()) { Slog.d(TAG, "SelinuxAuditLogsService not enabled"); return; } if (AUDITD_TAG_CODE == -1) { Slog.e(TAG, "auditd is not a registered tag on this system"); return; } LogsCollectorJobScheduler propertiesListener = new LogsCollectorJobScheduler( context.getSystemService(JobScheduler.class) .forNamespace(SELINUX_AUDIT_NAMESPACE)); propertiesListener.schedule(); DeviceConfig.addOnPropertiesChangedListener( DeviceConfig.NAMESPACE_ADSERVICES, context.getMainExecutor(), propertiesListener); }
Scheduled jobs related to logging of SELinux denials and audits. The job runs daily on idle devices. public class SelinuxAuditLogsService extends JobService { private static final String TAG = "SelinuxAuditLogs"; private static final String SELINUX_AUDIT_NAMESPACE = "SelinuxAuditLogsNamespace"; static final int AUDITD_TAG_CODE = EventLog.getTagCode("auditd"); private static final String CONFIG_SELINUX_AUDIT_JOB_FREQUENCY_HOURS = "selinux_audit_job_frequency_hours"; private static final String CONFIG_SELINUX_ENABLE_AUDIT_JOB = "selinux_enable_audit_job"; private static final String CONFIG_SELINUX_AUDIT_CAP = "selinux_audit_cap"; private static final int MAX_PERMITS_CAP_DEFAULT = 50000; private static final int SELINUX_AUDIT_JOB_ID = 25327386; private static final ComponentName SELINUX_AUDIT_JOB_COMPONENT = new ComponentName("android", SelinuxAuditLogsService.class.getName()); private static final ExecutorService EXECUTOR_SERVICE = Executors.newSingleThreadExecutor(); // Audit logging is subject to both rate and quota limiting. A {@link RateLimiter} makes sure // that we push no more than one atom every 10 milliseconds. A {@link QuotaLimiter} caps the // number of atoms pushed per day to CONFIG_SELINUX_AUDIT_CAP. The quota limiter is static // because new job executions happen in a new instance of this class. Making the quota limiter // an instance reference would reset the quota limitations between jobs executions. private static final Duration RATE_LIMITER_WINDOW = Duration.ofMillis(10); private static final QuotaLimiter QUOTA_LIMITER = new QuotaLimiter( DeviceConfig.getInt( DeviceConfig.NAMESPACE_ADSERVICES, CONFIG_SELINUX_AUDIT_CAP, MAX_PERMITS_CAP_DEFAULT)); private static final SelinuxAuditLogsJob LOGS_COLLECTOR_JOB = new SelinuxAuditLogsJob( new SelinuxAuditLogsCollector( new RateLimiter(RATE_LIMITER_WINDOW), QUOTA_LIMITER)); /** Schedule jobs with the {@link JobScheduler}.
SelinuxAuditLogsService::schedule
java
Reginer/aosp-android-jar
android-35/src/com/android/server/selinux/SelinuxAuditLogsService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/selinux/SelinuxAuditLogsService.java
MIT
public void init(SecureRandom random) throws IllegalArgumentException { this.random = random; }
Initialise the padder. @param random a SecureRandom if one is available.
X923Padding::init
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/org/bouncycastle/crypto/paddings/X923Padding.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/paddings/X923Padding.java
MIT
public String getPaddingName() { return "X9.23"; }
Return the name of the algorithm the padder implements. @return the name of the algorithm the padder implements.
X923Padding::getPaddingName
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/org/bouncycastle/crypto/paddings/X923Padding.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/paddings/X923Padding.java
MIT
public int addPadding( byte[] in, int inOff) { byte code = (byte)(in.length - inOff); while (inOff < in.length - 1) { if (random == null) { in[inOff] = 0; } else { in[inOff] = (byte)random.nextInt(); } inOff++; } in[inOff] = code; return code; }
add the pad bytes to the passed in block, returning the number of bytes added.
X923Padding::addPadding
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/org/bouncycastle/crypto/paddings/X923Padding.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/paddings/X923Padding.java
MIT
public int padCount(byte[] in) throws InvalidCipherTextException { int count = in[in.length - 1] & 0xff; if (count > in.length) { throw new InvalidCipherTextException("pad block corrupted"); } return count; }
return the number of pad bytes present in the block.
X923Padding::padCount
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/org/bouncycastle/crypto/paddings/X923Padding.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/paddings/X923Padding.java
MIT
private CdmaInboundSmsHandler(Context context, SmsStorageMonitor storageMonitor, Phone phone, CdmaSMSDispatcher smsDispatcher, Looper looper) { super("CdmaInboundSmsHandler", context, storageMonitor, phone, looper); mSmsDispatcher = smsDispatcher; phone.mCi.setOnNewCdmaSms(getHandler(), EVENT_NEW_SMS, null); mCellBroadcastServiceManager.enable(); mScpCallback = new RemoteCallback(result -> { if (result == null) { loge("SCP results error: missing extras"); return; } String sender = result.getString("sender"); if (sender == null) { loge("SCP results error: missing sender extra."); return; } ArrayList<CdmaSmsCbProgramResults> results = result.getParcelableArrayList("results"); if (results == null) { loge("SCP results error: missing results extra."); return; } BearerData bData = new BearerData(); bData.messageType = BearerData.MESSAGE_TYPE_SUBMIT; bData.messageId = SmsMessage.getNextMessageId(); bData.serviceCategoryProgramResults = results; byte[] encodedBearerData = BearerData.encode(bData); ByteArrayOutputStream baos = new ByteArrayOutputStream(100); DataOutputStream dos = new DataOutputStream(baos); try { dos.writeInt(SmsEnvelope.TELESERVICE_SCPT); dos.writeInt(0); //servicePresent dos.writeInt(0); //serviceCategory CdmaSmsAddress destAddr = CdmaSmsAddress.parse( PhoneNumberUtils.cdmaCheckAndProcessPlusCodeForSms(sender)); dos.write(destAddr.digitMode); dos.write(destAddr.numberMode); dos.write(destAddr.ton); // number_type dos.write(destAddr.numberPlan); dos.write(destAddr.numberOfDigits); dos.write(destAddr.origBytes, 0, destAddr.origBytes.length); // digits // Subaddress is not supported. dos.write(0); //subaddressType dos.write(0); //subaddr_odd dos.write(0); //subaddr_nbr_of_digits dos.write(encodedBearerData.length); dos.write(encodedBearerData, 0, encodedBearerData.length); // Ignore the RIL response. TODO: implement retry if SMS send fails. mPhone.mCi.sendCdmaSms(baos.toByteArray(), null); } catch (IOException e) { loge("exception creating SCP results PDU", e); } finally { try { dos.close(); } catch (IOException ignored) { } } }); if (TEST_MODE) { if (sTestBroadcastReceiver == null) { sTestBroadcastReceiver = new CdmaCbTestBroadcastReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(TEST_ACTION); context.registerReceiver(sTestBroadcastReceiver, filter, Context.RECEIVER_EXPORTED); } if (sTestScpBroadcastReceiver == null) { sTestScpBroadcastReceiver = new CdmaScpTestBroadcastReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(SCP_TEST_ACTION); context.registerReceiver(sTestScpBroadcastReceiver, filter, Context.RECEIVER_EXPORTED); } } }
Create a new inbound SMS handler for CDMA.
CdmaInboundSmsHandler::CdmaInboundSmsHandler
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
MIT
public static CdmaInboundSmsHandler makeInboundSmsHandler(Context context, SmsStorageMonitor storageMonitor, Phone phone, CdmaSMSDispatcher smsDispatcher, Looper looper) { CdmaInboundSmsHandler handler = new CdmaInboundSmsHandler(context, storageMonitor, phone, smsDispatcher, looper); handler.start(); return handler; }
Wait for state machine to enter startup state. We can't send any messages until then.
CdmaInboundSmsHandler::makeInboundSmsHandler
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
MIT
private static int resultToCause(int rc) { switch (rc) { case Activity.RESULT_OK: case Intents.RESULT_SMS_HANDLED: // Cause code is ignored on success. return 0; case Intents.RESULT_SMS_OUT_OF_MEMORY: return CommandsInterface.CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE; case Intents.RESULT_SMS_UNSUPPORTED: return CommandsInterface.CDMA_SMS_FAIL_CAUSE_INVALID_TELESERVICE_ID; case Intents.RESULT_SMS_GENERIC_ERROR: default: return CommandsInterface.CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM; } }
Convert Android result code to CDMA SMS failure cause. @param rc the Android SMS intent result value @return 0 for success, or a CDMA SMS failure cause value
CdmaInboundSmsHandler::resultToCause
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
MIT
private void handleVoicemailTeleservice(SmsMessage sms, @SmsSource int smsSource) { int voicemailCount = sms.getNumOfVoicemails(); if (DBG) log("Voicemail count=" + voicemailCount); // range check if (voicemailCount < 0) { voicemailCount = -1; } else if (voicemailCount > 99) { // C.S0015-B v2, 4.5.12 // range: 0-99 voicemailCount = 99; } // update voice mail count in phone mPhone.setVoiceMessageCount(voicemailCount); // update metrics addVoicemailSmsToMetrics(smsSource); }
Handle {@link SmsEnvelope#TELESERVICE_VMN} and {@link SmsEnvelope#TELESERVICE_MWI}. @param sms the message to process
CdmaInboundSmsHandler::handleVoicemailTeleservice
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
MIT
private int processCdmaWapPdu(byte[] pdu, int referenceNumber, String address, String dispAddr, long timestamp, @SmsSource int smsSource) { int index = 0; int msgType = (0xFF & pdu[index++]); if (msgType != 0) { log("Received a WAP SMS which is not WDP. Discard."); return Intents.RESULT_SMS_HANDLED; } int totalSegments = (0xFF & pdu[index++]); // >= 1 int segment = (0xFF & pdu[index++]); // >= 0 if (segment >= totalSegments) { loge("WDP bad segment #" + segment + " expecting 0-" + (totalSegments - 1)); return Intents.RESULT_SMS_HANDLED; } // Only the first segment contains sourcePort and destination Port int sourcePort = 0; int destinationPort = 0; if (segment == 0) { //process WDP segment sourcePort = (0xFF & pdu[index++]) << 8; sourcePort |= 0xFF & pdu[index++]; destinationPort = (0xFF & pdu[index++]) << 8; destinationPort |= 0xFF & pdu[index++]; // Some carriers incorrectly send duplicate port fields in omadm wap pushes. // If configured, check for that here if (mCheckForDuplicatePortsInOmadmWapPush) { if (checkDuplicatePortOmadmWapPush(pdu, index)) { index = index + 4; // skip duplicate port fields } } } // Lookup all other related parts log("Received WAP PDU. Type = " + msgType + ", originator = " + address + ", src-port = " + sourcePort + ", dst-port = " + destinationPort + ", ID = " + referenceNumber + ", segment# = " + segment + '/' + totalSegments); // pass the user data portion of the PDU to the shared handler in SMSDispatcher byte[] userData = new byte[pdu.length - index]; System.arraycopy(pdu, index, userData, 0, pdu.length - index); InboundSmsTracker tracker = TelephonyComponentFactory.getInstance() .inject(InboundSmsTracker.class.getName()).makeInboundSmsTracker(mContext, userData, timestamp, destinationPort, true, address, dispAddr, referenceNumber, segment, totalSegments, true, HexDump.toHexString(userData), false /* isClass0 */, mPhone.getSubId(), smsSource); // de-duping is done only for text messages return addTrackerToRawTableAndSendMessage(tracker, false /* don't de-dup */); }
Processes inbound messages that are in the WAP-WDP PDU format. See wap-259-wdp-20010614-a section 6.5 for details on the WAP-WDP PDU format. WDP segments are gathered until a datagram completes and gets dispatched. @param pdu The WAP-WDP PDU segment @return a result code from {@link android.provider.Telephony.Sms.Intents}, or {@link Activity#RESULT_OK} if the message has been broadcast to applications
CdmaInboundSmsHandler::processCdmaWapPdu
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java
MIT
public void dump(@NonNull String prefix, @NonNull PrintWriter pw) { pw.print(prefix); pw.print("Component: "); pw.println(getServiceInfo().getComponentName()); pw.print(prefix); pw.print("Settings: "); pw.println(mSettingsActivity); }
Dumps it!
ContentCaptureServiceInfo::dump
java
Reginer/aosp-android-jar
android-32/src/android/service/contentcapture/ContentCaptureServiceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/service/contentcapture/ContentCaptureServiceInfo.java
MIT
public createDocument01(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "staffNS", false); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
createDocument01::createDocument01
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level2/core/createDocument01.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level2/core/createDocument01.java
MIT
public void runTest() throws Throwable { String namespaceURI = "http://www.ecommerce.org/"; String malformedName = "prefix::local"; Document doc; DocumentType docType = null; DOMImplementation domImpl; Document aNewDoc; doc = (Document) load("staffNS", false); domImpl = doc.getImplementation(); { boolean success = false; try { aNewDoc = domImpl.createDocument(namespaceURI, malformedName, docType); } catch (DOMException ex) { success = (ex.code == DOMException.NAMESPACE_ERR); } assertTrue("throw_NAMESPACE_ERR", success); } }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
createDocument01::runTest
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level2/core/createDocument01.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level2/core/createDocument01.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument01"; }
Gets URI that identifies the test. @return uri identifier of test
createDocument01::getTargetURI
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level2/core/createDocument01.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level2/core/createDocument01.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(createDocument01.class, args); }
Runs this test from the command line. @param args command line arguments
createDocument01::main
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level2/core/createDocument01.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level2/core/createDocument01.java
MIT
public void dumpDebug(ProtoOutputStream proto, long fieldId) { long token = proto.start(fieldId); proto.write(PatternMatcherProto.PATTERN, mPattern); proto.write(PatternMatcherProto.TYPE, mType); // PatternMatcherProto.PARSED_PATTERN is too much to dump, but the field is reserved to // match the current data structure. proto.end(token); }
Pattern type: the given pattern must match the end of the string it is tested against. public static final int PATTERN_SUFFIX = 4; /** @hide @IntDef(value = { PATTERN_LITERAL, PATTERN_PREFIX, PATTERN_SIMPLE_GLOB, PATTERN_ADVANCED_GLOB, PATTERN_SUFFIX, }) @Retention(RetentionPolicy.SOURCE) public @interface PatternType {} // token types for advanced matching private static final int TOKEN_TYPE_LITERAL = 0; private static final int TOKEN_TYPE_ANY = 1; private static final int TOKEN_TYPE_SET = 2; private static final int TOKEN_TYPE_INVERSE_SET = 3; // Return for no match private static final int NO_MATCH = -1; private static final String TAG = "PatternMatcher"; // Parsed placeholders for advanced patterns private static final int PARSED_TOKEN_CHAR_SET_START = -1; private static final int PARSED_TOKEN_CHAR_SET_INVERSE_START = -2; private static final int PARSED_TOKEN_CHAR_SET_STOP = -3; private static final int PARSED_TOKEN_CHAR_ANY = -4; private static final int PARSED_MODIFIER_RANGE_START = -5; private static final int PARSED_MODIFIER_RANGE_STOP = -6; private static final int PARSED_MODIFIER_ZERO_OR_MORE = -7; private static final int PARSED_MODIFIER_ONE_OR_MORE = -8; private final String mPattern; private final int mType; private final int[] mParsedPattern; private static final int MAX_PATTERN_STORAGE = 2048; // workspace to use for building a parsed advanced pattern; private static final int[] sParsedPatternScratch = new int[MAX_PATTERN_STORAGE]; public PatternMatcher(String pattern, int type) { mPattern = pattern; mType = type; if (mType == PATTERN_ADVANCED_GLOB) { mParsedPattern = parseAndVerifyAdvancedPattern(pattern); } else { mParsedPattern = null; } } public final String getPath() { return mPattern; } public final int getType() { return mType; } public boolean match(String str) { return matchPattern(str, mPattern, mParsedPattern, mType); } public String toString() { String type = "? "; switch (mType) { case PATTERN_LITERAL: type = "LITERAL: "; break; case PATTERN_PREFIX: type = "PREFIX: "; break; case PATTERN_SIMPLE_GLOB: type = "GLOB: "; break; case PATTERN_ADVANCED_GLOB: type = "ADVANCED: "; break; case PATTERN_SUFFIX: type = "SUFFIX: "; break; } return "PatternMatcher{" + type + mPattern + "}"; } /** @hide
PatternMatcher::dumpDebug
java
Reginer/aosp-android-jar
android-35/src/android/os/PatternMatcher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/PatternMatcher.java
MIT
public boolean check() { try { if (mType == PATTERN_ADVANCED_GLOB) { return Arrays.equals(mParsedPattern, parseAndVerifyAdvancedPattern(mPattern)); } } catch (IllegalArgumentException e) { Log.w(TAG, "Failed to verify advanced pattern: " + e.getMessage()); return false; } return true; }
Perform a check on the matcher for the pattern type of {@link #PATTERN_ADVANCED_GLOB}. Return true if it passed. @hide
PatternMatcher::check
java
Reginer/aosp-android-jar
android-35/src/android/os/PatternMatcher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/PatternMatcher.java
MIT
synchronized static int[] parseAndVerifyAdvancedPattern(String pattern) { int ip = 0; final int LP = pattern.length(); int it = 0; boolean inSet = false; boolean inRange = false; boolean inCharClass = false; boolean addToParsedPattern; while (ip < LP) { if (it > MAX_PATTERN_STORAGE - 3) { throw new IllegalArgumentException("Pattern is too large!"); } char c = pattern.charAt(ip); addToParsedPattern = false; switch (c) { case '[': if (inSet) { addToParsedPattern = true; // treat as literal or char class in set } else { if (pattern.charAt(ip + 1) == '^') { sParsedPatternScratch[it++] = PARSED_TOKEN_CHAR_SET_INVERSE_START; ip++; // skip over the '^' } else { sParsedPatternScratch[it++] = PARSED_TOKEN_CHAR_SET_START; } ip++; // move to the next pattern char inSet = true; continue; } break; case ']': if (!inSet) { addToParsedPattern = true; // treat as literal outside of set } else { int parsedToken = sParsedPatternScratch[it - 1]; if (parsedToken == PARSED_TOKEN_CHAR_SET_START || parsedToken == PARSED_TOKEN_CHAR_SET_INVERSE_START) { throw new IllegalArgumentException( "You must define characters in a set."); } sParsedPatternScratch[it++] = PARSED_TOKEN_CHAR_SET_STOP; inSet = false; inCharClass = false; } break; case '{': if (!inSet) { if (it == 0 || isParsedModifier(sParsedPatternScratch[it - 1])) { throw new IllegalArgumentException("Modifier must follow a token."); } sParsedPatternScratch[it++] = PARSED_MODIFIER_RANGE_START; ip++; inRange = true; } break; case '}': if (inRange) { // only terminate the range if we're currently in one sParsedPatternScratch[it++] = PARSED_MODIFIER_RANGE_STOP; inRange = false; } break; case '*': if (!inSet) { if (it == 0 || isParsedModifier(sParsedPatternScratch[it - 1])) { throw new IllegalArgumentException("Modifier must follow a token."); } sParsedPatternScratch[it++] = PARSED_MODIFIER_ZERO_OR_MORE; } break; case '+': if (!inSet) { if (it == 0 || isParsedModifier(sParsedPatternScratch[it - 1])) { throw new IllegalArgumentException("Modifier must follow a token."); } sParsedPatternScratch[it++] = PARSED_MODIFIER_ONE_OR_MORE; } break; case '.': if (!inSet) { sParsedPatternScratch[it++] = PARSED_TOKEN_CHAR_ANY; } break; case '\\': // escape if (ip + 1 >= LP) { throw new IllegalArgumentException("Escape found at end of pattern!"); } c = pattern.charAt(++ip); addToParsedPattern = true; break; default: addToParsedPattern = true; break; } if (inSet) { if (inCharClass) { sParsedPatternScratch[it++] = c; inCharClass = false; } else { // look forward for character class if (ip + 2 < LP && pattern.charAt(ip + 1) == '-' && pattern.charAt(ip + 2) != ']') { inCharClass = true; sParsedPatternScratch[it++] = c; // set first token as lower end of range ip++; // advance past dash } else { // literal sParsedPatternScratch[it++] = c; // set first token as literal sParsedPatternScratch[it++] = c; // set second set as literal } } } else if (inRange) { int endOfSet = pattern.indexOf('}', ip); if (endOfSet < 0) { throw new IllegalArgumentException("Range not ended with '}'"); } String rangeString = pattern.substring(ip, endOfSet); int commaIndex = rangeString.indexOf(','); try { final int rangeMin; final int rangeMax; if (commaIndex < 0) { int parsedRange = Integer.parseInt(rangeString); rangeMin = rangeMax = parsedRange; } else { rangeMin = Integer.parseInt(rangeString.substring(0, commaIndex)); if (commaIndex == rangeString.length() - 1) { // e.g. {n,} (n or more) rangeMax = Integer.MAX_VALUE; } else { rangeMax = Integer.parseInt(rangeString.substring(commaIndex + 1)); } } if (rangeMin > rangeMax) { throw new IllegalArgumentException( "Range quantifier minimum is greater than maximum"); } sParsedPatternScratch[it++] = rangeMin; sParsedPatternScratch[it++] = rangeMax; } catch (NumberFormatException e) { throw new IllegalArgumentException("Range number format incorrect", e); } ip = endOfSet; continue; // don't increment ip } else if (addToParsedPattern) { sParsedPatternScratch[it++] = c; } ip++; } if (inSet) { throw new IllegalArgumentException("Set was not terminated!"); } return Arrays.copyOf(sParsedPatternScratch, it); }
Parses the advanced pattern and returns an integer array representation of it. The integer array treats each field as a character if positive and a unique token placeholder if negative. This method will throw on any pattern structure violations.
PatternMatcher::parseAndVerifyAdvancedPattern
java
Reginer/aosp-android-jar
android-35/src/android/os/PatternMatcher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/os/PatternMatcher.java
MIT
public FaceManager(Context context, IFaceService service) { mContext = context; mService = service; if (mService == null) { Slog.v(TAG, "FaceAuthenticationManagerService was null"); } mHandler = new MyHandler(context); }
@hide
FaceManager::FaceManager
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
private void useHandler(Handler handler) { if (handler != null) { mHandler = new MyHandler(handler.getLooper()); } else if (mHandler.getLooper() != mContext.getMainLooper()) { mHandler = new MyHandler(mContext.getMainLooper()); } }
Use the provided handler thread for events.
FaceManager::useHandler
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public static String getErrorString(Context context, int errMsg, int vendorCode) { switch (errMsg) { case FACE_ERROR_HW_UNAVAILABLE: return context.getString( com.android.internal.R.string.face_error_hw_not_available); case FACE_ERROR_UNABLE_TO_PROCESS: return context.getString( com.android.internal.R.string.face_error_unable_to_process); case FACE_ERROR_TIMEOUT: return context.getString(com.android.internal.R.string.face_error_timeout); case FACE_ERROR_NO_SPACE: return context.getString(com.android.internal.R.string.face_error_no_space); case FACE_ERROR_CANCELED: return context.getString(com.android.internal.R.string.face_error_canceled); case FACE_ERROR_LOCKOUT: return context.getString(com.android.internal.R.string.face_error_lockout); case FACE_ERROR_LOCKOUT_PERMANENT: return context.getString( com.android.internal.R.string.face_error_lockout_permanent); case FACE_ERROR_USER_CANCELED: return context.getString(com.android.internal.R.string.face_error_user_canceled); case FACE_ERROR_NOT_ENROLLED: return context.getString(com.android.internal.R.string.face_error_not_enrolled); case FACE_ERROR_HW_NOT_PRESENT: return context.getString(com.android.internal.R.string.face_error_hw_not_present); case BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED: return context.getString( com.android.internal.R.string.face_error_security_update_required); case BIOMETRIC_ERROR_RE_ENROLL: return context.getString( com.android.internal.R.string.face_recalibrate_notification_content); case FACE_ERROR_VENDOR: { String[] msgArray = context.getResources().getStringArray( com.android.internal.R.array.face_error_vendor); if (vendorCode < msgArray.length) { return msgArray[vendorCode]; } } } // This is used as a last resort in case a vendor string is missing // It should not happen for anything other than FACE_ERROR_VENDOR, but // warn and use the default if all else fails. // TODO(b/196639965): update string Slog.w(TAG, "Invalid error message: " + errMsg + ", " + vendorCode); return ""; }
@hide
FaceManager::getErrorString
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public static int getMappedAcquiredInfo(int acquireInfo, int vendorCode) { switch (acquireInfo) { case FACE_ACQUIRED_GOOD: return BiometricConstants.BIOMETRIC_ACQUIRED_GOOD; case FACE_ACQUIRED_INSUFFICIENT: case FACE_ACQUIRED_TOO_BRIGHT: case FACE_ACQUIRED_TOO_DARK: return BiometricConstants.BIOMETRIC_ACQUIRED_INSUFFICIENT; case FACE_ACQUIRED_TOO_CLOSE: case FACE_ACQUIRED_TOO_FAR: case FACE_ACQUIRED_TOO_HIGH: case FACE_ACQUIRED_TOO_LOW: case FACE_ACQUIRED_TOO_RIGHT: case FACE_ACQUIRED_TOO_LEFT: return BiometricConstants.BIOMETRIC_ACQUIRED_PARTIAL; case FACE_ACQUIRED_POOR_GAZE: case FACE_ACQUIRED_NOT_DETECTED: case FACE_ACQUIRED_TOO_MUCH_MOTION: case FACE_ACQUIRED_RECALIBRATE: return BiometricConstants.BIOMETRIC_ACQUIRED_INSUFFICIENT; case FACE_ACQUIRED_VENDOR: return BiometricConstants.BIOMETRIC_ACQUIRED_VENDOR_BASE + vendorCode; default: return BiometricConstants.BIOMETRIC_ACQUIRED_GOOD; } }
Used so BiometricPrompt can map the face ones onto existing public constants. @hide
FaceManager::getMappedAcquiredInfo
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public AuthenticationResult(CryptoObject crypto, Face face, int userId, boolean isStrongBiometric) { mCryptoObject = crypto; mFace = face; mUserId = userId; mIsStrongBiometric = isStrongBiometric; }
Authentication result @param crypto the crypto object @param face the recognized face data, if allowed. @hide
AuthenticationResult::AuthenticationResult
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public CryptoObject getCryptoObject() { return mCryptoObject; }
Obtain the crypto object associated with this transaction @return crypto object provided to {@link FaceManager#authenticate (CryptoObject, CancellationSignal, int, AuthenticationCallback, Handler)}.
AuthenticationResult::getCryptoObject
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public Face getFace() { return mFace; }
Obtain the Face associated with this operation. Applications are strongly discouraged from associating specific faces with specific applications or operations. @hide
AuthenticationResult::getFace
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public int getUserId() { return mUserId; }
Obtain the userId for which this face was authenticated. @hide
AuthenticationResult::getUserId
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public boolean isStrongBiometric() { return mIsStrongBiometric; }
Check whether the strength of the face modality associated with this operation is strong (i.e. not weak or convenience). @hide
AuthenticationResult::isStrongBiometric
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onAuthenticationError(int errorCode, CharSequence errString) { }
Called when an unrecoverable error has been encountered and the operation is complete. No further callbacks will be made on this object. @param errorCode An integer identifying the error message @param errString A human-readable error string that can be shown in UI
AuthenticationCallback::onAuthenticationError
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onAuthenticationHelp(int helpCode, CharSequence helpString) { }
Called when a recoverable error has been encountered during authentication. The help string is provided to give the user guidance for what went wrong, such as "Sensor dirty, please clean it." @param helpCode An integer identifying the error message @param helpString A human-readable string that can be shown in UI
AuthenticationCallback::onAuthenticationHelp
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onAuthenticationSucceeded(AuthenticationResult result) { }
Called when a face is recognized. @param result An object containing authentication-related data
AuthenticationCallback::onAuthenticationSucceeded
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onAuthenticationFailed() { }
Called when a face is detected but not recognized.
AuthenticationCallback::onAuthenticationFailed
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onAuthenticationAcquired(int acquireInfo) { }
Called when a face image has been acquired, but wasn't processed yet. @param acquireInfo one of FACE_ACQUIRED_* constants @hide
AuthenticationCallback::onAuthenticationAcquired
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onEnrollmentError(int errMsgId, CharSequence errString) { }
Called when an unrecoverable error has been encountered and the operation is complete. No further callbacks will be made on this object. @param errMsgId An integer identifying the error message @param errString A human-readable error string that can be shown in UI
EnrollmentCallback::onEnrollmentError
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) { }
Called when a recoverable error has been encountered during enrollment. The help string is provided to give the user guidance for what went wrong, such as "Image too dark, uncover light source" or what they need to do next, such as "Rotate face up / down." @param helpMsgId An integer identifying the error message @param helpString A human-readable string that can be shown in UI
EnrollmentCallback::onEnrollmentHelp
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onEnrollmentFrame( int helpCode, @Nullable CharSequence helpMessage, @Nullable FaceEnrollCell cell, @FaceEnrollStages.FaceEnrollStage int stage, float pan, float tilt, float distance) { onEnrollmentHelp(helpCode, helpMessage); }
Called each time a single frame is captured during enrollment. <p>For older, non-AIDL implementations, only {@code helpCode} and {@code helpMessage} are supported. Sensible default values will be provided for all other arguments. @param helpCode An integer identifying the capture status for this frame. @param helpMessage A human-readable help string that can be shown in UI. @param cell The cell captured during this frame of enrollment, if any. @param stage An integer representing the current stage of enrollment. @param pan The horizontal pan of the detected face. Values in the range [-1, 1] indicate a good capture. @param tilt The vertical tilt of the detected face. Values in the range [-1, 1] indicate a good capture. @param distance The distance of the detected face from the device. Values in the range [-1, 1] indicate a good capture.
EnrollmentCallback::onEnrollmentFrame
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT
public void onEnrollmentProgress(int remaining) { }
Called as each enrollment step progresses. Enrollment is considered complete when remaining reaches 0. This function will not be called if enrollment fails. See {@link EnrollmentCallback#onEnrollmentError(int, CharSequence)} @param remaining The number of remaining steps
EnrollmentCallback::onEnrollmentProgress
java
Reginer/aosp-android-jar
android-31/src/android/hardware/face/FaceManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/face/FaceManager.java
MIT