code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public void testSignal_IMSE() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
try {
c.signal();
shouldThrow();
} catch (IllegalMonitorStateException success) {}
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
Calling signal without holding sync throws IllegalMonitorStateException
| AwaitMethod::testSignal_IMSE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testSignalAll_IMSE() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
try {
c.signalAll();
shouldThrow();
} catch (IllegalMonitorStateException success) {}
} |
Calling signalAll without holding sync throws IllegalMonitorStateException
| AwaitMethod::testSignalAll_IMSE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testAwaitTimed_Timeout() { testAwait_Timeout(AwaitMethod.awaitTimed); } |
await/awaitNanos/awaitUntil without a signal times out
| AwaitMethod::testAwaitTimed_Timeout | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testSignal_await() { testSignal(AwaitMethod.await); } |
await/awaitNanos/awaitUntil returns when signalled
| AwaitMethod::testSignal_await | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testHasWaitersNPE() {
final Mutex sync = new Mutex();
try {
sync.hasWaiters(null);
shouldThrow();
} catch (NullPointerException success) {}
} |
hasWaiters(null) throws NullPointerException
| AwaitMethod::testHasWaitersNPE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetWaitQueueLengthNPE() {
final Mutex sync = new Mutex();
try {
sync.getWaitQueueLength(null);
shouldThrow();
} catch (NullPointerException success) {}
} |
getWaitQueueLength(null) throws NullPointerException
| AwaitMethod::testGetWaitQueueLengthNPE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetWaitingThreadsNPE() {
final Mutex sync = new Mutex();
try {
sync.getWaitingThreads(null);
shouldThrow();
} catch (NullPointerException success) {}
} |
getWaitingThreads throws NPE if null
| AwaitMethod::testGetWaitingThreadsNPE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testHasWaitersIAE() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
final Mutex sync2 = new Mutex();
try {
sync2.hasWaiters(c);
shouldThrow();
} catch (IllegalArgumentException success) {}
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
hasWaiters throws IllegalArgumentException if not owned
| AwaitMethod::testHasWaitersIAE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testHasWaitersIMSE() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
try {
sync.hasWaiters(c);
shouldThrow();
} catch (IllegalMonitorStateException success) {}
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
hasWaiters throws IllegalMonitorStateException if not synced
| AwaitMethod::testHasWaitersIMSE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetWaitQueueLengthIAE() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
final Mutex sync2 = new Mutex();
try {
sync2.getWaitQueueLength(c);
shouldThrow();
} catch (IllegalArgumentException success) {}
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
getWaitQueueLength throws IllegalArgumentException if not owned
| AwaitMethod::testGetWaitQueueLengthIAE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetWaitQueueLengthIMSE() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
try {
sync.getWaitQueueLength(c);
shouldThrow();
} catch (IllegalMonitorStateException success) {}
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
getWaitQueueLength throws IllegalMonitorStateException if not synced
| AwaitMethod::testGetWaitQueueLengthIMSE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetWaitingThreadsIAE() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
final Mutex sync2 = new Mutex();
try {
sync2.getWaitingThreads(c);
shouldThrow();
} catch (IllegalArgumentException success) {}
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
getWaitingThreads throws IllegalArgumentException if not owned
| AwaitMethod::testGetWaitingThreadsIAE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetWaitingThreadsIMSE() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
try {
sync.getWaitingThreads(c);
shouldThrow();
} catch (IllegalMonitorStateException success) {}
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
getWaitingThreads throws IllegalMonitorStateException if not synced
| AwaitMethod::testGetWaitingThreadsIMSE | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testHasWaiters() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
final BooleanLatch acquired = new BooleanLatch();
Thread t = newStartedThread(new CheckedRunnable() {
public void realRun() throws InterruptedException {
sync.acquire();
assertHasWaitersLocked(sync, c, NO_THREADS);
assertFalse(sync.hasWaiters(c));
assertTrue(acquired.releaseShared(0));
c.await();
sync.release();
}});
acquired.acquireShared(0);
sync.acquire();
assertHasWaitersLocked(sync, c, t);
assertHasExclusiveQueuedThreads(sync, NO_THREADS);
assertTrue(sync.hasWaiters(c));
c.signal();
assertHasWaitersLocked(sync, c, NO_THREADS);
assertHasExclusiveQueuedThreads(sync, t);
assertFalse(sync.hasWaiters(c));
sync.release();
awaitTermination(t);
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
hasWaiters returns true when a thread is waiting, else false
| AwaitMethod::testHasWaiters | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetWaitQueueLength() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
final BooleanLatch acquired1 = new BooleanLatch();
final BooleanLatch acquired2 = new BooleanLatch();
final Thread t1 = newStartedThread(new CheckedRunnable() {
public void realRun() throws InterruptedException {
sync.acquire();
assertHasWaitersLocked(sync, c, NO_THREADS);
assertEquals(0, sync.getWaitQueueLength(c));
assertTrue(acquired1.releaseShared(0));
c.await();
sync.release();
}});
acquired1.acquireShared(0);
sync.acquire();
assertHasWaitersLocked(sync, c, t1);
assertEquals(1, sync.getWaitQueueLength(c));
sync.release();
final Thread t2 = newStartedThread(new CheckedRunnable() {
public void realRun() throws InterruptedException {
sync.acquire();
assertHasWaitersLocked(sync, c, t1);
assertEquals(1, sync.getWaitQueueLength(c));
assertTrue(acquired2.releaseShared(0));
c.await();
sync.release();
}});
acquired2.acquireShared(0);
sync.acquire();
assertHasWaitersLocked(sync, c, t1, t2);
assertHasExclusiveQueuedThreads(sync, NO_THREADS);
assertEquals(2, sync.getWaitQueueLength(c));
c.signalAll();
assertHasWaitersLocked(sync, c, NO_THREADS);
assertHasExclusiveQueuedThreads(sync, t1, t2);
assertEquals(0, sync.getWaitQueueLength(c));
sync.release();
awaitTermination(t1);
awaitTermination(t2);
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
getWaitQueueLength returns number of waiting threads
| AwaitMethod::testGetWaitQueueLength | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetWaitingThreads() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
final BooleanLatch acquired1 = new BooleanLatch();
final BooleanLatch acquired2 = new BooleanLatch();
final Thread t1 = new Thread(new CheckedRunnable() {
public void realRun() throws InterruptedException {
sync.acquire();
assertHasWaitersLocked(sync, c, NO_THREADS);
assertTrue(sync.getWaitingThreads(c).isEmpty());
assertTrue(acquired1.releaseShared(0));
c.await();
sync.release();
}});
final Thread t2 = new Thread(new CheckedRunnable() {
public void realRun() throws InterruptedException {
sync.acquire();
assertHasWaitersLocked(sync, c, t1);
assertTrue(sync.getWaitingThreads(c).contains(t1));
assertFalse(sync.getWaitingThreads(c).isEmpty());
assertEquals(1, sync.getWaitingThreads(c).size());
assertTrue(acquired2.releaseShared(0));
c.await();
sync.release();
}});
sync.acquire();
assertHasWaitersLocked(sync, c, NO_THREADS);
assertFalse(sync.getWaitingThreads(c).contains(t1));
assertFalse(sync.getWaitingThreads(c).contains(t2));
assertTrue(sync.getWaitingThreads(c).isEmpty());
assertEquals(0, sync.getWaitingThreads(c).size());
sync.release();
t1.start();
acquired1.acquireShared(0);
sync.acquire();
assertHasWaitersLocked(sync, c, t1);
assertTrue(sync.getWaitingThreads(c).contains(t1));
assertFalse(sync.getWaitingThreads(c).contains(t2));
assertFalse(sync.getWaitingThreads(c).isEmpty());
assertEquals(1, sync.getWaitingThreads(c).size());
sync.release();
t2.start();
acquired2.acquireShared(0);
sync.acquire();
assertHasWaitersLocked(sync, c, t1, t2);
assertHasExclusiveQueuedThreads(sync, NO_THREADS);
assertTrue(sync.getWaitingThreads(c).contains(t1));
assertTrue(sync.getWaitingThreads(c).contains(t2));
assertFalse(sync.getWaitingThreads(c).isEmpty());
assertEquals(2, sync.getWaitingThreads(c).size());
c.signalAll();
assertHasWaitersLocked(sync, c, NO_THREADS);
assertHasExclusiveQueuedThreads(sync, t1, t2);
assertFalse(sync.getWaitingThreads(c).contains(t1));
assertFalse(sync.getWaitingThreads(c).contains(t2));
assertTrue(sync.getWaitingThreads(c).isEmpty());
assertEquals(0, sync.getWaitingThreads(c).size());
sync.release();
awaitTermination(t1);
awaitTermination(t2);
assertHasWaitersUnlocked(sync, c, NO_THREADS);
} |
getWaitingThreads returns only and all waiting threads
| AwaitMethod::testGetWaitingThreads | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testAwaitUninterruptibly() {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
final BooleanLatch pleaseInterrupt = new BooleanLatch();
Thread t = newStartedThread(new CheckedRunnable() {
public void realRun() {
sync.acquire();
assertTrue(pleaseInterrupt.releaseShared(0));
c.awaitUninterruptibly();
assertTrue(Thread.interrupted());
assertHasWaitersLocked(sync, c, NO_THREADS);
sync.release();
}});
pleaseInterrupt.acquireShared(0);
sync.acquire();
assertHasWaitersLocked(sync, c, t);
sync.release();
t.interrupt();
assertHasWaitersUnlocked(sync, c, t);
assertThreadStaysAlive(t);
sync.acquire();
assertHasWaitersLocked(sync, c, t);
assertHasExclusiveQueuedThreads(sync, NO_THREADS);
c.signal();
assertHasWaitersLocked(sync, c, NO_THREADS);
assertHasExclusiveQueuedThreads(sync, t);
sync.release();
awaitTermination(t);
} |
awaitUninterruptibly is uninterruptible
| AwaitMethod::testAwaitUninterruptibly | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testInterruptible_await() { testInterruptible(AwaitMethod.await); } |
await/awaitNanos/awaitUntil is interruptible
| AwaitMethod::testInterruptible_await | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testSignalAll_await() { testSignalAll(AwaitMethod.await); } |
signalAll wakes up all threads
| AwaitMethod::testSignalAll_await | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testToString() {
Mutex sync = new Mutex();
assertTrue(sync.toString().contains("State = " + Mutex.UNLOCKED));
sync.acquire();
assertTrue(sync.toString().contains("State = " + Mutex.LOCKED));
} |
toString indicates current state
| AwaitMethod::testToString | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testSerialization() {
Mutex sync = new Mutex();
assertFalse(serialClone(sync).isHeldExclusively());
sync.acquire();
Thread t = newStartedThread(new InterruptedSyncRunnable(sync));
waitForQueuedThread(sync, t);
assertTrue(sync.isHeldExclusively());
Mutex clone = serialClone(sync);
assertTrue(clone.isHeldExclusively());
assertHasExclusiveQueuedThreads(sync, t);
assertHasExclusiveQueuedThreads(clone, NO_THREADS);
t.interrupt();
awaitTermination(t);
sync.release();
assertFalse(sync.isHeldExclusively());
assertTrue(clone.isHeldExclusively());
assertHasExclusiveQueuedThreads(sync, NO_THREADS);
assertHasExclusiveQueuedThreads(clone, NO_THREADS);
} |
A serialized AQS deserializes with current state, but no queued threads
| AwaitMethod::testSerialization | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testGetStateWithReleaseShared() {
final BooleanLatch l = new BooleanLatch();
assertFalse(l.isSignalled());
assertTrue(l.releaseShared(0));
assertTrue(l.isSignalled());
} |
tryReleaseShared setting state changes getState
| AwaitMethod::testGetStateWithReleaseShared | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testReleaseShared() {
final BooleanLatch l = new BooleanLatch();
assertFalse(l.isSignalled());
assertTrue(l.releaseShared(0));
assertTrue(l.isSignalled());
assertTrue(l.releaseShared(0));
assertTrue(l.isSignalled());
} |
releaseShared has no effect when already signalled
| AwaitMethod::testReleaseShared | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testAcquireSharedInterruptibly() {
final BooleanLatch l = new BooleanLatch();
Thread t = newStartedThread(new CheckedRunnable() {
public void realRun() throws InterruptedException {
assertFalse(l.isSignalled());
l.acquireSharedInterruptibly(0);
assertTrue(l.isSignalled());
l.acquireSharedInterruptibly(0);
assertTrue(l.isSignalled());
}});
waitForQueuedThread(l, t);
assertFalse(l.isSignalled());
assertThreadStaysAlive(t);
assertHasSharedQueuedThreads(l, t);
assertTrue(l.releaseShared(0));
assertTrue(l.isSignalled());
awaitTermination(t);
} |
acquireSharedInterruptibly returns after release, but not before
| AwaitMethod::testAcquireSharedInterruptibly | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testTryAcquireSharedNanos() {
final BooleanLatch l = new BooleanLatch();
Thread t = newStartedThread(new CheckedRunnable() {
public void realRun() throws InterruptedException {
assertFalse(l.isSignalled());
long nanos = MILLISECONDS.toNanos(2 * LONG_DELAY_MS);
assertTrue(l.tryAcquireSharedNanos(0, nanos));
assertTrue(l.isSignalled());
assertTrue(l.tryAcquireSharedNanos(0, nanos));
assertTrue(l.isSignalled());
}});
waitForQueuedThread(l, t);
assertFalse(l.isSignalled());
assertThreadStaysAlive(t);
assertTrue(l.releaseShared(0));
assertTrue(l.isSignalled());
awaitTermination(t);
} |
tryAcquireSharedNanos returns after release, but not before
| AwaitMethod::testTryAcquireSharedNanos | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testAcquireSharedInterruptibly_Interruptible() {
final BooleanLatch l = new BooleanLatch();
Thread t = newStartedThread(new CheckedInterruptedRunnable() {
public void realRun() throws InterruptedException {
assertFalse(l.isSignalled());
l.acquireSharedInterruptibly(0);
}});
waitForQueuedThread(l, t);
assertFalse(l.isSignalled());
t.interrupt();
awaitTermination(t);
assertFalse(l.isSignalled());
} |
acquireSharedInterruptibly is interruptible
| AwaitMethod::testAcquireSharedInterruptibly_Interruptible | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testTryAcquireSharedNanos_Interruptible() {
final BooleanLatch l = new BooleanLatch();
Thread t = newStartedThread(new CheckedInterruptedRunnable() {
public void realRun() throws InterruptedException {
assertFalse(l.isSignalled());
long nanos = MILLISECONDS.toNanos(2 * LONG_DELAY_MS);
l.tryAcquireSharedNanos(0, nanos);
}});
waitForQueuedThread(l, t);
assertFalse(l.isSignalled());
t.interrupt();
awaitTermination(t);
assertFalse(l.isSignalled());
} |
tryAcquireSharedNanos is interruptible
| AwaitMethod::testTryAcquireSharedNanos_Interruptible | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testTryAcquireSharedNanos_Timeout() {
final BooleanLatch l = new BooleanLatch();
final BooleanLatch observedQueued = new BooleanLatch();
Thread t = newStartedThread(new CheckedRunnable() {
public void realRun() throws InterruptedException {
assertFalse(l.isSignalled());
for (long millis = timeoutMillis();
!observedQueued.isSignalled();
millis *= 2) {
long nanos = MILLISECONDS.toNanos(millis);
long startTime = System.nanoTime();
assertFalse(l.tryAcquireSharedNanos(0, nanos));
assertTrue(millisElapsedSince(startTime) >= millis);
}
assertFalse(l.isSignalled());
}});
waitForQueuedThread(l, t);
observedQueued.releaseShared(0);
assertFalse(l.isSignalled());
awaitTermination(t);
assertFalse(l.isSignalled());
} |
tryAcquireSharedNanos times out if not released before timeout
| AwaitMethod::testTryAcquireSharedNanos_Timeout | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testAwait_Zero() throws InterruptedException {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
sync.acquire();
assertTrue(c.awaitNanos(0L) <= 0);
assertFalse(c.await(0L, NANOSECONDS));
sync.release();
} |
awaitNanos/timed await with 0 wait times out immediately
| AwaitMethod::testAwait_Zero | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public void testAwait_NegativeInfinity() throws InterruptedException {
final Mutex sync = new Mutex();
final ConditionObject c = sync.newCondition();
sync.acquire();
assertTrue(c.awaitNanos(Long.MIN_VALUE) <= 0);
assertFalse(c.await(Long.MIN_VALUE, NANOSECONDS));
sync.release();
} |
awaitNanos/timed await with maximum negative wait times does not underflow
| AwaitMethod::testAwait_NegativeInfinity | java | Reginer/aosp-android-jar | android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/jsr166/AbstractQueuedLongSynchronizerTest.java | MIT |
public static ScriptIntrinsicHistogram create(RenderScript rs, Element e) {
if ((!e.isCompatible(Element.U8_4(rs))) &&
(!e.isCompatible(Element.U8_3(rs))) &&
(!e.isCompatible(Element.U8_2(rs))) &&
(!e.isCompatible(Element.U8(rs)))) {
throw new RSIllegalArgumentException("Unsupported element type.");
}
long id;
boolean mUseIncSupp = rs.isUseNative() &&
android.os.Build.VERSION.SDK_INT < INTRINSIC_API_LEVEL;
id = rs.nScriptIntrinsicCreate(9, e.getID(rs), mUseIncSupp);
ScriptIntrinsicHistogram si = new ScriptIntrinsicHistogram(id, rs);
si.setIncSupp(mUseIncSupp);
return si;
} |
Create an intrinsic for calculating the histogram of an uchar
or uchar4 image.
Supported elements types are
{@link Element#U8_4}, {@link Element#U8_3},
{@link Element#U8_2}, {@link Element#U8}
@param rs The RenderScript context
@param e Element type for inputs
@return ScriptIntrinsicHistogram
| ScriptIntrinsicHistogram::create | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void forEach(Allocation ain) {
forEach(ain, null);
} |
Process an input buffer and place the histogram into the
output allocation. The output allocation may be a narrower
vector size than the input. In this case the vector size of
the output is used to determine how many of the input
channels are used in the computation. This is useful if you
have an RGBA input buffer but only want the histogram for
RGB.
1D and 2D input allocations are supported.
@param ain The input image
| ScriptIntrinsicHistogram::forEach | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void forEach(Allocation ain, Script.LaunchOptions opt) {
if (ain.getType().getElement().getVectorSize() <
mOut.getType().getElement().getVectorSize()) {
throw new RSIllegalArgumentException(
"Input vector size must be >= output vector size.");
}
if (!ain.getType().getElement().isCompatible(Element.U8(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_2(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_3(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_4(mRS))) {
throw new RSIllegalArgumentException("Input type must be U8, U8_1, U8_2 or U8_4.");
}
forEach(0, ain, null, null, opt);
} |
Process an input buffer and place the histogram into the
output allocation. The output allocation may be a narrower
vector size than the input. In this case the vector size of
the output is used to determine how many of the input
channels are used in the computation. This is useful if you
have an RGBA input buffer but only want the histogram for
RGB.
1D and 2D input allocations are supported.
@param ain The input image
@param opt LaunchOptions for clipping
| ScriptIntrinsicHistogram::forEach | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void setDotCoefficients(float r, float g, float b, float a) {
if ((r < 0.f) || (g < 0.f) || (b < 0.f) || (a < 0.f)) {
throw new RSIllegalArgumentException("Coefficient may not be negative.");
}
if ((r + g + b + a) > 1.f) {
throw new RSIllegalArgumentException("Sum of coefficients must be 1.0 or less.");
}
FieldPacker fp = new FieldPacker(16);
fp.addF32(r);
fp.addF32(g);
fp.addF32(b);
fp.addF32(a);
setVar(0, fp);
} |
Set the coefficients used for the RGBA to Luminocity
calculation. The default is {0.299f, 0.587f, 0.114f, 0.f}.
Coefficients must be >= 0 and sum to 1.0 or less.
@param r Red coefficient
@param g Green coefficient
@param b Blue coefficient
@param a Alpha coefficient
| ScriptIntrinsicHistogram::setDotCoefficients | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void setOutput(Allocation aout) {
mOut = aout;
if (mOut.getType().getElement() != Element.U32(mRS) &&
mOut.getType().getElement() != Element.U32_2(mRS) &&
mOut.getType().getElement() != Element.U32_3(mRS) &&
mOut.getType().getElement() != Element.U32_4(mRS) &&
mOut.getType().getElement() != Element.I32(mRS) &&
mOut.getType().getElement() != Element.I32_2(mRS) &&
mOut.getType().getElement() != Element.I32_3(mRS) &&
mOut.getType().getElement() != Element.I32_4(mRS)) {
throw new RSIllegalArgumentException("Output type must be U32 or I32.");
}
if ((mOut.getType().getX() != 256) ||
(mOut.getType().getY() != 0) ||
mOut.getType().hasMipmaps() ||
(mOut.getType().getYuv() != 0)) {
throw new RSIllegalArgumentException("Output must be 1D, 256 elements.");
}
setVar(1, aout);
} |
Set the output of the histogram. 32 bit integer types are
supported.
@param aout The output allocation
| ScriptIntrinsicHistogram::setOutput | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void forEach_Dot(Allocation ain) {
forEach_Dot(ain, null);
} |
Process an input buffer and place the histogram into the
output allocation. The dot product of the input channel and
the coefficients from 'setDotCoefficients' are used to
calculate the output values.
1D and 2D input allocations are supported.
@param ain The input image
| ScriptIntrinsicHistogram::forEach_Dot | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public void forEach_Dot(Allocation ain, Script.LaunchOptions opt) {
if (mOut.getType().getElement().getVectorSize() != 1) {
throw new RSIllegalArgumentException("Output vector size must be one.");
}
if (!ain.getType().getElement().isCompatible(Element.U8(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_2(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_3(mRS)) &&
!ain.getType().getElement().isCompatible(Element.U8_4(mRS))) {
throw new RSIllegalArgumentException("Input type must be U8, U8_1, U8_2 or U8_4.");
}
forEach(1, ain, null, null, opt);
} |
Process an input buffer and place the histogram into the
output allocation. The dot product of the input channel and
the coefficients from 'setDotCoefficients' are used to
calculate the output values.
1D and 2D input allocations are supported.
@param ain The input image
@param opt LaunchOptions for clipping
| ScriptIntrinsicHistogram::forEach_Dot | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public Script.KernelID getKernelID_Separate() {
return createKernelID(0, 3, null, null);
} |
Get a KernelID for this intrinsic kernel.
@return Script.KernelID The KernelID object.
| ScriptIntrinsicHistogram::getKernelID_Separate | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
public Script.FieldID getFieldID_Input() {
return createFieldID(1, null);
} |
Get a FieldID for the input field of this intrinsic.
@return Script.FieldID The FieldID object.
| ScriptIntrinsicHistogram::getFieldID_Input | java | Reginer/aosp-android-jar | android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/androidx/renderscript/ScriptIntrinsicHistogram.java | MIT |
boolean hasForegroundServices() {
return mHasForegroundServices;
} |
@return true if this process has any foreground services (even timed-out short-FGS)
| ProcessServiceRecord::hasForegroundServices | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
private int getForegroundServiceTypes() {
return mHasForegroundServices ? mFgServiceTypes : 0;
} |
Returns the FGS typps, but it doesn't tell if the types include "NONE" or not, so
do not use it outside of this class.
| ProcessServiceRecord::getForegroundServiceTypes | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
boolean containsAnyForegroundServiceTypes(@ServiceInfo.ForegroundServiceType int types) {
return (getForegroundServiceTypes() & types) != 0;
} |
@return true if the fgs types includes any of the given types.
(wouldn't work for TYPE_NONE, which is 0)
| ProcessServiceRecord::containsAnyForegroundServiceTypes | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
boolean hasNonShortForegroundServices() {
if (!mHasForegroundServices) {
return false; // Process has no FGS running.
}
// Does the process has any FGS of TYPE_NONE?
if (mHasTypeNoneFgs) {
return true;
}
// If not, we can just check mFgServiceTypes.
return mFgServiceTypes != ServiceInfo.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE;
} |
@return true if the process has any FGS that are _not_ a "short" FGS.
| ProcessServiceRecord::hasNonShortForegroundServices | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
boolean areAllShortForegroundServicesProcstateTimedOut(long nowUptime) {
if (!mHasForegroundServices) { // Process has no FGS?
return false;
}
if (hasNonShortForegroundServices()) { // Any non-short FGS running?
return false;
}
// Now we need to look at all short-FGS within the process and see if all of them are
// procstate-timed-out or not.
for (int i = mServices.size() - 1; i >= 0; i--) {
final ServiceRecord sr = mServices.valueAt(i);
if (!sr.isShortFgs() || !sr.hasShortFgsInfo()) {
continue;
}
if (sr.getShortFgsInfo().getProcStateDemoteTime() >= nowUptime) {
return false;
}
}
return true;
} |
@return if this process:
- has at least one short-FGS
- has no other types of FGS
- and all the short-FGSes are procstate-timed out.
| ProcessServiceRecord::areAllShortForegroundServicesProcstateTimedOut | java | Reginer/aosp-android-jar | android-34/src/com/android/server/am/ProcessServiceRecord.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/am/ProcessServiceRecord.java | MIT |
void abort(int id) {
mActiveSyncs.get(id).finishNow();
} |
Aborts the sync (ie. it doesn't wait for ready or anything to finish)
| SyncGroup::abort | java | Reginer/aosp-android-jar | android-32/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
public ZipFile(String name) throws IOException {
this(new File(name), OPEN_READ);
} |
Opens a zip file for reading.
<p>First, if there is a security manager, its <code>checkRead</code>
method is called with the <code>name</code> argument as its argument
to ensure the read is allowed.
<p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
decode the entry names and comments.
@param name the name of the zip file
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws SecurityException if a security manager exists and its
<code>checkRead</code> method doesn't allow read access to the file.
@see SecurityManager#checkRead(java.lang.String)
| ZipFile::ZipFile | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public ZipFile(File file, int mode) throws IOException {
this(file, mode, StandardCharsets.UTF_8);
} |
Opens a new <code>ZipFile</code> to read from the specified
<code>File</code> object in the specified mode. The mode argument
must be either <tt>OPEN_READ</tt> or <tt>OPEN_READ | OPEN_DELETE</tt>.
<p>First, if there is a security manager, its <code>checkRead</code>
method is called with the <code>name</code> argument as its argument to
ensure the read is allowed.
<p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
decode the entry names and comments
@param file the ZIP file to be opened for reading
@param mode the mode in which the file is to be opened
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws SecurityException if a security manager exists and
its <code>checkRead</code> method
doesn't allow read access to the file,
or its <code>checkDelete</code> method doesn't allow deleting
the file when the <tt>OPEN_DELETE</tt> flag is set.
@throws IllegalArgumentException if the <tt>mode</tt> argument is invalid
@see SecurityManager#checkRead(java.lang.String)
@since 1.3
| ZipFile::ZipFile | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public ZipFile(File file) throws ZipException, IOException {
this(file, OPEN_READ);
} |
Opens a ZIP file for reading given the specified File object.
<p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
decode the entry names and comments.
@param file the ZIP file to be opened for reading
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
| ZipFile::ZipFile | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public ZipFile(File file, Charset charset) throws IOException
{
this(file, OPEN_READ, charset);
} |
Opens a ZIP file for reading given the specified File object.
@param file the ZIP file to be opened for reading
@param charset
The {@linkplain java.nio.charset.Charset charset} to be
used to decode the ZIP entry name and comment (ignored if
the <a href="package-summary.html#lang_encoding"> language
encoding bit</a> of the ZIP entry's general purpose bit
flag is set).
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@since 1.7
| ZipFile::ZipFile | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public String getComment() {
synchronized (this) {
ensureOpen();
byte[] bcomm = getCommentBytes(jzfile);
if (bcomm == null)
return null;
return zc.toString(bcomm, bcomm.length);
}
} |
Returns the zip file comment, or null if none.
@return the comment string for the zip file, or null if none
@throws IllegalStateException if the zip file has been closed
Since 1.7
| ZipFile::getComment | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public ZipEntry getEntry(String name) {
if (name == null) {
throw new NullPointerException("name");
}
long jzentry = 0;
synchronized (this) {
ensureOpen();
jzentry = getEntry(jzfile, zc.getBytes(name), true);
if (jzentry != 0) {
ZipEntry ze = getZipEntry(name, jzentry);
freeEntry(jzfile, jzentry);
return ze;
}
}
return null;
} |
Returns the zip file entry for the specified name, or null
if not found.
@param name the name of the entry
@return the zip file entry, or null if not found
@throws IllegalStateException if the zip file has been closed
| ZipFile::getEntry | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");
}
long jzentry = 0;
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
if (!zc.isUTF8() && (entry.flag & USE_UTF8) != 0) {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// Needed for ClassPathURLStreamHandler handling of URLs without trailing slashes.
// This was added as part of the work to move StrictJarFile from libcore to
// framework, see http://b/111293098 for more details.
// It should be possible to revert this after upgrading to OpenJDK 8u144 or above.
// jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), true);
} else {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// jzentry = getEntry(jzfile, zc.getBytes(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytes(entry.name), true);
}
if (jzentry == 0) {
return null;
}
in = new ZipFileInputStream(jzentry);
switch (getEntryMethod(jzentry)) {
case STORED:
synchronized (streams) {
streams.put(in, null);
}
return in;
case DEFLATED:
// MORE: Compute good size for inflater stream:
long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
// Android-changed: Use 64k buffer size, performs better than 8k.
// See http://b/65491407.
// if (size > 65536) size = 8192;
if (size > 65536) size = 65536;
if (size <= 0) size = 4096;
Inflater inf = getInflater();
InputStream is =
new ZipFileInflaterInputStream(in, inf, (int)size);
synchronized (streams) {
streams.put(is, inf);
}
return is;
default:
throw new ZipException("invalid compression method");
}
}
} |
Returns an input stream for reading the contents of the specified
zip file entry.
<p> Closing this ZIP file will, in turn, close all input
streams that have been returned by invocations of this method.
@param entry the zip file entry
@return the input stream for reading the contents of the specified
zip file entry.
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws IllegalStateException if the zip file has been closed
| ZipFile::getInputStream | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
private Inflater getInflater() {
Inflater inf;
synchronized (inflaterCache) {
while (null != (inf = inflaterCache.poll())) {
if (false == inf.ended()) {
return inf;
}
}
}
return new Inflater(true);
} |
Returns an input stream for reading the contents of the specified
zip file entry.
<p> Closing this ZIP file will, in turn, close all input
streams that have been returned by invocations of this method.
@param entry the zip file entry
@return the input stream for reading the contents of the specified
zip file entry.
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws IllegalStateException if the zip file has been closed
public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");
}
long jzentry = 0;
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
if (!zc.isUTF8() && (entry.flag & USE_UTF8) != 0) {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// Needed for ClassPathURLStreamHandler handling of URLs without trailing slashes.
// This was added as part of the work to move StrictJarFile from libcore to
// framework, see http://b/111293098 for more details.
// It should be possible to revert this after upgrading to OpenJDK 8u144 or above.
// jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), true);
} else {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// jzentry = getEntry(jzfile, zc.getBytes(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytes(entry.name), true);
}
if (jzentry == 0) {
return null;
}
in = new ZipFileInputStream(jzentry);
switch (getEntryMethod(jzentry)) {
case STORED:
synchronized (streams) {
streams.put(in, null);
}
return in;
case DEFLATED:
// MORE: Compute good size for inflater stream:
long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
// Android-changed: Use 64k buffer size, performs better than 8k.
// See http://b/65491407.
// if (size > 65536) size = 8192;
if (size > 65536) size = 65536;
if (size <= 0) size = 4096;
Inflater inf = getInflater();
InputStream is =
new ZipFileInflaterInputStream(in, inf, (int)size);
synchronized (streams) {
streams.put(is, inf);
}
return is;
default:
throw new ZipException("invalid compression method");
}
}
}
private class ZipFileInflaterInputStream extends InflaterInputStream {
private volatile boolean closeRequested = false;
private boolean eof = false;
private final ZipFileInputStream zfin;
ZipFileInflaterInputStream(ZipFileInputStream zfin, Inflater inf,
int size) {
super(zfin, inf, size);
this.zfin = zfin;
}
public void close() throws IOException {
if (closeRequested)
return;
closeRequested = true;
super.close();
Inflater inf;
synchronized (streams) {
inf = streams.remove(this);
}
if (inf != null) {
releaseInflater(inf);
}
}
// Override fill() method to provide an extra "dummy" byte
// at the end of the input stream. This is required when
// using the "nowrap" Inflater option.
protected void fill() throws IOException {
if (eof) {
throw new EOFException("Unexpected end of ZLIB input stream");
}
len = in.read(buf, 0, buf.length);
if (len == -1) {
buf[0] = 0;
len = 1;
eof = true;
}
inf.setInput(buf, 0, len);
}
public int available() throws IOException {
if (closeRequested)
return 0;
long avail = zfin.size() - inf.getBytesWritten();
return (avail > (long) Integer.MAX_VALUE ?
Integer.MAX_VALUE : (int) avail);
}
protected void finalize() throws Throwable {
close();
}
}
/*
Gets an inflater from the list of available inflaters or allocates
a new one.
| ZipFileInflaterInputStream::getInflater | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
private void releaseInflater(Inflater inf) {
if (false == inf.ended()) {
inf.reset();
synchronized (inflaterCache) {
inflaterCache.add(inf);
}
}
} |
Returns an input stream for reading the contents of the specified
zip file entry.
<p> Closing this ZIP file will, in turn, close all input
streams that have been returned by invocations of this method.
@param entry the zip file entry
@return the input stream for reading the contents of the specified
zip file entry.
@throws ZipException if a ZIP format error has occurred
@throws IOException if an I/O error has occurred
@throws IllegalStateException if the zip file has been closed
public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");
}
long jzentry = 0;
ZipFileInputStream in = null;
synchronized (this) {
ensureOpen();
if (!zc.isUTF8() && (entry.flag & USE_UTF8) != 0) {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// Needed for ClassPathURLStreamHandler handling of URLs without trailing slashes.
// This was added as part of the work to move StrictJarFile from libcore to
// framework, see http://b/111293098 for more details.
// It should be possible to revert this after upgrading to OpenJDK 8u144 or above.
// jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytesUTF8(entry.name), true);
} else {
// Android-changed: Find entry by name, falling back to name/ if cannot be found.
// jzentry = getEntry(jzfile, zc.getBytes(entry.name), false);
jzentry = getEntry(jzfile, zc.getBytes(entry.name), true);
}
if (jzentry == 0) {
return null;
}
in = new ZipFileInputStream(jzentry);
switch (getEntryMethod(jzentry)) {
case STORED:
synchronized (streams) {
streams.put(in, null);
}
return in;
case DEFLATED:
// MORE: Compute good size for inflater stream:
long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
// Android-changed: Use 64k buffer size, performs better than 8k.
// See http://b/65491407.
// if (size > 65536) size = 8192;
if (size > 65536) size = 65536;
if (size <= 0) size = 4096;
Inflater inf = getInflater();
InputStream is =
new ZipFileInflaterInputStream(in, inf, (int)size);
synchronized (streams) {
streams.put(is, inf);
}
return is;
default:
throw new ZipException("invalid compression method");
}
}
}
private class ZipFileInflaterInputStream extends InflaterInputStream {
private volatile boolean closeRequested = false;
private boolean eof = false;
private final ZipFileInputStream zfin;
ZipFileInflaterInputStream(ZipFileInputStream zfin, Inflater inf,
int size) {
super(zfin, inf, size);
this.zfin = zfin;
}
public void close() throws IOException {
if (closeRequested)
return;
closeRequested = true;
super.close();
Inflater inf;
synchronized (streams) {
inf = streams.remove(this);
}
if (inf != null) {
releaseInflater(inf);
}
}
// Override fill() method to provide an extra "dummy" byte
// at the end of the input stream. This is required when
// using the "nowrap" Inflater option.
protected void fill() throws IOException {
if (eof) {
throw new EOFException("Unexpected end of ZLIB input stream");
}
len = in.read(buf, 0, buf.length);
if (len == -1) {
buf[0] = 0;
len = 1;
eof = true;
}
inf.setInput(buf, 0, len);
}
public int available() throws IOException {
if (closeRequested)
return 0;
long avail = zfin.size() - inf.getBytesWritten();
return (avail > (long) Integer.MAX_VALUE ?
Integer.MAX_VALUE : (int) avail);
}
protected void finalize() throws Throwable {
close();
}
}
/*
Gets an inflater from the list of available inflaters or allocates
a new one.
private Inflater getInflater() {
Inflater inf;
synchronized (inflaterCache) {
while (null != (inf = inflaterCache.poll())) {
if (false == inf.ended()) {
return inf;
}
}
}
return new Inflater(true);
}
/*
Releases the specified inflater to the list of available inflaters.
| ZipFileInflaterInputStream::releaseInflater | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public String getName() {
return name;
} |
Returns the path name of the ZIP file.
@return the path name of the ZIP file
| ZipFileInflaterInputStream::getName | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public Enumeration<? extends ZipEntry> entries() {
return new ZipEntryIterator();
} |
Returns an enumeration of the ZIP file entries.
@return an enumeration of the ZIP file entries
@throws IllegalStateException if the zip file has been closed
| ZipEntryIterator::entries | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public Stream<? extends ZipEntry> stream() {
return StreamSupport.stream(Spliterators.spliterator(
new ZipEntryIterator(), size(),
Spliterator.ORDERED | Spliterator.DISTINCT |
Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
} |
Return an ordered {@code Stream} over the ZIP file entries.
Entries appear in the {@code Stream} in the order they appear in
the central directory of the ZIP file.
@return an ordered {@code Stream} of entries in this ZIP file
@throws IllegalStateException if the zip file has been closed
@since 1.8
| ZipEntryIterator::stream | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public int size() {
ensureOpen();
return total;
} |
Returns the number of entries in the ZIP file.
@return the number of entries in the ZIP file
@throws IllegalStateException if the zip file has been closed
| ZipEntryIterator::size | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public void close() throws IOException {
if (closeRequested)
return;
// Android-added: CloseGuard support.
if (guard != null) {
guard.close();
}
closeRequested = true;
synchronized (this) {
// Close streams, release their inflaters
// BEGIN Android-added: null field check to avoid NullPointerException during finalize.
// If the constructor threw an exception then the streams / inflaterCache fields can
// be null and close() can be called by the finalizer.
if (streams != null) {
// END Android-added: null field check to avoid NullPointerException during finalize.
synchronized (streams) {
if (false == streams.isEmpty()) {
Map<InputStream, Inflater> copy = new HashMap<>(streams);
streams.clear();
for (Map.Entry<InputStream, Inflater> e : copy.entrySet()) {
e.getKey().close();
Inflater inf = e.getValue();
if (inf != null) {
inf.end();
}
}
}
}
// BEGIN Android-added: null field check to avoid NullPointerException during finalize.
}
if (inflaterCache != null) {
// END Android-added: null field check to avoid NullPointerException during finalize.
// Release cached inflaters
Inflater inf;
synchronized (inflaterCache) {
while (null != (inf = inflaterCache.poll())) {
inf.end();
}
}
// BEGIN Android-added: null field check to avoid NullPointerException during finalize.
}
// END Android-added: null field check to avoid NullPointerException during finalize.
if (jzfile != 0) {
// Close the zip file
long zf = this.jzfile;
jzfile = 0;
close(zf);
}
// Android-added: Do not use unlink() to implement OPEN_DELETE.
if (fileToRemoveOnClose != null) {
fileToRemoveOnClose.delete();
}
}
} |
Closes the ZIP file.
<p> Closing this ZIP file will close all of the input streams
previously returned by invocations of the {@link #getInputStream
getInputStream} method.
@throws IOException if an I/O error has occurred
| ZipEntryIterator::close | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
protected void finalize() throws IOException {
// Android-added: CloseGuard support.
if (guard != null) {
guard.warnIfOpen();
}
close();
} |
Ensures that the system resources held by this ZipFile object are
released when there are no more references to it.
<p>
Since the time when GC would invoke this method is undetermined,
it is strongly recommended that applications invoke the <code>close</code>
method as soon they have finished accessing this <code>ZipFile</code>.
This will prevent holding up system resources for an undetermined
length of time.
@throws IOException if an I/O error has occurred
@see java.util.zip.ZipFile#close()
| ZipEntryIterator::finalize | java | Reginer/aosp-android-jar | android-33/src/java/util/zip/ZipFile.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/zip/ZipFile.java | MIT |
public Button(Context context) {
this(context, null);
} |
Simple constructor to use when creating a button from code.
@param context The Context the Button is running in, through which it can
access the current theme, resources, etc.
@see #Button(Context, AttributeSet)
| Button::Button | java | Reginer/aosp-android-jar | android-34/src/android/widget/Button.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/widget/Button.java | MIT |
public Button(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.buttonStyle);
} |
{@link LayoutInflater} calls this constructor when inflating a Button from XML.
The attributes defined by the current theme's
{@link android.R.attr#buttonStyle android:buttonStyle}
override base view attributes.
You typically do not call this constructor to create your own button instance in code.
However, you must override this constructor when
<a href="{@docRoot}training/custom-views/index.html">creating custom views</a>.
@param context The Context the view is running in, through which it can
access the current theme, resources, etc.
@param attrs The attributes of the XML Button tag being used to inflate the view.
@see #Button(Context, AttributeSet, int)
@see android.view.View#View(Context, AttributeSet)
| Button::Button | java | Reginer/aosp-android-jar | android-34/src/android/widget/Button.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/widget/Button.java | MIT |
public Button(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
} |
This constructor allows a Button subclass to use its own class-specific base style from a
theme attribute when inflating. The attributes defined by the current theme's
{@code defStyleAttr} override base view attributes.
<p>For Button's base view attributes see
{@link android.R.styleable#Button Button Attributes},
{@link android.R.styleable#TextView TextView Attributes},
{@link android.R.styleable#View View Attributes}.
@param context The Context the Button is running in, through which it can
access the current theme, resources, etc.
@param attrs The attributes of the XML Button tag that is inflating the view.
@param defStyleAttr The resource identifier of an attribute in the current theme
whose value is the the resource id of a style. The specified style’s
attribute values serve as default values for the button. Set this parameter
to 0 to avoid use of default values.
@see #Button(Context, AttributeSet, int, int)
@see android.view.View#View(Context, AttributeSet, int)
| Button::Button | java | Reginer/aosp-android-jar | android-34/src/android/widget/Button.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/widget/Button.java | MIT |
public Button(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
} |
This constructor allows a Button subclass to use its own class-specific base style from
either a theme attribute or style resource when inflating. To see how the final value of a
particular attribute is resolved based on your inputs to this constructor, see
{@link android.view.View#View(Context, AttributeSet, int, int)}.
@param context The Context the Button is running in, through which it can
access the current theme, resources, etc.
@param attrs The attributes of the XML Button tag that is inflating the view.
@param defStyleAttr The resource identifier of an attribute in the current theme
whose value is the the resource id of a style. The specified style’s
attribute values serve as default values for the button. Set this parameter
to 0 to avoid use of default values.
@param defStyleRes The identifier of a style resource that
supplies default values for the button, used only if
defStyleAttr is 0 or cannot be found in the theme.
Set this parameter to 0 to avoid use of default values.
@see #Button(Context, AttributeSet, int)
@see android.view.View#View(Context, AttributeSet, int, int)
| Button::Button | java | Reginer/aosp-android-jar | android-34/src/android/widget/Button.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/widget/Button.java | MIT |
static void enforcePermissionForPreflight(@NonNull Context context,
@NonNull Identity identity, @NonNull String permission) {
final int status = PermissionUtil.checkPermissionForPreflight(context, identity,
permission);
switch (status) {
case PermissionChecker.PERMISSION_GRANTED:
case PermissionChecker.PERMISSION_SOFT_DENIED:
return;
case PermissionChecker.PERMISSION_HARD_DENIED:
throw new SecurityException(
TextUtils.formatSimple("Failed to obtain permission %s for identity %s",
permission, toString(identity)));
default:
throw new RuntimeException("Unexpected permission check result.");
}
} |
Throws a {@link SecurityException} if originator permanently doesn't have the given
permission.
Soft (temporary) denials are considered OK for preflight purposes.
@param context A {@link Context}, used for permission checks.
@param identity The identity to check.
@param permission The identifier of the permission we want to check.
| SoundTriggerSessionPermissionsDecorator::enforcePermissionForPreflight | java | Reginer/aosp-android-jar | android-32/src/com/android/server/voiceinteraction/SoundTriggerSessionPermissionsDecorator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/voiceinteraction/SoundTriggerSessionPermissionsDecorator.java | MIT |
public X509V1CertImpl() { } |
Default constructor.
| X509V1CertImpl::X509V1CertImpl | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public X509V1CertImpl(byte[] certData)
throws CertificateException {
try {
ByteArrayInputStream bs;
bs = new ByteArrayInputStream(certData);
wrappedCert = (java.security.cert.X509Certificate)
getFactory().generateCertificate(bs);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
} |
Unmarshals a certificate from its encoded form, parsing the
encoded bytes. This form of constructor is used by agents which
need to examine and use certificate contents. That is, this is
one of the more commonly used constructors. Note that the buffer
must include only a certificate, and no "garbage" may be left at
the end. If you need to ignore data at the end of a certificate,
use another constructor.
@param certData the encoded bytes, with no trailing padding.
@exception CertificateException on parsing errors.
| X509V1CertImpl::X509V1CertImpl | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public X509V1CertImpl(InputStream in)
throws CertificateException {
try {
wrappedCert = (java.security.cert.X509Certificate)
getFactory().generateCertificate(in);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
} |
unmarshals an X.509 certificate from an input stream.
@param in an input stream holding at least one certificate
@exception CertificateException on parsing errors.
| X509V1CertImpl::X509V1CertImpl | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public byte[] getEncoded() throws CertificateEncodingException {
try {
return wrappedCert.getEncoded();
} catch (java.security.cert.CertificateEncodingException e) {
throw new CertificateEncodingException(e.getMessage());
}
} |
Returns the encoded form of this certificate. It is
assumed that each certificate type would have only a single
form of encoding; for example, X.509 certificates would
be encoded as ASN.1 DER.
| X509V1CertImpl::getEncoded | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public void verify(PublicKey key)
throws CertificateException, NoSuchAlgorithmException,
InvalidKeyException, NoSuchProviderException,
SignatureException
{
try {
wrappedCert.verify(key);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
} |
Throws an exception if the certificate was not signed using the
verification key provided. Successfully verifying a certificate
does <em>not</em> indicate that one should trust the entity which
it represents.
@param key the public key used for verification.
| X509V1CertImpl::verify | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public void verify(PublicKey key, String sigProvider)
throws CertificateException, NoSuchAlgorithmException,
InvalidKeyException, NoSuchProviderException,
SignatureException
{
try {
wrappedCert.verify(key, sigProvider);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
} |
Throws an exception if the certificate was not signed using the
verification key provided. Successfully verifying a certificate
does <em>not</em> indicate that one should trust the entity which
it represents.
@param key the public key used for verification.
@param sigProvider the name of the provider.
| X509V1CertImpl::verify | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public void checkValidity() throws
CertificateExpiredException, CertificateNotYetValidException {
checkValidity(new Date());
} |
Checks that the certificate is currently valid, i.e. the current
time is within the specified validity period.
| X509V1CertImpl::checkValidity | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public void checkValidity(Date date) throws
CertificateExpiredException, CertificateNotYetValidException {
try {
wrappedCert.checkValidity(date);
} catch (java.security.cert.CertificateNotYetValidException e) {
throw new CertificateNotYetValidException(e.getMessage());
} catch (java.security.cert.CertificateExpiredException e) {
throw new CertificateExpiredException(e.getMessage());
}
} |
Checks that the specified date is within the certificate's
validity period, or basically if the certificate would be
valid at the specified date/time.
@param date the Date to check against to see if this certificate
is valid at that date/time.
| X509V1CertImpl::checkValidity | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public String toString() {
return wrappedCert.toString();
} |
Returns a printable representation of the certificate. This does not
contain all the information available to distinguish this from any
other certificate. The certificate must be fully constructed
before this function may be called.
| X509V1CertImpl::toString | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public PublicKey getPublicKey() {
PublicKey key = wrappedCert.getPublicKey();
return key;
} |
Gets the publickey from this certificate.
@return the publickey.
| X509V1CertImpl::getPublicKey | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public int getVersion() {
return wrappedCert.getVersion() - 1;
} |
Gets the publickey from this certificate.
@return the publickey.
public PublicKey getPublicKey() {
PublicKey key = wrappedCert.getPublicKey();
return key;
}
/*
Gets the version number from the certificate.
@return the version number.
| X509V1CertImpl::getVersion | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public BigInteger getSerialNumber() {
return wrappedCert.getSerialNumber();
} |
Gets the serial number from the certificate.
@return the serial number.
| X509V1CertImpl::getSerialNumber | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public Principal getSubjectDN() {
return wrappedCert.getSubjectDN();
} |
Gets the subject distinguished name from the certificate.
@return the subject name.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getSubjectDN | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public Principal getIssuerDN() {
return wrappedCert.getIssuerDN();
} |
Gets the issuer distinguished name from the certificate.
@return the issuer name.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getIssuerDN | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public Date getNotBefore() {
return wrappedCert.getNotBefore();
} |
Gets the notBefore date from the validity period of the certificate.
@return the start date of the validity period.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getNotBefore | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public Date getNotAfter() {
return wrappedCert.getNotAfter();
} |
Gets the notAfter date from the validity period of the certificate.
@return the end date of the validity period.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getNotAfter | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public String getSigAlgName() {
return wrappedCert.getSigAlgName();
} |
Gets the signature algorithm name for the certificate
signature algorithm.
For example, the string "SHA1/DSA".
@return the signature algorithm name.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getSigAlgName | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public String getSigAlgOID() {
return wrappedCert.getSigAlgOID();
} |
Gets the signature algorithm OID string from the certificate.
For example, the string "1.2.840.10040.4.3"
@return the signature algorithm oid string.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getSigAlgOID | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public byte[] getSigAlgParams() {
return wrappedCert.getSigAlgParams();
} |
Gets the DER encoded signature algorithm parameters from this
certificate's signature algorithm.
@return the DER encoded signature algorithm parameters, or
null if no parameters are present.
@exception CertificateException if a parsing error occurs.
| X509V1CertImpl::getSigAlgParams | java | Reginer/aosp-android-jar | android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/sun/security/cert/internal/x509/X509V1CertImpl.java | MIT |
public final void addUidToObserverImpl(@NonNull IBinder observerToken, int uid) {
int i = mUidObservers.beginBroadcast();
while (i-- > 0) {
var reg = (UidObserverRegistration) mUidObservers.getBroadcastCookie(i);
if (reg.getToken().equals(observerToken)) {
reg.addUid(uid);
break;
}
if (i == 0) {
Slog.e(TAG_UID_OBSERVERS, "Unable to find UidObserver by token");
}
}
mUidObservers.finishBroadcast();
} |
Add a uid to the list of uids an observer is interested in. Must be run on the same thread
as mDispatchRunnable.
@param observerToken The token identifier for a UidObserver
@param uid The uid to add to the list of watched uids
| UidObserverController::addUidToObserverImpl | java | Reginer/aosp-android-jar | android-35/src/com/android/server/am/UidObserverController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/am/UidObserverController.java | MIT |
public final void removeUidFromObserverImpl(@NonNull IBinder observerToken, int uid) {
int i = mUidObservers.beginBroadcast();
while (i-- > 0) {
var reg = (UidObserverRegistration) mUidObservers.getBroadcastCookie(i);
if (reg.getToken().equals(observerToken)) {
reg.removeUid(uid);
break;
}
if (i == 0) {
Slog.e(TAG_UID_OBSERVERS, "Unable to find UidObserver by token");
}
}
mUidObservers.finishBroadcast();
} |
Remove a uid from the list of uids an observer is interested in. Must be run on the same
thread as mDispatchRunnable.
@param observerToken The token identifier for a UidObserver
@param uid The uid to remove from the list of watched uids
| UidObserverController::removeUidFromObserverImpl | java | Reginer/aosp-android-jar | android-35/src/com/android/server/am/UidObserverController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/am/UidObserverController.java | MIT |
public Attributes() {
this(11);
} |
Constructs a new, empty Attributes object with default size.
| Attributes::Attributes | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Attributes(int size) {
map = new LinkedHashMap<>(size);
} |
Constructs a new, empty Attributes object with the specified
initial size.
@param size the initial number of attributes
| Attributes::Attributes | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Attributes(Attributes attr) {
map = new LinkedHashMap<>(attr);
} |
Constructs a new Attributes object with the same attribute name-value
mappings as in the specified Attributes.
@param attr the specified Attributes
| Attributes::Attributes | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Object get(Object name) {
return map.get(name);
} |
Returns the value of the specified attribute name, or null if the
attribute name was not found.
@param name the attribute name
@return the value of the specified attribute name, or null if
not found.
| Attributes::get | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public String getValue(String name) {
return (String)get(Name.of(name));
} |
Returns the value of the specified attribute name, specified as
a string, or null if the attribute was not found. The attribute
name is case-insensitive.
<p>
This method is defined as:
<pre>
return (String)get(new Attributes.Name((String)name));
</pre>
@param name the attribute name as a string
@return the String value of the specified attribute name, or null if
not found.
@throws IllegalArgumentException if the attribute name is invalid
| Attributes::getValue | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public String getValue(Name name) {
return (String)get(name);
} |
Returns the value of the specified Attributes.Name, or null if the
attribute was not found.
<p>
This method is defined as:
<pre>
return (String)get(name);
</pre>
@param name the Attributes.Name object
@return the String value of the specified Attribute.Name, or null if
not found.
| Attributes::getValue | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Object put(Object name, Object value) {
return map.put((Attributes.Name)name, (String)value);
} |
Associates the specified value with the specified attribute name
(key) in this Map. If the Map previously contained a mapping for
the attribute name, the old value is replaced.
@param name the attribute name
@param value the attribute value
@return the previous value of the attribute, or null if none
@throws ClassCastException if the name is not a Attributes.Name
or the value is not a String
| Attributes::put | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public String putValue(String name, String value) {
return (String)put(Name.of(name), value);
} |
Associates the specified value with the specified attribute name,
specified as a String. The attributes name is case-insensitive.
If the Map previously contained a mapping for the attribute name,
the old value is replaced.
<p>
This method is defined as:
<pre>
return (String)put(new Attributes.Name(name), value);
</pre>
@param name the attribute name as a string
@param value the attribute value
@return the previous value of the attribute, or null if none
@throws IllegalArgumentException if the attribute name is invalid
| Attributes::putValue | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Object remove(Object name) {
return map.remove(name);
} |
Removes the attribute with the specified name (key) from this Map.
Returns the previous attribute value, or null if none.
@param name attribute name
@return the previous value of the attribute, or null if none
| Attributes::remove | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public boolean containsValue(Object value) {
return map.containsValue(value);
} |
Returns true if this Map maps one or more attribute names (keys)
to the specified value.
@param value the attribute value
@return true if this Map maps one or more attribute names to
the specified value
| Attributes::containsValue | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public boolean containsKey(Object name) {
return map.containsKey(name);
} |
Returns true if this Map contains the specified attribute name (key).
@param name the attribute name
@return true if this Map contains the specified attribute name
| Attributes::containsKey | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public void putAll(Map<?,?> attr) {
// ## javac bug?
if (!Attributes.class.isInstance(attr))
throw new ClassCastException();
for (Map.Entry<?,?> me : (attr).entrySet())
put(me.getKey(), me.getValue());
} |
Copies all of the attribute name-value mappings from the specified
Attributes to this Map. Duplicate mappings will be replaced.
@param attr the Attributes to be stored in this map
@throws ClassCastException if attr is not an Attributes
| Attributes::putAll | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public Name(String name) {
this.hashCode = hash(name);
this.name = name.intern();
} |
Constructs a new attribute name using the given string name.
@param name the attribute string name
@throws IllegalArgumentException if the attribute name was
invalid
@throws NullPointerException if the attribute name was null
| Name::Name | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
public boolean equals(Object o) {
if (this == o) {
return true;
}
// TODO(b/248243024) revert this.
/*
return o instanceof Name other
&& other.name.equalsIgnoreCase(name);
*/
if (o instanceof Name) {
return ((Name) o).name.equalsIgnoreCase(name);
}
return false;
} |
Compares this attribute name to another for equality.
@param o the object to compare
@return true if this attribute name is equal to the
specified attribute object
| Name::equals | java | Reginer/aosp-android-jar | android-34/src/java/util/jar/Attributes.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/util/jar/Attributes.java | MIT |
Subsets and Splits