code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
private void removeExpiredTimestamps() {
long beginCheckPeriod = System.currentTimeMillis() - mCheckPeriod;
synchronized (mSmsStamp) {
Iterator<Map.Entry<String, ArrayList<Long>>> iter = mSmsStamp.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, ArrayList<Long>> entry = iter.next();
ArrayList<Long> oldList = entry.getValue();
if (oldList.isEmpty() || oldList.get(oldList.size() - 1) < beginCheckPeriod) {
iter.remove();
}
}
}
} |
Remove keys containing only old timestamps. This can happen if an SMS app is used
to send messages and then uninstalled.
| SettingsObserverHandler::removeExpiredTimestamps | java | Reginer/aosp-android-jar | android-31/src/com/android/internal/telephony/SmsUsageMonitor.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/internal/telephony/SmsUsageMonitor.java | MIT |
protected PSource(String pSrcName) {
if (pSrcName == null) {
throw new NullPointerException("pSource algorithm is null");
}
this.pSrcName = pSrcName;
} |
Constructs a source of the encoding input P for OAEP
padding as defined in the PKCS #1 standard using the
specified PSource algorithm.
@param pSrcName the algorithm for the source of the
encoding input P.
@exception NullPointerException if <code>pSrcName</code>
is null.
| PSource::PSource | java | Reginer/aosp-android-jar | android-34/src/javax/crypto/spec/PSource.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/crypto/spec/PSource.java | MIT |
public String getAlgorithm() {
return pSrcName;
} |
Returns the PSource algorithm name.
@return the PSource algorithm name.
| PSource::getAlgorithm | java | Reginer/aosp-android-jar | android-34/src/javax/crypto/spec/PSource.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/crypto/spec/PSource.java | MIT |
public PSpecified(byte[] p) {
super("PSpecified");
this.p = p.clone();
} |
Constructs the source explicitly with the specified
value <code>p</code> as the encoding input P.
Note:
@param p the value of the encoding input. The contents
of the array are copied to protect against subsequent
modification.
@exception NullPointerException if <code>p</code> is null.
| PSpecified::PSpecified | java | Reginer/aosp-android-jar | android-34/src/javax/crypto/spec/PSource.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/crypto/spec/PSource.java | MIT |
public byte[] getValue() {
return (p.length==0? p: p.clone());
} |
Returns the value of encoding input P.
@return the value of encoding input P. A new array is
returned each time this method is called.
| PSpecified::getValue | java | Reginer/aosp-android-jar | android-34/src/javax/crypto/spec/PSource.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/crypto/spec/PSource.java | MIT |
public static <T> boolean contains(@Nullable Collection<T> collection, T element) {
return collection != null && collection.contains(element);
} |
@see Collection#contains(Object)
| CollectionUtils::contains | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> filter(@Nullable List<T> list,
java.util.function.Predicate<? super T> predicate) {
ArrayList<T> result = null;
for (int i = 0; i < size(list); i++) {
final T item = list.get(i);
if (predicate.test(item)) {
result = ArrayUtils.add(result, item);
}
}
return emptyIfNull(result);
} |
Returns a list of items from the provided list that match the given condition.
This is similar to {@link Stream#filter} but without the overhead of creating an intermediate
{@link Stream} instance
| CollectionUtils::filter | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> filter(@Nullable Set<T> set,
java.util.function.Predicate<? super T> predicate) {
if (set == null || set.size() == 0) return emptySet();
ArraySet<T> result = null;
if (set instanceof ArraySet) {
ArraySet<T> arraySet = (ArraySet<T>) set;
int size = arraySet.size();
for (int i = 0; i < size; i++) {
final T item = arraySet.valueAt(i);
if (predicate.test(item)) {
result = ArrayUtils.add(result, item);
}
}
} else {
for (T item : set) {
if (predicate.test(item)) {
result = ArrayUtils.add(result, item);
}
}
}
return emptyIfNull(result);
} |
@see #filter(List, java.util.function.Predicate)
| CollectionUtils::filter | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <T> void addIf(@Nullable List<T> source, @NonNull Collection<? super T> dest,
@Nullable Predicate<? super T> predicate) {
for (int i = 0; i < size(source); i++) {
final T item = source.get(i);
if (predicate.test(item)) {
dest.add(item);
}
}
} |
@see #filter(List, java.util.function.Predicate)
public static @NonNull <T> Set<T> filter(@Nullable Set<T> set,
java.util.function.Predicate<? super T> predicate) {
if (set == null || set.size() == 0) return emptySet();
ArraySet<T> result = null;
if (set instanceof ArraySet) {
ArraySet<T> arraySet = (ArraySet<T>) set;
int size = arraySet.size();
for (int i = 0; i < size; i++) {
final T item = arraySet.valueAt(i);
if (predicate.test(item)) {
result = ArrayUtils.add(result, item);
}
}
} else {
for (T item : set) {
if (predicate.test(item)) {
result = ArrayUtils.add(result, item);
}
}
}
return emptyIfNull(result);
}
/** Add all elements matching {@code predicate} in {@code source} to {@code dest}. | CollectionUtils::addIf | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <I, O> List<O> map(@Nullable List<I> cur,
Function<? super I, ? extends O> f) {
if (isEmpty(cur)) return Collections.emptyList();
final ArrayList<O> result = new ArrayList<>();
for (int i = 0; i < cur.size(); i++) {
result.add(f.apply(cur.get(i)));
}
return result;
} |
Returns a list of items resulting from applying the given function to each element of the
provided list.
The resulting list will have the same {@link #size} as the input one.
This is similar to {@link Stream#map} but without the overhead of creating an intermediate
{@link Stream} instance
| CollectionUtils::map | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <I, O> Set<O> map(@Nullable Set<I> cur,
Function<? super I, ? extends O> f) {
if (isEmpty(cur)) return emptySet();
ArraySet<O> result = new ArraySet<>();
if (cur instanceof ArraySet) {
ArraySet<I> arraySet = (ArraySet<I>) cur;
int size = arraySet.size();
for (int i = 0; i < size; i++) {
result.add(f.apply(arraySet.valueAt(i)));
}
} else {
for (I item : cur) {
result.add(f.apply(item));
}
}
return result;
} |
@see #map(List, Function)
| CollectionUtils::map | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <I, O> List<O> mapNotNull(@Nullable List<I> cur,
Function<? super I, ? extends O> f) {
if (isEmpty(cur)) return Collections.emptyList();
List<O> result = null;
for (int i = 0; i < cur.size(); i++) {
O transformed = f.apply(cur.get(i));
if (transformed != null) {
result = add(result, transformed);
}
}
return emptyIfNull(result);
} |
{@link #map(List, Function)} + {@link #filter(List, java.util.function.Predicate)}
Calling this is equivalent (but more memory efficient) to:
{@code
filter(
map(cur, f),
i -> { i != null })
}
| CollectionUtils::mapNotNull | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> emptyIfNull(@Nullable List<T> cur) {
return cur == null ? Collections.emptyList() : cur;
} |
Returns the given list, or an immutable empty list if the provided list is null
This can be used to guarantee null-safety without paying the price of extra allocations
@see Collections#emptyList
| CollectionUtils::emptyIfNull | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> emptyIfNull(@Nullable Set<T> cur) {
return cur == null ? emptySet() : cur;
} |
Returns the given set, or an immutable empty set if the provided set is null
This can be used to guarantee null-safety without paying the price of extra allocations
@see Collections#emptySet
| CollectionUtils::emptyIfNull | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <K, V> Map<K, V> emptyIfNull(@Nullable Map<K, V> cur) {
return cur == null ? Collections.emptyMap() : cur;
} |
Returns the given map, or an immutable empty map if the provided map is null
This can be used to guarantee null-safety without paying the price of extra allocations
@see Collections#emptyMap
| CollectionUtils::emptyIfNull | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static int size(@Nullable Collection<?> cur) {
return cur != null ? cur.size() : 0;
} |
Returns the size of the given collection, or 0 if null
| CollectionUtils::size | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static int size(@Nullable Map<?, ?> cur) {
return cur != null ? cur.size() : 0;
} |
Returns the size of the given map, or 0 if null
| CollectionUtils::size | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static boolean isEmpty(@Nullable Collection<?> cur) {
return size(cur) == 0;
} |
Returns whether the given collection {@link Collection#isEmpty is empty} or {@code null}
| CollectionUtils::isEmpty | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static boolean isEmpty(@Nullable Map<?, ?> cur) {
return size(cur) == 0;
} |
Returns whether the given map {@link Map#isEmpty is empty} or {@code null}
| CollectionUtils::isEmpty | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> filter(@Nullable List<?> list, Class<T> c) {
if (isEmpty(list)) return Collections.emptyList();
ArrayList<T> result = null;
for (int i = 0; i < list.size(); i++) {
final Object item = list.get(i);
if (c.isInstance(item)) {
result = ArrayUtils.add(result, (T) item);
}
}
return emptyIfNull(result);
} |
Returns the elements of the given list that are of type {@code c}
| CollectionUtils::filter | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <T> boolean any(@Nullable List<T> items,
java.util.function.Predicate<T> predicate) {
return find(items, predicate) != null;
} |
Returns whether there exists at least one element in the list for which
condition {@code predicate} is true
| CollectionUtils::any | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <T> boolean any(@Nullable Set<T> items,
java.util.function.Predicate<T> predicate) {
return find(items, predicate) != null;
} |
Returns whether there exists at least one element in the set for which
condition {@code predicate} is true
| CollectionUtils::any | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @Nullable <T> T find(@Nullable List<T> items,
java.util.function.Predicate<T> predicate) {
if (isEmpty(items)) return null;
for (int i = 0; i < items.size(); i++) {
final T item = items.get(i);
if (predicate.test(item)) return item;
}
return null;
} |
Returns the first element from the list for which
condition {@code predicate} is true, or null if there is no such element
| CollectionUtils::find | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @Nullable <T> T find(@Nullable Set<T> cur,
java.util.function.Predicate<T> predicate) {
if (cur == null || predicate == null) return null;
int size = cur.size();
if (size == 0) return null;
try {
if (cur instanceof ArraySet) {
ArraySet<T> arraySet = (ArraySet<T>) cur;
for (int i = 0; i < size; i++) {
T item = arraySet.valueAt(i);
if (predicate.test(item)) {
return item;
}
}
} else {
for (T t : cur) {
if (predicate.test(t)) {
return t;
}
}
}
} catch (Exception e) {
throw ExceptionUtils.propagate(e);
}
return null;
} |
Returns the first element from the set for which
condition {@code predicate} is true, or null if there is no such element
| CollectionUtils::find | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> add(@Nullable List<T> cur, T val) {
if (cur == null || cur == Collections.emptyList()) {
cur = new ArrayList<>();
}
cur.add(val);
return cur;
} |
Similar to {@link List#add}, but with support for list values of {@code null} and
{@link Collections#emptyList}
| CollectionUtils::add | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> add(@Nullable List<T> cur, int index, T val) {
if (cur == null || cur == Collections.emptyList()) {
cur = new ArrayList<>();
}
cur.add(index, val);
return cur;
} |
Similar to {@link List#add(int, Object)}, but with support for list values of {@code null}
and {@link Collections#emptyList}
| CollectionUtils::add | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> addAll(@Nullable Set<T> cur, @Nullable Collection<T> val) {
if (isEmpty(val)) {
return cur != null ? cur : emptySet();
}
if (cur == null || cur == emptySet()) {
cur = new ArraySet<>();
}
cur.addAll(val);
return cur;
} |
Similar to {@link Set#addAll(Collection)}}, but with support for list values of {@code null}
and {@link Collections#emptySet}
| CollectionUtils::addAll | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> add(@Nullable Set<T> cur, T val) {
if (cur == null || cur == emptySet()) {
cur = new ArraySet<>();
}
cur.add(val);
return cur;
} |
@see #add(List, Object)
| CollectionUtils::add | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <K, V> Map<K, V> add(@Nullable Map<K, V> map, K key, V value) {
if (map == null || map == Collections.emptyMap()) {
map = new ArrayMap<>();
}
map.put(key, value);
return map;
} |
@see #add(List, Object)
| CollectionUtils::add | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> remove(@Nullable List<T> cur, T val) {
if (isEmpty(cur)) {
return emptyIfNull(cur);
}
cur.remove(val);
return cur;
} |
Similar to {@link List#remove}, but with support for list values of {@code null} and
{@link Collections#emptyList}
| CollectionUtils::remove | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> remove(@Nullable Set<T> cur, T val) {
if (isEmpty(cur)) {
return emptyIfNull(cur);
}
cur.remove(val);
return cur;
} |
@see #remove(List, Object)
| CollectionUtils::remove | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> copyOf(@Nullable List<T> cur) {
return isEmpty(cur) ? Collections.emptyList() : new ArrayList<>(cur);
} |
@return a list that will not be affected by mutations to the given original list.
| CollectionUtils::copyOf | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> copyOf(@Nullable Set<T> cur) {
return isEmpty(cur) ? emptySet() : new ArraySet<>(cur);
} |
@return a list that will not be affected by mutations to the given original list.
| CollectionUtils::copyOf | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> toSet(@Nullable Collection<T> cur) {
return isEmpty(cur) ? emptySet() : new ArraySet<>(cur);
} |
@return a {@link Set} representing the given collection.
| CollectionUtils::toSet | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <T> void forEach(@Nullable Set<T> cur, @Nullable ThrowingConsumer<T> action) {
if (cur == null || action == null) return;
int size = cur.size();
if (size == 0) return;
try {
if (cur instanceof ArraySet) {
ArraySet<T> arraySet = (ArraySet<T>) cur;
for (int i = 0; i < size; i++) {
action.acceptOrThrow(arraySet.valueAt(i));
}
} else {
for (T t : cur) {
action.acceptOrThrow(t);
}
}
} catch (Exception e) {
throw ExceptionUtils.propagate(e);
}
} |
Applies {@code action} to each element in {@code cur}
This avoids creating an iterator if the given set is an {@link ArraySet}
| CollectionUtils::forEach | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <K, V> void forEach(@Nullable Map<K, V> cur, @Nullable BiConsumer<K, V> action) {
if (cur == null || action == null) {
return;
}
int size = cur.size();
if (size == 0) {
return;
}
if (cur instanceof ArrayMap) {
ArrayMap<K, V> arrayMap = (ArrayMap<K, V>) cur;
for (int i = 0; i < size; i++) {
action.accept(arrayMap.keyAt(i), arrayMap.valueAt(i));
}
} else {
for (K key : cur.keySet()) {
action.accept(key, cur.get(key));
}
}
} |
Applies {@code action} to each element in {@code cur}
This avoids creating an iterator if the given map is an {@link ArrayMap}
For non-{@link ArrayMap}s it avoids creating {@link Map.Entry} instances
| CollectionUtils::forEach | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @Nullable <T> T firstOrNull(@Nullable List<T> cur) {
return isEmpty(cur) ? null : cur.get(0);
} |
@return the first element if not empty/null, null otherwise
| CollectionUtils::firstOrNull | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @Nullable <T> T firstOrNull(@Nullable Collection<T> cur) {
return isEmpty(cur) ? null : cur.iterator().next();
} |
@return the first element if not empty/null, null otherwise
| CollectionUtils::firstOrNull | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> singletonOrEmpty(@Nullable T item) {
return item == null ? Collections.emptyList() : Collections.singletonList(item);
} |
@return list of single given element if it's not null, empty list otherwise
| CollectionUtils::singletonOrEmpty | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/CollectionUtils.java | MIT |
public static void make(Context context, String defaultMmTelPackageName,
String defaultRcsPackageName, int numSlots, ImsFeatureBinderRepository repo) {
if (sInstance == null) {
Looper looper = Looper.getMainLooper();
sInstance = new ImsResolver(context, defaultMmTelPackageName, defaultRcsPackageName,
numSlots, repo, looper);
}
} |
Create the ImsResolver Service singleton instance.
| ImsResolver::make | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/telephony/ims/ImsResolver.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/telephony/ims/ImsResolver.java | MIT |
public static @Nullable ImsResolver getInstance() {
return sInstance;
} |
@return The ImsResolver Service instance. May be {@code null} if no ImsResolver was created
due to IMS not being supported.
| ImsResolver::getInstance | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/telephony/ims/ImsResolver.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/telephony/ims/ImsResolver.java | MIT |
public boolean hasLeapSecond() {
return isFlagSet(HAS_LEAP_SECOND);
} |
Returns {@code true} if {@link #getLeapSecond()} is available, {@code false} otherwise.
| GnssClock::hasLeapSecond | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public int getLeapSecond() {
return mLeapSecond;
} |
Gets the leap second associated with the clock's time.
<p>The sign of the value is defined by the following equation:
<pre>
UtcTimeNanos = TimeNanos - (FullBiasNanos + BiasNanos) - LeapSecond * 1,000,000,000</pre>
<p>The value is only available if {@link #hasLeapSecond()} is {@code true}.
| GnssClock::getLeapSecond | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public long getTimeNanos() {
return mTimeNanos;
} |
Gets the GNSS receiver internal hardware clock value in nanoseconds.
<p>This value is expected to be monotonically increasing while the hardware clock remains
powered on. For the case of a hardware clock that is not continuously on, see the
{@link #getHardwareClockDiscontinuityCount} field. The GPS time can be derived by subtracting
the sum of {@link #getFullBiasNanos()} and {@link #getBiasNanos()} (when they are available)
from this value. Sub-nanosecond accuracy can be provided by means of {@link #getBiasNanos()}.
<p>The error estimate for this value (if applicable) is {@link #getTimeUncertaintyNanos()}.
| GnssClock::getTimeNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasTimeUncertaintyNanos() {
return isFlagSet(HAS_TIME_UNCERTAINTY);
} |
Returns {@code true} if {@link #getTimeUncertaintyNanos()} is available, {@code false}
otherwise.
| GnssClock::hasTimeUncertaintyNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasFullBiasNanos() {
return isFlagSet(HAS_FULL_BIAS);
} |
Returns {@code true} if {@link #getFullBiasNanos()} is available, {@code false} otherwise.
| GnssClock::hasFullBiasNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public long getFullBiasNanos() {
return mFullBiasNanos;
} |
Gets the difference between hardware clock ({@link #getTimeNanos()}) inside GPS receiver and
the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
<p>This value is available if the receiver has estimated GPS time. If the computed time is
for a non-GPS constellation, the time offset of that constellation to GPS has to be applied
to fill this value. The value is only available if {@link #hasFullBiasNanos()} is
{@code true}.
<p>The error estimate for the sum of this field and {@link #getBiasNanos} is
{@link #getBiasUncertaintyNanos()}.
<p>The sign of the value is defined by the following equation:
<pre>
local estimate of GPS time = TimeNanos - (FullBiasNanos + BiasNanos)</pre>
| GnssClock::getFullBiasNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasBiasNanos() {
return isFlagSet(HAS_BIAS);
} |
Returns {@code true} if {@link #getBiasNanos()} is available, {@code false} otherwise.
| GnssClock::hasBiasNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public double getBiasNanos() {
return mBiasNanos;
} |
Gets the clock's sub-nanosecond bias.
<p>See the description of how this field is part of converting from hardware clock time, to
GPS time, in {@link #getFullBiasNanos()}.
<p>The error estimate for the sum of this field and {@link #getFullBiasNanos} is
{@link #getBiasUncertaintyNanos()}.
<p>The value is only available if {@link #hasBiasNanos()} is {@code true}.
| GnssClock::getBiasNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasBiasUncertaintyNanos() {
return isFlagSet(HAS_BIAS_UNCERTAINTY);
} |
Returns {@code true} if {@link #getBiasUncertaintyNanos()} is available, {@code false}
otherwise.
| GnssClock::hasBiasUncertaintyNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasDriftNanosPerSecond() {
return isFlagSet(HAS_DRIFT);
} |
Returns {@code true} if {@link #getDriftNanosPerSecond()} is available, {@code false}
otherwise.
| GnssClock::hasDriftNanosPerSecond | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public double getDriftNanosPerSecond() {
return mDriftNanosPerSecond;
} |
Gets the clock's Drift in nanoseconds per second.
<p>This value is the instantaneous time-derivative of the value provided by
{@link #getBiasNanos()}.
<p>A positive value indicates that the frequency is higher than the nominal (e.g. GPS master
clock) frequency. The error estimate for this reported drift is
{@link #getDriftUncertaintyNanosPerSecond()}.
<p>The value is only available if {@link #hasDriftNanosPerSecond()} is {@code true}.
| GnssClock::getDriftNanosPerSecond | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasDriftUncertaintyNanosPerSecond() {
return isFlagSet(HAS_DRIFT_UNCERTAINTY);
} |
Returns {@code true} if {@link #getDriftUncertaintyNanosPerSecond()} is available,
{@code false} otherwise.
| GnssClock::hasDriftUncertaintyNanosPerSecond | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasElapsedRealtimeNanos() {
return isFlagSet(HAS_ELAPSED_REALTIME_NANOS);
} |
Returns {@code true} if {@link #getElapsedRealtimeNanos()} is available, {@code false}
otherwise.
| GnssClock::hasElapsedRealtimeNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public long getElapsedRealtimeNanos() {
return mElapsedRealtimeNanos;
} |
Returns the elapsed real-time of this clock since system boot, in nanoseconds.
<p>The value is only available if {@link #hasElapsedRealtimeNanos()} is
{@code true}.
| GnssClock::getElapsedRealtimeNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasElapsedRealtimeUncertaintyNanos() {
return isFlagSet(HAS_ELAPSED_REALTIME_UNCERTAINTY_NANOS);
} |
Returns {@code true} if {@link #getElapsedRealtimeUncertaintyNanos()} is available, {@code
false} otherwise.
| GnssClock::hasElapsedRealtimeUncertaintyNanos | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasReferenceConstellationTypeForIsb() {
return isFlagSet(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB);
} |
Returns {@code true} if {@link #getReferenceConstellationTypeForIsb()} is available,
{@code false} otherwise.
| GnssClock::hasReferenceConstellationTypeForIsb | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasReferenceCarrierFrequencyHzForIsb() {
return isFlagSet(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB);
} |
Returns {@code true} if {@link #getReferenceCarrierFrequencyHzForIsb()} is available, {@code
false} otherwise.
| GnssClock::hasReferenceCarrierFrequencyHzForIsb | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public boolean hasReferenceCodeTypeForIsb() {
return isFlagSet(HAS_REFERENCE_CODE_TYPE_FOR_ISB);
} |
Returns {@code true} if {@link #getReferenceCodeTypeForIsb()} is available, {@code
false} otherwise.
| GnssClock::hasReferenceCodeTypeForIsb | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public int getHardwareClockDiscontinuityCount() {
return mHardwareClockDiscontinuityCount;
} |
Gets count of hardware clock discontinuities.
<p>When this value stays the same, vs. a value in a previously reported {@link GnssClock}, it
can be safely assumed that the {@code TimeNanos} value has been derived from a clock that has
been running continuously - e.g. a single continuously powered crystal oscillator, and thus
the {@code (FullBiasNanos + BiasNanos)} offset can be modelled with traditional clock bias
& drift models.
<p>Each time this value changes, vs. the value in a previously reported {@link GnssClock},
that suggests the hardware clock may have experienced a discontinuity (e.g. a power cycle or
other anomaly), so that any assumptions about modelling a smoothly changing
{@code (FullBiasNanos + BiasNanos)} offset, and a smoothly growing {@code (TimeNanos)}
between this and the previously reported {@code GnssClock}, should be reset.
| GnssClock::getHardwareClockDiscontinuityCount | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssClock.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssClock.java | MIT |
public void setDataSource(String path) throws IllegalArgumentException {
if (path == null) {
throw new IllegalArgumentException("null path");
}
final Uri uri = Uri.parse(path);
final String scheme = uri.getScheme();
if ("file".equals(scheme)) {
path = uri.getPath();
} else if (scheme != null) {
setDataSource(path, new HashMap<String, String>());
return;
}
try (FileInputStream is = new FileInputStream(path)) {
FileDescriptor fd = is.getFD();
setDataSource(fd, 0, 0x7ffffffffffffffL);
} catch (FileNotFoundException fileEx) {
throw new IllegalArgumentException(path + " does not exist");
} catch (IOException ioEx) {
throw new IllegalArgumentException("couldn't open " + path);
}
} |
Sets the data source (file pathname) to use. Call this
method before the rest of the methods in this class. This method may be
time-consuming.
@param path The path, or the URI (doesn't support streaming source currently)
of the input media file.
@throws IllegalArgumentException If the path is invalid.
| MediaMetadataRetriever::setDataSource | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public void setDataSource(String uri, Map<String, String> headers)
throws IllegalArgumentException {
int i = 0;
String[] keys = new String[headers.size()];
String[] values = new String[headers.size()];
for (Map.Entry<String, String> entry: headers.entrySet()) {
keys[i] = entry.getKey();
values[i] = entry.getValue();
++i;
}
_setDataSource(
MediaHTTPService.createHttpServiceBinderIfNecessary(uri),
uri,
keys,
values);
} |
Sets the data source (URI) to use. Call this
method before the rest of the methods in this class. This method may be
time-consuming.
@param uri The URI of the input media.
@param headers the headers to be sent together with the request for the data
@throws IllegalArgumentException If the URI is invalid.
| MediaMetadataRetriever::setDataSource | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public void setDataSource(FileDescriptor fd, long offset, long length)
throws IllegalArgumentException {
try (ParcelFileDescriptor modernFd = FileUtils.convertToModernFd(fd)) {
if (modernFd == null) {
_setDataSource(fd, offset, length);
} else {
_setDataSource(modernFd.getFileDescriptor(), offset, length);
}
} catch (IOException e) {
Log.w(TAG, "Ignoring IO error while setting data source", e);
}
} |
Sets the data source (FileDescriptor) to use. It is the caller's
responsibility to close the file descriptor. It is safe to do so as soon
as this call returns. Call this method before the rest of the methods in
this class. This method may be time-consuming.
@param fd the FileDescriptor for the file you want to play
@param offset the offset into the file where the data to be played starts,
in bytes. It must be non-negative
@param length the length in bytes of the data to be played. It must be
non-negative.
@throws IllegalArgumentException if the arguments are invalid
| MediaMetadataRetriever::setDataSource | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public void setDataSource(FileDescriptor fd)
throws IllegalArgumentException {
// intentionally less than LONG_MAX
setDataSource(fd, 0, 0x7ffffffffffffffL);
} |
Sets the data source (FileDescriptor) to use. It is the caller's
responsibility to close the file descriptor. It is safe to do so as soon
as this call returns. Call this method before the rest of the methods in
this class. This method may be time-consuming.
@param fd the FileDescriptor for the file you want to play
@throws IllegalArgumentException if the FileDescriptor is invalid
| MediaMetadataRetriever::setDataSource | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public void setDataSource(Context context, Uri uri)
throws IllegalArgumentException, SecurityException {
if (uri == null) {
throw new IllegalArgumentException("null uri");
}
String scheme = uri.getScheme();
if(scheme == null || scheme.equals("file")) {
setDataSource(uri.getPath());
return;
}
AssetFileDescriptor fd = null;
try {
ContentResolver resolver = context.getContentResolver();
try {
boolean optimize =
SystemProperties.getBoolean("fuse.sys.transcode_retriever_optimize", false);
Bundle opts = new Bundle();
opts.putBoolean("android.provider.extra.ACCEPT_ORIGINAL_MEDIA_FORMAT", true);
fd = optimize ? resolver.openTypedAssetFileDescriptor(uri, "*/*", opts)
: resolver.openAssetFileDescriptor(uri, "r");
} catch(FileNotFoundException e) {
throw new IllegalArgumentException("could not access " + uri);
}
if (fd == null) {
throw new IllegalArgumentException("got null FileDescriptor for " + uri);
}
FileDescriptor descriptor = fd.getFileDescriptor();
if (!descriptor.valid()) {
throw new IllegalArgumentException("got invalid FileDescriptor for " + uri);
}
// Note: using getDeclaredLength so that our behavior is the same
// as previous versions when the content provider is returning
// a full file.
if (fd.getDeclaredLength() < 0) {
setDataSource(descriptor);
} else {
setDataSource(descriptor, fd.getStartOffset(), fd.getDeclaredLength());
}
return;
} catch (SecurityException ex) {
} finally {
try {
if (fd != null) {
fd.close();
}
} catch(IOException ioEx) {
}
}
setDataSource(uri.toString());
} |
Sets the data source as a content Uri. Call this method before
the rest of the methods in this class. This method may be time-consuming.
@param context the Context to use when resolving the Uri
@param uri the Content URI of the data you want to play
@throws IllegalArgumentException if the Uri is invalid
@throws SecurityException if the Uri cannot be used due to lack of
permission.
| MediaMetadataRetriever::setDataSource | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public void setDataSource(MediaDataSource dataSource)
throws IllegalArgumentException {
_setDataSource(dataSource);
} |
Sets the data source (MediaDataSource) to use.
@param dataSource the MediaDataSource for the media you want to play
| MediaMetadataRetriever::setDataSource | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable String extractMetadata(int keyCode) {
String meta = nativeExtractMetadata(keyCode);
if (keyCode == METADATA_KEY_GENRE) {
// translate numeric genre code(s) to human readable
meta = convertGenreTag(meta);
}
return meta;
} |
Call this method after setDataSource(). This method retrieves the
meta data value associated with the keyCode.
The keyCode currently supported is listed below as METADATA_XXX
constants. With any other value, it returns a null pointer.
@param keyCode One of the constants listed below at the end of the class.
@return The meta data value associate with the given keyCode on success;
null on failure.
| MediaMetadataRetriever::extractMetadata | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
private String convertGenreTag(String meta) {
if (TextUtils.isEmpty(meta)) {
return null;
}
if (Character.isDigit(meta.charAt(0))) {
// assume a single id3v1-style bare number without any extra characters
try {
int genreIndex = Integer.parseInt(meta);
if (genreIndex >= 0 && genreIndex < STANDARD_GENRES.length) {
return STANDARD_GENRES[genreIndex];
}
} catch (NumberFormatException e) {
// ignore and fall through
}
return null;
} else {
// assume id3v2-style genre tag, with parenthesized numeric genres
// and/or literal genre strings, possibly more than one per tag.
StringBuilder genres = null;
String nextGenre = null;
while (true) {
if (!TextUtils.isEmpty(nextGenre)) {
if (genres == null) {
genres = new StringBuilder();
}
if (genres.length() != 0) {
genres.append(", ");
}
genres.append(nextGenre);
nextGenre = null;
}
if (TextUtils.isEmpty(meta)) {
// entire tag has been processed.
break;
}
if (meta.startsWith("(RX)")) {
nextGenre = "Remix";
meta = meta.substring(4);
} else if (meta.startsWith("(CR)")) {
nextGenre = "Cover";
meta = meta.substring(4);
} else if (meta.startsWith("((")) {
// the id3v2 spec says that custom genres that start with a parenthesis
// should be "escaped" with another parenthesis, however the spec doesn't
// specify escaping parentheses inside the custom string. We'll parse any
// such strings until a closing parenthesis is found, or the end of
// the tag is reached.
int closeParenOffset = meta.indexOf(')');
if (closeParenOffset == -1) {
// string continues to end of tag
nextGenre = meta.substring(1);
meta = "";
} else {
nextGenre = meta.substring(1, closeParenOffset + 1);
meta = meta.substring(closeParenOffset + 1);
}
} else if (meta.startsWith("(")) {
// should be a parenthesized numeric genre
int closeParenOffset = meta.indexOf(')');
if (closeParenOffset == -1) {
return null;
}
String genreNumString = meta.substring(1, closeParenOffset);
try {
int genreIndex = Integer.parseInt(genreNumString.toString());
if (genreIndex >= 0 && genreIndex < STANDARD_GENRES.length) {
nextGenre = STANDARD_GENRES[genreIndex];
} else {
return null;
}
} catch (NumberFormatException e) {
return null;
}
meta = meta.substring(closeParenOffset + 1);
} else {
// custom genre
nextGenre = meta;
meta = "";
}
}
return genres == null || genres.length() == 0 ? null : genres.toString();
}
} |
Call this method after setDataSource(). This method retrieves the
meta data value associated with the keyCode.
The keyCode currently supported is listed below as METADATA_XXX
constants. With any other value, it returns a null pointer.
@param keyCode One of the constants listed below at the end of the class.
@return The meta data value associate with the given keyCode on success;
null on failure.
public @Nullable String extractMetadata(int keyCode) {
String meta = nativeExtractMetadata(keyCode);
if (keyCode == METADATA_KEY_GENRE) {
// translate numeric genre code(s) to human readable
meta = convertGenreTag(meta);
}
return meta;
}
/*
The id3v2 spec doesn't specify the syntax of the genre tag very precisely, so
some assumptions are made. Using one possible interpretation of the id3v2
spec, this method converts an id3 genre tag string to a human readable string,
as follows:
- if the first character of the tag is a digit, the entire tag is assumed to
be an id3v1 numeric genre code. If the tag does not parse to a number, or
the number is outside the range of defined standard genres, it is ignored.
- if the tag does not start with a digit, it is assumed to be an id3v2 style
tag consisting of one or more genres, with each genre being either a parenthesized
integer referring to an id3v1 numeric genre code, the special indicators "(CR)" or
"(RX)" (for "Cover" or "Remix", respectively), or a custom genre string. When
a custom genre string is encountered, it is assumed to continue until the end
of the tag, unless it starts with "((" in which case it is assumed to continue
until the next close-parenthesis or the end of the tag. Any parse error in the tag
causes it to be ignored.
The human-readable genre string is not localized, and uses the English genre names
from the spec.
| MediaMetadataRetriever::convertGenreTag | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getFrameAtTime(long timeUs, @Option int option) {
if (option < OPTION_PREVIOUS_SYNC ||
option > OPTION_CLOSEST) {
throw new IllegalArgumentException("Unsupported option: " + option);
}
return _getFrameAtTime(timeUs, option, -1 /*dst_width*/, -1 /*dst_height*/, null);
} |
This method is similar to {@link #getFrameAtTime(long, int, BitmapParams)}
except that the device will choose the actual {@link Bitmap.Config} to use.
@param timeUs The time position where the frame will be retrieved.
When retrieving the frame at the given time position, there is no
guarantee that the data source has a frame located at the position.
When this happens, a frame nearby will be returned. If timeUs is
negative, time position and option will ignored, and any frame
that the implementation considers as representative may be returned.
@param option a hint on how the frame is found. Use
{@link #OPTION_PREVIOUS_SYNC} if one wants to retrieve a sync frame
that has a timestamp earlier than or the same as timeUs. Use
{@link #OPTION_NEXT_SYNC} if one wants to retrieve a sync frame
that has a timestamp later than or the same as timeUs. Use
{@link #OPTION_CLOSEST_SYNC} if one wants to retrieve a sync frame
that has a timestamp closest to or the same as timeUs. Use
{@link #OPTION_CLOSEST} if one wants to retrieve a frame that may
or may not be a sync frame but is closest to or the same as timeUs.
{@link #OPTION_CLOSEST} often has larger performance overhead compared
to the other options if there is no sync frame located at timeUs.
@return A Bitmap containing a representative video frame, which can be null,
if such a frame cannot be retrieved. {@link Bitmap#getConfig()} can
be used to query the actual {@link Bitmap.Config}.
@see #getFrameAtTime(long, int, BitmapParams)
| MediaMetadataRetriever::getFrameAtTime | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getFrameAtTime(
long timeUs, @Option int option, @NonNull BitmapParams params) {
if (option < OPTION_PREVIOUS_SYNC ||
option > OPTION_CLOSEST) {
throw new IllegalArgumentException("Unsupported option: " + option);
}
return _getFrameAtTime(timeUs, option, -1 /*dst_width*/, -1 /*dst_height*/, params);
} |
Call this method after setDataSource(). This method finds a
representative frame close to the given time position by considering
the given option if possible, and returns it as a bitmap.
<p>If you don't need a full-resolution
frame (for example, because you need a thumbnail image), use
{@link #getScaledFrameAtTime getScaledFrameAtTime()} instead of this
method.</p>
@param timeUs The time position where the frame will be retrieved.
When retrieving the frame at the given time position, there is no
guarantee that the data source has a frame located at the position.
When this happens, a frame nearby will be returned. If timeUs is
negative, time position and option will ignored, and any frame
that the implementation considers as representative may be returned.
@param option a hint on how the frame is found. Use
{@link #OPTION_PREVIOUS_SYNC} if one wants to retrieve a sync frame
that has a timestamp earlier than or the same as timeUs. Use
{@link #OPTION_NEXT_SYNC} if one wants to retrieve a sync frame
that has a timestamp later than or the same as timeUs. Use
{@link #OPTION_CLOSEST_SYNC} if one wants to retrieve a sync frame
that has a timestamp closest to or the same as timeUs. Use
{@link #OPTION_CLOSEST} if one wants to retrieve a frame that may
or may not be a sync frame but is closest to or the same as timeUs.
{@link #OPTION_CLOSEST} often has larger performance overhead compared
to the other options if there is no sync frame located at timeUs.
@param params BitmapParams that controls the returned bitmap config
(such as pixel formats).
@return A Bitmap containing a representative video frame, which
can be null, if such a frame cannot be retrieved.
@see #getFrameAtTime(long, int)
| MediaMetadataRetriever::getFrameAtTime | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getScaledFrameAtTime(long timeUs, @Option int option,
@IntRange(from=1) int dstWidth, @IntRange(from=1) int dstHeight) {
validate(option, dstWidth, dstHeight);
return _getFrameAtTime(timeUs, option, dstWidth, dstHeight, null);
} |
This method is similar to {@link #getScaledFrameAtTime(long, int, int, int, BitmapParams)}
except that the device will choose the actual {@link Bitmap.Config} to use.
@param timeUs The time position in microseconds where the frame will be retrieved.
When retrieving the frame at the given time position, there is no
guarantee that the data source has a frame located at the position.
When this happens, a frame nearby will be returned. If timeUs is
negative, time position and option will ignored, and any frame
that the implementation considers as representative may be returned.
@param option a hint on how the frame is found. Use
{@link #OPTION_PREVIOUS_SYNC} if one wants to retrieve a sync frame
that has a timestamp earlier than or the same as timeUs. Use
{@link #OPTION_NEXT_SYNC} if one wants to retrieve a sync frame
that has a timestamp later than or the same as timeUs. Use
{@link #OPTION_CLOSEST_SYNC} if one wants to retrieve a sync frame
that has a timestamp closest to or the same as timeUs. Use
{@link #OPTION_CLOSEST} if one wants to retrieve a frame that may
or may not be a sync frame but is closest to or the same as timeUs.
{@link #OPTION_CLOSEST} often has larger performance overhead compared
to the other options if there is no sync frame located at timeUs.
@param dstWidth expected output bitmap width
@param dstHeight expected output bitmap height
@return A Bitmap containing a representative video frame, which can be null,
if such a frame cannot be retrieved. {@link Bitmap#getConfig()} can
be used to query the actual {@link Bitmap.Config}.
@throws IllegalArgumentException if passed in invalid option or width by height
is less than or equal to 0.
@see #getScaledFrameAtTime(long, int, int, int, BitmapParams)
| MediaMetadataRetriever::getScaledFrameAtTime | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getScaledFrameAtTime(long timeUs, @Option int option,
@IntRange(from=1) int dstWidth, @IntRange(from=1) int dstHeight,
@NonNull BitmapParams params) {
validate(option, dstWidth, dstHeight);
return _getFrameAtTime(timeUs, option, dstWidth, dstHeight, params);
} |
Retrieve a video frame near a given timestamp scaled to a desired size.
Call this method after setDataSource(). This method finds a representative
frame close to the given time position by considering the given option
if possible, and returns it as a bitmap with same aspect ratio as the source
while scaling it so that it fits into the desired size of dst_width by dst_height.
This is useful for generating a thumbnail for an input data source or just to
obtain a scaled frame at the given time position.
@param timeUs The time position in microseconds where the frame will be retrieved.
When retrieving the frame at the given time position, there is no
guarantee that the data source has a frame located at the position.
When this happens, a frame nearby will be returned. If timeUs is
negative, time position and option will ignored, and any frame
that the implementation considers as representative may be returned.
@param option a hint on how the frame is found. Use
{@link #OPTION_PREVIOUS_SYNC} if one wants to retrieve a sync frame
that has a timestamp earlier than or the same as timeUs. Use
{@link #OPTION_NEXT_SYNC} if one wants to retrieve a sync frame
that has a timestamp later than or the same as timeUs. Use
{@link #OPTION_CLOSEST_SYNC} if one wants to retrieve a sync frame
that has a timestamp closest to or the same as timeUs. Use
{@link #OPTION_CLOSEST} if one wants to retrieve a frame that may
or may not be a sync frame but is closest to or the same as timeUs.
{@link #OPTION_CLOSEST} often has larger performance overhead compared
to the other options if there is no sync frame located at timeUs.
@param dstWidth expected output bitmap width
@param dstHeight expected output bitmap height
@param params BitmapParams that controls the returned bitmap config
(such as pixel formats).
@return A Bitmap of size not larger than dstWidth by dstHeight containing a
scaled video frame, which can be null, if such a frame cannot be retrieved.
@throws IllegalArgumentException if passed in invalid option or width by height
is less than or equal to 0.
@see #getScaledFrameAtTime(long, int, int, int)
| MediaMetadataRetriever::getScaledFrameAtTime | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getFrameAtTime(long timeUs) {
return getFrameAtTime(timeUs, OPTION_CLOSEST_SYNC);
} |
Call this method after setDataSource(). This method finds a
representative frame close to the given time position if possible,
and returns it as a bitmap. Call this method if one does not care
how the frame is found as long as it is close to the given time;
otherwise, please call {@link #getFrameAtTime(long, int)}.
<p>If you don't need a full-resolution
frame (for example, because you need a thumbnail image), use
{@link #getScaledFrameAtTime getScaledFrameAtTime()} instead of this
method.</p>
@param timeUs The time position where the frame will be retrieved.
When retrieving the frame at the given time position, there is no
guarentee that the data source has a frame located at the position.
When this happens, a frame nearby will be returned. If timeUs is
negative, time position and option will ignored, and any frame
that the implementation considers as representative may be returned.
@return A Bitmap of size dst_widthxdst_height containing a representative
video frame, which can be null, if such a frame cannot be retrieved.
@see #getFrameAtTime(long, int)
| MediaMetadataRetriever::getFrameAtTime | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getFrameAtTime() {
return _getFrameAtTime(
-1, OPTION_CLOSEST_SYNC, -1 /*dst_width*/, -1 /*dst_height*/, null);
} |
Call this method after setDataSource(). This method finds a
representative frame at any time position if possible,
and returns it as a bitmap. Call this method if one does not
care about where the frame is located; otherwise, please call
{@link #getFrameAtTime(long)} or {@link #getFrameAtTime(long, int)}
<p>If you don't need a full-resolution
frame (for example, because you need a thumbnail image), use
{@link #getScaledFrameAtTime getScaledFrameAtTime()} instead of this
method.</p>
@return A Bitmap containing a representative video frame, which
can be null, if such a frame cannot be retrieved.
@see #getFrameAtTime(long)
@see #getFrameAtTime(long, int)
| MediaMetadataRetriever::getFrameAtTime | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public BitmapParams() {} |
Create a default BitmapParams object. By default, it uses {@link Bitmap.Config#ARGB_8888}
as the preferred bitmap config.
| BitmapParams::BitmapParams | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public void setPreferredConfig(@NonNull Bitmap.Config config) {
if (config == null) {
throw new IllegalArgumentException("preferred config can't be null");
}
inPreferredConfig = config;
} |
Set the preferred bitmap config for the decoder to decode into.
If not set, or the request cannot be met, the decoder will output
in {@link Bitmap.Config#ARGB_8888} config by default.
After decode, the actual config used can be retrieved by {@link #getActualConfig()}.
@param config the preferred bitmap config to use.
| BitmapParams::setPreferredConfig | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @NonNull Bitmap.Config getPreferredConfig() {
return inPreferredConfig;
} |
Retrieve the preferred bitmap config in the params.
@return the preferred bitmap config.
| BitmapParams::getPreferredConfig | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @NonNull Bitmap.Config getActualConfig() {
return outActualConfig;
} |
Get the actual bitmap config used to decode the bitmap after the decoding.
@return the actual bitmap config used.
| BitmapParams::getActualConfig | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getFrameAtIndex(int frameIndex, @NonNull BitmapParams params) {
List<Bitmap> bitmaps = getFramesAtIndex(frameIndex, 1, params);
return bitmaps.get(0);
} |
This method retrieves a video frame by its index. It should only be called
after {@link #setDataSource}.
After the bitmap is returned, you can query the actual parameters that were
used to create the bitmap from the {@code BitmapParams} argument, for instance
to query the bitmap config used for the bitmap with {@link BitmapParams#getActualConfig}.
@param frameIndex 0-based index of the video frame. The frame index must be that of
a valid frame. The total number of frames available for retrieval can be queried
via the {@link #METADATA_KEY_VIDEO_FRAME_COUNT} key.
@param params BitmapParams that controls the returned bitmap config (such as pixel formats).
@throws IllegalStateException if the container doesn't contain video or image sequences.
@throws IllegalArgumentException if the requested frame index does not exist.
@return A Bitmap containing the requested video frame, or null if the retrieval fails.
@see #getFrameAtIndex(int)
@see #getFramesAtIndex(int, int, BitmapParams)
@see #getFramesAtIndex(int, int)
| BitmapParams::getFrameAtIndex | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getFrameAtIndex(int frameIndex) {
List<Bitmap> bitmaps = getFramesAtIndex(frameIndex, 1);
return bitmaps.get(0);
} |
This method is similar to {@link #getFrameAtIndex(int, BitmapParams)} except that
the default for {@link BitmapParams} will be used.
@param frameIndex 0-based index of the video frame. The frame index must be that of
a valid frame. The total number of frames available for retrieval can be queried
via the {@link #METADATA_KEY_VIDEO_FRAME_COUNT} key.
@throws IllegalStateException if the container doesn't contain video or image sequences.
@throws IllegalArgumentException if the requested frame index does not exist.
@return A Bitmap containing the requested video frame, or null if the retrieval fails.
@see #getFrameAtIndex(int, BitmapParams)
@see #getFramesAtIndex(int, int, BitmapParams)
@see #getFramesAtIndex(int, int)
| BitmapParams::getFrameAtIndex | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @NonNull List<Bitmap> getFramesAtIndex(
int frameIndex, int numFrames, @NonNull BitmapParams params) {
return getFramesAtIndexInternal(frameIndex, numFrames, params);
} |
This method retrieves a consecutive set of video frames starting at the
specified index. It should only be called after {@link #setDataSource}.
If the caller intends to retrieve more than one consecutive video frames,
this method is preferred over {@link #getFrameAtIndex(int, BitmapParams)} for efficiency.
After the bitmaps are returned, you can query the actual parameters that were
used to create the bitmaps from the {@code BitmapParams} argument, for instance
to query the bitmap config used for the bitmaps with {@link BitmapParams#getActualConfig}.
@param frameIndex 0-based index of the first video frame to retrieve. The frame index
must be that of a valid frame. The total number of frames available for retrieval
can be queried via the {@link #METADATA_KEY_VIDEO_FRAME_COUNT} key.
@param numFrames number of consecutive video frames to retrieve. Must be a positive
value. The stream must contain at least numFrames frames starting at frameIndex.
@param params BitmapParams that controls the returned bitmap config (such as pixel formats).
@throws IllegalStateException if the container doesn't contain video or image sequences.
@throws IllegalArgumentException if the frameIndex or numFrames is invalid, or the
stream doesn't contain at least numFrames starting at frameIndex.
@return An list of Bitmaps containing the requested video frames. The returned
array could contain less frames than requested if the retrieval fails.
@see #getFrameAtIndex(int, BitmapParams)
@see #getFrameAtIndex(int)
@see #getFramesAtIndex(int, int)
| BitmapParams::getFramesAtIndex | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @NonNull List<Bitmap> getFramesAtIndex(int frameIndex, int numFrames) {
return getFramesAtIndexInternal(frameIndex, numFrames, null);
} |
This method is similar to {@link #getFramesAtIndex(int, int, BitmapParams)} except that
the default for {@link BitmapParams} will be used.
@param frameIndex 0-based index of the first video frame to retrieve. The frame index
must be that of a valid frame. The total number of frames available for retrieval
can be queried via the {@link #METADATA_KEY_VIDEO_FRAME_COUNT} key.
@param numFrames number of consecutive video frames to retrieve. Must be a positive
value. The stream must contain at least numFrames frames starting at frameIndex.
@throws IllegalStateException if the container doesn't contain video or image sequences.
@throws IllegalArgumentException if the frameIndex or numFrames is invalid, or the
stream doesn't contain at least numFrames starting at frameIndex.
@return An list of Bitmaps containing the requested video frames. The returned
array could contain less frames than requested if the retrieval fails.
@see #getFrameAtIndex(int, BitmapParams)
@see #getFrameAtIndex(int)
@see #getFramesAtIndex(int, int, BitmapParams)
| BitmapParams::getFramesAtIndex | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getImageAtIndex(int imageIndex, @NonNull BitmapParams params) {
return getImageAtIndexInternal(imageIndex, params);
} |
This method retrieves a still image by its index. It should only be called
after {@link #setDataSource}.
After the bitmap is returned, you can query the actual parameters that were
used to create the bitmap from the {@code BitmapParams} argument, for instance
to query the bitmap config used for the bitmap with {@link BitmapParams#getActualConfig}.
@param imageIndex 0-based index of the image.
@param params BitmapParams that controls the returned bitmap config (such as pixel formats).
@throws IllegalStateException if the container doesn't contain still images.
@throws IllegalArgumentException if the requested image does not exist.
@return the requested still image, or null if the image cannot be retrieved.
@see #getImageAtIndex(int)
@see #getPrimaryImage(BitmapParams)
@see #getPrimaryImage()
| BitmapParams::getImageAtIndex | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getImageAtIndex(int imageIndex) {
return getImageAtIndexInternal(imageIndex, null);
} |
This method is similar to {@link #getImageAtIndex(int, BitmapParams)} except that
the default for {@link BitmapParams} will be used.
@param imageIndex 0-based index of the image.
@throws IllegalStateException if the container doesn't contain still images.
@throws IllegalArgumentException if the requested image does not exist.
@return the requested still image, or null if the image cannot be retrieved.
@see #getImageAtIndex(int, BitmapParams)
@see #getPrimaryImage(BitmapParams)
@see #getPrimaryImage()
| BitmapParams::getImageAtIndex | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getPrimaryImage(@NonNull BitmapParams params) {
return getImageAtIndexInternal(-1, params);
} |
This method retrieves the primary image of the media content. It should only
be called after {@link #setDataSource}.
After the bitmap is returned, you can query the actual parameters that were
used to create the bitmap from the {@code BitmapParams} argument, for instance
to query the bitmap config used for the bitmap with {@link BitmapParams#getActualConfig}.
@param params BitmapParams that controls the returned bitmap config (such as pixel formats).
@return the primary image, or null if it cannot be retrieved.
@throws IllegalStateException if the container doesn't contain still images.
@see #getImageAtIndex(int, BitmapParams)
@see #getImageAtIndex(int)
@see #getPrimaryImage()
| BitmapParams::getPrimaryImage | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable Bitmap getPrimaryImage() {
return getImageAtIndexInternal(-1, null);
} |
This method is similar to {@link #getPrimaryImage(BitmapParams)} except that
the default for {@link BitmapParams} will be used.
@return the primary image, or null if it cannot be retrieved.
@throws IllegalStateException if the container doesn't contain still images.
@see #getImageAtIndex(int, BitmapParams)
@see #getImageAtIndex(int)
@see #getPrimaryImage(BitmapParams)
| BitmapParams::getPrimaryImage | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public @Nullable byte[] getEmbeddedPicture() {
return getEmbeddedPicture(EMBEDDED_PICTURE_TYPE_ANY);
} |
Call this method after setDataSource(). This method finds the optional
graphic or album/cover art associated associated with the data source. If
there are more than one pictures, (any) one of them is returned.
@return null if no such graphic is found.
| BitmapParams::getEmbeddedPicture | java | Reginer/aosp-android-jar | android-35/src/android/media/MediaMetadataRetriever.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaMetadataRetriever.java | MIT |
public void setDismissHandler(KeyguardDismissHandler dismissHandler) {
mDismissHandler = dismissHandler;
} |
Executes actions that require the screen to be unlocked. Delegates the actual handling to an
implementation passed via {@link #setDismissHandler}.
@SysUISingleton
public class KeyguardDismissUtil implements KeyguardDismissHandler {
private static final String TAG = "KeyguardDismissUtil";
private volatile KeyguardDismissHandler mDismissHandler;
@Inject
public KeyguardDismissUtil() {
}
/** Sets the actual {@link KeyguardDismissHandler} implementation. | KeyguardDismissUtil::setDismissHandler | java | Reginer/aosp-android-jar | android-34/src/com/android/systemui/statusbar/phone/KeyguardDismissUtil.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/phone/KeyguardDismissUtil.java | MIT |
public static VoiceCallRatTracker fromProto(VoiceCallRatUsage[] usages) {
VoiceCallRatTracker tracker = new VoiceCallRatTracker();
if (usages == null) {
Rlog.e(TAG, "fromProto: usages=null");
} else {
Arrays.stream(usages).forEach(e -> tracker.addProto(e));
}
return tracker;
} |
Uses a HashMap to track carrier and RAT usage, in terms of duration and number of calls.
<p>This tracker is first used by each call, and then used for aggregating usages across calls.
<p>This class is not thread-safe. Callers (from {@link PersistAtomsStorage} and {@link
VoiceCallSessionStats}) should ensure each instance of this class is accessed by only one thread
at a time.
public class VoiceCallRatTracker {
private static final String TAG = VoiceCallRatTracker.class.getSimpleName();
/** A Map holding all carrier-RAT combinations and corresponding durations and call counts.
private final Map<Key, Value> mRatUsageMap = new HashMap<>();
/** Tracks last carrier/RAT combination during a call.
private Key mLastKey;
/** Tracks the time when last carrier/RAT combination was updated.
private long mLastKeyTimestampMillis;
/** Creates an empty RAT tracker for each call.
VoiceCallRatTracker() {
clear();
}
/** Creates an RAT tracker from saved atoms at startup. | getSimpleName::fromProto | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/metrics/VoiceCallRatTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/metrics/VoiceCallRatTracker.java | MIT |
public VoiceCallRatUsage[] toProto() {
return mRatUsageMap.entrySet().stream()
.map(VoiceCallRatTracker::entryToProto)
.toArray(VoiceCallRatUsage[]::new);
} |
Uses a HashMap to track carrier and RAT usage, in terms of duration and number of calls.
<p>This tracker is first used by each call, and then used for aggregating usages across calls.
<p>This class is not thread-safe. Callers (from {@link PersistAtomsStorage} and {@link
VoiceCallSessionStats}) should ensure each instance of this class is accessed by only one thread
at a time.
public class VoiceCallRatTracker {
private static final String TAG = VoiceCallRatTracker.class.getSimpleName();
/** A Map holding all carrier-RAT combinations and corresponding durations and call counts.
private final Map<Key, Value> mRatUsageMap = new HashMap<>();
/** Tracks last carrier/RAT combination during a call.
private Key mLastKey;
/** Tracks the time when last carrier/RAT combination was updated.
private long mLastKeyTimestampMillis;
/** Creates an empty RAT tracker for each call.
VoiceCallRatTracker() {
clear();
}
/** Creates an RAT tracker from saved atoms at startup.
public static VoiceCallRatTracker fromProto(VoiceCallRatUsage[] usages) {
VoiceCallRatTracker tracker = new VoiceCallRatTracker();
if (usages == null) {
Rlog.e(TAG, "fromProto: usages=null");
} else {
Arrays.stream(usages).forEach(e -> tracker.addProto(e));
}
return tracker;
}
/** Append the map to javanano persist atoms. | getSimpleName::toProto | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/metrics/VoiceCallRatTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/metrics/VoiceCallRatTracker.java | MIT |
public IImsRegistrationListener getRegistrationListener() {
return mListener;
} |
Need access to the listener in order to register for events in MMTelFeature adapter
| ImsRegistrationCompatAdapter::getRegistrationListener | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/ims/ImsRegistrationCompatAdapter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/ims/ImsRegistrationCompatAdapter.java | MIT |
public void keepNamespaceAttributes() {
this.keepNamespaceAttributes = true;
} |
Retains namespace attributes like {@code xmlns="http://foo"} or {@code xmlns:foo="http:foo"}
in pulled elements. Most applications will only be interested in the effective namespaces of
their elements, so these attributes aren't useful. But for structure preserving wrappers like
DOM, it is necessary to keep the namespace data around.
| KXmlParser::keepNamespaceAttributes | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private String readUntil(char[] delimiter, boolean returnText)
throws IOException, XmlPullParserException {
int start = position;
StringBuilder result = null;
if (returnText && text != null) {
result = new StringBuilder();
result.append(text);
}
search:
while (true) {
if (position + delimiter.length > limit) {
if (start < position && returnText) {
if (result == null) {
result = new StringBuilder();
}
result.append(buffer, start, position - start);
}
if (!fillBuffer(delimiter.length)) {
checkRelaxed(UNEXPECTED_EOF);
type = COMMENT;
return null;
}
start = position;
}
// TODO: replace with Arrays.equals(buffer, position, delimiter, 0, delimiter.length)
// when the VM has better method inlining
for (int i = 0; i < delimiter.length; i++) {
if (buffer[position + i] != delimiter[i]) {
position++;
continue search;
}
}
break;
}
int end = position;
position += delimiter.length;
if (!returnText) {
return null;
} else if (result == null) {
return stringPool.get(buffer, start, end - start);
} else {
result.append(buffer, start, end - start);
return result.toString();
}
} |
Reads text until the specified delimiter is encountered. Consumes the
text and the delimiter.
@param returnText true to return the read text excluding the delimiter;
false to return null.
| KXmlParser::readUntil | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void readXmlDeclaration() throws IOException, XmlPullParserException {
if (bufferStartLine != 0 || bufferStartColumn != 0 || position != 0) {
checkRelaxed("processing instructions must not start with xml");
}
read(START_PROCESSING_INSTRUCTION);
parseStartTag(true, true);
if (attributeCount < 1 || !"version".equals(attributes[2])) {
checkRelaxed("version expected");
}
version = attributes[3];
int pos = 1;
if (pos < attributeCount && "encoding".equals(attributes[2 + 4])) {
encoding = attributes[3 + 4];
pos++;
}
if (pos < attributeCount && "standalone".equals(attributes[4 * pos + 2])) {
String st = attributes[3 + 4 * pos];
if ("yes".equals(st)) {
standalone = Boolean.TRUE;
} else if ("no".equals(st)) {
standalone = Boolean.FALSE;
} else {
checkRelaxed("illegal standalone value: " + st);
}
pos++;
}
if (pos != attributeCount) {
checkRelaxed("unexpected attributes in XML declaration");
}
isWhitespace = true;
text = null;
} |
Returns true if an XML declaration was read.
| KXmlParser::readXmlDeclaration | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void readDoctype(boolean saveDtdText) throws IOException, XmlPullParserException {
read(START_DOCTYPE);
int startPosition = -1;
if (saveDtdText) {
bufferCapture = new StringBuilder();
startPosition = position;
}
try {
skip();
rootElementName = readName();
readExternalId(true, true);
skip();
if (peekCharacter() == '[') {
readInternalSubset();
}
skip();
} finally {
if (saveDtdText) {
bufferCapture.append(buffer, 0, position);
bufferCapture.delete(0, startPosition);
text = bufferCapture.toString();
bufferCapture = null;
}
}
read('>');
skip();
} |
Read the document's DTD. Although this parser is non-validating, the DTD
must be parsed to capture entity values and default attribute values.
| KXmlParser::readDoctype | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private boolean readExternalId(boolean requireSystemName, boolean assignFields)
throws IOException, XmlPullParserException {
skip();
int c = peekCharacter();
if (c == 'S') {
read(SYSTEM);
} else if (c == 'P') {
read(PUBLIC);
skip();
if (assignFields) {
publicId = readQuotedId(true);
} else {
readQuotedId(false);
}
} else {
return false;
}
skip();
if (!requireSystemName) {
int delimiter = peekCharacter();
if (delimiter != '"' && delimiter != '\'') {
return true; // no system name!
}
}
if (assignFields) {
systemId = readQuotedId(true);
} else {
readQuotedId(false);
}
return true;
} |
Reads an external ID of one of these two forms:
SYSTEM "quoted system name"
PUBLIC "quoted public id" "quoted system name"
If the system name is not required, this also supports lone public IDs of
this form:
PUBLIC "quoted public id"
Returns true if any ID was read.
| KXmlParser::readExternalId | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private String readQuotedId(boolean returnText) throws IOException, XmlPullParserException {
int quote = peekCharacter();
char[] delimiter;
if (quote == '"') {
delimiter = DOUBLE_QUOTE;
} else if (quote == '\'') {
delimiter = SINGLE_QUOTE;
} else {
throw new XmlPullParserException("Expected a quoted string", this, null);
}
position++;
return readUntil(delimiter, returnText);
} |
Reads a quoted string, performing no entity escaping of the contents.
| KXmlParser::readQuotedId | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void readElementDeclaration() throws IOException, XmlPullParserException {
read(START_ELEMENT);
skip();
readName();
readContentSpec();
skip();
read('>');
} |
Read an element declaration. This contains a name and a content spec.
<!ELEMENT foo EMPTY >
<!ELEMENT foo (bar?,(baz|quux)) >
<!ELEMENT foo (#PCDATA|bar)* >
| KXmlParser::readElementDeclaration | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void readContentSpec() throws IOException, XmlPullParserException {
// this implementation is very lenient; it scans for balanced parens only
skip();
int c = peekCharacter();
if (c == '(') {
int depth = 0;
do {
if (c == '(') {
depth++;
} else if (c == ')') {
depth--;
} else if (c == -1) {
throw new XmlPullParserException(
"Unterminated element content spec", this, null);
}
position++;
c = peekCharacter();
} while (depth > 0);
if (c == '*' || c == '?' || c == '+') {
position++;
}
} else if (c == EMPTY[0]) {
read(EMPTY);
} else if (c == ANY[0]) {
read(ANY);
} else {
throw new XmlPullParserException("Expected element content spec", this, null);
}
} |
Read an element content spec. This is a regular expression-like pattern
of names or other content specs. The following operators are supported:
sequence: (a,b,c)
choice: (a|b|c)
optional: a?
one or more: a+
any number: a*
The special name '#PCDATA' is permitted but only if it is the first
element of the first group:
(#PCDATA|a|b)
The top-level element must be either a choice, a sequence, or one of the
special names EMPTY and ANY.
| KXmlParser::readContentSpec | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
private void readAttributeListDeclaration() throws IOException, XmlPullParserException {
read(START_ATTLIST);
skip();
String elementName = readName();
while (true) {
skip();
int c = peekCharacter();
if (c == '>') {
position++;
return;
}
// attribute name
String attributeName = readName();
// attribute type
skip();
if (position + 1 >= limit && !fillBuffer(2)) {
throw new XmlPullParserException("Malformed attribute list", this, null);
}
if (buffer[position] == NOTATION[0] && buffer[position + 1] == NOTATION[1]) {
read(NOTATION);
skip();
}
c = peekCharacter();
if (c == '(') {
position++;
while (true) {
skip();
readName();
skip();
c = peekCharacter();
if (c == ')') {
position++;
break;
} else if (c == '|') {
position++;
} else {
throw new XmlPullParserException("Malformed attribute type", this, null);
}
}
} else {
readName();
}
// default value
skip();
c = peekCharacter();
if (c == '#') {
position++;
c = peekCharacter();
if (c == 'R') {
read(REQUIRED);
} else if (c == 'I') {
read(IMPLIED);
} else if (c == 'F') {
read(FIXED);
} else {
throw new XmlPullParserException("Malformed attribute type", this, null);
}
skip();
c = peekCharacter();
}
if (c == '"' || c == '\'') {
position++;
// TODO: does this do escaping correctly?
String value = readValue((char) c, true, true, ValueContext.ATTRIBUTE);
if (peekCharacter() == c) {
position++;
}
defineAttributeDefault(elementName, attributeName, value);
}
}
} |
Reads an attribute list declaration such as the following:
<!ATTLIST foo
bar CDATA #IMPLIED
quux (a|b|c) "c"
baz NOTATION (a|b|c) #FIXED "c">
Each attribute has a name, type and default.
Types are one of the built-in types (CDATA, ID, IDREF, IDREFS, ENTITY,
ENTITIES, NMTOKEN, or NMTOKENS), an enumerated type "(list|of|options)"
or NOTATION followed by an enumerated type.
The default is either #REQUIRED, #IMPLIED, #FIXED, a quoted value, or
#FIXED with a quoted value.
| KXmlParser::readAttributeListDeclaration | java | Reginer/aosp-android-jar | android-32/src/com/android/org/kxml2/io/KXmlParser.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/org/kxml2/io/KXmlParser.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.