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
default void onEntryUpdated(@NonNull NotificationEntry entry) { }
Called whenever a notification with the same key as an existing notification is posted. By the time this listener is called, the entry's SBN and Ranking will already have been updated.
onEntryUpdated
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
MIT
default void onEntryRemoved(@NonNull NotificationEntry entry, @CancellationReason int reason) { }
Called whenever a notification is retracted by system server. This method is not called immediately after a user dismisses a notification: we wait until we receive confirmation from system server before considering the notification removed.
onEntryRemoved
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
MIT
default void onEntryCleanUp(@NonNull NotificationEntry entry) { }
Called whenever a {@link NotificationEntry} is considered deleted. This should be used for cleaning up any state tied to the notification. This is the deletion parallel of {@link #onEntryInit} and similarly means that you cannot expect other {@link NotifCollectionListener} implementations to still have valid state for the entry during this call. Instead, use {@link #onEntryRemoved} which will be called before deletion.
onEntryCleanUp
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
MIT
default void onRankingApplied() { }
Called whenever a ranking update is applied. During a ranking update, all active, non-lifetime-extended notification entries will have their ranking object updated. Ranking updates occur whenever a notification is added, updated, or removed, or when a standalone ranking is sent from the server. If a non-standalone ranking is applied, the event that accompanied the ranking is emitted first (e.g. {@link #onEntryAdded}), followed by the ranking event.
onRankingApplied
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
MIT
default void onRankingUpdate(NotificationListenerService.RankingMap rankingMap) { }
Called whenever system server sends a standalone ranking update (i.e. one that isn't associated with a notification being added or removed). In general it is unsafe to depend on this method as rankings can change for other reasons. Instead, listen for {@link #onRankingApplied()}, which is called whenever ANY ranking update is applied, regardless of source. @deprecated Use {@link #onRankingApplied()} instead.
onRankingUpdate
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
MIT
default void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { }
Called when a notification channel is modified, in response to {@link NotificationListenerService#onNotificationChannelModified}. @param pkgName the package the notification channel belongs to. @param user the user the notification channel belongs to. @param channel the channel being modified. @param modificationType the type of modification that occurred to the channel.
onNotificationChannelModified
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java
MIT
static Bitmap takeScreenshot() { Log.d(TAG, "Taking fullscreen screenshot"); // Take the screenshot final IBinder displayToken = SurfaceControl.getInternalDisplayToken(); final SurfaceControl.DisplayCaptureArgs captureArgs = new SurfaceControl.DisplayCaptureArgs.Builder(displayToken) .build(); final SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer = SurfaceControl.captureDisplay(captureArgs); final Bitmap screenShot = screenshotBuffer == null ? null : screenshotBuffer.asBitmap(); if (screenShot == null) { Log.e(TAG, "Failed to take fullscreen screenshot"); return null; } // Optimization screenShot.setHasAlpha(false); return screenShot; }
Takes a screenshot. @return The screenshot bitmap on success, null otherwise.
Screenshooter::takeScreenshot
java
Reginer/aosp-android-jar
android-31/src/com/android/shell/Screenshooter.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/shell/Screenshooter.java
MIT
public void initializeCount(boolean stable) { synchronized (mLock) { if (stable) { mStableCount = 1; mNumStableIncs = 1; mUnstableCount = 0; mNumUnstableIncs = 0; } else { mStableCount = 0; mNumStableIncs = 0; mUnstableCount = 1; mNumUnstableIncs = 1; } } }
Initializes the reference counts. Either the stable or unstable count is set to 1; the other reference count is set to zero.
ContentProviderConnection::initializeCount
java
Reginer/aosp-android-jar
android-32/src/com/android/server/am/ContentProviderConnection.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/am/ContentProviderConnection.java
MIT
public int incrementCount(boolean stable) { synchronized (mLock) { if (DEBUG_PROVIDER) { final ContentProviderRecord cpr = provider; Slog.v(TAG_AM, "Adding provider requested by " + client.processName + " from process " + cpr.info.processName + ": " + cpr.name.flattenToShortString() + " scnt=" + mStableCount + " uscnt=" + mUnstableCount); } if (stable) { mStableCount++; mNumStableIncs++; } else { mUnstableCount++; mNumUnstableIncs++; } return mStableCount + mUnstableCount; } }
Increments the stable or unstable reference count and return the total number of references.
ContentProviderConnection::incrementCount
java
Reginer/aosp-android-jar
android-32/src/com/android/server/am/ContentProviderConnection.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/am/ContentProviderConnection.java
MIT
public int decrementCount(boolean stable) { synchronized (mLock) { if (DEBUG_PROVIDER) { final ContentProviderRecord cpr = provider; Slog.v(TAG_AM, "Removing provider requested by " + client.processName + " from process " + cpr.info.processName + ": " + cpr.name.flattenToShortString() + " scnt=" + mStableCount + " uscnt=" + mUnstableCount); } if (stable) { mStableCount--; } else { mUnstableCount--; } return mStableCount + mUnstableCount; } }
Decrements either the stable or unstable count and return the total number of references.
ContentProviderConnection::decrementCount
java
Reginer/aosp-android-jar
android-32/src/com/android/server/am/ContentProviderConnection.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/am/ContentProviderConnection.java
MIT
public void adjustCounts(int stableIncrement, int unstableIncrement) { synchronized (mLock) { if (stableIncrement > 0) { mNumStableIncs += stableIncrement; } final int stable = mStableCount + stableIncrement; if (stable < 0) { throw new IllegalStateException("stableCount < 0: " + stable); } if (unstableIncrement > 0) { mNumUnstableIncs += unstableIncrement; } final int unstable = mUnstableCount + unstableIncrement; if (unstable < 0) { throw new IllegalStateException("unstableCount < 0: " + unstable); } if ((stable + unstable) <= 0) { throw new IllegalStateException("ref counts can't go to zero here: stable=" + stable + " unstable=" + unstable); } mStableCount = stable; mUnstableCount = unstable; } }
Adjusts the reference counts up or down (the inputs may be positive, zero, or negative. This method does not return a total count because a return is not needed for the current use case.
ContentProviderConnection::adjustCounts
java
Reginer/aosp-android-jar
android-32/src/com/android/server/am/ContentProviderConnection.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/am/ContentProviderConnection.java
MIT
public int stableCount() { synchronized (mLock) { return mStableCount; } }
Returns the number of stable references.
ContentProviderConnection::stableCount
java
Reginer/aosp-android-jar
android-32/src/com/android/server/am/ContentProviderConnection.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/am/ContentProviderConnection.java
MIT
public int unstableCount() { synchronized (mLock) { return mUnstableCount; } }
Returns the number of unstable references.
ContentProviderConnection::unstableCount
java
Reginer/aosp-android-jar
android-32/src/com/android/server/am/ContentProviderConnection.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/am/ContentProviderConnection.java
MIT
int totalRefCount() { synchronized (mLock) { return mStableCount + mUnstableCount; } }
Returns the total number of stable and unstable references.
ContentProviderConnection::totalRefCount
java
Reginer/aosp-android-jar
android-32/src/com/android/server/am/ContentProviderConnection.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/am/ContentProviderConnection.java
MIT
private static TreeMap map5() { TreeMap map = new TreeMap(); assertTrue(map.isEmpty()); map.put(one, "A"); map.put(five, "E"); map.put(three, "C"); map.put(two, "B"); map.put(four, "D"); assertFalse(map.isEmpty()); assertEquals(5, map.size()); return map; }
Returns a new map from Integers 1-5 to Strings "A"-"E".
TreeMapTest::map5
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testClear() { TreeMap map = map5(); map.clear(); assertEquals(0, map.size()); }
clear removes all pairs
TreeMapTest::testClear
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testConstructFromSorted() { TreeMap map = map5(); TreeMap map2 = new TreeMap(map); assertEquals(map, map2); }
copy constructor creates map equal to source map
TreeMapTest::testConstructFromSorted
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testEquals() { TreeMap map1 = map5(); TreeMap map2 = map5(); assertEquals(map1, map2); assertEquals(map2, map1); map1.clear(); assertFalse(map1.equals(map2)); assertFalse(map2.equals(map1)); }
Maps with same contents are equal
TreeMapTest::testEquals
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testContainsKey() { TreeMap map = map5(); assertTrue(map.containsKey(one)); assertFalse(map.containsKey(zero)); }
containsKey returns true for contained key
TreeMapTest::testContainsKey
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testContainsValue() { TreeMap map = map5(); assertTrue(map.containsValue("A")); assertFalse(map.containsValue("Z")); }
containsValue returns true for held values
TreeMapTest::testContainsValue
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testGet() { TreeMap map = map5(); assertEquals("A", (String)map.get(one)); TreeMap empty = new TreeMap(); assertNull(empty.get(one)); }
get returns the correct element at the given key, or null if not present
TreeMapTest::testGet
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testIsEmpty() { TreeMap empty = new TreeMap(); TreeMap map = map5(); assertTrue(empty.isEmpty()); assertFalse(map.isEmpty()); }
isEmpty is true of empty map and false for non-empty
TreeMapTest::testIsEmpty
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testFirstKey() { TreeMap map = map5(); assertEquals(one, map.firstKey()); }
firstKey returns first key
TreeMapTest::testFirstKey
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testLastKey() { TreeMap map = map5(); assertEquals(five, map.lastKey()); }
lastKey returns last key
TreeMapTest::testLastKey
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testKeySetToArray() { TreeMap map = map5(); Set s = map.keySet(); Object[] ar = s.toArray(); assertTrue(s.containsAll(Arrays.asList(ar))); assertEquals(5, ar.length); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); }
keySet.toArray returns contains all keys
TreeMapTest::testKeySetToArray
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testDescendingKeySetToArray() { TreeMap map = map5(); Set s = map.descendingKeySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); assertTrue(s.containsAll(Arrays.asList(ar))); ar[0] = m10; assertFalse(s.containsAll(Arrays.asList(ar))); }
descendingkeySet.toArray returns contains all keys
TreeMapTest::testDescendingKeySetToArray
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testKeySet() { TreeMap map = map5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(one)); assertTrue(s.contains(two)); assertTrue(s.contains(three)); assertTrue(s.contains(four)); assertTrue(s.contains(five)); }
keySet returns a Set containing all the keys
TreeMapTest::testKeySet
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testKeySetOrder() { TreeMap map = map5(); Set s = map.keySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, one); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) < 0); last = k; ++count; } assertEquals(5, count); }
keySet is ordered
TreeMapTest::testKeySetOrder
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testKeySetDescendingIteratorOrder() { TreeMap map = map5(); NavigableSet s = map.navigableKeySet(); Iterator i = s.descendingIterator(); Integer last = (Integer)i.next(); assertEquals(last, five); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) > 0); last = k; ++count; } assertEquals(5, count); }
descending iterator of key set is inverse ordered
TreeMapTest::testKeySetDescendingIteratorOrder
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testDescendingKeySetOrder() { TreeMap map = map5(); Set s = map.descendingKeySet(); Iterator i = s.iterator(); Integer last = (Integer)i.next(); assertEquals(last, five); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) > 0); last = k; ++count; } assertEquals(5, count); }
descendingKeySet is ordered
TreeMapTest::testDescendingKeySetOrder
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testDescendingKeySetDescendingIteratorOrder() { TreeMap map = map5(); NavigableSet s = map.descendingKeySet(); Iterator i = s.descendingIterator(); Integer last = (Integer)i.next(); assertEquals(last, one); int count = 1; while (i.hasNext()) { Integer k = (Integer)i.next(); assertTrue(last.compareTo(k) < 0); last = k; ++count; } assertEquals(5, count); }
descending iterator of descendingKeySet is ordered
TreeMapTest::testDescendingKeySetDescendingIteratorOrder
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testValues() { TreeMap map = map5(); Collection s = map.values(); assertEquals(5, s.size()); assertTrue(s.contains("A")); assertTrue(s.contains("B")); assertTrue(s.contains("C")); assertTrue(s.contains("D")); assertTrue(s.contains("E")); }
values collection contains all values
TreeMapTest::testValues
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testEntrySet() { TreeMap map = map5(); Set s = map.entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } }
entrySet contains all pairs
TreeMapTest::testEntrySet
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testDescendingEntrySet() { TreeMap map = map5(); Set s = map.descendingMap().entrySet(); assertEquals(5, s.size()); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); assertTrue( (e.getKey().equals(one) && e.getValue().equals("A")) || (e.getKey().equals(two) && e.getValue().equals("B")) || (e.getKey().equals(three) && e.getValue().equals("C")) || (e.getKey().equals(four) && e.getValue().equals("D")) || (e.getKey().equals(five) && e.getValue().equals("E"))); } }
descendingEntrySet contains all pairs
TreeMapTest::testDescendingEntrySet
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testEntrySetToArray() { TreeMap map = map5(); Set s = map.entrySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); for (int i = 0; i < 5; ++i) { assertTrue(map.containsKey(((Map.Entry)(ar[i])).getKey())); assertTrue(map.containsValue(((Map.Entry)(ar[i])).getValue())); } }
entrySet.toArray contains all entries
TreeMapTest::testEntrySetToArray
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testDescendingEntrySetToArray() { TreeMap map = map5(); Set s = map.descendingMap().entrySet(); Object[] ar = s.toArray(); assertEquals(5, ar.length); for (int i = 0; i < 5; ++i) { assertTrue(map.containsKey(((Map.Entry)(ar[i])).getKey())); assertTrue(map.containsValue(((Map.Entry)(ar[i])).getValue())); } }
descendingEntrySet.toArray contains all entries
TreeMapTest::testDescendingEntrySetToArray
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testPutAll() { TreeMap empty = new TreeMap(); TreeMap map = map5(); empty.putAll(map); assertEquals(5, empty.size()); assertTrue(empty.containsKey(one)); assertTrue(empty.containsKey(two)); assertTrue(empty.containsKey(three)); assertTrue(empty.containsKey(four)); assertTrue(empty.containsKey(five)); }
putAll adds all key-value pairs from the given map
TreeMapTest::testPutAll
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testRemove() { TreeMap map = map5(); map.remove(five); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); }
remove removes the correct key-value pair from the map
TreeMapTest::testRemove
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testLowerEntry() { TreeMap map = map5(); Map.Entry e1 = map.lowerEntry(three); assertEquals(two, e1.getKey()); Map.Entry e2 = map.lowerEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.lowerEntry(one); assertNull(e3); Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); }
lowerEntry returns preceding entry.
TreeMapTest::testLowerEntry
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testHigherEntry() { TreeMap map = map5(); Map.Entry e1 = map.higherEntry(three); assertEquals(four, e1.getKey()); Map.Entry e2 = map.higherEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.higherEntry(five); assertNull(e3); Map.Entry e4 = map.higherEntry(six); assertNull(e4); }
higherEntry returns next entry.
TreeMapTest::testHigherEntry
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testFloorEntry() { TreeMap map = map5(); Map.Entry e1 = map.floorEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.floorEntry(six); assertEquals(five, e2.getKey()); Map.Entry e3 = map.floorEntry(one); assertEquals(one, e3.getKey()); Map.Entry e4 = map.floorEntry(zero); assertNull(e4); }
floorEntry returns preceding entry.
TreeMapTest::testFloorEntry
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testCeilingEntry() { TreeMap map = map5(); Map.Entry e1 = map.ceilingEntry(three); assertEquals(three, e1.getKey()); Map.Entry e2 = map.ceilingEntry(zero); assertEquals(one, e2.getKey()); Map.Entry e3 = map.ceilingEntry(five); assertEquals(five, e3.getKey()); Map.Entry e4 = map.ceilingEntry(six); assertNull(e4); }
ceilingEntry returns next entry.
TreeMapTest::testCeilingEntry
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testLowerKey() { TreeMap q = map5(); Object e1 = q.lowerKey(three); assertEquals(two, e1); Object e2 = q.lowerKey(six); assertEquals(five, e2); Object e3 = q.lowerKey(one); assertNull(e3); Object e4 = q.lowerKey(zero); assertNull(e4); }
lowerKey returns preceding element
TreeMapTest::testLowerKey
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testHigherKey() { TreeMap q = map5(); Object e1 = q.higherKey(three); assertEquals(four, e1); Object e2 = q.higherKey(zero); assertEquals(one, e2); Object e3 = q.higherKey(five); assertNull(e3); Object e4 = q.higherKey(six); assertNull(e4); }
higherKey returns next element
TreeMapTest::testHigherKey
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testFloorKey() { TreeMap q = map5(); Object e1 = q.floorKey(three); assertEquals(three, e1); Object e2 = q.floorKey(six); assertEquals(five, e2); Object e3 = q.floorKey(one); assertEquals(one, e3); Object e4 = q.floorKey(zero); assertNull(e4); }
floorKey returns preceding element
TreeMapTest::testFloorKey
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testCeilingKey() { TreeMap q = map5(); Object e1 = q.ceilingKey(three); assertEquals(three, e1); Object e2 = q.ceilingKey(zero); assertEquals(one, e2); Object e3 = q.ceilingKey(five); assertEquals(five, e3); Object e4 = q.ceilingKey(six); assertNull(e4); }
ceilingKey returns next element
TreeMapTest::testCeilingKey
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testPollFirstEntry() { TreeMap map = map5(); Map.Entry e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(two, e.getKey()); map.put(one, "A"); e = map.pollFirstEntry(); assertEquals(one, e.getKey()); assertEquals("A", e.getValue()); e = map.pollFirstEntry(); assertEquals(three, e.getKey()); map.remove(four); e = map.pollFirstEntry(); assertEquals(five, e.getKey()); try { e.setValue("A"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); }
pollFirstEntry returns entries in order
TreeMapTest::testPollFirstEntry
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testPollLastEntry() { TreeMap map = map5(); Map.Entry e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(four, e.getKey()); map.put(five, "E"); e = map.pollLastEntry(); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); e = map.pollLastEntry(); assertEquals(three, e.getKey()); map.remove(two); e = map.pollLastEntry(); assertEquals(one, e.getKey()); try { e.setValue("E"); shouldThrow(); } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); }
pollLastEntry returns entries in order
TreeMapTest::testPollLastEntry
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testSize() { TreeMap map = map5(); TreeMap empty = new TreeMap(); assertEquals(0, empty.size()); assertEquals(5, map.size()); }
size returns the correct values
TreeMapTest::testSize
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testToString() { TreeMap map = map5(); String s = map.toString(); for (int i = 1; i <= 5; ++i) { assertTrue(s.contains(String.valueOf(i))); } }
toString contains toString of elements
TreeMapTest::testToString
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testGet_NullPointerException() { TreeMap c = map5(); try { c.get(null); shouldThrow(); } catch (NullPointerException success) {} }
get(null) of nonempty map throws NPE
TreeMapTest::testGet_NullPointerException
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testContainsKey_NullPointerException() { TreeMap c = map5(); try { c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} }
containsKey(null) of nonempty map throws NPE
TreeMapTest::testContainsKey_NullPointerException
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testRemove1_NullPointerException() { TreeMap c = new TreeMap(); c.put("sadsdf", "asdads"); try { c.remove(null); shouldThrow(); } catch (NullPointerException success) {} }
remove(null) throws NPE for nonempty map
TreeMapTest::testRemove1_NullPointerException
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testSerialization() throws Exception { NavigableMap x = map5(); NavigableMap y = serialClone(x); assertNotSame(x, y); assertEquals(x.size(), y.size()); assertEquals(x.toString(), y.toString()); assertEquals(x, y); assertEquals(y, x); }
A deserialized map equals original
TreeMapTest::testSerialization
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testSubMapContents() { TreeMap map = map5(); NavigableMap sm = map.subMap(two, true, four, false); assertEquals(two, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals(2, sm.size()); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(three, k); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator j = sm.keySet().iterator(); j.next(); j.remove(); assertFalse(map.containsKey(two)); assertEquals(4, map.size()); assertEquals(1, sm.size()); assertEquals(three, sm.firstKey()); assertEquals(three, sm.lastKey()); assertEquals("C", sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); }
subMap returns map with keys in requested range
TreeMapTest::testSubMapContents
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testHeadMapContents() { TreeMap map = map5(); NavigableMap sm = map.headMap(four, false); assertTrue(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertFalse(sm.containsKey(four)); assertFalse(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(one, k); k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); assertFalse(i.hasNext()); sm.clear(); assertTrue(sm.isEmpty()); assertEquals(2, map.size()); assertEquals(four, map.firstKey()); }
headMap returns map with keys in requested range
TreeMapTest::testHeadMapContents
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testTailMapContents() { TreeMap map = map5(); NavigableMap sm = map.tailMap(two, true); assertFalse(sm.containsKey(one)); assertTrue(sm.containsKey(two)); assertTrue(sm.containsKey(three)); assertTrue(sm.containsKey(four)); assertTrue(sm.containsKey(five)); Iterator i = sm.keySet().iterator(); Object k; k = (Integer)(i.next()); assertEquals(two, k); k = (Integer)(i.next()); assertEquals(three, k); k = (Integer)(i.next()); assertEquals(four, k); k = (Integer)(i.next()); assertEquals(five, k); assertFalse(i.hasNext()); Iterator r = sm.descendingKeySet().iterator(); k = (Integer)(r.next()); assertEquals(five, k); k = (Integer)(r.next()); assertEquals(four, k); k = (Integer)(r.next()); assertEquals(three, k); k = (Integer)(r.next()); assertEquals(two, k); assertFalse(r.hasNext()); Iterator ei = sm.entrySet().iterator(); Map.Entry e; e = (Map.Entry)(ei.next()); assertEquals(two, e.getKey()); assertEquals("B", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(three, e.getKey()); assertEquals("C", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(four, e.getKey()); assertEquals("D", e.getValue()); e = (Map.Entry)(ei.next()); assertEquals(five, e.getKey()); assertEquals("E", e.getValue()); assertFalse(i.hasNext()); NavigableMap ssm = sm.tailMap(four, true); assertEquals(four, ssm.firstKey()); assertEquals(five, ssm.lastKey()); assertEquals("D", ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); }
headMap returns map with keys in requested range
TreeMapTest::testTailMapContents
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public void testRecursiveSubMaps() throws Exception { int mapSize = expensiveTests ? 1000 : 100; Class cl = TreeMap.class; NavigableMap<Integer, Integer> map = newMap(cl); bs = new BitSet(mapSize); populate(map, mapSize); check(map, 0, mapSize - 1, true); check(map.descendingMap(), 0, mapSize - 1, false); mutateMap(map, 0, mapSize - 1); check(map, 0, mapSize - 1, true); check(map.descendingMap(), 0, mapSize - 1, false); bashSubMap(map.subMap(0, true, mapSize, false), 0, mapSize - 1, true); }
Submaps of submaps subdivide correctly
TreeMapTest::testRecursiveSubMaps
java
Reginer/aosp-android-jar
android-31/src/jsr166/TreeMapTest.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/TreeMapTest.java
MIT
public List<GetCredentialProviderData> getCandidateProviderDataList() { return mCandidateProviderDataList; }
Returns candidate provider data list. @hide
GetCandidateCredentialsResponse::getCandidateProviderDataList
java
Reginer/aosp-android-jar
android-35/src/android/credentials/GetCandidateCredentialsResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/credentials/GetCandidateCredentialsResponse.java
MIT
public void changeMagnificationMode(int displayId, int magnificationMode) { synchronized (mLock) { if (displayId == Display.DEFAULT_DISPLAY) { persistMagnificationModeSettingsLocked(magnificationMode); } else { final AccessibilityUserState userState = getCurrentUserStateLocked(); final int currentMode = userState.getMagnificationModeLocked(displayId); if (magnificationMode != currentMode) { userState.setMagnificationModeLocked(displayId, magnificationMode); updateMagnificationModeChangeSettingsLocked(userState, displayId); } } } }
Changes the magnification mode on the given display. @param displayId the logical display @param magnificationMode the target magnification mode
AccessibilityManagerService::changeMagnificationMode
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public boolean performActionOnAccessibilityFocusedItemNotLocked( AccessibilityNodeInfo.AccessibilityAction action) { AccessibilityNodeInfo focus = getAccessibilityFocusNotLocked(); if ((focus == null) || !focus.getActionList().contains(action)) { return false; } return focus.performAction(action.getId()); }
Perform an accessibility action on the view that currently has accessibility focus. Has no effect if no item has accessibility focus, if the item with accessibility focus does not expose the specified action, or if the action fails. @param action The action to perform. @return {@code true} if the action was performed. {@code false} if it was not.
InteractionBridge::performActionOnAccessibilityFocusedItemNotLocked
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public int getMagnificationMode(int displayId) { synchronized (mLock) { return getCurrentUserStateLocked().getMagnificationModeLocked(displayId); } }
Gets the magnification mode of the specified display. @param displayId The logical displayId. @return magnification mode. It's either ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN or ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW.
AccessibilityContentObserver::getMagnificationMode
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public void updateAlwaysOnMagnification() { synchronized (mLock) { readAlwaysOnMagnificationLocked(getCurrentUserState()); } }
Called when always on magnification feature flag flips to check if the feature should be enabled for current user state.
AccessibilityContentObserver::updateAlwaysOnMagnification
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public void scheduleBindInput() { mMainHandler.sendMessage(obtainMessage(AccessibilityManagerService::bindInput, this)); }
Bind input for accessibility services which request ime capabilities.
AccessibilityContentObserver::scheduleBindInput
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public void scheduleUnbindInput() { mMainHandler.sendMessage(obtainMessage(AccessibilityManagerService::unbindInput, this)); }
Unbind input for accessibility services which request ime capabilities.
AccessibilityContentObserver::scheduleUnbindInput
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public void scheduleStartInput(IRemoteAccessibilityInputConnection connection, EditorInfo editorInfo, boolean restarting) { mMainHandler.sendMessage(obtainMessage(AccessibilityManagerService::startInput, this, connection, editorInfo, restarting)); }
Start input for accessibility services which request ime capabilities.
AccessibilityContentObserver::scheduleStartInput
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public void scheduleCreateImeSession(ArraySet<Integer> ignoreSet) { mMainHandler.sendMessage(obtainMessage(AccessibilityManagerService::createImeSession, this, ignoreSet)); }
Request input sessions from all accessibility services which request ime capabilities and whose id is not in the ignoreSet
AccessibilityContentObserver::scheduleCreateImeSession
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public void scheduleSetImeSessionEnabled(SparseArray<IAccessibilityInputMethodSession> sessions, boolean enabled) { mMainHandler.sendMessage(obtainMessage(AccessibilityManagerService::setImeSessionEnabled, this, sessions, enabled)); }
Enable or disable the sessions. @param sessions Sessions to enable or disable. @param enabled True if enable the sessions or false if disable the sessions.
AccessibilityContentObserver::scheduleSetImeSessionEnabled
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
private boolean postponeWindowStateEvent(AccessibilityEvent event) { synchronized (mLock) { final int resolvedWindowId = mA11yWindowManager.resolveParentWindowIdLocked( event.getWindowId()); if (mA11yWindowManager.findWindowInfoByIdLocked(resolvedWindowId) != null) { return false; } final SendWindowStateChangedEventRunnable pendingRunnable = new SendWindowStateChangedEventRunnable(new AccessibilityEvent(event)); mMainHandler.postDelayed(pendingRunnable, POSTPONE_WINDOW_STATE_CHANGED_EVENT_TIMEOUT_MILLIS); mSendWindowStateChangedEventRunnables.add(pendingRunnable); return true; } }
Postpones the {@link AccessibilityEvent} with {@link AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED} which doesn't have the corresponding window until the window is added or timeout. @return {@code true} if the event is postponed.
SendWindowStateChangedEventRunnable::postponeWindowStateEvent
java
Reginer/aosp-android-jar
android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/accessibility/AccessibilityManagerService.java
MIT
public CurrencyPluralInfo() { initialize(ULocale.getDefault(Category.FORMAT)); }
Create a CurrencyPluralInfo object for the default <code>FORMAT</code> locale. @see Category#FORMAT
CurrencyPluralInfo::CurrencyPluralInfo
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public CurrencyPluralInfo(Locale locale) { initialize(ULocale.forLocale(locale)); }
Create a CurrencyPluralInfo object for the given locale. @param locale the locale
CurrencyPluralInfo::CurrencyPluralInfo
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public CurrencyPluralInfo(ULocale locale) { initialize(locale); }
Create a CurrencyPluralInfo object for the given locale. @param locale the locale
CurrencyPluralInfo::CurrencyPluralInfo
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public static CurrencyPluralInfo getInstance() { return new CurrencyPluralInfo(); }
Gets a CurrencyPluralInfo instance for the default locale. @return A CurrencyPluralInfo instance.
CurrencyPluralInfo::getInstance
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public static CurrencyPluralInfo getInstance(Locale locale) { return new CurrencyPluralInfo(locale); }
Gets a CurrencyPluralInfo instance for the given locale. @param locale the locale. @return A CurrencyPluralInfo instance.
CurrencyPluralInfo::getInstance
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public static CurrencyPluralInfo getInstance(ULocale locale) { return new CurrencyPluralInfo(locale); }
Gets a CurrencyPluralInfo instance for the given locale. @param locale the locale. @return A CurrencyPluralInfo instance.
CurrencyPluralInfo::getInstance
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public PluralRules getPluralRules() { return pluralRules; }
Gets plural rules of this locale, used for currency plural format @return plural rule
CurrencyPluralInfo::getPluralRules
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public String getCurrencyPluralPattern(String pluralCount) { String currencyPluralPattern = pluralCountToCurrencyUnitPattern.get(pluralCount); if (currencyPluralPattern == null) { // fall back to "other" if (!pluralCount.equals("other")) { currencyPluralPattern = pluralCountToCurrencyUnitPattern.get("other"); } if (currencyPluralPattern == null) { // no currencyUnitPatterns defined, // fallback to predefined default. // This should never happen when ICU resource files are // available, since currencyUnitPattern of "other" is always // defined in root. currencyPluralPattern = defaultCurrencyPluralPattern; } } return currencyPluralPattern; }
Given a plural count, gets currency plural pattern of this locale, used for currency plural format @param pluralCount currency plural count @return a currency plural pattern based on plural count
CurrencyPluralInfo::getCurrencyPluralPattern
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public ULocale getLocale() { return ulocale; }
Get locale @return locale
CurrencyPluralInfo::getLocale
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public void setPluralRules(String ruleDescription) { pluralRules = PluralRules.createRules(ruleDescription); }
Set plural rules. These are initially set in the constructor based on the locale, and usually do not need to be changed. @param ruleDescription new plural rule description
CurrencyPluralInfo::setPluralRules
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public void setCurrencyPluralPattern(String pluralCount, String pattern) { pluralCountToCurrencyUnitPattern.put(pluralCount, pattern); }
Set currency plural patterns. These are initially set in the constructor based on the locale, and usually do not need to be changed. The decimal digits part of the pattern cannot be specified via this method. All plural forms will use the same decimal pattern as set in the constructor of DecimalFormat. For example, you can't set "0.0" for plural "few" but "0.00" for plural "many". @param pluralCount the plural count for which the currency pattern will be overridden. @param pattern the new currency plural pattern
CurrencyPluralInfo::setCurrencyPluralPattern
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public void setLocale(ULocale loc) { ulocale = loc; initialize(loc); }
Set locale. This also sets both the plural rules and the currency plural patterns to be the defaults for the locale. @param loc the new locale to set
CurrencyPluralInfo::setLocale
java
Reginer/aosp-android-jar
android-35/src/android/icu/text/CurrencyPluralInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/text/CurrencyPluralInfo.java
MIT
public TaskFragmentInfo( @NonNull IBinder fragmentToken, @NonNull WindowContainerToken token, @NonNull Configuration configuration, int runningActivityCount, boolean isVisible, @NonNull List<IBinder> activities, @NonNull Point positionInParent, boolean isTaskClearedForReuse, boolean isTaskFragmentClearedForPip, @NonNull Point minimumDimensions) { mFragmentToken = requireNonNull(fragmentToken); mToken = requireNonNull(token); mConfiguration.setTo(configuration); mRunningActivityCount = runningActivityCount; mIsVisible = isVisible; mActivities.addAll(activities); mPositionInParent.set(positionInParent); mIsTaskClearedForReuse = isTaskClearedForReuse; mIsTaskFragmentClearedForPip = isTaskFragmentClearedForPip; mMinimumDimensions.set(minimumDimensions); }
The maximum {@link ActivityInfo.WindowLayout#minWidth} and {@link ActivityInfo.WindowLayout#minHeight} aggregated from the TaskFragment's child activities. @NonNull private final Point mMinimumDimensions = new Point(); /** @hide
TaskFragmentInfo::TaskFragmentInfo
java
Reginer/aosp-android-jar
android-33/src/android/window/TaskFragmentInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/TaskFragmentInfo.java
MIT
public boolean isTaskFragmentClearedForPip() { return mIsTaskFragmentClearedForPip; }
The maximum {@link ActivityInfo.WindowLayout#minWidth} and {@link ActivityInfo.WindowLayout#minHeight} aggregated from the TaskFragment's child activities. @NonNull private final Point mMinimumDimensions = new Point(); /** @hide public TaskFragmentInfo( @NonNull IBinder fragmentToken, @NonNull WindowContainerToken token, @NonNull Configuration configuration, int runningActivityCount, boolean isVisible, @NonNull List<IBinder> activities, @NonNull Point positionInParent, boolean isTaskClearedForReuse, boolean isTaskFragmentClearedForPip, @NonNull Point minimumDimensions) { mFragmentToken = requireNonNull(fragmentToken); mToken = requireNonNull(token); mConfiguration.setTo(configuration); mRunningActivityCount = runningActivityCount; mIsVisible = isVisible; mActivities.addAll(activities); mPositionInParent.set(positionInParent); mIsTaskClearedForReuse = isTaskClearedForReuse; mIsTaskFragmentClearedForPip = isTaskFragmentClearedForPip; mMinimumDimensions.set(minimumDimensions); } @NonNull public IBinder getFragmentToken() { return mFragmentToken; } @NonNull public WindowContainerToken getToken() { return mToken; } @NonNull public Configuration getConfiguration() { return mConfiguration; } public boolean isEmpty() { return mRunningActivityCount == 0; } public boolean hasRunningActivity() { return mRunningActivityCount > 0; } public int getRunningActivityCount() { return mRunningActivityCount; } public boolean isVisible() { return mIsVisible; } @NonNull public List<IBinder> getActivities() { return mActivities; } /** Returns the relative position of the fragment's top left corner in the parent container. @NonNull public Point getPositionInParent() { return mPositionInParent; } public boolean isTaskClearedForReuse() { return mIsTaskClearedForReuse; } /** @hide
TaskFragmentInfo::isTaskFragmentClearedForPip
java
Reginer/aosp-android-jar
android-33/src/android/window/TaskFragmentInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/TaskFragmentInfo.java
MIT
public int getMinimumWidth() { return mMinimumDimensions.x; }
Returns the minimum width this TaskFragment can be resized to. Client side must not {@link WindowContainerTransaction#setBounds(WindowContainerToken, Rect)} that {@link Rect#width()} is shorter than the reported value. @hide pending unhide
TaskFragmentInfo::getMinimumWidth
java
Reginer/aosp-android-jar
android-33/src/android/window/TaskFragmentInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/TaskFragmentInfo.java
MIT
public int getMinimumHeight() { return mMinimumDimensions.y; }
Returns the minimum width this TaskFragment can be resized to. Client side must not {@link WindowContainerTransaction#setBounds(WindowContainerToken, Rect)} that {@link Rect#height()} is shorter than the reported value. @hide pending unhide
TaskFragmentInfo::getMinimumHeight
java
Reginer/aosp-android-jar
android-33/src/android/window/TaskFragmentInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/TaskFragmentInfo.java
MIT
public boolean equalsForTaskFragmentOrganizer(@Nullable TaskFragmentInfo that) { if (that == null) { return false; } return mFragmentToken.equals(that.mFragmentToken) && mToken.equals(that.mToken) && mRunningActivityCount == that.mRunningActivityCount && mIsVisible == that.mIsVisible && getWindowingMode() == that.getWindowingMode() && mActivities.equals(that.mActivities) && mPositionInParent.equals(that.mPositionInParent) && mIsTaskClearedForReuse == that.mIsTaskClearedForReuse && mIsTaskFragmentClearedForPip == that.mIsTaskFragmentClearedForPip && mMinimumDimensions.equals(that.mMinimumDimensions); }
Returns {@code true} if the parameters that are important for task fragment organizers are equal between this {@link TaskFragmentInfo} and {@param that}.
TaskFragmentInfo::equalsForTaskFragmentOrganizer
java
Reginer/aosp-android-jar
android-33/src/android/window/TaskFragmentInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/window/TaskFragmentInfo.java
MIT
public SearchRecentSuggestions(Context context, String authority, int mode) { if (TextUtils.isEmpty(authority) || ((mode & SearchRecentSuggestionsProvider.DATABASE_MODE_QUERIES) == 0)) { throw new IllegalArgumentException(); } // unpack mode flags mTwoLineDisplay = (0 != (mode & SearchRecentSuggestionsProvider.DATABASE_MODE_2LINES)); // saved values mContext = context; mAuthority = new String(authority); // derived values mSuggestionsUri = Uri.parse("content://" + mAuthority + "/suggestions"); }
Although provider utility classes are typically static, this one must be constructed because it needs to be initialized using the same values that you provided in your {@link android.content.SearchRecentSuggestionsProvider}. @param authority This must match the authority that you've declared in your manifest. @param mode You can use mode flags here to determine certain functional aspects of your database. Note, this value should not change from run to run, because when it does change, your suggestions database may be wiped. @see android.content.SearchRecentSuggestionsProvider @see android.content.SearchRecentSuggestionsProvider#setupSuggestions
SearchRecentSuggestions::SearchRecentSuggestions
java
Reginer/aosp-android-jar
android-33/src/android/provider/SearchRecentSuggestions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/provider/SearchRecentSuggestions.java
MIT
public void saveRecentQuery(final String queryString, final String line2) { if (TextUtils.isEmpty(queryString)) { return; } if (!mTwoLineDisplay && !TextUtils.isEmpty(line2)) { throw new IllegalArgumentException(); } new Thread("saveRecentQuery") { @Override public void run() { saveRecentQueryBlocking(queryString, line2); sWritesInProgress.release(); } }.start(); }
Add a query to the recent queries list. Returns immediately, performing the save in the background. @param queryString The string as typed by the user. This string will be displayed as the suggestion, and if the user clicks on the suggestion, this string will be sent to your searchable activity (as a new search query). @param line2 If you have configured your recent suggestions provider with {@link android.content.SearchRecentSuggestionsProvider#DATABASE_MODE_2LINES}, you can pass a second line of text here. It will be shown in a smaller font, below the primary suggestion. When typing, matches in either line of text will be displayed in the list. If you did not configure two-line mode, or if a given suggestion does not have any additional text to display, you can pass null here.
SearchRecentSuggestions::saveRecentQuery
java
Reginer/aosp-android-jar
android-33/src/android/provider/SearchRecentSuggestions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/provider/SearchRecentSuggestions.java
MIT
public void clearHistory() { ContentResolver cr = mContext.getContentResolver(); truncateHistory(cr, 0); }
Completely delete the history. Use this call to implement a "clear history" UI. Any application that implements search suggestions based on previous actions (such as recent queries, page/items viewed, etc.) should provide a way for the user to clear the history. This gives the user a measure of privacy, if they do not wish for their recent searches to be replayed by other users of the device (via suggestions).
SearchRecentSuggestions::clearHistory
java
Reginer/aosp-android-jar
android-33/src/android/provider/SearchRecentSuggestions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/provider/SearchRecentSuggestions.java
MIT
protected void truncateHistory(ContentResolver cr, int maxEntries) { if (maxEntries < 0) { throw new IllegalArgumentException(); } try { // null means "delete all". otherwise "delete but leave n newest" String selection = null; if (maxEntries > 0) { selection = "_id IN " + "(SELECT _id FROM suggestions" + " ORDER BY " + SuggestionColumns.DATE + " DESC" + " LIMIT -1 OFFSET " + String.valueOf(maxEntries) + ")"; } cr.delete(mSuggestionsUri, selection, null); } catch (RuntimeException e) { Log.e(LOG_TAG, "truncateHistory", e); } }
Reduces the length of the history table, to prevent it from growing too large. @param cr Convenience copy of the content resolver. @param maxEntries Max entries to leave in the table. 0 means remove all entries.
SearchRecentSuggestions::truncateHistory
java
Reginer/aosp-android-jar
android-33/src/android/provider/SearchRecentSuggestions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/provider/SearchRecentSuggestions.java
MIT
public AudioDevicePort port() { return (AudioDevicePort)mPort; }
Returns the audio device port this AudioDevicePortConfig is issued from.
AudioDevicePortConfig::port
java
Reginer/aosp-android-jar
android-35/src/android/media/AudioDevicePortConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/AudioDevicePortConfig.java
MIT
public void setSuppressLayout(boolean suppress) { this.mSuppressLayout = suppress; }
This tells the Visibility transition to suppress layout during the transition and release the suppression after the transition. @hide
VisibilityInfo::setSuppressLayout
java
Reginer/aosp-android-jar
android-31/src/android/transition/Visibility.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/transition/Visibility.java
MIT
public boolean isVisible(TransitionValues values) { if (values == null) { return false; } int visibility = (Integer) values.values.get(PROPNAME_VISIBILITY); View parent = (View) values.values.get(PROPNAME_PARENT); return visibility == View.VISIBLE && parent != null; }
Returns whether the view is 'visible' according to the given values object. This is determined by testing the same properties in the values object that are used to determine whether the object is appearing or disappearing in the {@link Transition#createAnimator(ViewGroup, TransitionValues, TransitionValues)} method. This method can be called by, for example, subclasses that want to know whether the object is visible in the same way that Visibility determines it for the actual animation. @param values The TransitionValues object that holds the information by which visibility is determined. @return True if the view reference by <code>values</code> is visible, false otherwise.
VisibilityInfo::isVisible
java
Reginer/aosp-android-jar
android-31/src/android/transition/Visibility.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/transition/Visibility.java
MIT
public Animator onAppear(ViewGroup sceneRoot, TransitionValues startValues, int startVisibility, TransitionValues endValues, int endVisibility) { if ((mMode & MODE_IN) != MODE_IN || endValues == null) { return null; } if (startValues == null) { VisibilityInfo parentVisibilityInfo = null; View endParent = (View) endValues.view.getParent(); TransitionValues startParentValues = getMatchedTransitionValues(endParent, false); TransitionValues endParentValues = getTransitionValues(endParent, false); parentVisibilityInfo = getVisibilityChangeInfo(startParentValues, endParentValues); if (parentVisibilityInfo.visibilityChange) { return null; } } return onAppear(sceneRoot, endValues.view, startValues, endValues); }
The default implementation of this method calls {@link #onAppear(ViewGroup, View, TransitionValues, TransitionValues)}. Subclasses should override this method or {@link #onAppear(ViewGroup, View, TransitionValues, TransitionValues)}. if they need to create an Animator when targets appear. The method should only be called by the Visibility class; it is not intended to be called from external classes. @param sceneRoot The root of the transition hierarchy @param startValues The target values in the start scene @param startVisibility The target visibility in the start scene @param endValues The target values in the end scene @param endVisibility The target visibility in the end scene @return An Animator to be started at the appropriate time in the overall transition for this scene change. A null value means no animation should be run.
VisibilityInfo::onAppear
java
Reginer/aosp-android-jar
android-31/src/android/transition/Visibility.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/transition/Visibility.java
MIT
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) { return null; }
The default implementation of this method returns a null Animator. Subclasses should override this method to make targets appear with the desired transition. The method should only be called from {@link #onAppear(ViewGroup, TransitionValues, int, TransitionValues, int)}. @param sceneRoot The root of the transition hierarchy @param view The View to make appear. This will be in the target scene's View hierarchy and will be VISIBLE. @param startValues The target values in the start scene @param endValues The target values in the end scene @return An Animator to be started at the appropriate time in the overall transition for this scene change. A null value means no animation should be run.
VisibilityInfo::onAppear
java
Reginer/aosp-android-jar
android-31/src/android/transition/Visibility.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/transition/Visibility.java
MIT
public Animator onDisappear(ViewGroup sceneRoot, TransitionValues startValues, int startVisibility, TransitionValues endValues, int endVisibility) { if ((mMode & MODE_OUT) != MODE_OUT) { return null; } if (startValues == null) { // startValues(and startView) will never be null for disappear transition. return null; } final View startView = startValues.view; final View endView = (endValues != null) ? endValues.view : null; View overlayView = null; View viewToKeep = null; boolean reusingOverlayView = false; View savedOverlayView = (View) startView.getTag(R.id.transition_overlay_view_tag); if (savedOverlayView != null) { // we've already created overlay for the start view. // it means that we are applying two visibility // transitions for the same view overlayView = savedOverlayView; reusingOverlayView = true; } else { boolean needOverlayForStartView = false; if (endView == null || endView.getParent() == null) { if (endView != null) { // endView was removed from its parent - add it to the overlay overlayView = endView; } else { needOverlayForStartView = true; } } else { // visibility change if (endVisibility == View.INVISIBLE) { viewToKeep = endView; } else { // Becoming GONE if (startView == endView) { viewToKeep = endView; } else { needOverlayForStartView = true; } } } if (needOverlayForStartView) { // endView does not exist. Use startView only under certain // conditions, because placing a view in an overlay necessitates // it being removed from its current parent if (startView.getParent() == null) { // no parent - safe to use overlayView = startView; } else if (startView.getParent() instanceof View) { View startParent = (View) startView.getParent(); TransitionValues startParentValues = getTransitionValues(startParent, true); TransitionValues endParentValues = getMatchedTransitionValues(startParent, true); VisibilityInfo parentVisibilityInfo = getVisibilityChangeInfo(startParentValues, endParentValues); if (!parentVisibilityInfo.visibilityChange) { overlayView = TransitionUtils.copyViewImage(sceneRoot, startView, startParent); } else { int id = startParent.getId(); if (startParent.getParent() == null && id != View.NO_ID && sceneRoot.findViewById(id) != null && mCanRemoveViews) { // no parent, but its parent is unparented but the parent // hierarchy has been replaced by a new hierarchy with the same id // and it is safe to un-parent startView overlayView = startView; } else { // TODO: Handle this case as well } } } } } if (overlayView != null) { // TODO: Need to do this for general case of adding to overlay final ViewGroupOverlay overlay; if (!reusingOverlayView) { overlay = sceneRoot.getOverlay(); int[] screenLoc = (int[]) startValues.values.get(PROPNAME_SCREEN_LOCATION); int screenX = screenLoc[0]; int screenY = screenLoc[1]; int[] loc = new int[2]; sceneRoot.getLocationOnScreen(loc); overlayView.offsetLeftAndRight((screenX - loc[0]) - overlayView.getLeft()); overlayView.offsetTopAndBottom((screenY - loc[1]) - overlayView.getTop()); overlay.add(overlayView); } else { overlay = null; } Animator animator = onDisappear(sceneRoot, overlayView, startValues, endValues); if (!reusingOverlayView) { if (animator == null) { overlay.remove(overlayView); } else { startView.setTagInternal(R.id.transition_overlay_view_tag, overlayView); final View finalOverlayView = overlayView; addListener(new TransitionListenerAdapter() { @Override public void onTransitionPause(Transition transition) { overlay.remove(finalOverlayView); } @Override public void onTransitionResume(Transition transition) { if (finalOverlayView.getParent() == null) { overlay.add(finalOverlayView); } else { cancel(); } } @Override public void onTransitionEnd(Transition transition) { startView.setTagInternal(R.id.transition_overlay_view_tag, null); overlay.remove(finalOverlayView); transition.removeListener(this); } }); } } return animator; } if (viewToKeep != null) { int originalVisibility = viewToKeep.getVisibility(); viewToKeep.setTransitionVisibility(View.VISIBLE); Animator animator = onDisappear(sceneRoot, viewToKeep, startValues, endValues); if (animator != null) { DisappearListener disappearListener = new DisappearListener(viewToKeep, endVisibility, mSuppressLayout); animator.addListener(disappearListener); animator.addPauseListener(disappearListener); addListener(disappearListener); } else { viewToKeep.setTransitionVisibility(originalVisibility); } return animator; } return null; }
Subclasses should override this method or {@link #onDisappear(ViewGroup, View, TransitionValues, TransitionValues)} if they need to create an Animator when targets disappear. The method should only be called by the Visibility class; it is not intended to be called from external classes. <p> The default implementation of this method attempts to find a View to use to call {@link #onDisappear(ViewGroup, View, TransitionValues, TransitionValues)}, based on the situation of the View in the View hierarchy. For example, if a View was simply removed from its parent, then the View will be added into a {@link android.view.ViewGroupOverlay} and passed as the <code>view</code> parameter in {@link #onDisappear(ViewGroup, View, TransitionValues, TransitionValues)}. If a visible View is changed to be {@link View#GONE} or {@link View#INVISIBLE}, then it can be used as the <code>view</code> and the visibility will be changed to {@link View#VISIBLE} for the duration of the animation. However, if a View is in a hierarchy which is also altering its visibility, the situation can be more complicated. In general, if a view that is no longer in the hierarchy in the end scene still has a parent (so its parent hierarchy was removed, but it was not removed from its parent), then it will be left alone to avoid side-effects from improperly removing it from its parent. The only exception to this is if the previous {@link Scene} was {@link Scene#getSceneForLayout(ViewGroup, int, android.content.Context) created from a layout resource file}, then it is considered safe to un-parent the starting scene view in order to make it disappear.</p> @param sceneRoot The root of the transition hierarchy @param startValues The target values in the start scene @param startVisibility The target visibility in the start scene @param endValues The target values in the end scene @param endVisibility The target visibility in the end scene @return An Animator to be started at the appropriate time in the overall transition for this scene change. A null value means no animation should be run.
VisibilityInfo::onDisappear
java
Reginer/aosp-android-jar
android-31/src/android/transition/Visibility.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/transition/Visibility.java
MIT
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) { return null; }
The default implementation of this method returns a null Animator. Subclasses should override this method to make targets disappear with the desired transition. The method should only be called from {@link #onDisappear(ViewGroup, TransitionValues, int, TransitionValues, int)}. @param sceneRoot The root of the transition hierarchy @param view The View to make disappear. This will be in the target scene's View hierarchy or in an {@link android.view.ViewGroupOverlay} and will be VISIBLE. @param startValues The target values in the start scene @param endValues The target values in the end scene @return An Animator to be started at the appropriate time in the overall transition for this scene change. A null value means no animation should be run.
VisibilityInfo::onDisappear
java
Reginer/aosp-android-jar
android-31/src/android/transition/Visibility.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/transition/Visibility.java
MIT
public static boolean canQueryViaComponents(AndroidPackage querying, AndroidPackage potentialTarget, WatchedArrayList<String> protectedBroadcasts) { if (!querying.getQueriesIntents().isEmpty()) { for (Intent intent : querying.getQueriesIntents()) { if (matchesPackage(intent, potentialTarget, protectedBroadcasts)) { return true; } } } if (!querying.getQueriesProviders().isEmpty() && matchesProviders(querying.getQueriesProviders(), potentialTarget)) { return true; } return false; }
/* Copyright (C) 2022 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package com.android.server.pm; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Intent; import android.content.IntentFilter; import com.android.internal.util.ArrayUtils; import com.android.server.pm.parsing.pkg.AndroidPackage; import com.android.server.pm.pkg.PackageStateInternal; import com.android.server.pm.pkg.component.ParsedComponent; import com.android.server.pm.pkg.component.ParsedIntentInfo; import com.android.server.pm.pkg.component.ParsedMainComponent; import com.android.server.pm.pkg.component.ParsedProvider; import com.android.server.utils.WatchedArrayList; import java.util.List; import java.util.Set; import java.util.StringTokenizer; final class AppsFilterUtils { public static boolean requestsQueryAllPackages(@NonNull AndroidPackage pkg) { // we're not guaranteed to have permissions yet analyzed at package add, so we inspect the // package directly return pkg.getRequestedPermissions().contains( Manifest.permission.QUERY_ALL_PACKAGES); } /** Returns true if the querying package may query for the potential target package
AppsFilterUtils::canQueryViaComponents
java
Reginer/aosp-android-jar
android-33/src/com/android/server/pm/AppsFilterUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/pm/AppsFilterUtils.java
MIT
public boolean hasWorkPolicy() { return getWorkPolicyInfoIntentDO() != null || getWorkPolicyInfoIntentPO() != null; }
Returns {@code true} if it is possilbe to resolve an Intent to launch the "Your work policy info" page provided by the active Device Owner or Profile Owner app if it exists, {@code false} otherwise.
WorkPolicyUtils::hasWorkPolicy
java
Reginer/aosp-android-jar
android-34/src/com/android/settingslib/utils/WorkPolicyUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/settingslib/utils/WorkPolicyUtils.java
MIT
public boolean showWorkPolicyInfo(Context activityContext) { Intent intent = getWorkPolicyInfoIntentDO(); if (intent != null) { activityContext.startActivity(intent); return true; } intent = getWorkPolicyInfoIntentPO(); final int userId = getManagedProfileUserId(); if (intent != null && userId != USER_NULL) { activityContext.startActivityAsUser(intent, UserHandle.of(userId)); return true; } return false; }
Launches the Device Owner or Profile Owner's activity that displays the "Your work policy info" page. Returns {@code true} if the activity has indeed been launched.
WorkPolicyUtils::showWorkPolicyInfo
java
Reginer/aosp-android-jar
android-34/src/com/android/settingslib/utils/WorkPolicyUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/settingslib/utils/WorkPolicyUtils.java
MIT