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 float getAutomaticScreenBrightness(BrightnessEvent brightnessEvent, boolean isAutomaticBrightnessAdjusted) { float brightness = (mAutomaticBrightnessController != null) ? mAutomaticBrightnessController.getAutomaticScreenBrightness(brightnessEvent) : PowerManager.BRIGHTNESS_INVALID_FLOAT; if (!isAutomaticBrightnessAdjusted) { adjustAutomaticBrightnessStateIfValid(brightness); } return brightness; }
Evaluates the target automatic brightness of the associated display. @param brightnessEvent Event object to populate with details about why the specific brightness was chosen.
AutomaticBrightnessStrategy::getAutomaticScreenBrightness
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public boolean hasAppliedAutoBrightness() { return mAppliedAutoBrightness; }
Returns if the auto brightness has been applied
AutomaticBrightnessStrategy::hasAppliedAutoBrightness
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public void setAutoBrightnessApplied(boolean autoBrightnessApplied) { mAppliedAutoBrightness = autoBrightnessApplied; }
Sets if the auto-brightness is applied on the latest brightness change.
AutomaticBrightnessStrategy::setAutoBrightnessApplied
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
private float updateTemporaryAutoBrightnessAdjustments() { mAppliedTemporaryAutoBrightnessAdjustment = !Float.isNaN(mTemporaryAutoBrightnessAdjustment); // We do not update the mAutoBrightnessAdjustment with mTemporaryAutoBrightnessAdjustment // since we have not settled to a value yet return mAppliedTemporaryAutoBrightnessAdjustment ? mTemporaryAutoBrightnessAdjustment : mAutoBrightnessAdjustment; }
Evaluates if there are any temporary auto-brightness adjustments which is not applied yet. Temporary brightness adjustments happen when the user moves the brightness slider in the auto-brightness mode, but hasn't settled to a value yet
AutomaticBrightnessStrategy::updateTemporaryAutoBrightnessAdjustments
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
private float getAutoBrightnessAdjustmentSetting() { final float adj = Settings.System.getFloatForUser(mContext.getContentResolver(), Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f, UserHandle.USER_CURRENT); return Float.isNaN(adj) ? 0.0f : BrightnessUtils.clampBrightnessAdjustment(adj); }
Returns the auto-brightness adjustment that is set in the system setting.
AutomaticBrightnessStrategy::getAutoBrightnessAdjustmentSetting
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.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-33/src/android/permission/LegacyPermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/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-33/src/android/permission/LegacyPermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/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-33/src/android/permission/LegacyPermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/permission/LegacyPermissionManager.java
MIT
public hc_namednodemapreturnfirstitem(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "hc_staff", true); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
hc_namednodemapreturnfirstitem::hc_namednodemapreturnfirstitem
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_namednodemapreturnfirstitem.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_namednodemapreturnfirstitem.java
MIT
public void runTest() throws Throwable { Document doc; NodeList elementList; Node testAddress; NamedNodeMap attributes; Node child; String nodeName; java.util.Collection htmlExpected = new java.util.ArrayList(); htmlExpected.add("title"); htmlExpected.add("class"); java.util.Collection expected = new java.util.ArrayList(); expected.add("title"); expected.add("class"); expected.add("dir"); java.util.Collection actual = new java.util.ArrayList(); doc = (Document) load("hc_staff", true); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(1); attributes = testAddress.getAttributes(); for (int indexN10070 = 0; indexN10070 < attributes.getLength(); indexN10070++) { child = (Node) attributes.item(indexN10070); nodeName = child.getNodeName(); actual.add(nodeName); } if (("text/html".equals(getContentType()))) { assertEqualsIgnoreCase("attrName_html", htmlExpected, actual); } else { assertEquals("attrName", expected, actual); } }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
hc_namednodemapreturnfirstitem::runTest
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_namednodemapreturnfirstitem.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_namednodemapreturnfirstitem.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnfirstitem"; }
Gets URI that identifies the test. @return uri identifier of test
hc_namednodemapreturnfirstitem::getTargetURI
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_namednodemapreturnfirstitem.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_namednodemapreturnfirstitem.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(hc_namednodemapreturnfirstitem.class, args); }
Runs this test from the command line. @param args command line arguments
hc_namednodemapreturnfirstitem::main
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_namednodemapreturnfirstitem.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_namednodemapreturnfirstitem.java
MIT
public static int calendarDay2Day(int day) { switch (day) { case Calendar.SUNDAY: return SU; case Calendar.MONDAY: return MO; case Calendar.TUESDAY: return TU; case Calendar.WEDNESDAY: return WE; case Calendar.THURSDAY: return TH; case Calendar.FRIDAY: return FR; case Calendar.SATURDAY: return SA; default: throw new RuntimeException("bad day of week: " + day); } }
Converts one of the Calendar.SUNDAY constants to the SU, MO, etc. constants. btw, I think we should switch to those here too, to get rid of this function, if possible.
InvalidFormatException::calendarDay2Day
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
public static int day2CalendarDay(int day) { switch (day) { case SU: return Calendar.SUNDAY; case MO: return Calendar.MONDAY; case TU: return Calendar.TUESDAY; case WE: return Calendar.WEDNESDAY; case TH: return Calendar.THURSDAY; case FR: return Calendar.FRIDAY; case SA: return Calendar.SATURDAY; default: throw new RuntimeException("bad day of week: " + day); } }
Converts one of the SU, MO, etc. constants to the Calendar.SUNDAY constants. btw, I think we should switch to those here too, to get rid of this function, if possible.
InvalidFormatException::day2CalendarDay
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
private static String day2String(int day) { switch (day) { case SU: return "SU"; case MO: return "MO"; case TU: return "TU"; case WE: return "WE"; case TH: return "TH"; case FR: return "FR"; case SA: return "SA"; default: throw new IllegalArgumentException("bad day argument: " + day); } }
Converts one of the internal day constants (SU, MO, etc.) to the two-letter string representing that constant. @param day one the internal constants SU, MO, etc. @return the two-letter string for the day ("SU", "MO", etc.) @throws IllegalArgumentException Thrown if the day argument is not one of the defined day constants.
InvalidFormatException::day2String
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
public boolean repeatsMonthlyOnDayCount() { if (this.freq != MONTHLY) { return false; } if (bydayCount != 1 || bymonthdayCount != 0) { return false; } if (bydayNum[0] <= 0) { return false; } return true; }
Determines whether this rule specifies a simple monthly rule by weekday, such as "FREQ=MONTHLY;BYDAY=3TU" (the 3rd Tuesday of every month). <p> Negative days, e.g. "FREQ=MONTHLY;BYDAY=-1TU" (the last Tuesday of every month), will cause "false" to be returned. <p> Rules that fire every week, such as "FREQ=MONTHLY;BYDAY=TU" (every Tuesday of every month) will cause "false" to be returned. (Note these are usually expressed as WEEKLY rules, and hence are uncommon.) @return true if this rule is of the appropriate form
InvalidFormatException::repeatsMonthlyOnDayCount
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
private static boolean arraysEqual(int[] array1, int count1, int[] array2, int count2) { if (count1 != count2) { return false; } for (int i = 0; i < count1; i++) { if (array1[i] != array2[i]) return false; } return true; }
Determines whether two integer arrays contain identical elements. <p> The native implementation over-allocated the arrays (and may have stuff left over from a previous run), so we can't just check the arrays -- the separately-maintained count field also matters. We assume that a null array will have a count of zero, and that the array can hold as many elements as the associated count indicates. <p> TODO: replace this with Arrays.equals() when the old parser goes away.
InvalidFormatException::arraysEqual
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
private void resetFields() { until = null; freq = count = interval = bysecondCount = byminuteCount = byhourCount = bydayCount = bymonthdayCount = byyeardayCount = byweeknoCount = bymonthCount = bysetposCount = 0; }
Resets parser-modified fields to their initial state. Does not alter startDate. <p> The original parser always set all of the "count" fields, "wkst", and "until", essentially allowing the same object to be used multiple times by calling parse(). It's unclear whether this behavior was intentional. For now, be paranoid and preserve the existing behavior by resetting the fields. <p> We don't need to touch the integer arrays; they will either be ignored or overwritten. The "startDate" field is not set by the parser, so we ignore it here.
InvalidFormatException::resetFields
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
public void parse(String recur) { /* * From RFC 2445 section 4.3.10: * * recur = "FREQ"=freq *( * ; either UNTIL or COUNT may appear in a 'recur', * ; but UNTIL and COUNT MUST NOT occur in the same 'recur' * * ( ";" "UNTIL" "=" enddate ) / * ( ";" "COUNT" "=" 1*DIGIT ) / * * ; the rest of these keywords are optional, * ; but MUST NOT occur more than once * * ( ";" "INTERVAL" "=" 1*DIGIT ) / * ( ";" "BYSECOND" "=" byseclist ) / * ( ";" "BYMINUTE" "=" byminlist ) / * ( ";" "BYHOUR" "=" byhrlist ) / * ( ";" "BYDAY" "=" bywdaylist ) / * ( ";" "BYMONTHDAY" "=" bymodaylist ) / * ( ";" "BYYEARDAY" "=" byyrdaylist ) / * ( ";" "BYWEEKNO" "=" bywknolist ) / * ( ";" "BYMONTH" "=" bymolist ) / * ( ";" "BYSETPOS" "=" bysplist ) / * ( ";" "WKST" "=" weekday ) / * ( ";" x-name "=" text ) * ) * * The rule parts are not ordered in any particular sequence. * * Examples: * FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU * FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8 * * Strategy: * (1) Split the string at ';' boundaries to get an array of rule "parts". * (2) For each part, find substrings for left/right sides of '=' (name/value). * (3) Call a <name>-specific parsing function to parse the <value> into an * output field. * * By keeping track of which names we've seen in a bit vector, we can verify the * constraints indicated above (FREQ appears first, none of them appear more than once -- * though x-[name] would require special treatment), and we have either UNTIL or COUNT * but not both. * * In general, RFC 2445 property names (e.g. "FREQ") and enumerations ("TU") must * be handled in a case-insensitive fashion, but case may be significant for other * properties. We don't have any case-sensitive values in RRULE, except possibly * for the custom "X-" properties, but we ignore those anyway. Thus, we can trivially * convert the entire string to upper case and then use simple comparisons. * * Differences from previous version: * - allows lower-case property and enumeration values [optional] * - enforces that FREQ appears first * - enforces that only one of UNTIL and COUNT may be specified * - allows (but ignores) X-* parts * - improved validation on various values (e.g. UNTIL timestamps) * - error messages are more specific * * TODO: enforce additional constraints listed in RFC 5545, notably the "N/A" entries * in section 3.3.10. For example, if FREQ=WEEKLY, we should reject a rule that * includes a BYMONTHDAY part. */ /* TODO: replace with "if (freq != 0) throw" if nothing requires this */ resetFields(); int parseFlags = 0; String[] parts; if (ALLOW_LOWER_CASE) { parts = recur.toUpperCase().split(";"); } else { parts = recur.split(";"); } for (String part : parts) { // allow empty part (e.g., double semicolon ";;") if (TextUtils.isEmpty(part)) { continue; } int equalIndex = part.indexOf('='); if (equalIndex <= 0) { /* no '=' or no LHS */ throw new InvalidFormatException("Missing LHS in " + part); } String lhs = part.substring(0, equalIndex); String rhs = part.substring(equalIndex + 1); if (rhs.length() == 0) { throw new InvalidFormatException("Missing RHS in " + part); } /* * In lieu of a "switch" statement that allows string arguments, we use a * map from strings to parsing functions. */ PartParser parser = sParsePartMap.get(lhs); if (parser == null) { if (lhs.startsWith("X-")) { //Log.d(TAG, "Ignoring custom part " + lhs); continue; } throw new InvalidFormatException("Couldn't find parser for " + lhs); } else { int flag = parser.parsePart(rhs, this); if ((parseFlags & flag) != 0) { throw new InvalidFormatException("Part " + lhs + " was specified twice"); } parseFlags |= flag; } } // If not specified, week starts on Monday. if ((parseFlags & PARSED_WKST) == 0) { wkst = MO; } // FREQ is mandatory. if ((parseFlags & PARSED_FREQ) == 0) { throw new InvalidFormatException("Must specify a FREQ value"); } // Can't have both UNTIL and COUNT. if ((parseFlags & (PARSED_UNTIL | PARSED_COUNT)) == (PARSED_UNTIL | PARSED_COUNT)) { if (ONLY_ONE_UNTIL_COUNT) { throw new InvalidFormatException("Must not specify both UNTIL and COUNT: " + recur); } else { Log.w(TAG, "Warning: rrule has both UNTIL and COUNT: " + recur); } } }
Parses an rfc2445 recurrence rule string into its component pieces. Attempting to parse malformed input will result in an EventRecurrence.InvalidFormatException. @param recur The recurrence rule to parse (in un-folded form).
InvalidFormatException::parse
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
public static int parseIntRange(String str, int minVal, int maxVal, boolean allowZero) { try { if (str.charAt(0) == '+') { // Integer.parseInt does not allow a leading '+', so skip it manually. str = str.substring(1); } int val = Integer.parseInt(str); if (val < minVal || val > maxVal || (val == 0 && !allowZero)) { throw new InvalidFormatException("Integer value out of range: " + str); } return val; } catch (NumberFormatException nfe) { throw new InvalidFormatException("Invalid integer value: " + str); } }
Parses an integer, with range-checking. @param str The string to parse. @param minVal Minimum allowed value. @param maxVal Maximum allowed value. @param allowZero Is 0 allowed? @return The parsed value.
PartParser::parseIntRange
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
public static int[] parseNumberList(String listStr, int minVal, int maxVal, boolean allowZero) { int[] values; if (listStr.indexOf(",") < 0) { // Common case: only one entry, skip split() overhead. values = new int[1]; values[0] = parseIntRange(listStr, minVal, maxVal, allowZero); } else { String[] valueStrs = listStr.split(","); int len = valueStrs.length; values = new int[len]; for (int i = 0; i < len; i++) { values[i] = parseIntRange(valueStrs[i], minVal, maxVal, allowZero); } } return values; }
Parses a comma-separated list of integers, with range-checking. @param listStr The string to parse. @param minVal Minimum allowed value. @param maxVal Maximum allowed value. @param allowZero Is 0 allowed? @return A new array with values, sized to hold the exact number of elements.
PartParser::parseNumberList
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
private static void parseWday(String str, int[] byday, int[] bydayNum, int index) { int wdayStrStart = str.length() - 2; String wdayStr; if (wdayStrStart > 0) { /* number is included; parse it out and advance to weekday */ String numPart = str.substring(0, wdayStrStart); int num = parseIntRange(numPart, -53, 53, false); bydayNum[index] = num; wdayStr = str.substring(wdayStrStart); } else { /* just the weekday string */ wdayStr = str; } Integer wday = sParseWeekdayMap.get(wdayStr); if (wday == null) { throw new InvalidFormatException("Invalid BYDAY value: " + str); } byday[index] = wday; }
Parses a comma-separated list of integers, with range-checking. @param listStr The string to parse. @param minVal Minimum allowed value. @param maxVal Maximum allowed value. @param allowZero Is 0 allowed? @return A new array with values, sized to hold the exact number of elements. public static int[] parseNumberList(String listStr, int minVal, int maxVal, boolean allowZero) { int[] values; if (listStr.indexOf(",") < 0) { // Common case: only one entry, skip split() overhead. values = new int[1]; values[0] = parseIntRange(listStr, minVal, maxVal, allowZero); } else { String[] valueStrs = listStr.split(","); int len = valueStrs.length; values = new int[len]; for (int i = 0; i < len; i++) { values[i] = parseIntRange(valueStrs[i], minVal, maxVal, allowZero); } } return values; } } /** parses FREQ={SECONDLY,MINUTELY,...} private static class ParseFreq extends PartParser { @Override public int parsePart(String value, EventRecurrence er) { Integer freq = sParseFreqMap.get(value); if (freq == null) { throw new InvalidFormatException("Invalid FREQ value: " + value); } er.freq = freq; return PARSED_FREQ; } } /** parses UNTIL=enddate, e.g. "19970829T021400" private static class ParseUntil extends PartParser { @Override public int parsePart(String value, EventRecurrence er) { if (VALIDATE_UNTIL) { try { // Parse the time to validate it. The result isn't retained. Time until = new Time(); until.parse(value); } catch (IllegalArgumentException iae) { throw new InvalidFormatException("Invalid UNTIL value: " + value); } } er.until = value; return PARSED_UNTIL; } } /** parses COUNT=[non-negative-integer] private static class ParseCount extends PartParser { @Override public int parsePart(String value, EventRecurrence er) { er.count = parseIntRange(value, Integer.MIN_VALUE, Integer.MAX_VALUE, true); if (er.count < 0) { Log.d(TAG, "Invalid Count. Forcing COUNT to 1 from " + value); er.count = 1; // invalid count. assume one time recurrence. } return PARSED_COUNT; } } /** parses INTERVAL=[non-negative-integer] private static class ParseInterval extends PartParser { @Override public int parsePart(String value, EventRecurrence er) { er.interval = parseIntRange(value, Integer.MIN_VALUE, Integer.MAX_VALUE, true); if (er.interval < 1) { Log.d(TAG, "Invalid Interval. Forcing INTERVAL to 1 from " + value); er.interval = 1; } return PARSED_INTERVAL; } } /** parses BYSECOND=byseclist private static class ParseBySecond extends PartParser { @Override public int parsePart(String value, EventRecurrence er) { int[] bysecond = parseNumberList(value, 0, 59, true); er.bysecond = bysecond; er.bysecondCount = bysecond.length; return PARSED_BYSECOND; } } /** parses BYMINUTE=byminlist private static class ParseByMinute extends PartParser { @Override public int parsePart(String value, EventRecurrence er) { int[] byminute = parseNumberList(value, 0, 59, true); er.byminute = byminute; er.byminuteCount = byminute.length; return PARSED_BYMINUTE; } } /** parses BYHOUR=byhrlist private static class ParseByHour extends PartParser { @Override public int parsePart(String value, EventRecurrence er) { int[] byhour = parseNumberList(value, 0, 23, true); er.byhour = byhour; er.byhourCount = byhour.length; return PARSED_BYHOUR; } } /** parses BYDAY=bywdaylist, e.g. "1SU,-1SU" private static class ParseByDay extends PartParser { @Override public int parsePart(String value, EventRecurrence er) { int[] byday; int[] bydayNum; int bydayCount; if (value.indexOf(",") < 0) { /* only one entry, skip split() overhead bydayCount = 1; byday = new int[1]; bydayNum = new int[1]; parseWday(value, byday, bydayNum, 0); } else { String[] wdays = value.split(","); int len = wdays.length; bydayCount = len; byday = new int[len]; bydayNum = new int[len]; for (int i = 0; i < len; i++) { parseWday(wdays[i], byday, bydayNum, i); } } er.byday = byday; er.bydayNum = bydayNum; er.bydayCount = bydayCount; return PARSED_BYDAY; } /** parses [int]weekday, putting the pieces into parallel array entries
ParseByDay::parseWday
java
Reginer/aosp-android-jar
android-34/src/com/android/calendarcommon2/EventRecurrence.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/calendarcommon2/EventRecurrence.java
MIT
public ServerTransaction sendRinging(RequestEvent event, String tag) throws SipException { try { Request request = event.getRequest(); ServerTransaction transaction = getServerTransaction(event); Response response = mMessageFactory.createResponse(Response.RINGING, request); ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME); toHeader.setTag(tag); response.addHeader(toHeader); if (DBG) log("send RINGING: " + response); transaction.sendResponse(response); return transaction; } catch (ParseException e) { throw new SipException("sendRinging()", e); } }
@param event the INVITE request event
getSimpleName::sendRinging
java
Reginer/aosp-android-jar
android-34/src/com/android/server/sip/SipHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/sip/SipHelper.java
MIT
public ServerTransaction sendInviteOk(RequestEvent event, SipProfile localProfile, String sessionDescription, ServerTransaction inviteTransaction, String externalIp, int externalPort) throws SipException { try { Request request = event.getRequest(); Response response = mMessageFactory.createResponse(Response.OK, request); response.addHeader(createContactHeader(localProfile, externalIp, externalPort)); response.setContent(sessionDescription, mHeaderFactory.createContentTypeHeader( "application", "sdp")); if (inviteTransaction == null) { inviteTransaction = getServerTransaction(event); } if (inviteTransaction.getState() != TransactionState.COMPLETED) { if (DBG) log("send OK: " + response); inviteTransaction.sendResponse(response); } return inviteTransaction; } catch (ParseException e) { throw new SipException("sendInviteOk()", e); } }
@param event the INVITE request event
getSimpleName::sendInviteOk
java
Reginer/aosp-android-jar
android-34/src/com/android/server/sip/SipHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/sip/SipHelper.java
MIT
public void sendInviteAck(ResponseEvent event, Dialog dialog) throws SipException { Response response = event.getResponse(); long cseq = ((CSeqHeader) response.getHeader(CSeqHeader.NAME)) .getSeqNumber(); Request ack = dialog.createAck(cseq); if (DBG) log("send ACK: " + ack); dialog.sendAck(ack); }
@param event the INVITE ACK request event
getSimpleName::sendInviteAck
java
Reginer/aosp-android-jar
android-34/src/com/android/server/sip/SipHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/sip/SipHelper.java
MIT
default Map.Entry<K,V> firstEntry() { var it = entrySet().iterator(); return it.hasNext() ? new NullableKeyValueHolder<>(it.next()) : null; }
Returns the first key-value mapping in this map, or {@code null} if the map is empty. @implSpec The implementation in this interface obtains the iterator of this map's entrySet. If the iterator has an element, it returns an unmodifiable copy of that element. Otherwise, it returns null. @return the first key-value mapping, or {@code null} if this map is empty
firstEntry
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
default Map.Entry<K,V> lastEntry() { var it = reversed().entrySet().iterator(); return it.hasNext() ? new NullableKeyValueHolder<>(it.next()) : null; }
Returns the last key-value mapping in this map, or {@code null} if the map is empty. @implSpec The implementation in this interface obtains the iterator of the entrySet of this map's reversed view. If the iterator has an element, it returns an unmodifiable copy of that element. Otherwise, it returns null. @return the last key-value mapping, or {@code null} if this map is empty
lastEntry
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
default Map.Entry<K,V> pollFirstEntry() { var it = entrySet().iterator(); if (it.hasNext()) { var entry = new NullableKeyValueHolder<>(it.next()); it.remove(); return entry; } else { return null; } }
Removes and returns the first key-value mapping in this map, or {@code null} if the map is empty (optional operation). @implSpec The implementation in this interface obtains the iterator of this map's entrySet. If the iterator has an element, it calls {@code remove} on the iterator and then returns an unmodifiable copy of that element. Otherwise, it returns null. @return the removed first entry of this map, or {@code null} if this map is empty @throws UnsupportedOperationException if this collection implementation does not support this operation
pollFirstEntry
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
default Map.Entry<K,V> pollLastEntry() { var it = reversed().entrySet().iterator(); if (it.hasNext()) { var entry = new NullableKeyValueHolder<>(it.next()); it.remove(); return entry; } else { return null; } }
Removes and returns the last key-value mapping in this map, or {@code null} if the map is empty (optional operation). @implSpec The implementation in this interface obtains the iterator of the entrySet of this map's reversed view. If the iterator has an element, it calls {@code remove} on the iterator and then returns an unmodifiable copy of that element. Otherwise, it returns null. @return the removed last entry of this map, or {@code null} if this map is empty @throws UnsupportedOperationException if this collection implementation does not support this operation
pollLastEntry
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
default V putFirst(K k, V v) { throw new UnsupportedOperationException(); }
Inserts the given mapping into the map if it is not already present, or replaces the value of a mapping if it is already present (optional operation). After this operation completes normally, the given mapping will be present in this map, and it will be the first mapping in this map's encounter order. @implSpec The implementation in this interface always throws {@code UnsupportedOperationException}. @param k the key @param v the value @return the value previously associated with k, or null if none @throws UnsupportedOperationException if this collection implementation does not support this operation
putFirst
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
default V putLast(K k, V v) { throw new UnsupportedOperationException(); }
Inserts the given mapping into the map if it is not already present, or replaces the value of a mapping if it is already present (optional operation). After this operation completes normally, the given mapping will be present in this map, and it will be the last mapping in this map's encounter order. @implSpec The implementation in this interface always throws {@code UnsupportedOperationException}. @param k the key @param v the value @return the value previously associated with k, or null if none @throws UnsupportedOperationException if this collection implementation does not support this operation
putLast
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
default SequencedSet<K> sequencedKeySet() { class SeqKeySet extends AbstractMap.ViewCollection<K> implements SequencedSet<K> { Collection<K> view() { return SequencedMap.this.keySet(); } public SequencedSet<K> reversed() { return SequencedMap.this.reversed().sequencedKeySet(); } public boolean equals(Object other) { return view().equals(other); } public int hashCode() { return view().hashCode(); } } return new SeqKeySet(); }
Returns a {@code SequencedSet} view of this map's {@link #keySet keySet}. @implSpec The implementation in this interface returns a {@code SequencedSet} instance that behaves as follows. Its {@link SequencedSet#add add} and {@link SequencedSet#addAll addAll} methods throw {@link UnsupportedOperationException}. Its {@link SequencedSet#reversed reversed} method returns the {@link #sequencedKeySet sequencedKeySet} view of the {@link #reversed reversed} view of this map. Each of its other methods calls the corresponding method of the {@link #keySet keySet} view of this map. @return a {@code SequencedSet} view of this map's {@code keySet}
sequencedKeySet
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
default SequencedCollection<V> sequencedValues() { class SeqValues extends AbstractMap.ViewCollection<V> implements SequencedCollection<V> { Collection<V> view() { return SequencedMap.this.values(); } public SequencedCollection<V> reversed() { return SequencedMap.this.reversed().sequencedValues(); } } return new SeqValues(); }
Returns a {@code SequencedCollection} view of this map's {@link #values values} collection. @implSpec The implementation in this interface returns a {@code SequencedCollection} instance that behaves as follows. Its {@link SequencedCollection#add add} and {@link SequencedCollection#addAll addAll} methods throw {@link UnsupportedOperationException}. Its {@link SequencedCollection#reversed reversed} method returns the {@link #sequencedValues sequencedValues} view of the {@link #reversed reversed} view of this map. Its {@link Object#equals equals} and {@link Object#hashCode hashCode} methods are inherited from {@link Object}. Each of its other methods calls the corresponding method of the {@link #values values} view of this map. @return a {@code SequencedCollection} view of this map's {@code values} collection
sequencedValues
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
default SequencedSet<Map.Entry<K, V>> sequencedEntrySet() { class SeqEntrySet extends AbstractMap.ViewCollection<Map.Entry<K, V>> implements SequencedSet<Map.Entry<K, V>> { Collection<Map.Entry<K, V>> view() { return SequencedMap.this.entrySet(); } public SequencedSet<Map.Entry<K, V>> reversed() { return SequencedMap.this.reversed().sequencedEntrySet(); } public boolean equals(Object other) { return view().equals(other); } public int hashCode() { return view().hashCode(); } } return new SeqEntrySet(); }
Returns a {@code SequencedSet} view of this map's {@link #entrySet entrySet}. @implSpec The implementation in this interface returns a {@code SequencedSet} instance that behaves as follows. Its {@link SequencedSet#add add} and {@link SequencedSet#addAll addAll} methods throw {@link UnsupportedOperationException}. Its {@link SequencedSet#reversed reversed} method returns the {@link #sequencedEntrySet sequencedEntrySet} view of the {@link #reversed reversed} view of this map. Each of its other methods calls the corresponding method of the {@link #entrySet entrySet} view of this map. @return a {@code SequencedSet} view of this map's {@code entrySet}
sequencedEntrySet
java
Reginer/aosp-android-jar
android-35/src/java/util/SequencedMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/SequencedMap.java
MIT
public InvalidKeyException() { super(); }
Constructs an InvalidKeyException with no detail message. A detail message is a String that describes this particular exception.
InvalidKeyException::InvalidKeyException
java
Reginer/aosp-android-jar
android-32/src/java/security/InvalidKeyException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/InvalidKeyException.java
MIT
public InvalidKeyException(String msg) { super(msg); }
Constructs an InvalidKeyException with the specified detail message. A detail message is a String that describes this particular exception. @param msg the detail message.
InvalidKeyException::InvalidKeyException
java
Reginer/aosp-android-jar
android-32/src/java/security/InvalidKeyException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/InvalidKeyException.java
MIT
public InvalidKeyException(String message, Throwable cause) { super(message, cause); }
Creates a {@code InvalidKeyException} with the specified detail message and cause. @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method). @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) @since 1.5
InvalidKeyException::InvalidKeyException
java
Reginer/aosp-android-jar
android-32/src/java/security/InvalidKeyException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/InvalidKeyException.java
MIT
public InvalidKeyException(Throwable cause) { super(cause); }
Creates a {@code InvalidKeyException} with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail message of {@code cause}). @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) @since 1.5
InvalidKeyException::InvalidKeyException
java
Reginer/aosp-android-jar
android-32/src/java/security/InvalidKeyException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/InvalidKeyException.java
MIT
public hc_elementretrieveattrvalue(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "hc_staff", false); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
hc_elementretrieveattrvalue::hc_elementretrieveattrvalue
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_elementretrieveattrvalue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_elementretrieveattrvalue.java
MIT
public void runTest() throws Throwable { Document doc; NodeList elementList; Element testAddress; String attrValue; doc = (Document) load("hc_staff", false); elementList = doc.getElementsByTagName("acronym"); testAddress = (Element) elementList.item(2); attrValue = testAddress.getAttribute("class"); assertEquals("attrValue", "No", attrValue); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
hc_elementretrieveattrvalue::runTest
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_elementretrieveattrvalue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_elementretrieveattrvalue.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveattrvalue"; }
Gets URI that identifies the test. @return uri identifier of test
hc_elementretrieveattrvalue::getTargetURI
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_elementretrieveattrvalue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_elementretrieveattrvalue.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(hc_elementretrieveattrvalue.class, args); }
Runs this test from the command line. @param args command line arguments
hc_elementretrieveattrvalue::main
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_elementretrieveattrvalue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_elementretrieveattrvalue.java
MIT
public static void toAggStatsProto(ProtoOutputStream proto, long fieldId, long min, long average, long max, int meanKb, int maxKb) { final long aggStatsToken = proto.start(fieldId); proto.write(AggStats.MIN, min); proto.write(AggStats.AVERAGE, average); proto.write(AggStats.MAX, max); proto.write(AggStats.MEAN_KB, meanKb); proto.write(AggStats.MAX_KB, maxKb); proto.end(aggStatsToken); }
Dump AggStats to ProtoOutputStream
ProtoUtils::toAggStatsProto
java
Reginer/aosp-android-jar
android-32/src/android/util/proto/ProtoUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/util/proto/ProtoUtils.java
MIT
public static void toAggStatsProto(ProtoOutputStream proto, long fieldId, long min, long average, long max) { toAggStatsProto(proto, fieldId, min, average, max, 0, 0); }
Dump AggStats to ProtoOutputStream
ProtoUtils::toAggStatsProto
java
Reginer/aosp-android-jar
android-32/src/android/util/proto/ProtoUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/util/proto/ProtoUtils.java
MIT
public static void toDuration(ProtoOutputStream proto, long fieldId, long startMs, long endMs) { final long token = proto.start(fieldId); proto.write(Duration.START_MS, startMs); proto.write(Duration.END_MS, endMs); proto.end(token); }
Dump Duration to ProtoOutputStream
ProtoUtils::toDuration
java
Reginer/aosp-android-jar
android-32/src/android/util/proto/ProtoUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/util/proto/ProtoUtils.java
MIT
public static void writeBitWiseFlagsToProtoEnum(ProtoOutputStream proto, long fieldId, int flags, int[] origEnums, int[] protoEnums) { if (protoEnums.length != origEnums.length) { throw new IllegalArgumentException("The length of origEnums must match protoEnums"); } int len = origEnums.length; for (int i = 0; i < len; i++) { // handle zero flag case. if (origEnums[i] == 0 && flags == 0) { proto.write(fieldId, protoEnums[i]); return; } if ((flags & origEnums[i]) != 0) { proto.write(fieldId, protoEnums[i]); } } }
Helper function to write bit-wise flags to proto as repeated enums
ProtoUtils::writeBitWiseFlagsToProtoEnum
java
Reginer/aosp-android-jar
android-32/src/android/util/proto/ProtoUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/util/proto/ProtoUtils.java
MIT
public static String currentFieldToString(ProtoInputStream proto) throws IOException { StringBuilder sb = new StringBuilder(); final int fieldNumber = proto.getFieldNumber(); final int wireType = proto.getWireType(); long fieldConstant; sb.append("Offset : 0x" + Integer.toHexString(proto.getOffset())); sb.append("\nField Number : 0x" + Integer.toHexString(proto.getFieldNumber())); sb.append("\nWire Type : "); switch (wireType) { case ProtoStream.WIRE_TYPE_VARINT: sb.append("varint"); fieldConstant = ProtoStream.makeFieldId(fieldNumber, ProtoStream.FIELD_COUNT_SINGLE | ProtoStream.FIELD_TYPE_INT64); sb.append("\nField Value : 0x" + Long.toHexString(proto.readLong(fieldConstant))); break; case ProtoStream.WIRE_TYPE_FIXED64: sb.append("fixed64"); fieldConstant = ProtoStream.makeFieldId(fieldNumber, ProtoStream.FIELD_COUNT_SINGLE | ProtoStream.FIELD_TYPE_FIXED64); sb.append("\nField Value : 0x" + Long.toHexString(proto.readLong(fieldConstant))); break; case ProtoStream.WIRE_TYPE_LENGTH_DELIMITED: sb.append("length delimited"); fieldConstant = ProtoStream.makeFieldId(fieldNumber, ProtoStream.FIELD_COUNT_SINGLE | ProtoStream.FIELD_TYPE_BYTES); sb.append("\nField Bytes : " + proto.readBytes(fieldConstant)); break; case ProtoStream.WIRE_TYPE_START_GROUP: sb.append("start group"); break; case ProtoStream.WIRE_TYPE_END_GROUP: sb.append("end group"); break; case ProtoStream.WIRE_TYPE_FIXED32: sb.append("fixed32"); fieldConstant = ProtoStream.makeFieldId(fieldNumber, ProtoStream.FIELD_COUNT_SINGLE | ProtoStream.FIELD_TYPE_FIXED32); sb.append("\nField Value : 0x" + Integer.toHexString(proto.readInt(fieldConstant))); break; default: sb.append("unknown(" + proto.getWireType() + ")"); } return sb.toString(); }
Provide debug data about the current field as a string
ProtoUtils::currentFieldToString
java
Reginer/aosp-android-jar
android-32/src/android/util/proto/ProtoUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/util/proto/ProtoUtils.java
MIT
private Bitmap createIconBitmap(Drawable icon, float scale, int size, boolean insetAdiForShadow, boolean ignoreAdiMask) { Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); mCanvas.setBitmap(bitmap); mOldBounds.set(icon.getBounds()); if (icon instanceof AdaptiveIconDrawable) { final AdaptiveIconDrawable adi = (AdaptiveIconDrawable) icon; // By default assumes the output bitmap will have a shadow directly applied and makes // room for it by insetting. If there are intermediate steps before applying the shadow // insetting is disableable. int offset = Math.round(size * (1 - scale) / 2); if (insetAdiForShadow) { offset = Math.max((int) Math.ceil(BLUR_FACTOR * size), offset); } Rect bounds = new Rect(offset, offset, size - offset, size - offset); // AdaptiveIconDrawables are by default masked by the user's icon shape selection. // If further masking is to be done, directly render to avoid the system masking. if (ignoreAdiMask) { final int cX = bounds.width() / 2; final int cY = bounds.height() / 2; final float portScale = 1f / (1 + 2 * getExtraInsetFraction()); final int insetWidth = (int) (bounds.width() / (portScale * 2)); final int insetHeight = (int) (bounds.height() / (portScale * 2)); Rect childRect = new Rect(cX - insetWidth, cY - insetHeight, cX + insetWidth, cY + insetHeight); Optional.ofNullable(adi.getBackground()).ifPresent(drawable -> { drawable.setBounds(childRect); drawable.draw(mCanvas); }); Optional.ofNullable(adi.getForeground()).ifPresent(drawable -> { drawable.setBounds(childRect); drawable.draw(mCanvas); }); } else { adi.setBounds(bounds); adi.draw(mCanvas); } } else { if (icon instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) icon; Bitmap b = bitmapDrawable.getBitmap(); if (bitmap != null && b.getDensity() == Bitmap.DENSITY_NONE) { bitmapDrawable.setTargetDensity(mContext.getResources().getDisplayMetrics()); } } int width = size; int height = size; int intrinsicWidth = icon.getIntrinsicWidth(); int intrinsicHeight = icon.getIntrinsicHeight(); if (intrinsicWidth > 0 && intrinsicHeight > 0) { // Scale the icon proportionally to the icon dimensions final float ratio = (float) intrinsicWidth / intrinsicHeight; if (intrinsicWidth > intrinsicHeight) { height = (int) (width / ratio); } else if (intrinsicHeight > intrinsicWidth) { width = (int) (height * ratio); } } final int left = (size - width) / 2; final int top = (size - height) / 2; icon.setBounds(left, top, left + width, top + height); mCanvas.save(); mCanvas.scale(scale, scale, size / 2, size / 2); icon.draw(mCanvas); mCanvas.restore(); } icon.setBounds(mOldBounds); mCanvas.setBitmap(null); return bitmap; }
@param icon drawable that should be flattened to a bitmap @param scale the scale to apply before drawing {@param icon} on the canvas @param insetAdiForShadow when rendering AdaptiveIconDrawables inset to make room for a shadow @param ignoreAdiMask when rendering AdaptiveIconDrawables ignore the current system mask
SimpleIconFactory::createIconBitmap
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/app/SimpleIconFactory.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/app/SimpleIconFactory.java
MIT
private synchronized float getScale(@NonNull Drawable d, @Nullable RectF outBounds) { if (d instanceof AdaptiveIconDrawable) { if (mAdaptiveIconScale != SCALE_NOT_INITIALIZED) { if (outBounds != null) { outBounds.set(mAdaptiveIconBounds); } return mAdaptiveIconScale; } } int width = d.getIntrinsicWidth(); int height = d.getIntrinsicHeight(); if (width <= 0 || height <= 0) { width = width <= 0 || width > mMaxSize ? mMaxSize : width; height = height <= 0 || height > mMaxSize ? mMaxSize : height; } else if (width > mMaxSize || height > mMaxSize) { int max = Math.max(width, height); width = mMaxSize * width / max; height = mMaxSize * height / max; } mBitmap.eraseColor(Color.TRANSPARENT); d.setBounds(0, 0, width, height); d.draw(mScaleCheckCanvas); ByteBuffer buffer = ByteBuffer.wrap(mPixels); buffer.rewind(); mBitmap.copyPixelsToBuffer(buffer); // Overall bounds of the visible icon. int topY = -1; int bottomY = -1; int leftX = mMaxSize + 1; int rightX = -1; // Create border by going through all pixels one row at a time and for each row find // the first and the last non-transparent pixel. Set those values to mLeftBorder and // mRightBorder and use -1 if there are no visible pixel in the row. // buffer position int index = 0; // buffer shift after every row, width of buffer = mMaxSize int rowSizeDiff = mMaxSize - width; // first and last position for any row. int firstX, lastX; for (int y = 0; y < height; y++) { firstX = lastX = -1; for (int x = 0; x < width; x++) { if ((mPixels[index] & 0xFF) > MIN_VISIBLE_ALPHA) { if (firstX == -1) { firstX = x; } lastX = x; } index++; } index += rowSizeDiff; mLeftBorder[y] = firstX; mRightBorder[y] = lastX; // If there is at least one visible pixel, update the overall bounds. if (firstX != -1) { bottomY = y; if (topY == -1) { topY = y; } leftX = Math.min(leftX, firstX); rightX = Math.max(rightX, lastX); } } if (topY == -1 || rightX == -1) { // No valid pixels found. Do not scale. return 1; } convertToConvexArray(mLeftBorder, 1, topY, bottomY); convertToConvexArray(mRightBorder, -1, topY, bottomY); // Area of the convex hull float area = 0; for (int y = 0; y < height; y++) { if (mLeftBorder[y] <= -1) { continue; } area += mRightBorder[y] - mLeftBorder[y] + 1; } // Area of the rectangle required to fit the convex hull float rectArea = (bottomY + 1 - topY) * (rightX + 1 - leftX); float hullByRect = area / rectArea; float scaleRequired; if (hullByRect < CIRCLE_AREA_BY_RECT) { scaleRequired = MAX_CIRCLE_AREA_FACTOR; } else { scaleRequired = MAX_SQUARE_AREA_FACTOR + LINEAR_SCALE_SLOPE * (1 - hullByRect); } mBounds.left = leftX; mBounds.right = rightX; mBounds.top = topY; mBounds.bottom = bottomY; if (outBounds != null) { outBounds.set(((float) mBounds.left) / width, ((float) mBounds.top) / height, 1 - ((float) mBounds.right) / width, 1 - ((float) mBounds.bottom) / height); } float areaScale = area / (width * height); // Use sqrt of the final ratio as the images is scaled across both width and height. float scale = areaScale > scaleRequired ? (float) Math.sqrt(scaleRequired / areaScale) : 1; if (d instanceof AdaptiveIconDrawable && mAdaptiveIconScale == SCALE_NOT_INITIALIZED) { mAdaptiveIconScale = scale; mAdaptiveIconBounds.set(mBounds); } return scale; }
Returns the amount by which the {@param d} should be scaled (in both dimensions) so that it matches the design guidelines for a launcher icon. We first calculate the convex hull of the visible portion of the icon. This hull then compared with the bounding rectangle of the hull to find how closely it resembles a circle and a square, by comparing the ratio of the areas. Note that this is not an ideal solution but it gives satisfactory result without affecting the performance. This closeness is used to determine the ratio of hull area to the full icon size. Refer {@link #MAX_CIRCLE_AREA_FACTOR} and {@link #MAX_SQUARE_AREA_FACTOR} @param outBounds optional rect to receive the fraction distance from each edge.
SimpleIconFactory::getScale
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/app/SimpleIconFactory.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/app/SimpleIconFactory.java
MIT
private static void convertToConvexArray( float[] xCoordinates, int direction, int topY, int bottomY) { int total = xCoordinates.length; // The tangent at each pixel. float[] angles = new float[total - 1]; int first = topY; // First valid y coordinate int last = -1; // Last valid y coordinate which didn't have a missing value float lastAngle = Float.MAX_VALUE; for (int i = topY + 1; i <= bottomY; i++) { if (xCoordinates[i] <= -1) { continue; } int start; if (lastAngle == Float.MAX_VALUE) { start = first; } else { float currentAngle = (xCoordinates[i] - xCoordinates[last]) / (i - last); start = last; // If this position creates a concave angle, keep moving up until we find a // position which creates a convex angle. if ((currentAngle - lastAngle) * direction < 0) { while (start > first) { start--; currentAngle = (xCoordinates[i] - xCoordinates[start]) / (i - start); if ((currentAngle - angles[start]) * direction >= 0) { break; } } } } // Reset from last check lastAngle = (xCoordinates[i] - xCoordinates[start]) / (i - start); // Update all the points from start. for (int j = start; j < i; j++) { angles[j] = lastAngle; xCoordinates[j] = xCoordinates[start] + lastAngle * (j - start); } last = i; } }
Modifies {@param xCoordinates} to represent a convex border. Fills in all missing values (except on either ends) with appropriate values. @param xCoordinates map of x coordinate per y. @param direction 1 for left border and -1 for right border. @param topY the first Y position (inclusive) with a valid value. @param bottomY the last Y position (inclusive) with a valid value.
SimpleIconFactory::convertToConvexArray
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/app/SimpleIconFactory.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/app/SimpleIconFactory.java
MIT
public void setScale(float scale) { float h = getIntrinsicHeight(); float w = getIntrinsicWidth(); mScaleX = scale * LEGACY_ICON_SCALE; mScaleY = scale * LEGACY_ICON_SCALE; if (h > w && w > 0) { mScaleX *= w / h; } else if (w > h && h > 0) { mScaleY *= h / w; } }
Sets the scale associated with this drawable @param scale
FixedScaleDrawable::setScale
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/app/SimpleIconFactory.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/app/SimpleIconFactory.java
MIT
protected Validator() { }
Constructor for derived classes. <p> The constructor does nothing. <p> Derived classes must create {@link Validator} objects that have <tt>null</tt> {@link ErrorHandler} and <tt>null</tt> {@link LSResourceResolver}.
Validator::Validator
java
Reginer/aosp-android-jar
android-33/src/javax/xml/validation/Validator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/javax/xml/validation/Validator.java
MIT
public void validate(Source source) throws SAXException, IOException { validate(source, null); }
Validates the specified input. <p> This is just a convenience method of: <pre> validate(source,null); </pre> @see #setErrorHandler(ErrorHandler)
Validator::validate
java
Reginer/aosp-android-jar
android-33/src/javax/xml/validation/Validator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/javax/xml/validation/Validator.java
MIT
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException("name == null"); } throw new SAXNotRecognizedException(name); }
Look up the value of a feature flag. <p>The feature name is any fully-qualified URI. It is possible for a {@link Validator} to recognize a feature name but temporarily be unable to return its value. Some feature values may be available only in specific contexts, such as before, during, or after a validation. <p>Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.</p> @param name The feature name, which is a non-null fully-qualified URI. @return The current value of the feature (true or false). @exception org.xml.sax.SAXNotRecognizedException If the feature value can't be assigned or retrieved. @exception org.xml.sax.SAXNotSupportedException When the {@link Validator} recognizes the feature name but cannot determine its value at this time. @throws NullPointerException When the name parameter is null. @see #setFeature(String, boolean)
Validator::getFeature
java
Reginer/aosp-android-jar
android-33/src/javax/xml/validation/Validator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/javax/xml/validation/Validator.java
MIT
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException("name == null"); } throw new SAXNotRecognizedException(name); }
Set the value of a feature flag. <p> Feature can be used to control the way a {@link Validator} parses schemas, although {@link Validator}s are not required to recognize any specific property names.</p> <p>The feature name is any fully-qualified URI. It is possible for a {@link Validator} to expose a feature value but to be unable to change the current value. Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a validation.</p> @param name The feature name, which is a non-null fully-qualified URI. @param value The requested value of the feature (true or false). @exception org.xml.sax.SAXNotRecognizedException If the feature value can't be assigned or retrieved. @exception org.xml.sax.SAXNotSupportedException When the {@link Validator} recognizes the feature name but cannot set the requested value. @throws NullPointerException When the name parameter is null. @see #getFeature(String)
Validator::setFeature
java
Reginer/aosp-android-jar
android-33/src/javax/xml/validation/Validator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/javax/xml/validation/Validator.java
MIT
public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException("name == null"); } throw new SAXNotRecognizedException(name); }
Set the value of a property. <p>The property name is any fully-qualified URI. It is possible for a {@link Validator} to recognize a property name but to be unable to change the current value. Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a validation.</p> <p>{@link Validator}s are not required to recognize setting any specific property names.</p> @param name The property name, which is a non-null fully-qualified URI. @param object The requested value for the property. @exception org.xml.sax.SAXNotRecognizedException If the property value can't be assigned or retrieved. @exception org.xml.sax.SAXNotSupportedException When the {@link Validator} recognizes the property name but cannot set the requested value. @throws NullPointerException When the name parameter is null.
Validator::setProperty
java
Reginer/aosp-android-jar
android-33/src/javax/xml/validation/Validator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/javax/xml/validation/Validator.java
MIT
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException("name == null"); } throw new SAXNotRecognizedException(name); }
Look up the value of a property. <p>The property name is any fully-qualified URI. It is possible for a {@link Validator} to recognize a property name but temporarily be unable to return its value. Some property values may be available only in specific contexts, such as before, during, or after a validation.</p> <p>{@link Validator}s are not required to recognize any specific property names.</p> <p>Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.</p> @param name The property name, which is a non-null fully-qualified URI. @return The current value of the property. @exception org.xml.sax.SAXNotRecognizedException If the property value can't be assigned or retrieved. @exception org.xml.sax.SAXNotSupportedException When the XMLReader recognizes the property name but cannot determine its value at this time. @throws NullPointerException When the name parameter is null. @see #setProperty(String, Object)
Validator::getProperty
java
Reginer/aosp-android-jar
android-33/src/javax/xml/validation/Validator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/javax/xml/validation/Validator.java
MIT
public static VerifiedSigner extractCertificates(String apkFile) throws SignatureNotFoundException, SecurityException { Pair<V4Signature.HashingInfo, V4Signature.SigningInfos> pair = extractSignature(apkFile); return verify(apkFile, pair.first, pair.second, APK_SIGNATURE_SCHEME_DEFAULT); }
Extracts and verifies APK Signature Scheme v4 signature of the provided APK and returns the certificates associated with each signer.
ApkSignatureSchemeV4Verifier::extractCertificates
java
Reginer/aosp-android-jar
android-33/src/android/util/apk/ApkSignatureSchemeV4Verifier.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/util/apk/ApkSignatureSchemeV4Verifier.java
MIT
public static Pair<V4Signature.HashingInfo, V4Signature.SigningInfos> extractSignature( String apkFile) throws SignatureNotFoundException { final File apk = new File(apkFile); final byte[] signatureBytes = IncrementalManager.unsafeGetFileSignature( apk.getAbsolutePath()); if (signatureBytes == null || signatureBytes.length == 0) { throw new SignatureNotFoundException("Failed to obtain signature bytes from IncFS."); } try { final V4Signature signature = V4Signature.readFrom(signatureBytes); if (!signature.isVersionSupported()) { throw new SecurityException( "v4 signature version " + signature.version + " is not supported"); } final V4Signature.HashingInfo hashingInfo = V4Signature.HashingInfo.fromByteArray( signature.hashingInfo); final V4Signature.SigningInfos signingInfos = V4Signature.SigningInfos.fromByteArray( signature.signingInfos); return Pair.create(hashingInfo, signingInfos); } catch (IOException e) { throw new SignatureNotFoundException("Failed to read V4 signature.", e); } }
Extracts APK Signature Scheme v4 signature of the provided APK.
ApkSignatureSchemeV4Verifier::extractSignature
java
Reginer/aosp-android-jar
android-33/src/android/util/apk/ApkSignatureSchemeV4Verifier.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/util/apk/ApkSignatureSchemeV4Verifier.java
MIT
public static VerifiedSigner verify(String apkFile, final V4Signature.HashingInfo hashingInfo, final V4Signature.SigningInfos signingInfos, final int v3BlockId) throws SignatureNotFoundException, SecurityException { final V4Signature.SigningInfo signingInfo = findSigningInfoForBlockId(signingInfos, v3BlockId); // Verify signed data and extract certificates and apk digest. final byte[] signedData = V4Signature.getSignedData(new File(apkFile).length(), hashingInfo, signingInfo); final Pair<Certificate, byte[]> result = verifySigner(signingInfo, signedData); // Populate digests enforced by IncFS driver. Map<Integer, byte[]> contentDigests = new ArrayMap<>(); contentDigests.put(convertToContentDigestType(hashingInfo.hashAlgorithm), hashingInfo.rawRootHash); return new VerifiedSigner(new Certificate[]{result.first}, result.second, contentDigests); }
Verifies APK Signature Scheme v4 signature and returns the certificates associated with each signer.
ApkSignatureSchemeV4Verifier::verify
java
Reginer/aosp-android-jar
android-33/src/android/util/apk/ApkSignatureSchemeV4Verifier.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/util/apk/ApkSignatureSchemeV4Verifier.java
MIT
public void onSystemReady() { mGnssLocationProvider.onSystemReady(); }
/* Copyright (C) 2020 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package com.android.server.location.gnss; import android.Manifest; import android.annotation.Nullable; import android.content.Context; import android.content.Intent; import android.hardware.location.GeofenceHardware; import android.hardware.location.GeofenceHardwareImpl; import android.location.FusedBatchOptions; import android.location.GnssAntennaInfo; import android.location.GnssCapabilities; import android.location.GnssMeasurementCorrections; import android.location.GnssMeasurementRequest; import android.location.IGnssAntennaInfoListener; import android.location.IGnssMeasurementsListener; import android.location.IGnssNavigationMessageListener; import android.location.IGnssNmeaListener; import android.location.IGnssStatusListener; import android.location.IGpsGeofenceHardware; import android.location.Location; import android.location.LocationManager; import android.location.util.identity.CallerIdentity; import android.os.BatteryStats; import android.os.Binder; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.util.IndentingPrintWriter; import android.util.Log; import com.android.internal.app.IBatteryStats; import com.android.server.FgThread; import com.android.server.location.gnss.hal.GnssNative; import com.android.server.location.injector.Injector; import java.io.FileDescriptor; import java.util.List; /** Manages Gnss providers and related Gnss functions for LocationManagerService. public class GnssManagerService { public static final String TAG = "GnssManager"; public static final boolean D = Log.isLoggable(TAG, Log.DEBUG); private static final String ATTRIBUTION_ID = "GnssService"; final Context mContext; private final GnssNative mGnssNative; private final GnssLocationProvider mGnssLocationProvider; private final GnssStatusProvider mGnssStatusProvider; private final GnssNmeaProvider mGnssNmeaProvider; private final GnssMeasurementsProvider mGnssMeasurementsProvider; private final GnssNavigationMessageProvider mGnssNavigationMessageProvider; private final GnssAntennaInfoProvider mGnssAntennaInfoProvider; private final IGpsGeofenceHardware mGnssGeofenceProxy; private final GnssGeofenceHalModule mGeofenceHalModule; private final GnssCapabilitiesHalModule mCapabilitiesHalModule; private final GnssMetrics mGnssMetrics; public GnssManagerService(Context context, Injector injector, GnssNative gnssNative) { mContext = context.createAttributionContext(ATTRIBUTION_ID); mGnssNative = gnssNative; mGnssMetrics = new GnssMetrics(mContext, IBatteryStats.Stub.asInterface( ServiceManager.getService(BatteryStats.SERVICE_NAME)), mGnssNative); mGnssLocationProvider = new GnssLocationProvider(mContext, injector, mGnssNative, mGnssMetrics); mGnssStatusProvider = new GnssStatusProvider(injector, mGnssNative); mGnssNmeaProvider = new GnssNmeaProvider(injector, mGnssNative); mGnssMeasurementsProvider = new GnssMeasurementsProvider(injector, mGnssNative); mGnssNavigationMessageProvider = new GnssNavigationMessageProvider(injector, mGnssNative); mGnssAntennaInfoProvider = new GnssAntennaInfoProvider(mGnssNative); mGnssGeofenceProxy = new GnssGeofenceProxy(mGnssNative); mGeofenceHalModule = new GnssGeofenceHalModule(mGnssNative); mCapabilitiesHalModule = new GnssCapabilitiesHalModule(mGnssNative); // allow gnss access to begin - we must assume that callbacks can start immediately mGnssNative.register(); } /** Called when system is ready.
GnssManagerService::onSystemReady
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public GnssLocationProvider getGnssLocationProvider() { return mGnssLocationProvider; }
/* Copyright (C) 2020 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package com.android.server.location.gnss; import android.Manifest; import android.annotation.Nullable; import android.content.Context; import android.content.Intent; import android.hardware.location.GeofenceHardware; import android.hardware.location.GeofenceHardwareImpl; import android.location.FusedBatchOptions; import android.location.GnssAntennaInfo; import android.location.GnssCapabilities; import android.location.GnssMeasurementCorrections; import android.location.GnssMeasurementRequest; import android.location.IGnssAntennaInfoListener; import android.location.IGnssMeasurementsListener; import android.location.IGnssNavigationMessageListener; import android.location.IGnssNmeaListener; import android.location.IGnssStatusListener; import android.location.IGpsGeofenceHardware; import android.location.Location; import android.location.LocationManager; import android.location.util.identity.CallerIdentity; import android.os.BatteryStats; import android.os.Binder; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.util.IndentingPrintWriter; import android.util.Log; import com.android.internal.app.IBatteryStats; import com.android.server.FgThread; import com.android.server.location.gnss.hal.GnssNative; import com.android.server.location.injector.Injector; import java.io.FileDescriptor; import java.util.List; /** Manages Gnss providers and related Gnss functions for LocationManagerService. public class GnssManagerService { public static final String TAG = "GnssManager"; public static final boolean D = Log.isLoggable(TAG, Log.DEBUG); private static final String ATTRIBUTION_ID = "GnssService"; final Context mContext; private final GnssNative mGnssNative; private final GnssLocationProvider mGnssLocationProvider; private final GnssStatusProvider mGnssStatusProvider; private final GnssNmeaProvider mGnssNmeaProvider; private final GnssMeasurementsProvider mGnssMeasurementsProvider; private final GnssNavigationMessageProvider mGnssNavigationMessageProvider; private final GnssAntennaInfoProvider mGnssAntennaInfoProvider; private final IGpsGeofenceHardware mGnssGeofenceProxy; private final GnssGeofenceHalModule mGeofenceHalModule; private final GnssCapabilitiesHalModule mCapabilitiesHalModule; private final GnssMetrics mGnssMetrics; public GnssManagerService(Context context, Injector injector, GnssNative gnssNative) { mContext = context.createAttributionContext(ATTRIBUTION_ID); mGnssNative = gnssNative; mGnssMetrics = new GnssMetrics(mContext, IBatteryStats.Stub.asInterface( ServiceManager.getService(BatteryStats.SERVICE_NAME)), mGnssNative); mGnssLocationProvider = new GnssLocationProvider(mContext, injector, mGnssNative, mGnssMetrics); mGnssStatusProvider = new GnssStatusProvider(injector, mGnssNative); mGnssNmeaProvider = new GnssNmeaProvider(injector, mGnssNative); mGnssMeasurementsProvider = new GnssMeasurementsProvider(injector, mGnssNative); mGnssNavigationMessageProvider = new GnssNavigationMessageProvider(injector, mGnssNative); mGnssAntennaInfoProvider = new GnssAntennaInfoProvider(mGnssNative); mGnssGeofenceProxy = new GnssGeofenceProxy(mGnssNative); mGeofenceHalModule = new GnssGeofenceHalModule(mGnssNative); mCapabilitiesHalModule = new GnssCapabilitiesHalModule(mGnssNative); // allow gnss access to begin - we must assume that callbacks can start immediately mGnssNative.register(); } /** Called when system is ready. public void onSystemReady() { mGnssLocationProvider.onSystemReady(); } /** Retrieve the GnssLocationProvider.
GnssManagerService::getGnssLocationProvider
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public IGpsGeofenceHardware getGnssGeofenceProxy() { return mGnssGeofenceProxy; }
/* Copyright (C) 2020 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package com.android.server.location.gnss; import android.Manifest; import android.annotation.Nullable; import android.content.Context; import android.content.Intent; import android.hardware.location.GeofenceHardware; import android.hardware.location.GeofenceHardwareImpl; import android.location.FusedBatchOptions; import android.location.GnssAntennaInfo; import android.location.GnssCapabilities; import android.location.GnssMeasurementCorrections; import android.location.GnssMeasurementRequest; import android.location.IGnssAntennaInfoListener; import android.location.IGnssMeasurementsListener; import android.location.IGnssNavigationMessageListener; import android.location.IGnssNmeaListener; import android.location.IGnssStatusListener; import android.location.IGpsGeofenceHardware; import android.location.Location; import android.location.LocationManager; import android.location.util.identity.CallerIdentity; import android.os.BatteryStats; import android.os.Binder; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.util.IndentingPrintWriter; import android.util.Log; import com.android.internal.app.IBatteryStats; import com.android.server.FgThread; import com.android.server.location.gnss.hal.GnssNative; import com.android.server.location.injector.Injector; import java.io.FileDescriptor; import java.util.List; /** Manages Gnss providers and related Gnss functions for LocationManagerService. public class GnssManagerService { public static final String TAG = "GnssManager"; public static final boolean D = Log.isLoggable(TAG, Log.DEBUG); private static final String ATTRIBUTION_ID = "GnssService"; final Context mContext; private final GnssNative mGnssNative; private final GnssLocationProvider mGnssLocationProvider; private final GnssStatusProvider mGnssStatusProvider; private final GnssNmeaProvider mGnssNmeaProvider; private final GnssMeasurementsProvider mGnssMeasurementsProvider; private final GnssNavigationMessageProvider mGnssNavigationMessageProvider; private final GnssAntennaInfoProvider mGnssAntennaInfoProvider; private final IGpsGeofenceHardware mGnssGeofenceProxy; private final GnssGeofenceHalModule mGeofenceHalModule; private final GnssCapabilitiesHalModule mCapabilitiesHalModule; private final GnssMetrics mGnssMetrics; public GnssManagerService(Context context, Injector injector, GnssNative gnssNative) { mContext = context.createAttributionContext(ATTRIBUTION_ID); mGnssNative = gnssNative; mGnssMetrics = new GnssMetrics(mContext, IBatteryStats.Stub.asInterface( ServiceManager.getService(BatteryStats.SERVICE_NAME)), mGnssNative); mGnssLocationProvider = new GnssLocationProvider(mContext, injector, mGnssNative, mGnssMetrics); mGnssStatusProvider = new GnssStatusProvider(injector, mGnssNative); mGnssNmeaProvider = new GnssNmeaProvider(injector, mGnssNative); mGnssMeasurementsProvider = new GnssMeasurementsProvider(injector, mGnssNative); mGnssNavigationMessageProvider = new GnssNavigationMessageProvider(injector, mGnssNative); mGnssAntennaInfoProvider = new GnssAntennaInfoProvider(mGnssNative); mGnssGeofenceProxy = new GnssGeofenceProxy(mGnssNative); mGeofenceHalModule = new GnssGeofenceHalModule(mGnssNative); mCapabilitiesHalModule = new GnssCapabilitiesHalModule(mGnssNative); // allow gnss access to begin - we must assume that callbacks can start immediately mGnssNative.register(); } /** Called when system is ready. public void onSystemReady() { mGnssLocationProvider.onSystemReady(); } /** Retrieve the GnssLocationProvider. public GnssLocationProvider getGnssLocationProvider() { return mGnssLocationProvider; } /** Retrieve the IGpsGeofenceHardware.
GnssManagerService::getGnssGeofenceProxy
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public int getGnssYearOfHardware() { return mGnssNative.getHardwareYear(); }
Get year of GNSS hardware.
GnssManagerService::getGnssYearOfHardware
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public GnssCapabilities getGnssCapabilities() { return mGnssNative.getCapabilities(); }
Get GNSS hardware capabilities.
GnssManagerService::getGnssCapabilities
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public @Nullable List<GnssAntennaInfo> getGnssAntennaInfos() { return mGnssAntennaInfoProvider.getAntennaInfos(); }
Get GNSS antenna information.
GnssManagerService::getGnssAntennaInfos
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public int getGnssBatchSize() { return mGnssLocationProvider.getBatchSize(); }
Get size of GNSS batch (GNSS location results are batched together for power savings).
GnssManagerService::getGnssBatchSize
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void registerGnssStatusCallback(IGnssStatusListener listener, String packageName, @Nullable String attributionTag, String listenerId) { mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION, null); CallerIdentity identity = CallerIdentity.fromBinder(mContext, packageName, attributionTag, listenerId); mGnssStatusProvider.addListener(identity, listener); }
Registers listener for GNSS status changes.
GnssManagerService::registerGnssStatusCallback
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void unregisterGnssStatusCallback(IGnssStatusListener listener) { mGnssStatusProvider.removeListener(listener); }
Unregisters listener for GNSS status changes.
GnssManagerService::unregisterGnssStatusCallback
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void registerGnssNmeaCallback(IGnssNmeaListener listener, String packageName, @Nullable String attributionTag, String listenerId) { mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION, null); CallerIdentity identity = CallerIdentity.fromBinder(mContext, packageName, attributionTag, listenerId); mGnssNmeaProvider.addListener(identity, listener); }
Registers listener for GNSS NMEA messages.
GnssManagerService::registerGnssNmeaCallback
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void unregisterGnssNmeaCallback(IGnssNmeaListener listener) { mGnssNmeaProvider.removeListener(listener); }
Unregisters listener for GNSS NMEA messages.
GnssManagerService::unregisterGnssNmeaCallback
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void addGnssMeasurementsListener(GnssMeasurementRequest request, IGnssMeasurementsListener listener, String packageName, @Nullable String attributionTag, String listenerId) { mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION, null); if (request.isCorrelationVectorOutputsEnabled()) { mContext.enforceCallingOrSelfPermission(Manifest.permission.LOCATION_HARDWARE, null); } CallerIdentity identity = CallerIdentity.fromBinder(mContext, packageName, attributionTag, listenerId); mGnssMeasurementsProvider.addListener(request, identity, listener); }
Adds a GNSS measurements listener.
GnssManagerService::addGnssMeasurementsListener
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void injectGnssMeasurementCorrections(GnssMeasurementCorrections corrections) { mContext.enforceCallingOrSelfPermission(Manifest.permission.LOCATION_HARDWARE, null); mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION, null); if (!mGnssNative.injectMeasurementCorrections(corrections)) { Log.w(TAG, "failed to inject GNSS measurement corrections"); } }
Injects GNSS measurement corrections.
GnssManagerService::injectGnssMeasurementCorrections
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void removeGnssMeasurementsListener(IGnssMeasurementsListener listener) { mGnssMeasurementsProvider.removeListener(listener); }
Removes a GNSS measurements listener.
GnssManagerService::removeGnssMeasurementsListener
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void addGnssNavigationMessageListener(IGnssNavigationMessageListener listener, String packageName, @Nullable String attributionTag, String listenerId) { mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION, null); CallerIdentity identity = CallerIdentity.fromBinder(mContext, packageName, attributionTag, listenerId); mGnssNavigationMessageProvider.addListener(identity, listener); }
Adds a GNSS navigation message listener.
GnssManagerService::addGnssNavigationMessageListener
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void removeGnssNavigationMessageListener(IGnssNavigationMessageListener listener) { mGnssNavigationMessageProvider.removeListener(listener); }
Removes a GNSS navigation message listener.
GnssManagerService::removeGnssNavigationMessageListener
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void addGnssAntennaInfoListener(IGnssAntennaInfoListener listener, String packageName, @Nullable String attributionTag, String listenerId) { CallerIdentity identity = CallerIdentity.fromBinder(mContext, packageName, attributionTag, listenerId); mGnssAntennaInfoProvider.addListener(identity, listener); }
Adds a GNSS antenna info listener.
GnssManagerService::addGnssAntennaInfoListener
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void removeGnssAntennaInfoListener(IGnssAntennaInfoListener listener) { mGnssAntennaInfoProvider.removeListener(listener); }
Removes a GNSS antenna info listener.
GnssManagerService::removeGnssAntennaInfoListener
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void sendNiResponse(int notifId, int userResponse) { try { mGnssLocationProvider.getNetInitiatedListener().sendNiResponse(notifId, userResponse); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Send Ni Response, indicating a location request initiated by a network carrier.
GnssManagerService::sendNiResponse
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public void dump(FileDescriptor fd, IndentingPrintWriter ipw, String[] args) { if (args.length > 0 && args[0].equals("--gnssmetrics")) { ipw.append(mGnssMetrics.dumpGnssMetricsAsProtoString()); return; } ipw.println("Capabilities: " + mGnssNative.getCapabilities()); if (mGnssStatusProvider.isSupported()) { ipw.println("Status Provider:"); ipw.increaseIndent(); mGnssStatusProvider.dump(fd, ipw, args); ipw.decreaseIndent(); } if (mGnssMeasurementsProvider.isSupported()) { ipw.println("Measurements Provider:"); ipw.increaseIndent(); mGnssMeasurementsProvider.dump(fd, ipw, args); ipw.decreaseIndent(); } if (mGnssNavigationMessageProvider.isSupported()) { ipw.println("Navigation Message Provider:"); ipw.increaseIndent(); mGnssNavigationMessageProvider.dump(fd, ipw, args); ipw.decreaseIndent(); } if (mGnssAntennaInfoProvider.isSupported()) { ipw.println("Navigation Message Provider:"); ipw.increaseIndent(); ipw.println("Antenna Infos: " + mGnssAntennaInfoProvider.getAntennaInfos()); mGnssAntennaInfoProvider.dump(fd, ipw, args); ipw.decreaseIndent(); } GnssPowerStats powerStats = mGnssNative.getPowerStats(); if (powerStats != null) { ipw.println("Last Power Stats:"); ipw.increaseIndent(); powerStats.dump(fd, ipw, args, mGnssNative.getCapabilities()); ipw.decreaseIndent(); } }
Dump info for debugging.
GnssManagerService::dump
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssManagerService.java
MIT
public static ScriptIntrinsicHistogram create(RenderScript rs, Element e) { if ((!e.isCompatible(Element.U8_4(rs))) && (!e.isCompatible(Element.U8_3(rs))) && (!e.isCompatible(Element.U8_2(rs))) && (!e.isCompatible(Element.U8(rs)))) { throw new RSIllegalArgumentException("Unsupported element type."); } long id = rs.nScriptIntrinsicCreate(9, e.getID(rs)); ScriptIntrinsicHistogram sib = new ScriptIntrinsicHistogram(id, rs); return sib; }
Create an intrinsic for calculating the histogram of an uchar or uchar4 image. Supported elements types are {@link Element#U8_4}, {@link Element#U8_3}, {@link Element#U8_2}, {@link Element#U8} @param rs The RenderScript context @param e Element type for inputs @return ScriptIntrinsicHistogram
ScriptIntrinsicHistogram::create
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public void forEach(Allocation ain) { forEach(ain, null); }
Process an input buffer and place the histogram into the output allocation. The output allocation may be a narrower vector size than the input. In this case the vector size of the output is used to determine how many of the input channels are used in the computation. This is useful if you have an RGBA input buffer but only want the histogram for RGB. 1D and 2D input allocations are supported. @param ain The input image
ScriptIntrinsicHistogram::forEach
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public void forEach(Allocation ain, Script.LaunchOptions opt) { if (ain.getType().getElement().getVectorSize() < mOut.getType().getElement().getVectorSize()) { throw new RSIllegalArgumentException( "Input vector size must be >= output vector size."); } if (!ain.getType().getElement().isCompatible(Element.U8(mRS)) && !ain.getType().getElement().isCompatible(Element.U8_2(mRS)) && !ain.getType().getElement().isCompatible(Element.U8_3(mRS)) && !ain.getType().getElement().isCompatible(Element.U8_4(mRS))) { throw new RSIllegalArgumentException("Input type must be U8, U8_1, U8_2 or U8_4."); } forEach(0, ain, null, null, opt); }
Process an input buffer and place the histogram into the output allocation. The output allocation may be a narrower vector size than the input. In this case the vector size of the output is used to determine how many of the input channels are used in the computation. This is useful if you have an RGBA input buffer but only want the histogram for RGB. 1D and 2D input allocations are supported. @param ain The input image @param opt LaunchOptions for clipping
ScriptIntrinsicHistogram::forEach
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public void setDotCoefficients(float r, float g, float b, float a) { if ((r < 0.f) || (g < 0.f) || (b < 0.f) || (a < 0.f)) { throw new RSIllegalArgumentException("Coefficient may not be negative."); } if ((r + g + b + a) > 1.f) { throw new RSIllegalArgumentException("Sum of coefficients must be 1.0 or less."); } FieldPacker fp = new FieldPacker(16); fp.addF32(r); fp.addF32(g); fp.addF32(b); fp.addF32(a); setVar(0, fp); }
Set the coefficients used for the RGBA to Luminocity calculation. The default is {0.299f, 0.587f, 0.114f, 0.f}. Coefficients must be >= 0 and sum to 1.0 or less. @param r Red coefficient @param g Green coefficient @param b Blue coefficient @param a Alpha coefficient
ScriptIntrinsicHistogram::setDotCoefficients
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public void setOutput(Allocation aout) { mOut = aout; if (mOut.getType().getElement() != Element.U32(mRS) && mOut.getType().getElement() != Element.U32_2(mRS) && mOut.getType().getElement() != Element.U32_3(mRS) && mOut.getType().getElement() != Element.U32_4(mRS) && mOut.getType().getElement() != Element.I32(mRS) && mOut.getType().getElement() != Element.I32_2(mRS) && mOut.getType().getElement() != Element.I32_3(mRS) && mOut.getType().getElement() != Element.I32_4(mRS)) { throw new RSIllegalArgumentException("Output type must be U32 or I32."); } if ((mOut.getType().getX() != 256) || (mOut.getType().getY() != 0) || mOut.getType().hasMipmaps() || (mOut.getType().getYuv() != 0)) { throw new RSIllegalArgumentException("Output must be 1D, 256 elements."); } setVar(1, aout); }
Set the output of the histogram. 32 bit integer types are supported. @param aout The output allocation
ScriptIntrinsicHistogram::setOutput
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public void forEach_Dot(Allocation ain) { forEach_Dot(ain, null); }
Process an input buffer and place the histogram into the output allocation. The dot product of the input channel and the coefficients from 'setDotCoefficients' are used to calculate the output values. 1D and 2D input allocations are supported. @param ain The input image
ScriptIntrinsicHistogram::forEach_Dot
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public void forEach_Dot(Allocation ain, Script.LaunchOptions opt) { if (mOut.getType().getElement().getVectorSize() != 1) { throw new RSIllegalArgumentException("Output vector size must be one."); } if (!ain.getType().getElement().isCompatible(Element.U8(mRS)) && !ain.getType().getElement().isCompatible(Element.U8_2(mRS)) && !ain.getType().getElement().isCompatible(Element.U8_3(mRS)) && !ain.getType().getElement().isCompatible(Element.U8_4(mRS))) { throw new RSIllegalArgumentException("Input type must be U8, U8_1, U8_2 or U8_4."); } forEach(1, ain, null, null, opt); }
Process an input buffer and place the histogram into the output allocation. The dot product of the input channel and the coefficients from 'setDotCoefficients' are used to calculate the output values. 1D and 2D input allocations are supported. @param ain The input image @param opt LaunchOptions for clipping
ScriptIntrinsicHistogram::forEach_Dot
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public Script.KernelID getKernelID_Separate() { return createKernelID(0, 3, null, null); }
Get a KernelID for this intrinsic kernel. @return Script.KernelID The KernelID object.
ScriptIntrinsicHistogram::getKernelID_Separate
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public Script.FieldID getFieldID_Input() { return createFieldID(1, null); }
Get a FieldID for the input field of this intrinsic. @return Script.FieldID The FieldID object.
ScriptIntrinsicHistogram::getFieldID_Input
java
Reginer/aosp-android-jar
android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/renderscript/ScriptIntrinsicHistogram.java
MIT
public boolean isConnectable() { return mConnectable; }
Returns whether the advertisement will be connectable.
AdvertisingSetParameters::isConnectable
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public boolean isScannable() { return mScannable; }
Returns whether the advertisement will be scannable.
AdvertisingSetParameters::isScannable
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public boolean isLegacy() { return mIsLegacy; }
Returns whether the legacy advertisement will be used.
AdvertisingSetParameters::isLegacy
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public boolean isAnonymous() { return mIsAnonymous; }
Returns whether the advertisement will be anonymous.
AdvertisingSetParameters::isAnonymous
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public boolean includeTxPower() { return mIncludeTxPower; }
Returns whether the TX Power will be included.
AdvertisingSetParameters::includeTxPower
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public int getPrimaryPhy() { return mPrimaryPhy; }
Returns the primary advertising phy.
AdvertisingSetParameters::getPrimaryPhy
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public int getSecondaryPhy() { return mSecondaryPhy; }
Returns the secondary advertising phy.
AdvertisingSetParameters::getSecondaryPhy
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public int getInterval() { return mInterval; }
Returns the advertising interval.
AdvertisingSetParameters::getInterval
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public int getTxPowerLevel() { return mTxPowerLevel; }
Returns the TX power level for advertising.
AdvertisingSetParameters::getTxPowerLevel
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public Builder setConnectable(boolean connectable) { mConnectable = connectable; return this; }
Set whether the advertisement type should be connectable or non-connectable. Legacy advertisements can be both connectable and scannable. Non-legacy advertisements can be only scannable or only connectable. @param connectable Controls whether the advertisement type will be connectable (true) or non-connectable (false).
Builder::setConnectable
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT
public Builder setScannable(boolean scannable) { mScannable = scannable; return this; }
Set whether the advertisement type should be scannable. Legacy advertisements can be both connectable and scannable. Non-legacy advertisements can be only scannable or only connectable. @param scannable Controls whether the advertisement type will be scannable (true) or non-scannable (false).
Builder::setScannable
java
Reginer/aosp-android-jar
android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/bluetooth/le/AdvertisingSetParameters.java
MIT