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 void enforceCallingUid() { if (!checkCallingUid()) { throw new SecurityException("Calling uid: " + Binder.getCallingUid() + " doesn't match source uid: " + mAttributionSourceState.uid); } // No need to check package as app ops manager does it already. }
If you are handling an IPC and you don't trust the caller you need to validate whether the attribution source is one for the calling app to prevent the caller to pass you a source from another app without including themselves in the attribution chain. @throws SecurityException if the attribution source cannot be trusted to be from the caller.
ScopedParcelState::enforceCallingUid
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public boolean checkCallingUid() { final int callingUid = Binder.getCallingUid(); if (callingUid != Process.ROOT_UID && callingUid != Process.SYSTEM_UID && callingUid != mAttributionSourceState.uid) { return false; } // No need to check package as app ops manager does it already. return true; }
If you are handling an IPC and you don't trust the caller you need to validate whether the attribution source is one for the calling app to prevent the caller to pass you a source from another app without including themselves in the attribution chain. f @return if the attribution source cannot be trusted to be from the caller.
ScopedParcelState::checkCallingUid
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public int getNextUid() { if (mAttributionSourceState.next != null && mAttributionSourceState.next.length > 0) { return mAttributionSourceState.next[0].uid; } return Process.INVALID_UID; }
@return The next UID that would receive the permission protected data. @hide
ScopedParcelState::getNextUid
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public @Nullable String getNextPackageName() { if (mAttributionSourceState.next != null && mAttributionSourceState.next.length > 0) { return mAttributionSourceState.next[0].packageName; } return null; }
@return The next package that would receive the permission protected data. @hide
ScopedParcelState::getNextPackageName
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public @Nullable String getNextAttributionTag() { if (mAttributionSourceState.next != null && mAttributionSourceState.next.length > 0) { return mAttributionSourceState.next[0].attributionTag; } return null; }
@return The next package's attribution tag that would receive the permission protected data. @hide
ScopedParcelState::getNextAttributionTag
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public @Nullable IBinder getNextToken() { if (mAttributionSourceState.next != null && mAttributionSourceState.next.length > 0) { return mAttributionSourceState.next[0].token; } return null; }
@return The next package's token that would receive the permission protected data. @hide
ScopedParcelState::getNextToken
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public boolean isTrusted(@NonNull Context context) { return mAttributionSourceState.token != null && context.getSystemService(PermissionManager.class) .isRegisteredAttributionSource(this); }
Checks whether this attribution source can be trusted. That is whether the app it refers to created it and provided to the attribution chain. @param context Context handle. @return Whether this is a trusted source.
ScopedParcelState::isTrusted
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public Builder(int uid) { mAttributionSourceState.uid = uid; }
Creates a new Builder. @param uid The UID that is accessing the permission protected data.
Builder::Builder
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public @NonNull Builder setPackageName(@Nullable String value) { checkNotUsed(); mBuilderFieldsSet |= 0x2; mAttributionSourceState.packageName = value; return this; }
The package that is accessing the permission protected data.
Builder::setPackageName
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public @NonNull Builder setAttributionTag(@Nullable String value) { checkNotUsed(); mBuilderFieldsSet |= 0x4; mAttributionSourceState.attributionTag = value; return this; }
The attribution tag of the app accessing the permission protected data.
Builder::setAttributionTag
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public @NonNull Builder setNext(@Nullable AttributionSource value) { checkNotUsed(); mBuilderFieldsSet |= 0x10; mAttributionSourceState.next = (value != null) ? new AttributionSourceState[] {value.mAttributionSourceState} : mAttributionSourceState.next; return this; }
The next app to receive the permission protected data.
Builder::setNext
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public @NonNull AttributionSource build() { checkNotUsed(); mBuilderFieldsSet |= 0x40; // Mark builder used if ((mBuilderFieldsSet & 0x2) == 0) { mAttributionSourceState.packageName = null; } if ((mBuilderFieldsSet & 0x4) == 0) { mAttributionSourceState.attributionTag = null; } if ((mBuilderFieldsSet & 0x8) == 0) { mAttributionSourceState.renouncedPermissions = null; } if ((mBuilderFieldsSet & 0x10) == 0) { mAttributionSourceState.next = null; } mAttributionSourceState.token = sDefaultToken; if (mAttributionSourceState.next == null) { // The NDK aidl backend doesn't support null parcelable arrays. mAttributionSourceState.next = new AttributionSourceState[0]; } return new AttributionSource(mAttributionSourceState); }
The next app to receive the permission protected data. public @NonNull Builder setNext(@Nullable AttributionSource value) { checkNotUsed(); mBuilderFieldsSet |= 0x10; mAttributionSourceState.next = (value != null) ? new AttributionSourceState[] {value.mAttributionSourceState} : mAttributionSourceState.next; return this; } /** Builds the instance. This builder should not be touched after calling this!
Builder::build
java
Reginer/aosp-android-jar
android-32/src/android/content/AttributionSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/AttributionSource.java
MIT
public X9FieldID(BigInteger primeP) { this.id = prime_field; this.parameters = new ASN1Integer(primeP); }
Constructor for elliptic curves over prime fields <code>F<sub>2</sub></code>. @param primeP The prime <code>p</code> defining the prime field.
X9FieldID::X9FieldID
java
Reginer/aosp-android-jar
android-34/src/com/android/org/bouncycastle/asn1/x9/X9FieldID.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/org/bouncycastle/asn1/x9/X9FieldID.java
MIT
public X9FieldID(int m, int k1) { this(m, k1, 0, 0); }
Constructor for elliptic curves over binary fields <code>F<sub>2<sup>m</sup></sub></code>. @param m The exponent <code>m</code> of <code>F<sub>2<sup>m</sup></sub></code>. @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> + x<sup>k1</sup> + 1</code> represents the reduction polynomial <code>f(z)</code>.
X9FieldID::X9FieldID
java
Reginer/aosp-android-jar
android-34/src/com/android/org/bouncycastle/asn1/x9/X9FieldID.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/org/bouncycastle/asn1/x9/X9FieldID.java
MIT
public X9FieldID(int m, int k1, int k2, int k3) { this.id = characteristic_two_field; ASN1EncodableVector fieldIdParams = new ASN1EncodableVector(3); fieldIdParams.add(new ASN1Integer(m)); if (k2 == 0) { if (k3 != 0) { throw new IllegalArgumentException("inconsistent k values"); } fieldIdParams.add(tpBasis); fieldIdParams.add(new ASN1Integer(k1)); } else { if (k2 <= k1 || k3 <= k2) { throw new IllegalArgumentException("inconsistent k values"); } fieldIdParams.add(ppBasis); ASN1EncodableVector pentanomialParams = new ASN1EncodableVector(3); pentanomialParams.add(new ASN1Integer(k1)); pentanomialParams.add(new ASN1Integer(k2)); pentanomialParams.add(new ASN1Integer(k3)); fieldIdParams.add(new DERSequence(pentanomialParams)); } this.parameters = new DERSequence(fieldIdParams); }
Constructor for elliptic curves over binary fields <code>F<sub>2<sup>m</sup></sub></code>. @param m The exponent <code>m</code> of <code>F<sub>2<sup>m</sup></sub></code>. @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> + x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> represents the reduction polynomial <code>f(z)</code>. @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> + x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> represents the reduction polynomial <code>f(z)</code>. @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> + x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code> represents the reduction polynomial <code>f(z)</code>..
X9FieldID::X9FieldID
java
Reginer/aosp-android-jar
android-34/src/com/android/org/bouncycastle/asn1/x9/X9FieldID.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/org/bouncycastle/asn1/x9/X9FieldID.java
MIT
public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(2); v.add(this.id); v.add(this.parameters); return new DERSequence(v); }
Produce a DER encoding of the following structure. <pre> FieldID ::= SEQUENCE { fieldType FIELD-ID.&amp;id({IOSet}), parameters FIELD-ID.&amp;Type({IOSet}{&#64;fieldType}) } </pre>
X9FieldID::toASN1Primitive
java
Reginer/aosp-android-jar
android-34/src/com/android/org/bouncycastle/asn1/x9/X9FieldID.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/org/bouncycastle/asn1/x9/X9FieldID.java
MIT
public void readPrefixTimeZonesMap(SortedMap<Integer, String> sortedPrefixTimeZoneMap) { phonePrefixMap.readPhonePrefixMap(sortedPrefixTimeZoneMap); }
Creates a {@link PrefixTimeZonesMap} initialized with {@code sortedPrefixTimeZoneMap}. Note that the underlying implementation of this method is expensive thus should not be called by time-critical applications. @param sortedPrefixTimeZoneMap a map from phone number prefixes to their corresponding time zones, sorted in ascending order of the phone number prefixes as integers.
PrefixTimeZonesMap::readPrefixTimeZonesMap
java
Reginer/aosp-android-jar
android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
MIT
public void writeExternal(ObjectOutput objectOutput) throws IOException { phonePrefixMap.writeExternal(objectOutput); }
Supports Java Serialization.
PrefixTimeZonesMap::writeExternal
java
Reginer/aosp-android-jar
android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
MIT
private List<String> lookupTimeZonesForNumber(long key) { // Lookup in the map data. The returned String may consist of several time zones, so it must be // split. String timezonesString = phonePrefixMap.lookup(key); if (timezonesString == null) { return new LinkedList<String>(); } return tokenizeRawOutputString(timezonesString); }
Returns the list of time zones {@code key} corresponds to. <p>{@code key} could be the calling country code and the full significant number of a certain number, or it could be just a phone-number prefix. For example, the full number 16502530000 (from the phone-number +1 650 253 0000) is a valid input. Also, any of its prefixes, such as 16502, is also valid. @param key the key to look up @return the list of corresponding time zones
PrefixTimeZonesMap::lookupTimeZonesForNumber
java
Reginer/aosp-android-jar
android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
MIT
public List<String> lookupTimeZonesForNumber(PhoneNumber number) { long phonePrefix = Long.parseLong(number.getCountryCode() + PhoneNumberUtil.getInstance().getNationalSignificantNumber(number)); return lookupTimeZonesForNumber(phonePrefix); }
As per {@link #lookupTimeZonesForNumber(long)}, but receives the number as a PhoneNumber instead of a long. @param number the phone number to look up @return the list of corresponding time zones
PrefixTimeZonesMap::lookupTimeZonesForNumber
java
Reginer/aosp-android-jar
android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
MIT
public List<String> lookupCountryLevelTimeZonesForNumber(PhoneNumber number) { return lookupTimeZonesForNumber(number.getCountryCode()); }
Returns the list of time zones {@code number}'s calling country code corresponds to. @param number the phone number to look up @return the list of corresponding time zones
PrefixTimeZonesMap::lookupCountryLevelTimeZonesForNumber
java
Reginer/aosp-android-jar
android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
MIT
private List<String> tokenizeRawOutputString(String timezonesString) { StringTokenizer tokenizer = new StringTokenizer(timezonesString, RAW_STRING_TIMEZONES_SEPARATOR); LinkedList<String> timezonesList = new LinkedList<String>(); while (tokenizer.hasMoreTokens()) { timezonesList.add(tokenizer.nextToken()); } return timezonesList; }
Split {@code timezonesString} into all the time zones that are part of it.
PrefixTimeZonesMap::tokenizeRawOutputString
java
Reginer/aosp-android-jar
android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
MIT
static int findLimit(InputStream in) { if (in instanceof LimitedInputStream) { return ((LimitedInputStream)in).getLimit(); } else if (in instanceof ASN1InputStream) { return ((ASN1InputStream)in).getLimit(); } else if (in instanceof ByteArrayInputStream) { return ((ByteArrayInputStream)in).available(); } else if (in instanceof FileInputStream) { try { FileChannel channel = ((FileInputStream)in).getChannel(); long size = (channel != null) ? channel.size() : Integer.MAX_VALUE; if (size < Integer.MAX_VALUE) { return (int)size; } } catch (IOException e) { // ignore - they'll find out soon enough! } } // BEGIN Android-changed: Check max memory at runtime long maxMemory = Runtime.getRuntime().maxMemory(); if (maxMemory > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } return (int) maxMemory; // END Android-changed: Check max memory at runtime }
Find out possible longest length, capped by available memory. @param in input stream of interest @return length calculation or MAX_VALUE.
StreamUtil::findLimit
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/org/bouncycastle/asn1/StreamUtil.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/asn1/StreamUtil.java
MIT
public static DERUniversalString getInstance( Object obj) { if (obj == null || obj instanceof DERUniversalString) { return (DERUniversalString)obj; } if (obj instanceof byte[]) { try { return (DERUniversalString)fromByteArray((byte[])obj); } catch (Exception e) { throw new IllegalArgumentException("encoding error getInstance: " + e.toString()); } } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); }
Return a Universal String from the passed in object. @param obj a DERUniversalString or an object that can be converted into one. @exception IllegalArgumentException if the object cannot be converted. @return a DERUniversalString instance, or null
DERUniversalString::getInstance
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/org/bouncycastle/asn1/DERUniversalString.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/DERUniversalString.java
MIT
public static DERUniversalString getInstance( ASN1TaggedObject obj, boolean explicit) { ASN1Primitive o = obj.getObject(); if (explicit || o instanceof DERUniversalString) { return getInstance(o); } else { return new DERUniversalString(ASN1OctetString.getInstance(o).getOctets()); } }
Return a Universal String from a tagged object. @param obj the tagged object holding the object we want @param explicit true if the object is meant to be explicitly tagged false otherwise. @exception IllegalArgumentException if the tagged object cannot be converted. @return a DERUniversalString instance, or null
DERUniversalString::getInstance
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/org/bouncycastle/asn1/DERUniversalString.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/DERUniversalString.java
MIT
public DERUniversalString( byte[] string) { this.string = Arrays.clone(string); }
Basic constructor - byte encoded string. @param string the byte encoding of the string to be carried in the UniversalString object,
DERUniversalString::DERUniversalString
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/org/bouncycastle/asn1/DERUniversalString.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/DERUniversalString.java
MIT
public static ArrayList<Locale> getSuitableLocalesForSpellChecker( @Nullable final Locale systemLocale) { final Locale systemLocaleLanguageCountryVariant; final Locale systemLocaleLanguageCountry; final Locale systemLocaleLanguage; if (systemLocale != null) { final String language = systemLocale.getLanguage(); final boolean hasLanguage = !TextUtils.isEmpty(language); final String country = systemLocale.getCountry(); final boolean hasCountry = !TextUtils.isEmpty(country); final String variant = systemLocale.getVariant(); final boolean hasVariant = !TextUtils.isEmpty(variant); if (hasLanguage && hasCountry && hasVariant) { systemLocaleLanguageCountryVariant = new Locale(language, country, variant); } else { systemLocaleLanguageCountryVariant = null; } if (hasLanguage && hasCountry) { systemLocaleLanguageCountry = new Locale(language, country); } else { systemLocaleLanguageCountry = null; } if (hasLanguage) { systemLocaleLanguage = new Locale(language); } else { systemLocaleLanguage = null; } } else { systemLocaleLanguageCountryVariant = null; systemLocaleLanguageCountry = null; systemLocaleLanguage = null; } final ArrayList<Locale> locales = new ArrayList<>(); if (systemLocaleLanguageCountryVariant != null) { locales.add(systemLocaleLanguageCountryVariant); } if (Locale.ENGLISH.equals(systemLocaleLanguage)) { if (systemLocaleLanguageCountry != null) { // If the system language is English, and the region is also explicitly specified, // following fallback order will be applied. // - systemLocaleLanguageCountry [if systemLocaleLanguageCountry is non-null] // - en_US [if systemLocaleLanguageCountry is non-null and not en_US] // - en_GB [if systemLocaleLanguageCountry is non-null and not en_GB] // - en if (systemLocaleLanguageCountry != null) { locales.add(systemLocaleLanguageCountry); } if (!Locale.US.equals(systemLocaleLanguageCountry)) { locales.add(Locale.US); } if (!Locale.UK.equals(systemLocaleLanguageCountry)) { locales.add(Locale.UK); } locales.add(Locale.ENGLISH); } else { // If the system language is English, but no region is specified, following // fallback order will be applied. // - en // - en_US // - en_GB locales.add(Locale.ENGLISH); locales.add(Locale.US); locales.add(Locale.UK); } } else { // If the system language is not English, the fallback order will be // - systemLocaleLanguageCountry [if non-null] // - systemLocaleLanguage [if non-null] // - en_US // - en_GB // - en if (systemLocaleLanguageCountry != null) { locales.add(systemLocaleLanguageCountry); } if (systemLocaleLanguage != null) { locales.add(systemLocaleLanguage); } locales.add(Locale.US); locales.add(Locale.UK); locales.add(Locale.ENGLISH); } return locales; }
Returns a list of {@link Locale} in the order of appropriateness for the default spell checker service. <p>If the system language is English, and the region is also explicitly specified in the system locale, the following fallback order will be applied.</p> <ul> <li>(system-locale-language, system-locale-region, system-locale-variant) (if exists)</li> <li>(system-locale-language, system-locale-region)</li> <li>("en", "US")</li> <li>("en", "GB")</li> <li>("en")</li> </ul> <p>If the system language is English, but no region is specified in the system locale, the following fallback order will be applied.</p> <ul> <li>("en")</li> <li>("en", "US")</li> <li>("en", "GB")</li> </ul> <p>If the system language is not English, the following fallback order will be applied.</p> <ul> <li>(system-locale-language, system-locale-region, system-locale-variant) (if exists)</li> <li>(system-locale-language, system-locale-region) (if exists)</li> <li>(system-locale-language) (if exists)</li> <li>("en", "US")</li> <li>("en", "GB")</li> <li>("en")</li> </ul> @param systemLocale the current system locale to be taken into consideration. @return a list of {@link Locale}. The first one is considered to be most appropriate.
LocaleUtils::getSuitableLocalesForSpellChecker
java
Reginer/aosp-android-jar
android-32/src/com/android/server/textservices/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/textservices/LocaleUtils.java
MIT
public SparseIntArray() { this(0); }
Creates a new SparseIntArray containing no mappings.
SparseIntArray::SparseIntArray
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public SparseIntArray(int initialCapacity) { if (initialCapacity == 0) { mKeys = EmptyArray.INT; mValues = EmptyArray.INT; } else { mKeys = ArrayUtils.newUnpaddedIntArray(initialCapacity); mValues = new int[mKeys.length]; } mSize = 0; }
Creates a new SparseIntArray containing no mappings that will not require any additional memory allocation to store the specified number of mappings. If you supply an initial capacity of 0, the sparse array will be initialized with a light-weight representation not requiring any additional array allocations.
SparseIntArray::SparseIntArray
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public int get(int key) { return get(key, 0); }
Gets the int mapped from the specified key, or <code>0</code> if no such mapping has been made.
SparseIntArray::get
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public int get(int key, int valueIfKeyNotFound) { int i = ContainerHelpers.binarySearch(mKeys, mSize, key); if (i < 0) { return valueIfKeyNotFound; } else { return mValues[i]; } }
Gets the int mapped from the specified key, or the specified value if no such mapping has been made.
SparseIntArray::get
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public void delete(int key) { int i = ContainerHelpers.binarySearch(mKeys, mSize, key); if (i >= 0) { removeAt(i); } }
Removes the mapping from the specified key, if there was any.
SparseIntArray::delete
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public void removeAt(int index) { System.arraycopy(mKeys, index + 1, mKeys, index, mSize - (index + 1)); System.arraycopy(mValues, index + 1, mValues, index, mSize - (index + 1)); mSize--; }
Removes the mapping at the given index.
SparseIntArray::removeAt
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public void put(int key, int value) { int i = ContainerHelpers.binarySearch(mKeys, mSize, key); if (i >= 0) { mValues[i] = value; } else { i = ~i; mKeys = GrowingArrayUtils.insert(mKeys, mSize, i, key); mValues = GrowingArrayUtils.insert(mValues, mSize, i, value); mSize++; } }
Adds a mapping from the specified key to the specified value, replacing the previous mapping from the specified key if there was one.
SparseIntArray::put
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public int size() { return mSize; }
Returns the number of key-value mappings that this SparseIntArray currently stores.
SparseIntArray::size
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public int keyAt(int index) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. // Check if exception should be thrown outside of the critical path. throw new ArrayIndexOutOfBoundsException(index); } return mKeys[index]; }
Given an index in the range <code>0...size()-1</code>, returns the key from the <code>index</code>th key-value mapping that this SparseIntArray stores. <p>The keys corresponding to indices in ascending order are guaranteed to be in ascending order, e.g., <code>keyAt(0)</code> will return the smallest key and <code>keyAt(size()-1)</code> will return the largest key.</p> <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting {@link android.os.Build.VERSION_CODES#Q} and later.</p>
SparseIntArray::keyAt
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public int valueAt(int index) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. // Check if exception should be thrown outside of the critical path. throw new ArrayIndexOutOfBoundsException(index); } return mValues[index]; }
Given an index in the range <code>0...size()-1</code>, returns the value from the <code>index</code>th key-value mapping that this SparseIntArray stores. <p>The values corresponding to indices in ascending order are guaranteed to be associated with keys in ascending order, e.g., <code>valueAt(0)</code> will return the value associated with the smallest key and <code>valueAt(size()-1)</code> will return the value associated with the largest key.</p> <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting {@link android.os.Build.VERSION_CODES#Q} and later.</p>
SparseIntArray::valueAt
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public void setValueAt(int index, int value) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. // Check if exception should be thrown outside of the critical path. throw new ArrayIndexOutOfBoundsException(index); } mValues[index] = value; }
Directly set the value at a particular index. <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined for apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting {@link android.os.Build.VERSION_CODES#Q} and later.</p>
SparseIntArray::setValueAt
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public int indexOfKey(int key) { return ContainerHelpers.binarySearch(mKeys, mSize, key); }
Returns the index for which {@link #keyAt} would return the specified key, or a negative number if the specified key is not mapped.
SparseIntArray::indexOfKey
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public int indexOfValue(int value) { for (int i = 0; i < mSize; i++) if (mValues[i] == value) return i; return -1; }
Returns an index for which {@link #valueAt} would return the specified key, or a negative number if no keys map to the specified value. Beware that this is a linear search, unlike lookups by key, and that multiple keys can map to the same value and this will find only one of them.
SparseIntArray::indexOfValue
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public void clear() { mSize = 0; }
Removes all key-value mappings from this SparseIntArray.
SparseIntArray::clear
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public void append(int key, int value) { if (mSize != 0 && key <= mKeys[mSize - 1]) { put(key, value); return; } mKeys = GrowingArrayUtils.append(mKeys, mSize, key); mValues = GrowingArrayUtils.append(mValues, mSize, value); mSize++; }
Puts a key/value pair into the array, optimizing for the case where the key is greater than all existing keys in the array.
SparseIntArray::append
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public int[] copyKeys() { if (size() == 0) { return null; } return Arrays.copyOf(mKeys, size()); }
Provides a copy of keys. @hide *
SparseIntArray::copyKeys
java
Reginer/aosp-android-jar
android-35/src/android/util/SparseIntArray.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/SparseIntArray.java
MIT
public static HttpResponseCache getInstalled() { ResponseCache installed = ResponseCache.getDefault(); if (installed instanceof HttpResponseCache) { return (HttpResponseCache) installed; } return null; }
Returns the currently-installed {@code HttpResponseCache}, or null if there is no cache installed or it is not a {@code HttpResponseCache}.
HttpResponseCache::getInstalled
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
public static synchronized HttpResponseCache install(File directory, long maxSize) throws IOException { ResponseCache installed = ResponseCache.getDefault(); if (installed instanceof HttpResponseCache) { HttpResponseCache installedResponseCache = (HttpResponseCache) installed; CacheHolder cacheHolder = installedResponseCache.getCacheHolder(); // don't close and reopen if an equivalent cache is already installed if (cacheHolder.isEquivalent(directory, maxSize)) { return installedResponseCache; } else { // The HttpResponseCache that owns this object is about to be replaced. installedResponseCache.close(); } } CacheHolder cacheHolder = CacheHolder.create(directory, maxSize); AndroidResponseCacheAdapter androidResponseCacheAdapter = new AndroidResponseCacheAdapter(cacheHolder); HttpResponseCache responseCache = new HttpResponseCache(androidResponseCacheAdapter); ResponseCache.setDefault(responseCache); return responseCache; }
Creates a new HTTP response cache and sets it as the system default cache. @param directory the directory to hold cache data. @param maxSize the maximum size of the cache in bytes. @return the newly-installed cache @throws IOException if {@code directory} cannot be used for this cache. Most applications should respond to this exception by logging a warning.
HttpResponseCache::install
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
public long size() { try { return mDelegate.getSize(); } catch (IOException e) { // This can occur if the cache failed to lazily initialize. return -1; } }
Returns the number of bytes currently being used to store the values in this cache. This may be greater than the {@link #maxSize} if a background deletion is pending. {@code -1} is returned if the size cannot be determined.
HttpResponseCache::size
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
public long maxSize() { return mDelegate.getMaxSize(); }
Returns the maximum number of bytes that this cache should use to store its data.
HttpResponseCache::maxSize
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
public void flush() { try { mDelegate.flush(); } catch (IOException ignored) { } }
Force buffered operations to the filesystem. This ensures that responses written to the cache will be available the next time the cache is opened, even if this process is killed.
HttpResponseCache::flush
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
public int getNetworkCount() { return mDelegate.getNetworkCount(); }
Returns the number of HTTP requests that required the network to either supply a response or validate a locally cached response.
HttpResponseCache::getNetworkCount
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
public int getHitCount() { return mDelegate.getHitCount(); }
Returns the number of HTTP requests whose response was provided by the cache. This may include conditional {@code GET} requests that were validated over the network.
HttpResponseCache::getHitCount
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
public int getRequestCount() { return mDelegate.getRequestCount(); }
Returns the total number of HTTP requests that were made. This includes both client requests and requests that were made on the client's behalf to handle a redirects and retries.
HttpResponseCache::getRequestCount
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
public void delete() throws IOException { if (ResponseCache.getDefault() == this) { ResponseCache.setDefault(null); } mDelegate.delete(); }
Uninstalls the cache and deletes all of its stored contents.
HttpResponseCache::delete
java
Reginer/aosp-android-jar
android-34/src/android/net/http/HttpResponseCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/http/HttpResponseCache.java
MIT
private Device(String manufacturer, String model, @DeviceType int type) { validateIntDefValue(type, Device.VALID_TYPES, DeviceType.class.getSimpleName()); mManufacturer = manufacturer; mModel = model; mType = type; }
@param manufacturer An optional client supplied manufacturer of the device @param model An optional client supplied model of the device @param type An optional client supplied type of the device
Builder::Device
java
Reginer/aosp-android-jar
android-34/src/android/health/connect/datatypes/Device.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/health/connect/datatypes/Device.java
MIT
public CertPathValidatorException() { this(null, null); }
Creates a {@code CertPathValidatorException} with no detail message.
CertPathValidatorException::CertPathValidatorException
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public CertPathValidatorException(String msg) { this(msg, null); }
Creates a {@code CertPathValidatorException} with the given detail message. A detail message is a {@code String} that describes this particular exception. @param msg the detail message
CertPathValidatorException::CertPathValidatorException
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public CertPathValidatorException(Throwable cause) { this((cause == null ? null : cause.toString()), cause); }
Creates a {@code CertPathValidatorException} that wraps the specified throwable. This allows any exception to be converted into a {@code CertPathValidatorException}, while retaining information about the wrapped exception, which may be useful for debugging. The detail message is set to ({@code cause==null ? null : cause.toString()}) (which typically contains the class and detail message of cause). @param cause the cause (which is saved for later retrieval by the {@link #getCause getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.)
CertPathValidatorException::CertPathValidatorException
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public CertPathValidatorException(String msg, Throwable cause) { this(msg, cause, null, -1); }
Creates a {@code CertPathValidatorException} with the specified detail message and cause. @param msg the detail message @param cause the cause (which is saved for later retrieval by the {@link #getCause getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.)
CertPathValidatorException::CertPathValidatorException
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public CertPathValidatorException(String msg, Throwable cause, CertPath certPath, int index) { this(msg, cause, certPath, index, BasicReason.UNSPECIFIED); }
Creates a {@code CertPathValidatorException} with the specified detail message, cause, certification path, and index. @param msg the detail message (or {@code null} if none) @param cause the cause (or {@code null} if none) @param certPath the certification path that was in the process of being validated when the error was encountered @param index the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a {@code CertPath} is zero based. @throws IndexOutOfBoundsException if the index is out of range {@code (index < -1 || (certPath != null && index >= certPath.getCertificates().size()) } @throws IllegalArgumentException if {@code certPath} is {@code null} and {@code index} is not -1
CertPathValidatorException::CertPathValidatorException
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public CertPathValidatorException(String msg, Throwable cause, CertPath certPath, int index, Reason reason) { super(msg, cause); if (certPath == null && index != -1) { throw new IllegalArgumentException(); } if (index < -1 || (certPath != null && index >= certPath.getCertificates().size())) { throw new IndexOutOfBoundsException(); } if (reason == null) { throw new NullPointerException("reason can't be null"); } this.certPath = certPath; this.index = index; this.reason = reason; }
Creates a {@code CertPathValidatorException} with the specified detail message, cause, certification path, index, and reason. @param msg the detail message (or {@code null} if none) @param cause the cause (or {@code null} if none) @param certPath the certification path that was in the process of being validated when the error was encountered @param index the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a {@code CertPath} is zero based. @param reason the reason the validation failed @throws IndexOutOfBoundsException if the index is out of range {@code (index < -1 || (certPath != null && index >= certPath.getCertificates().size()) } @throws IllegalArgumentException if {@code certPath} is {@code null} and {@code index} is not -1 @throws NullPointerException if {@code reason} is {@code null} @since 1.7
CertPathValidatorException::CertPathValidatorException
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public CertPath getCertPath() { return this.certPath; }
Returns the certification path that was being validated when the exception was thrown. @return the {@code CertPath} that was being validated when the exception was thrown (or {@code null} if not specified)
CertPathValidatorException::getCertPath
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public int getIndex() { return this.index; }
Returns the index of the certificate in the certification path that caused the exception to be thrown. Note that the list of certificates in a {@code CertPath} is zero based. If no index has been set, -1 is returned. @return the index that has been set, or -1 if none has been set
CertPathValidatorException::getIndex
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public Reason getReason() { return this.reason; }
Returns the reason that the validation failed. The reason is associated with the index of the certificate returned by {@link #getIndex}. @return the reason that the validation failed, or {@code BasicReason.UNSPECIFIED} if a reason has not been specified @since 1.7
CertPathValidatorException::getReason
java
Reginer/aosp-android-jar
android-35/src/java/security/cert/CertPathValidatorException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPathValidatorException.java
MIT
public SubtitleTrack[] getTracks() { synchronized(mTracks) { SubtitleTrack[] tracks = new SubtitleTrack[mTracks.size()]; mTracks.toArray(tracks); return tracks; } }
@return the available subtitle tracks for this media. These include the tracks found by {@link MediaPlayer} as well as any tracks added manually via {@link #addTrack}.
SubtitleController::getTracks
java
Reginer/aosp-android-jar
android-31/src/android/media/SubtitleController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/SubtitleController.java
MIT
public SubtitleTrack getSelectedTrack() { return mSelectedTrack; }
@return the currently selected subtitle track
SubtitleController::getSelectedTrack
java
Reginer/aosp-android-jar
android-31/src/android/media/SubtitleController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/SubtitleController.java
MIT
public boolean selectTrack(SubtitleTrack track) { if (track != null && !mTracks.contains(track)) { return false; } processOnAnchor(mHandler.obtainMessage(WHAT_SELECT_TRACK, track)); return true; }
Selects a subtitle track. As a result, this track will receive in-band data from the {@link MediaPlayer}. However, this does not change the subtitle visibility. Should be called from the anchor's (UI) thread. {@see #Anchor.getSubtitleLooper} @param track The subtitle track to select. This must be one of the tracks in {@link #getTracks}. @return true if the track was successfully selected.
SubtitleController::selectTrack
java
Reginer/aosp-android-jar
android-31/src/android/media/SubtitleController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/SubtitleController.java
MIT
public SubtitleTrack getDefaultTrack() { SubtitleTrack bestTrack = null; int bestScore = -1; Locale selectedLocale = mCaptioningManager.getLocale(); Locale locale = selectedLocale; if (locale == null) { locale = Locale.getDefault(); } boolean selectForced = !mCaptioningManager.isEnabled(); synchronized(mTracks) { for (SubtitleTrack track: mTracks) { MediaFormat format = track.getFormat(); String language = format.getString(MediaFormat.KEY_LANGUAGE); boolean forced = format.getInteger(MediaFormat.KEY_IS_FORCED_SUBTITLE, 0) != 0; boolean autoselect = format.getInteger(MediaFormat.KEY_IS_AUTOSELECT, 1) != 0; boolean is_default = format.getInteger(MediaFormat.KEY_IS_DEFAULT, 0) != 0; boolean languageMatches = (locale == null || locale.getLanguage().equals("") || locale.getISO3Language().equals(language) || locale.getLanguage().equals(language)); // is_default is meaningless unless caption language is 'default' int score = (forced ? 0 : 8) + (((selectedLocale == null) && is_default) ? 4 : 0) + (autoselect ? 0 : 2) + (languageMatches ? 1 : 0); if (selectForced && !forced) { continue; } // we treat null locale/language as matching any language if ((selectedLocale == null && is_default) || (languageMatches && (autoselect || forced || selectedLocale != null))) { if (score > bestScore) { bestScore = score; bestTrack = track; } } } } return bestTrack; }
@return the default subtitle track based on system preferences, or null, if no such track exists in this manager. Supports HLS-flags: AUTOSELECT, FORCED & DEFAULT. 1. If captioning is disabled, only consider FORCED tracks. Otherwise, consider all tracks, but prefer non-FORCED ones. 2. If user selected "Default" caption language: a. If there is a considered track with DEFAULT=yes, returns that track (favor the first one in the current language if there are more than one default tracks, or the first in general if none of them are in the current language). b. Otherwise, if there is a track with AUTOSELECT=yes in the current language, return that one. c. If there are no default tracks, and no autoselectable tracks in the current language, return null. 3. If there is a track with the caption language, select that one. Prefer the one with AUTOSELECT=no. The default values for these flags are DEFAULT=no, AUTOSELECT=yes and FORCED=no.
SubtitleController::getDefaultTrack
java
Reginer/aosp-android-jar
android-31/src/android/media/SubtitleController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/SubtitleController.java
MIT
public void selectDefaultTrack() { processOnAnchor(mHandler.obtainMessage(WHAT_SELECT_DEFAULT_TRACK)); }
@return the default subtitle track based on system preferences, or null, if no such track exists in this manager. Supports HLS-flags: AUTOSELECT, FORCED & DEFAULT. 1. If captioning is disabled, only consider FORCED tracks. Otherwise, consider all tracks, but prefer non-FORCED ones. 2. If user selected "Default" caption language: a. If there is a considered track with DEFAULT=yes, returns that track (favor the first one in the current language if there are more than one default tracks, or the first in general if none of them are in the current language). b. Otherwise, if there is a track with AUTOSELECT=yes in the current language, return that one. c. If there are no default tracks, and no autoselectable tracks in the current language, return null. 3. If there is a track with the caption language, select that one. Prefer the one with AUTOSELECT=no. The default values for these flags are DEFAULT=no, AUTOSELECT=yes and FORCED=no. public SubtitleTrack getDefaultTrack() { SubtitleTrack bestTrack = null; int bestScore = -1; Locale selectedLocale = mCaptioningManager.getLocale(); Locale locale = selectedLocale; if (locale == null) { locale = Locale.getDefault(); } boolean selectForced = !mCaptioningManager.isEnabled(); synchronized(mTracks) { for (SubtitleTrack track: mTracks) { MediaFormat format = track.getFormat(); String language = format.getString(MediaFormat.KEY_LANGUAGE); boolean forced = format.getInteger(MediaFormat.KEY_IS_FORCED_SUBTITLE, 0) != 0; boolean autoselect = format.getInteger(MediaFormat.KEY_IS_AUTOSELECT, 1) != 0; boolean is_default = format.getInteger(MediaFormat.KEY_IS_DEFAULT, 0) != 0; boolean languageMatches = (locale == null || locale.getLanguage().equals("") || locale.getISO3Language().equals(language) || locale.getLanguage().equals(language)); // is_default is meaningless unless caption language is 'default' int score = (forced ? 0 : 8) + (((selectedLocale == null) && is_default) ? 4 : 0) + (autoselect ? 0 : 2) + (languageMatches ? 1 : 0); if (selectForced && !forced) { continue; } // we treat null locale/language as matching any language if ((selectedLocale == null && is_default) || (languageMatches && (autoselect || forced || selectedLocale != null))) { if (score > bestScore) { bestScore = score; bestTrack = track; } } } } return bestTrack; } private boolean mTrackIsExplicit = false; private boolean mVisibilityIsExplicit = false; /** @hide - should be called from anchor thread
SubtitleController::selectDefaultTrack
java
Reginer/aosp-android-jar
android-31/src/android/media/SubtitleController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/SubtitleController.java
MIT
public SubtitleTrack addTrack(MediaFormat format) { synchronized(mRenderers) { for (Renderer renderer: mRenderers) { if (renderer.supports(format)) { SubtitleTrack track = renderer.createTrack(format); if (track != null) { synchronized(mTracks) { if (mTracks.size() == 0) { mCaptioningManager.addCaptioningChangeListener( mCaptioningChangeListener); } mTracks.add(track); } return track; } } } } return null; }
Adds a new, external subtitle track to the manager. @param format the format of the track that will include at least the MIME type {@link MediaFormat@KEY_MIME}. @return the created {@link SubtitleTrack} object
SubtitleController::addTrack
java
Reginer/aosp-android-jar
android-31/src/android/media/SubtitleController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/SubtitleController.java
MIT
public boolean hasRendererFor(MediaFormat format) { synchronized(mRenderers) { // TODO how to get available renderers in the system for (Renderer renderer: mRenderers) { if (renderer.supports(format)) { return true; } } return false; } }
Add support for a subtitle format in {@link MediaPlayer}. @param renderer a {@link SubtitleController.Renderer} object that adds support for a subtitle format. @UnsupportedAppUsage public void registerRenderer(Renderer renderer) { synchronized(mRenderers) { // TODO how to get available renderers in the system if (!mRenderers.contains(renderer)) { // TODO should added renderers override existing ones (to allow replacing?) mRenderers.add(renderer); } } } /** @hide
Renderer::hasRendererFor
java
Reginer/aosp-android-jar
android-31/src/android/media/SubtitleController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/SubtitleController.java
MIT
public void setAnchor(Anchor anchor) { if (mAnchor == anchor) { return; } if (mAnchor != null) { checkAnchorLooper(); mAnchor.setSubtitleWidget(null); } mAnchor = anchor; mHandler = null; if (mAnchor != null) { mHandler = new Handler(mAnchor.getSubtitleLooper(), mCallback); checkAnchorLooper(); mAnchor.setSubtitleWidget(getRenderingWidget()); } }
@hide - called from anchor's looper (if any, both when unsetting and setting)
SubtitleController::setAnchor
java
Reginer/aosp-android-jar
android-31/src/android/media/SubtitleController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/SubtitleController.java
MIT
static MethodTypeDesc ofDescriptor(String descriptor) { return MethodTypeDescImpl.ofDescriptor(descriptor); }
Creates a {@linkplain MethodTypeDesc} given a method descriptor string. @param descriptor a method descriptor string @return a {@linkplain MethodTypeDesc} describing the desired method type @throws NullPointerException if the argument is {@code null} @throws IllegalArgumentException if the descriptor string is not a valid method descriptor @jvms 4.3.3 Method Descriptors
ofDescriptor
java
Reginer/aosp-android-jar
android-34/src/java/lang/constant/MethodTypeDesc.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/lang/constant/MethodTypeDesc.java
MIT
static MethodTypeDesc of(ClassDesc returnDesc, ClassDesc... paramDescs) { return new MethodTypeDescImpl(returnDesc, paramDescs); }
Returns a {@linkplain MethodTypeDesc} given the return type and parameter types. @param returnDesc a {@linkplain ClassDesc} describing the return type @param paramDescs {@linkplain ClassDesc}s describing the argument types @return a {@linkplain MethodTypeDesc} describing the desired method type @throws NullPointerException if any argument or its contents are {@code null} @throws IllegalArgumentException if any element of {@code paramDescs} is a {@link ClassDesc} for {@code void}
of
java
Reginer/aosp-android-jar
android-34/src/java/lang/constant/MethodTypeDesc.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/lang/constant/MethodTypeDesc.java
MIT
default String descriptorString() { return String.format("(%s)%s", Stream.of(parameterArray()) .map(ClassDesc::descriptorString) .collect(Collectors.joining()), returnType().descriptorString()); }
Returns the method type descriptor string. @return the method type descriptor string @jvms 4.3.3 Method Descriptors
descriptorString
java
Reginer/aosp-android-jar
android-34/src/java/lang/constant/MethodTypeDesc.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/lang/constant/MethodTypeDesc.java
MIT
default String displayDescriptor() { return String.format("(%s)%s", Stream.of(parameterArray()) .map(ClassDesc::displayName) .collect(Collectors.joining(",")), returnType().displayName()); }
Returns a human-readable descriptor for this method type, using the canonical names for parameter and return types. @return the human-readable descriptor for this method type
displayDescriptor
java
Reginer/aosp-android-jar
android-34/src/java/lang/constant/MethodTypeDesc.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/lang/constant/MethodTypeDesc.java
MIT
public static IntentBroadcaster getInstance(Context context) { if (sIntentBroadcaster == null) { sIntentBroadcaster = new IntentBroadcaster(context); } return sIntentBroadcaster; }
Method to get an instance of IntentBroadcaster after creating one if needed. @return IntentBroadcaster instance
IntentBroadcaster::getInstance
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/IntentBroadcaster.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/IntentBroadcaster.java
MIT
public void broadcastStickyIntent(Context context, Intent intent, int phoneId) { logd("Broadcasting and adding intent for rebroadcast: " + intent.getAction() + " " + intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE) + " for phoneId " + phoneId); synchronized (mRebroadcastIntents) { context.sendStickyBroadcastAsUser(intent, UserHandle.ALL); mRebroadcastIntents.put(phoneId, intent); } }
Wrapper for ActivityManager.broadcastStickyIntent() that also stores intent to be rebroadcast on USER_UNLOCKED
IntentBroadcaster::broadcastStickyIntent
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/IntentBroadcaster.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/IntentBroadcaster.java
MIT
public void onLayoutComplete() { mLastTotalSpace = getTotalSpace(); }
Call this method after onLayout method is complete if state is NOT pre-layout. This method records information like layout bounds that might be useful in the next layout calculations.
OrientationHelper::onLayoutComplete
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/widget/OrientationHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/widget/OrientationHelper.java
MIT
public int getTotalSpaceChange() { return INVALID_SIZE == mLastTotalSpace ? 0 : getTotalSpace() - mLastTotalSpace; }
Returns the layout space change between the previous layout pass and current layout pass. <p> Make sure you call {@link #onLayoutComplete()} at the end of your LayoutManager's {@link RecyclerView.LayoutManager#onLayoutChildren(RecyclerView.Recycler, RecyclerView.State)} method. @return The difference between the current total space and previous layout's total space. @see #onLayoutComplete()
OrientationHelper::getTotalSpaceChange
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/widget/OrientationHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/widget/OrientationHelper.java
MIT
public static OrientationHelper createOrientationHelper( RecyclerView.LayoutManager layoutManager, int orientation) { switch (orientation) { case HORIZONTAL: return createHorizontalHelper(layoutManager); case VERTICAL: return createVerticalHelper(layoutManager); } throw new IllegalArgumentException("invalid orientation"); }
Creates an OrientationHelper for the given LayoutManager and orientation. @param layoutManager LayoutManager to attach to @param orientation Desired orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL} @return A new OrientationHelper
OrientationHelper::createOrientationHelper
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/widget/OrientationHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/widget/OrientationHelper.java
MIT
public static OrientationHelper createHorizontalHelper( RecyclerView.LayoutManager layoutManager) { return new OrientationHelper(layoutManager) { @Override public int getEndAfterPadding() { return mLayoutManager.getWidth() - mLayoutManager.getPaddingRight(); } @Override public int getEnd() { return mLayoutManager.getWidth(); } @Override public void offsetChildren(int amount) { mLayoutManager.offsetChildrenHorizontal(amount); } @Override public int getStartAfterPadding() { return mLayoutManager.getPaddingLeft(); } @Override public int getDecoratedMeasurement(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return mLayoutManager.getDecoratedMeasuredWidth(view) + params.leftMargin + params.rightMargin; } @Override public int getDecoratedMeasurementInOther(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return mLayoutManager.getDecoratedMeasuredHeight(view) + params.topMargin + params.bottomMargin; } @Override public int getDecoratedEnd(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return mLayoutManager.getDecoratedRight(view) + params.rightMargin; } @Override public int getDecoratedStart(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return mLayoutManager.getDecoratedLeft(view) - params.leftMargin; } @Override public int getTransformedEndWithDecoration(View view) { mLayoutManager.getTransformedBoundingBox(view, true, mTmpRect); return mTmpRect.right; } @Override public int getTransformedStartWithDecoration(View view) { mLayoutManager.getTransformedBoundingBox(view, true, mTmpRect); return mTmpRect.left; } @Override public int getTotalSpace() { return mLayoutManager.getWidth() - mLayoutManager.getPaddingLeft() - mLayoutManager.getPaddingRight(); } @Override public void offsetChild(View view, int offset) { view.offsetLeftAndRight(offset); } @Override public int getEndPadding() { return mLayoutManager.getPaddingRight(); } @Override public int getMode() { return mLayoutManager.getWidthMode(); } @Override public int getModeInOther() { return mLayoutManager.getHeightMode(); } }; }
Creates a horizontal OrientationHelper for the given LayoutManager. @param layoutManager The LayoutManager to attach to. @return A new OrientationHelper
OrientationHelper::createHorizontalHelper
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/widget/OrientationHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/widget/OrientationHelper.java
MIT
public static OrientationHelper createVerticalHelper(RecyclerView.LayoutManager layoutManager) { return new OrientationHelper(layoutManager) { @Override public int getEndAfterPadding() { return mLayoutManager.getHeight() - mLayoutManager.getPaddingBottom(); } @Override public int getEnd() { return mLayoutManager.getHeight(); } @Override public void offsetChildren(int amount) { mLayoutManager.offsetChildrenVertical(amount); } @Override public int getStartAfterPadding() { return mLayoutManager.getPaddingTop(); } @Override public int getDecoratedMeasurement(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return mLayoutManager.getDecoratedMeasuredHeight(view) + params.topMargin + params.bottomMargin; } @Override public int getDecoratedMeasurementInOther(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return mLayoutManager.getDecoratedMeasuredWidth(view) + params.leftMargin + params.rightMargin; } @Override public int getDecoratedEnd(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return mLayoutManager.getDecoratedBottom(view) + params.bottomMargin; } @Override public int getDecoratedStart(View view) { final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); return mLayoutManager.getDecoratedTop(view) - params.topMargin; } @Override public int getTransformedEndWithDecoration(View view) { mLayoutManager.getTransformedBoundingBox(view, true, mTmpRect); return mTmpRect.bottom; } @Override public int getTransformedStartWithDecoration(View view) { mLayoutManager.getTransformedBoundingBox(view, true, mTmpRect); return mTmpRect.top; } @Override public int getTotalSpace() { return mLayoutManager.getHeight() - mLayoutManager.getPaddingTop() - mLayoutManager.getPaddingBottom(); } @Override public void offsetChild(View view, int offset) { view.offsetTopAndBottom(offset); } @Override public int getEndPadding() { return mLayoutManager.getPaddingBottom(); } @Override public int getMode() { return mLayoutManager.getHeightMode(); } @Override public int getModeInOther() { return mLayoutManager.getWidthMode(); } }; }
Creates a vertical OrientationHelper for the given LayoutManager. @param layoutManager The LayoutManager to attach to. @return A new OrientationHelper
OrientationHelper::createVerticalHelper
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/widget/OrientationHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/widget/OrientationHelper.java
MIT
public Rfc822Token(@Nullable String name, @Nullable String address, @Nullable String comment) { mName = name; mAddress = address; mComment = comment; }
Creates a new Rfc822Token with the specified name, address, and comment.
Rfc822Token::Rfc822Token
java
Reginer/aosp-android-jar
android-31/src/android/text/util/Rfc822Token.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/text/util/Rfc822Token.java
MIT
public void setName(@Nullable String name) { mName = name; }
Changes the name to the specified name.
Rfc822Token::setName
java
Reginer/aosp-android-jar
android-31/src/android/text/util/Rfc822Token.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/text/util/Rfc822Token.java
MIT
public void setAddress(@Nullable String address) { mAddress = address; }
Changes the address to the specified address.
Rfc822Token::setAddress
java
Reginer/aosp-android-jar
android-31/src/android/text/util/Rfc822Token.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/text/util/Rfc822Token.java
MIT
public void setComment(@Nullable String comment) { mComment = comment; }
Changes the comment to the specified comment.
Rfc822Token::setComment
java
Reginer/aosp-android-jar
android-31/src/android/text/util/Rfc822Token.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/text/util/Rfc822Token.java
MIT
public String toString() { StringBuilder sb = new StringBuilder(); if (mName != null && mName.length() != 0) { sb.append(quoteNameIfNecessary(mName)); sb.append(' '); } if (mComment != null && mComment.length() != 0) { sb.append('('); sb.append(quoteComment(mComment)); sb.append(") "); } if (mAddress != null && mAddress.length() != 0) { sb.append('<'); sb.append(mAddress); sb.append('>'); } return sb.toString(); }
Returns the name (with quoting added if necessary), the comment (in parentheses), and the address (in angle brackets). This should be suitable for inclusion in an RFC 822 address list.
Rfc822Token::toString
java
Reginer/aosp-android-jar
android-31/src/android/text/util/Rfc822Token.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/text/util/Rfc822Token.java
MIT
public static String quoteNameIfNecessary(String name) { int len = name.length(); for (int i = 0; i < len; i++) { char c = name.charAt(i); if (! ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == ' ') || (c >= '0' && c <= '9'))) { return '"' + quoteName(name) + '"'; } } return name; }
Returns the name, conservatively quoting it if there are any characters that are likely to cause trouble outside of a quoted string, or returning it literally if it seems safe.
Rfc822Token::quoteNameIfNecessary
java
Reginer/aosp-android-jar
android-31/src/android/text/util/Rfc822Token.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/text/util/Rfc822Token.java
MIT
public static String quoteName(String name) { StringBuilder sb = new StringBuilder(); int len = name.length(); for (int i = 0; i < len; i++) { char c = name.charAt(i); if (c == '\\' || c == '"') { sb.append('\\'); } sb.append(c); } return sb.toString(); }
Returns the name, with internal backslashes and quotation marks preceded by backslashes. The outer quote marks themselves are not added by this method.
Rfc822Token::quoteName
java
Reginer/aosp-android-jar
android-31/src/android/text/util/Rfc822Token.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/text/util/Rfc822Token.java
MIT
public static String quoteComment(String comment) { int len = comment.length(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < len; i++) { char c = comment.charAt(i); if (c == '(' || c == ')' || c == '\\') { sb.append('\\'); } sb.append(c); } return sb.toString(); }
Returns the comment, with internal backslashes and parentheses preceded by backslashes. The outer parentheses themselves are not added by this method.
Rfc822Token::quoteComment
java
Reginer/aosp-android-jar
android-31/src/android/text/util/Rfc822Token.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/text/util/Rfc822Token.java
MIT
private Phone getPhone(int subId) { Phone p = null; for (Phone phone : mPhones) { if (phone.getSubId() == subId && phone.getPhoneType() != PhoneConstants.PHONE_TYPE_IMS) { p = phone; break; } } return p; }
get Phone object corresponds to subId @return Phone
CallManager::getPhone
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public int getServiceState(int subId) { int resultState = ServiceState.STATE_OUT_OF_SERVICE; for (Phone phone : mPhones) { if (phone.getSubId() == subId) { int serviceState = phone.getServiceState().getState(); if (serviceState == ServiceState.STATE_IN_SERVICE) { // IN_SERVICE has the highest priority resultState = serviceState; break; } else if (serviceState == ServiceState.STATE_OUT_OF_SERVICE) { // OUT_OF_SERVICE replaces EMERGENCY_ONLY and POWER_OFF // Note: EMERGENCY_ONLY is not in use at this moment if ( resultState == ServiceState.STATE_EMERGENCY_ONLY || resultState == ServiceState.STATE_POWER_OFF) { resultState = serviceState; } } else if (serviceState == ServiceState.STATE_EMERGENCY_ONLY) { if (resultState == ServiceState.STATE_POWER_OFF) { resultState = serviceState; } } } } return resultState; }
@return the Phone service state corresponds to subId
CallManager::getServiceState
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public Phone getRingingPhone(int subId) { return getFirstActiveRingingCall(subId).getPhone(); }
@return the phone associated with the ringing call of a particular subId
CallManager::getRingingPhone
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public void rejectCall(Call ringingCall) throws CallStateException { if (VDBG) { Rlog.d(LOG_TAG, toString()); } Phone ringingPhone = ringingCall.getPhone(); ringingPhone.rejectCall(); if (VDBG) { Rlog.d(LOG_TAG, "End rejectCall(" +ringingCall + ")"); Rlog.d(LOG_TAG, toString()); } }
Reject (ignore) a ringing call. In GSM, this means UDUB (User Determined User Busy). Reject occurs asynchronously, and final notification occurs via {@link #registerForPreciseCallStateChanged(android.os.Handler, int, java.lang.Object) registerForPreciseCallStateChanged()}. @exception CallStateException when no call is ringing or waiting
CallManager::rejectCall
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public boolean canConference(Call heldCall) { Phone activePhone = null; Phone heldPhone = null; if (hasActiveFgCall()) { activePhone = getActiveFgCall().getPhone(); } if (heldCall != null) { heldPhone = heldCall.getPhone(); } return heldPhone.getClass().equals(activePhone.getClass()); }
Whether or not the phone can conference in the current phone state--that is, one call holding and one call active. @return true if the phone can conference; false otherwise.
CallManager::canConference
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public Connection dial(Phone phone, String dialString, int videoState) throws CallStateException { int subId = phone.getSubId(); Connection result; if (VDBG) { Rlog.d(LOG_TAG, " dial(" + phone + ", "+ dialString + ")" + " subId = " + subId); Rlog.d(LOG_TAG, toString()); } if (!canDial(phone)) { /* * canDial function only checks whether the phone can make a new call. * InCall MMI commmands are basically supplementary services * within a call eg: call hold, call deflection, explicit call transfer etc. */ String newDialString = PhoneNumberUtils.stripSeparators(dialString); if (phone.handleInCallMmiCommands(newDialString)) { return null; } else { throw new CallStateException("cannot dial in current state"); } } if ( hasActiveFgCall(subId) ) { Phone activePhone = getActiveFgCall(subId).getPhone(); boolean hasBgCall = !(activePhone.getBackgroundCall().isIdle()); if (DBG) { Rlog.d(LOG_TAG, "hasBgCall: "+ hasBgCall + " sameChannel:" + (activePhone == phone)); } // Manipulation between IMS phone and its owner // will be treated in GSM/CDMA phone. Phone imsPhone = phone.getImsPhone(); if (activePhone != phone && (imsPhone == null || imsPhone != activePhone)) { if (hasBgCall) { Rlog.d(LOG_TAG, "Hangup"); getActiveFgCall(subId).hangup(); } else { Rlog.d(LOG_TAG, "Switch"); activePhone.switchHoldingAndActive(); } } } result = phone.dial(dialString, new PhoneInternalInterface.DialArgs.Builder<>() .setVideoState(videoState).build()); if (VDBG) { Rlog.d(LOG_TAG, "End dial(" + phone + ", "+ dialString + ")"); Rlog.d(LOG_TAG, toString()); } return result; }
Initiate a new voice connection. This happens asynchronously, so you cannot assume the audio path is connected (or a call index has been assigned) until PhoneStateChanged notification has occurred. @exception CallStateException if a new outgoing call is not currently possible because no more call slots exist or a call exists that is dialing, alerting, ringing, or waiting. Other errors are handled asynchronously.
CallManager::dial
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public Connection dial(Phone phone, String dialString, UUSInfo uusInfo, int videoState) throws CallStateException { return phone.dial(dialString, new PhoneInternalInterface.DialArgs.Builder<>() .setUusInfo(uusInfo) .setVideoState(videoState).build()); }
Initiate a new voice connection. This happens asynchronously, so you cannot assume the audio path is connected (or a call index has been assigned) until PhoneStateChanged notification has occurred. @exception CallStateException if a new outgoing call is not currently possible because no more call slots exist or a call exists that is dialing, alerting, ringing, or waiting. Other errors are handled asynchronously.
CallManager::dial
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public void clearDisconnected() { for(Phone phone : mPhones) { phone.clearDisconnected(); } }
clear disconnect connection for each phone
CallManager::clearDisconnected
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public void clearDisconnected(int subId) { for(Phone phone : mPhones) { if (phone.getSubId() == subId) { phone.clearDisconnected(); } } }
clear disconnect connection for a phone specific to the provided subId
CallManager::clearDisconnected
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public boolean canTransfer(Call heldCall) { Phone activePhone = null; Phone heldPhone = null; if (hasActiveFgCall()) { activePhone = getActiveFgCall().getPhone(); } if (heldCall != null) { heldPhone = heldCall.getPhone(); } return (heldPhone == activePhone && activePhone.canTransfer()); }
Whether or not the phone can do explicit call transfer in the current phone state--that is, one call holding and one call active. @return true if the phone can do explicit call transfer; false otherwise.
CallManager::canTransfer
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT
public boolean canTransfer(Call heldCall, int subId) { Phone activePhone = null; Phone heldPhone = null; if (hasActiveFgCall(subId)) { activePhone = getActiveFgCall(subId).getPhone(); } if (heldCall != null) { heldPhone = heldCall.getPhone(); } return (heldPhone == activePhone && activePhone.canTransfer()); }
Whether or not the phone specific to subId can do explicit call transfer in the current phone state--that is, one call holding and one call active. @return true if the phone can do explicit call transfer; false otherwise.
CallManager::canTransfer
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/telephony/CallManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/CallManager.java
MIT