code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
private void dumpCheckin(PrintWriter pw, long start, long end, NetworkTemplate groupTemplate,
String groupPrefix) {
final ArrayMap<Key, NetworkStatsHistory> grouped = new ArrayMap<>();
// Walk through all history, grouping by matching network templates
for (int i = 0; i < mStats.size(); i++) {
final Key key = mStats.keyAt(i);
final NetworkStatsHistory value = mStats.valueAt(i);
if (!templateMatches(groupTemplate, key.ident)) continue;
if (key.set >= NetworkStats.SET_DEBUG_START) continue;
final Key groupKey = new Key(null, key.uid, key.set, key.tag);
NetworkStatsHistory groupHistory = grouped.get(groupKey);
if (groupHistory == null) {
groupHistory = new NetworkStatsHistory(value.getBucketDuration());
grouped.put(groupKey, groupHistory);
}
groupHistory.recordHistory(value, start, end);
}
for (int i = 0; i < grouped.size(); i++) {
final Key key = grouped.keyAt(i);
final NetworkStatsHistory value = grouped.valueAt(i);
if (value.size() == 0) continue;
pw.print("c,");
pw.print(groupPrefix); pw.print(',');
pw.print(key.uid); pw.print(',');
pw.print(NetworkStats.setToCheckinString(key.set)); pw.print(',');
pw.print(key.tag);
pw.println();
value.dumpCheckin(pw);
}
} |
Dump all contained stats that match requested parameters, but group
together all matching {@link NetworkTemplate} under a single prefix.
| NetworkStatsCollection::dumpCheckin | java | Reginer/aosp-android-jar | android-31/src/com/android/server/net/NetworkStatsCollection.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/net/NetworkStatsCollection.java | MIT |
private static boolean templateMatches(NetworkTemplate template, NetworkIdentitySet identSet) {
for (NetworkIdentity ident : identSet) {
if (template.matches(ident)) {
return true;
}
}
return false;
} |
Test if given {@link NetworkTemplate} matches any {@link NetworkIdentity}
in the given {@link NetworkIdentitySet}.
| NetworkStatsCollection::templateMatches | java | Reginer/aosp-android-jar | android-31/src/com/android/server/net/NetworkStatsCollection.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/net/NetworkStatsCollection.java | MIT |
private void updateNotifications(List<PrintJobInfo> printJobs) {
ArraySet<PrintJobId> removedPrintJobs = new ArraySet<>(mNotifications);
final int numPrintJobs = printJobs.size();
// Create per print job notification
for (int i = 0; i < numPrintJobs; i++) {
PrintJobInfo printJob = printJobs.get(i);
PrintJobId printJobId = printJob.getId();
removedPrintJobs.remove(printJobId);
mNotifications.add(printJobId);
createSimpleNotification(printJob);
}
// Remove notifications for print jobs that do not exist anymore
final int numRemovedPrintJobs = removedPrintJobs.size();
for (int i = 0; i < numRemovedPrintJobs; i++) {
PrintJobId removedPrintJob = removedPrintJobs.valueAt(i);
mNotificationManager.cancel(removedPrintJob.flattenToString(), 0);
mNotifications.remove(removedPrintJob);
}
} |
Update notifications for the given print jobs, remove all other notifications.
@param printJobs The print job that we want to create notifications for.
| NotificationController::updateNotifications | java | Reginer/aosp-android-jar | android-31/src/com/android/printspooler/model/NotificationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/printspooler/model/NotificationController.java | MIT |
private Action createCancelAction(PrintJobInfo printJob) {
return new Action.Builder(
Icon.createWithResource(mContext, R.drawable.ic_clear),
mContext.getString(R.string.cancel), createCancelIntent(printJob)).build();
} |
Create an {@link Action} that cancels a {@link PrintJobInfo print job}.
@param printJob The {@link PrintJobInfo print job} to cancel
@return An {@link Action} that will cancel a print job
| NotificationController::createCancelAction | java | Reginer/aosp-android-jar | android-31/src/com/android/printspooler/model/NotificationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/printspooler/model/NotificationController.java | MIT |
private void createNotification(@NonNull PrintJobInfo printJob, @Nullable Action firstAction,
@Nullable Action secondAction) {
Notification.Builder builder = new Notification.Builder(mContext, computeChannel(printJob))
.setContentIntent(createContentIntent(printJob.getId()))
.setSmallIcon(computeNotificationIcon(printJob))
.setContentTitle(computeNotificationTitle(printJob))
.setWhen(System.currentTimeMillis())
.setOngoing(true)
.setShowWhen(true)
.setOnlyAlertOnce(true)
.setColor(mContext.getColor(
com.android.internal.R.color.system_notification_accent_color));
if (firstAction != null) {
builder.addAction(firstAction);
}
if (secondAction != null) {
builder.addAction(secondAction);
}
if (printJob.getState() == PrintJobInfo.STATE_STARTED
|| printJob.getState() == PrintJobInfo.STATE_QUEUED) {
float progress = printJob.getProgress();
if (progress >= 0) {
builder.setProgress(Integer.MAX_VALUE, (int) (Integer.MAX_VALUE * progress),
false);
} else {
builder.setProgress(Integer.MAX_VALUE, 0, true);
}
}
CharSequence status = printJob.getStatus(mContext.getPackageManager());
if (status != null) {
builder.setContentText(status);
} else {
builder.setContentText(printJob.getPrinterName());
}
mNotificationManager.notify(printJob.getId().flattenToString(), 0, builder.build());
} |
Create a notification for a print job.
@param printJob the job the notification is for
@param firstAction the first action shown in the notification
@param secondAction the second action shown in the notification
| NotificationController::createNotification | java | Reginer/aosp-android-jar | android-31/src/com/android/printspooler/model/NotificationController.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/printspooler/model/NotificationController.java | MIT |
public HandshakeCompletedEvent(SSLSocket sock, SSLSession s)
{
super(sock);
session = s;
} |
Constructs a new HandshakeCompletedEvent.
@param sock the SSLSocket acting as the source of the event
@param s the SSLSession this event is associated with
| HandshakeCompletedEvent::HandshakeCompletedEvent | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
public SSLSession getSession()
{
return session;
} |
Returns the session that triggered this event.
@return the <code>SSLSession</code> for this handshake
| HandshakeCompletedEvent::getSession | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
public String getCipherSuite()
{
return session.getCipherSuite();
} |
Returns the cipher suite in use by the session which was produced
by the handshake. (This is a convenience method for
getting the ciphersuite from the SSLsession.)
@return the name of the cipher suite negotiated during this session.
| HandshakeCompletedEvent::getCipherSuite | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
public java.security.cert.Certificate [] getLocalCertificates()
{
return session.getLocalCertificates();
} |
Returns the certificate(s) that were sent to the peer during
handshaking.
Note: This method is useful only when using certificate-based
cipher suites.
When multiple certificates are available for use in a
handshake, the implementation chooses what it considers the
"best" certificate chain available, and transmits that to
the other side. This method allows the caller to know
which certificate chain was actually used.
@return an ordered array of certificates, with the local
certificate first followed by any
certificate authorities. If no certificates were sent,
then null is returned.
@see #getLocalPrincipal()
| HandshakeCompletedEvent::getLocalCertificates | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
public java.security.cert.Certificate [] getPeerCertificates()
throws SSLPeerUnverifiedException
{
return session.getPeerCertificates();
} |
Returns the identity of the peer which was established as part
of defining the session.
Note: This method can be used only when using certificate-based
cipher suites; using it with non-certificate-based cipher suites,
such as Kerberos, will throw an SSLPeerUnverifiedException.
@return an ordered array of the peer certificates,
with the peer's own certificate first followed by
any certificate authorities.
@exception SSLPeerUnverifiedException if the peer is not verified.
@see #getPeerPrincipal()
| HandshakeCompletedEvent::getPeerCertificates | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
public javax.security.cert.X509Certificate [] getPeerCertificateChain()
throws SSLPeerUnverifiedException
{
return session.getPeerCertificateChain();
} |
Returns the identity of the peer which was identified as part
of defining the session.
Note: This method can be used only when using certificate-based
cipher suites; using it with non-certificate-based cipher suites,
such as Kerberos, will throw an SSLPeerUnverifiedException.
<p><em>Note: this method exists for compatibility with previous
releases. New applications should use
{@link #getPeerCertificates} instead.</em></p>
@return an ordered array of peer X.509 certificates,
with the peer's own certificate first followed by any
certificate authorities. (The certificates are in
the original JSSE
{@link javax.security.cert.X509Certificate} format).
@exception SSLPeerUnverifiedException if the peer is not verified.
@see #getPeerPrincipal()
| HandshakeCompletedEvent::getPeerCertificateChain | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
public Principal getPeerPrincipal()
throws SSLPeerUnverifiedException
{
Principal principal;
try {
principal = session.getPeerPrincipal();
} catch (AbstractMethodError e) {
// if the provider does not support it, fallback to peer certs.
// return the X500Principal of the end-entity cert.
Certificate[] certs = getPeerCertificates();
principal = ((X509Certificate)certs[0]).getSubjectX500Principal();
}
return principal;
} |
Returns the identity of the peer which was established as part of
defining the session.
@return the peer's principal. Returns an X500Principal of the
end-entity certiticate for X509-based cipher suites, and
KerberosPrincipal for Kerberos cipher suites.
@throws SSLPeerUnverifiedException if the peer's identity has not
been verified
@see #getPeerCertificates()
@see #getLocalPrincipal()
@since 1.5
| HandshakeCompletedEvent::getPeerPrincipal | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
public Principal getLocalPrincipal()
{
Principal principal;
try {
principal = session.getLocalPrincipal();
} catch (AbstractMethodError e) {
principal = null;
// if the provider does not support it, fallback to local certs.
// return the X500Principal of the end-entity cert.
Certificate[] certs = getLocalCertificates();
if (certs != null) {
principal =
((X509Certificate)certs[0]).getSubjectX500Principal();
}
}
return principal;
} |
Returns the principal that was sent to the peer during handshaking.
@return the principal sent to the peer. Returns an X500Principal
of the end-entity certificate for X509-based cipher suites, and
KerberosPrincipal for Kerberos cipher suites. If no principal was
sent, then null is returned.
@see #getLocalCertificates()
@see #getPeerPrincipal()
@since 1.5
| HandshakeCompletedEvent::getLocalPrincipal | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
public SSLSocket getSocket()
{
return (SSLSocket) getSource();
} |
Returns the socket which is the source of this event.
(This is a convenience function, to let applications
write code without type casts.)
@return the socket on which the connection was made.
| HandshakeCompletedEvent::getSocket | java | Reginer/aosp-android-jar | android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/net/ssl/HandshakeCompletedEvent.java | MIT |
@TrackerType int getType() {
return AppRestrictionController.TRACKER_TYPE_UNKNOWN;
} |
Return the type of tracker (as defined by AppRestrictionController.TrackerType)
| BaseAppStateTracker::getType | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
byte[] getTrackerInfoForStatsd(int uid) {
return null;
} |
Return the relevant info object for the tracker for the given uid, used for statsd.
| BaseAppStateTracker::getTrackerInfoForStatsd | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
T getPolicy() {
return mInjector.getPolicy();
} |
Return the policy holder of this tracker.
| BaseAppStateTracker::getPolicy | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onSystemReady() {
mInjector.onSystemReady();
} |
Called when the system is ready to rock.
| BaseAppStateTracker::onSystemReady | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUidAdded(final int uid) {
} |
Called when a user with the given uid is added.
| BaseAppStateTracker::onUidAdded | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUidRemoved(final int uid) {
} |
Called when a user with the given uid is removed.
| BaseAppStateTracker::onUidRemoved | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUserAdded(final @UserIdInt int userId) {
} |
Called when a user with the given userId is added.
| BaseAppStateTracker::onUserAdded | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUserStarted(final @UserIdInt int userId) {
} |
Called when a user with the given userId is started.
| BaseAppStateTracker::onUserStarted | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUserStopped(final @UserIdInt int userId) {
} |
Called when a user with the given userId is stopped.
| BaseAppStateTracker::onUserStopped | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUserRemoved(final @UserIdInt int userId) {
} |
Called when a user with the given userId is removed.
| BaseAppStateTracker::onUserRemoved | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onLockedBootCompleted() {
} |
Called when the system sends LOCKED_BOOT_COMPLETED.
| BaseAppStateTracker::onLockedBootCompleted | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onPropertiesChanged(@NonNull String name) {
getPolicy().onPropertiesChanged(name);
} |
Called when a device config property in the activity manager namespace
has changed.
| BaseAppStateTracker::onPropertiesChanged | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUserInteractionStarted(String packageName, int uid) {
} |
Called when an app has transitioned into an active state due to user interaction.
| BaseAppStateTracker::onUserInteractionStarted | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onBackgroundRestrictionChanged(int uid, String pkgName, boolean restricted) {
} |
Called when the background restriction settings of the given app is changed.
| BaseAppStateTracker::onBackgroundRestrictionChanged | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUidProcStateChanged(int uid, int procState) {
} |
Called when the process state of the given UID has been changed.
<p>Note: as of now, for simplification, we're tracking the TOP state changes only.</p>
| BaseAppStateTracker::onUidProcStateChanged | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void onUidGone(int uid) {
} |
Called when all the processes in the given UID have died.
| BaseAppStateTracker::onUidGone | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
void dump(PrintWriter pw, String prefix) {
mInjector.getPolicy().dump(pw, " " + prefix);
} |
Dump to the given printer writer.
| BaseAppStateTracker::dump | java | Reginer/aosp-android-jar | android-33/src/com/android/server/am/BaseAppStateTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/am/BaseAppStateTracker.java | MIT |
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, Intent intent) {
Rlog.d(TAG, "Received broadcast " + intent.getAction());
if (Intent.ACTION_USER_UNLOCKED.equals(intent.getAction())) {
new ScanRawTableThread(context).start();
}
}
}; | Broadcast receiver that processes the raw table when the user unlocks the phone for the
first time after reboot and the credential-encrypted storage is available.
| SmsBroadcastUndelivered::BroadcastReceiver | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/SmsBroadcastUndelivered.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/SmsBroadcastUndelivered.java | MIT |
public MemoryIntArray(int size) throws IOException {
if (size > MAX_SIZE) {
throw new IllegalArgumentException("Max size is " + MAX_SIZE);
}
mIsOwner = true;
final String name = UUID.randomUUID().toString();
mFd = nativeCreate(name, size);
mMemoryAddr = nativeOpen(mFd, mIsOwner);
mCloseGuard.open("close");
} |
Creates a new instance.
@param size The size of the array in terms of integer slots. Cannot be
more than {@link #getMaxSize()}.
@throws IOException If an error occurs while accessing the shared memory.
| MemoryIntArray::MemoryIntArray | java | Reginer/aosp-android-jar | android-31/src/android/util/MemoryIntArray.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/util/MemoryIntArray.java | MIT |
public boolean isWritable() {
enforceNotClosed();
return mIsOwner;
} |
@return Gets whether this array is mutable.
| MemoryIntArray::isWritable | java | Reginer/aosp-android-jar | android-31/src/android/util/MemoryIntArray.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/util/MemoryIntArray.java | MIT |
public int get(int index) throws IOException {
enforceNotClosed();
enforceValidIndex(index);
return nativeGet(mFd, mMemoryAddr, index);
} |
Gets the value at a given index.
@param index The index.
@return The value at this index.
@throws IOException If an error occurs while accessing the shared memory.
| MemoryIntArray::get | java | Reginer/aosp-android-jar | android-31/src/android/util/MemoryIntArray.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/util/MemoryIntArray.java | MIT |
public void set(int index, int value) throws IOException {
enforceNotClosed();
enforceWritable();
enforceValidIndex(index);
nativeSet(mFd, mMemoryAddr, index, value);
} |
Sets the value at a given index. This method can be called only if
{@link #isWritable()} returns true which means your process is the
owner.
@param index The index.
@param value The value to set.
@throws IOException If an error occurs while accessing the shared memory.
| MemoryIntArray::set | java | Reginer/aosp-android-jar | android-31/src/android/util/MemoryIntArray.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/util/MemoryIntArray.java | MIT |
public int size() throws IOException {
enforceNotClosed();
return nativeSize(mFd);
} |
Gets the array size.
@throws IOException If an error occurs while accessing the shared memory.
| MemoryIntArray::size | java | Reginer/aosp-android-jar | android-31/src/android/util/MemoryIntArray.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/util/MemoryIntArray.java | MIT |
public boolean isClosed() {
return mFd == -1;
} |
@return Whether this array is closed and shouldn't be used.
| MemoryIntArray::isClosed | java | Reginer/aosp-android-jar | android-31/src/android/util/MemoryIntArray.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/util/MemoryIntArray.java | MIT |
public static int getMaxSize() {
return MAX_SIZE;
} |
@return The max array size.
| MemoryIntArray::getMaxSize | java | Reginer/aosp-android-jar | android-31/src/android/util/MemoryIntArray.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/util/MemoryIntArray.java | MIT |
public VirtualMachineError() {
super();
} |
Constructs a {@code VirtualMachineError} with no detail message.
| VirtualMachineError::VirtualMachineError | java | Reginer/aosp-android-jar | android-34/src/java/lang/VirtualMachineError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/lang/VirtualMachineError.java | MIT |
public VirtualMachineError(String message) {
super(message);
} |
Constructs a {@code VirtualMachineError} with the specified
detail message.
@param message the detail message.
| VirtualMachineError::VirtualMachineError | java | Reginer/aosp-android-jar | android-34/src/java/lang/VirtualMachineError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/lang/VirtualMachineError.java | MIT |
public VirtualMachineError(String message, Throwable cause) {
super(message, cause);
} |
Constructs a {@code VirtualMachineError} with the specified
detail message and cause. <p>Note that the detail message
associated with {@code cause} is <i>not</i> automatically
incorporated in this error's detail message.
@param message the detail message (which is saved for later retrieval
by the {@link #getMessage()} method).
@param cause the cause (which is saved for later retrieval by the
{@link #getCause()} method). (A {@code null} value is
permitted, and indicates that the cause is nonexistent or
unknown.)
@since 1.8
| VirtualMachineError::VirtualMachineError | java | Reginer/aosp-android-jar | android-34/src/java/lang/VirtualMachineError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/lang/VirtualMachineError.java | MIT |
public VirtualMachineError(Throwable cause) {
super(cause);
} |
Constructs an a {@code VirtualMachineError} with the specified
cause and a detail message of {@code (cause==null ? null :
cause.toString())} (which typically contains the class and
detail message of {@code cause}).
@param cause the cause (which is saved for later retrieval by the
{@link #getCause()} method). (A {@code null} value is
permitted, and indicates that the cause is nonexistent or
unknown.)
@since 1.8
| VirtualMachineError::VirtualMachineError | java | Reginer/aosp-android-jar | android-34/src/java/lang/VirtualMachineError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/lang/VirtualMachineError.java | MIT |
private void updateOrder() {
boolean isLayoutRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
boolean isLayoutReverse = isLayoutRtl ^ mIsAlternativeOrder;
if (mIsLayoutReverse != isLayoutReverse) {
// reversity changed, swap the order of all views.
int childCount = getChildCount();
ArrayList<View> childList = new ArrayList<>(childCount);
for (int i = 0; i < childCount; i++) {
childList.add(getChildAt(i));
}
removeAllViews();
for (int i = childCount - 1; i >= 0; i--) {
final View child = childList.get(i);
super.addView(child);
}
mIsLayoutReverse = isLayoutReverse;
}
} |
In landscape, the LinearLayout is not auto mirrored since it is vertical. Therefore we
have to do it manually
| ReverseLinearLayout::updateOrder | java | Reginer/aosp-android-jar | android-31/src/com/android/systemui/navigationbar/buttons/ReverseLinearLayout.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/navigationbar/buttons/ReverseLinearLayout.java | MIT |
void removeOldTransactions(long minAgeMs) {
final long cutoff = getCurrentTimeMillis() - minAgeMs;
while (mTransactions.size() > 0 && mTransactions.get(0).endTimeMs <= cutoff) {
mTransactions.remove(0);
}
} |
Ledger to track the last recorded balance and recent activities of an app.
class Ledger {
static class Transaction {
public final long startTimeMs;
public final long endTimeMs;
public final int eventId;
@Nullable
public final String tag;
public final long delta;
public final long ctp;
Transaction(long startTimeMs, long endTimeMs,
int eventId, @Nullable String tag, long delta, long ctp) {
this.startTimeMs = startTimeMs;
this.endTimeMs = endTimeMs;
this.eventId = eventId;
this.tag = tag;
this.delta = delta;
this.ctp = ctp;
}
}
/** Last saved balance. This doesn't take currently ongoing events into account.
private long mCurrentBalance = 0;
private final List<Transaction> mTransactions = new ArrayList<>();
private final SparseLongArray mCumulativeDeltaPerReason = new SparseLongArray();
private long mEarliestSumTime;
Ledger() {
}
Ledger(long currentBalance, @NonNull List<Transaction> transactions) {
mCurrentBalance = currentBalance;
mTransactions.addAll(transactions);
}
long getCurrentBalance() {
return mCurrentBalance;
}
@Nullable
Transaction getEarliestTransaction() {
if (mTransactions.size() > 0) {
return mTransactions.get(0);
}
return null;
}
@NonNull
List<Transaction> getTransactions() {
return mTransactions;
}
void recordTransaction(@NonNull Transaction transaction) {
mTransactions.add(transaction);
mCurrentBalance += transaction.delta;
final long sum = mCumulativeDeltaPerReason.get(transaction.eventId);
mCumulativeDeltaPerReason.put(transaction.eventId, sum + transaction.delta);
mEarliestSumTime = Math.min(mEarliestSumTime, transaction.startTimeMs);
}
long get24HourSum(int eventId, final long now) {
final long windowStartTime = now - 24 * HOUR_IN_MILLIS;
if (mEarliestSumTime < windowStartTime) {
// Need to redo sums
mCumulativeDeltaPerReason.clear();
for (int i = mTransactions.size() - 1; i >= 0; --i) {
final Transaction transaction = mTransactions.get(i);
if (transaction.endTimeMs <= windowStartTime) {
break;
}
long sum = mCumulativeDeltaPerReason.get(transaction.eventId);
if (transaction.startTimeMs >= windowStartTime) {
sum += transaction.delta;
} else {
// Pro-rate durationed deltas. Intentionally floor the result.
sum += (long) (1.0 * (transaction.endTimeMs - windowStartTime)
transaction.delta)
/ (transaction.endTimeMs - transaction.startTimeMs);
}
mCumulativeDeltaPerReason.put(transaction.eventId, sum);
}
mEarliestSumTime = windowStartTime;
}
return mCumulativeDeltaPerReason.get(eventId);
}
/** Deletes transactions that are older than {@code minAgeMs}. | Transaction::removeOldTransactions | java | Reginer/aosp-android-jar | android-33/src/com/android/server/tare/Ledger.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/tare/Ledger.java | MIT |
public boolean isSessionDisconnected() {
return mSpellCheckerSessionListenerImpl.isDisconnected();
} |
@return true if the connection to a text service of this session is disconnected and not
alive.
| getSimpleName::isSessionDisconnected | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public SpellCheckerInfo getSpellChecker() {
return mSpellCheckerInfo;
} |
Get the spell checker service info this spell checker session has.
@return SpellCheckerInfo for the specified locale.
| getSimpleName::getSpellChecker | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public void cancel() {
mSpellCheckerSessionListenerImpl.cancel();
} |
Cancel pending and running spell check tasks
| getSimpleName::cancel | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public void close() {
mGuard.close();
mSpellCheckerSessionListenerImpl.close();
mTextServicesManager.finishSpellCheckerService(mSpellCheckerSessionListenerImpl);
} |
Finish this session and allow TextServicesManagerService to disconnect the bound spell
checker.
| getSimpleName::close | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public void getSentenceSuggestions(TextInfo[] textInfos, int suggestionsLimit) {
final InputMethodManager imm = mTextServicesManager.getInputMethodManager();
if (imm != null && imm.isInputMethodSuppressingSpellChecker()) {
handleOnGetSentenceSuggestionsMultiple(new SentenceSuggestionsInfo[0]);
return;
}
mSpellCheckerSessionListenerImpl.getSentenceSuggestionsMultiple(
textInfos, suggestionsLimit);
} |
Get suggestions from the specified sentences
@param textInfos an array of text metadata for a spell checker
@param suggestionsLimit the maximum number of suggestions that will be returned
| getSimpleName::getSentenceSuggestions | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public boolean shouldReferToSpellCheckerLanguageSettings() {
return mShouldReferToSpellCheckerLanguageSettings;
} |
Returns true if the user's spell checker language settings should be used to determine
the spell checker locale.
| SpellCheckerSessionParams::shouldReferToSpellCheckerLanguageSettings | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public @SuggestionsInfo.ResultAttrs int getSupportedAttributes() {
return mSupportedAttributes;
} |
Returns a bitmask of {@link SuggestionsInfo} attributes that the spell checker can set
in {@link SuggestionsInfo} it returns.
@see android.service.textservice.SpellCheckerService.Session#getSupportedAttributes()
| SpellCheckerSessionParams::getSupportedAttributes | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public Builder() {
} |
Returns a bundle containing extra parameters for the spell checker.
<p>This bundle can be used to pass implementation-specific parameters to the
{@link android.service.textservice.SpellCheckerService} implementation.
@see android.service.textservice.SpellCheckerService.Session#getBundle()
@NonNull
public Bundle getExtras() {
return mExtras;
}
/** Builder of {@link SpellCheckerSessionParams}.
public static final class Builder {
@Nullable
private Locale mLocale;
private boolean mShouldReferToSpellCheckerLanguageSettings = false;
private @SuggestionsInfo.ResultAttrs int mSupportedAttributes = 0;
private Bundle mExtras = Bundle.EMPTY;
/** Constructs a {@code Builder}. | Builder::Builder | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public ITextServicesSessionListener getTextServicesSessionListener() {
return mInternalListener;
} |
@hide
| InternalListener::getTextServicesSessionListener | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public ISpellCheckerSessionListener getSpellCheckerSessionListener() {
return mSpellCheckerSessionListenerImpl;
} |
@hide
| InternalListener::getSpellCheckerSessionListener | java | Reginer/aosp-android-jar | android-35/src/android/view/textservice/SpellCheckerSession.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/view/textservice/SpellCheckerSession.java | MIT |
public static MockSimplePeriod of(long amount, TemporalUnit unit) {
return new MockSimplePeriod(amount, unit);
} |
Obtains a {@code MockSimplePeriod} from an amount and unit.
<p>
The parameters represent the two parts of a phrase like '6 Days'.
@param amount the amount of the period, measured in terms of the unit, positive or negative
@param unit the unit that the period is measured in, must not be the 'Forever' unit, not null
@return the {@code MockSimplePeriod} instance, not null
@throws java.time.DateTimeException if the period unit is {@link java.time.temporal.ChronoUnit#FOREVER}.
| MockSimplePeriod::of | java | Reginer/aosp-android-jar | android-33/src/tck/java/time/MockSimplePeriod.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/tck/java/time/MockSimplePeriod.java | MIT |
public static void showReEnrollmentNotification(@NonNull Context context) {
final NotificationManager notificationManager =
context.getSystemService(NotificationManager.class);
final String name =
context.getString(R.string.face_recalibrate_notification_name);
final String title =
context.getString(R.string.face_recalibrate_notification_title);
final String content =
context.getString(R.string.face_recalibrate_notification_content);
final Intent intent = new Intent("android.settings.FACE_SETTINGS");
intent.setPackage("com.android.settings");
intent.putExtra(KEY_RE_ENROLL_FACE, true);
final PendingIntent pendingIntent = PendingIntent.getActivityAsUser(context,
0 /* requestCode */, intent, PendingIntent.FLAG_IMMUTABLE /* flags */,
null /* options */, UserHandle.CURRENT);
final String channelName = "FaceEnrollNotificationChannel";
showNotificationHelper(context, name, title, content, pendingIntent, channelName,
RE_ENROLL_NOTIFICATION_TAG);
} |
Shows a face re-enrollment notification.
| BiometricNotificationUtils::showReEnrollmentNotification | java | Reginer/aosp-android-jar | android-34/src/com/android/server/biometrics/sensors/BiometricNotificationUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/biometrics/sensors/BiometricNotificationUtils.java | MIT |
@NonNull public ViewNode[] findViewNodesByAutofillIds(@NonNull AutofillId[] ids) {
final ArrayDeque<ViewNode> nodesToProcess = new ArrayDeque<>();
final ViewNode[] foundNodes = new AssistStructure.ViewNode[ids.length];
// Indexes of foundNodes that are not found yet
final SparseIntArray missingNodeIndexes = new SparseIntArray(ids.length);
for (int i = 0; i < ids.length; i++) {
if (mViewNodeLookupTable != null) {
int lookupTableIndex = mViewNodeLookupTable.indexOfKey(ids[i]);
if (lookupTableIndex >= 0) {
foundNodes[i] = mViewNodeLookupTable.valueAt(lookupTableIndex);
} else {
missingNodeIndexes.put(i, /* ignored */ 0);
}
} else {
missingNodeIndexes.put(i, /* ignored */ 0);
}
}
final int numWindowNodes = mStructure.getWindowNodeCount();
for (int i = 0; i < numWindowNodes; i++) {
nodesToProcess.add(mStructure.getWindowNodeAt(i).getRootViewNode());
}
while (missingNodeIndexes.size() > 0 && !nodesToProcess.isEmpty()) {
final ViewNode node = nodesToProcess.removeFirst();
for (int i = 0; i < missingNodeIndexes.size(); i++) {
final int index = missingNodeIndexes.keyAt(i);
final AutofillId id = ids[index];
if (id != null && id.equals(node.getAutofillId())) {
foundNodes[index] = node;
if (mViewNodeLookupTable == null) {
mViewNodeLookupTable = new ArrayMap<>(ids.length);
}
mViewNodeLookupTable.put(id, node);
missingNodeIndexes.removeAt(i);
break;
}
}
for (int i = 0; i < node.getChildCount(); i++) {
nodesToProcess.addLast(node.getChildAt(i));
}
}
// Remember which ids could not be resolved to not search for them again the next time
for (int i = 0; i < missingNodeIndexes.size(); i++) {
if (mViewNodeLookupTable == null) {
mViewNodeLookupTable = new ArrayMap<>(missingNodeIndexes.size());
}
mViewNodeLookupTable.put(ids[missingNodeIndexes.keyAt(i)], null);
}
return foundNodes;
} |
Finds {@link ViewNode ViewNodes} that have the requested ids.
@param ids The ids of the node to find.
@return The nodes indexed in the same way as the ids.
@hide
| FillContext::findViewNodesByAutofillIds | java | Reginer/aosp-android-jar | android-34/src/android/service/autofill/FillContext.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/service/autofill/FillContext.java | MIT |
default boolean disallowInterceptTouch(MotionEvent event) {
return false;
} |
If the parent should not be allowed to intercept touch events.
@param event A touch event.
@return {@code true} if touch should be passed forward.
@see android.view.ViewGroup#requestDisallowInterceptTouchEvent(boolean)
| disallowInterceptTouch | java | Reginer/aosp-android-jar | android-32/src/com/android/keyguard/KeyguardSecurityView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/keyguard/KeyguardSecurityView.java | MIT |
default void onStartingToHide() {}; |
When bouncer was visible but is being dragged down or dismissed.
| onStartingToHide | java | Reginer/aosp-android-jar | android-32/src/com/android/keyguard/KeyguardSecurityView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/keyguard/KeyguardSecurityView.java | MIT |
private GnssAutomaticGainControl(double levelDb, int constellationType,
long carrierFrequencyHz) {
mLevelDb = levelDb;
mConstellationType = constellationType;
mCarrierFrequencyHz = carrierFrequencyHz;
} |
Creates a {@link GnssAutomaticGainControl} with a full list of parameters.
| GnssAutomaticGainControl::GnssAutomaticGainControl | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssAutomaticGainControl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssAutomaticGainControl.java | MIT |
public Builder() {
} |
Constructs a {@link GnssAutomaticGainControl.Builder} instance.
| Builder::Builder | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssAutomaticGainControl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssAutomaticGainControl.java | MIT |
public Builder(@NonNull GnssAutomaticGainControl agc) {
mLevelDb = agc.getLevelDb();
mConstellationType = agc.getConstellationType();
mCarrierFrequencyHz = agc.getCarrierFrequencyHz();
} |
Constructs a {@link GnssAutomaticGainControl.Builder} instance by copying a
{@link GnssAutomaticGainControl}.
| Builder::Builder | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssAutomaticGainControl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssAutomaticGainControl.java | MIT |
@NonNull public Builder setCarrierFrequencyHz(@IntRange(from = 0) long carrierFrequencyHz) {
Preconditions.checkArgumentNonnegative(carrierFrequencyHz);
mCarrierFrequencyHz = carrierFrequencyHz;
return this;
} |
Sets the Carrier frequency in Hz.
| Builder::setCarrierFrequencyHz | java | Reginer/aosp-android-jar | android-33/src/android/location/GnssAutomaticGainControl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/location/GnssAutomaticGainControl.java | MIT |
public void apply(WireBuffer buffer, int textId,
float value, short digitsBefore,
short digitsAfter, int flags) {
buffer.start(Operations.TEXT_FROM_FLOAT);
buffer.writeInt(textId);
buffer.writeFloat(value);
buffer.writeInt((digitsBefore << 16) | digitsAfter);
buffer.writeInt(flags);
} |
Writes out the operation to the buffer
@param buffer
@param textId
@param value
@param digitsBefore
@param digitsAfter
@param flags
| Companion::apply | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/widget/remotecompose/core/operations/TextFromFloat.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/widget/remotecompose/core/operations/TextFromFloat.java | MIT |
public hc_characterdataindexsizeerrsubstringoffsetgreater(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "hc_staff", false);
} |
Constructor.
@param factory document factory, may not be null
@throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
| hc_characterdataindexsizeerrsubstringoffsetgreater::hc_characterdataindexsizeerrsubstringoffsetgreater | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater.java | MIT |
public void runTest() throws Throwable {
Document doc;
NodeList elementList;
Node nameNode;
CharacterData child;
String badString;
doc = (Document) load("hc_staff", false);
elementList = doc.getElementsByTagName("acronym");
nameNode = elementList.item(0);
child = (CharacterData) nameNode.getFirstChild();
{
boolean success = false;
try {
badString = child.substringData(40, 3);
} catch (DOMException ex) {
success = (ex.code == DOMException.INDEX_SIZE_ERR);
}
assertTrue("throw_INDEX_SIZE_ERR", success);
}
} |
Runs the test case.
@throws Throwable Any uncaught exception causes test to fail
| hc_characterdataindexsizeerrsubstringoffsetgreater::runTest | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater.java | MIT |
public String getTargetURI() {
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater";
} |
Gets URI that identifies the test.
@return uri identifier of test
| hc_characterdataindexsizeerrsubstringoffsetgreater::getTargetURI | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater.java | MIT |
public static void main(final String[] args) {
DOMTestCase.doMain(hc_characterdataindexsizeerrsubstringoffsetgreater.class, args);
} |
Runs this test from the command line.
@param args command line arguments
| hc_characterdataindexsizeerrsubstringoffsetgreater::main | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater.java | MIT |
public void notifyChanged() {
synchronized(mObservers) {
// since onChanged() is implemented by the app, it could do anything, including
// removing itself from {@link mObservers} - and that could cause problems if
// an iterator is used on the ArrayList {@link mObservers}.
// to avoid such problems, just march thru the list in the reverse order.
for (int i = mObservers.size() - 1; i >= 0; i--) {
mObservers.get(i).onChanged();
}
}
} |
Invokes {@link DataSetObserver#onChanged} on each observer.
Called when the contents of the data set have changed. The recipient
will obtain the new contents the next time it queries the data set.
| DataSetObservable::notifyChanged | java | Reginer/aosp-android-jar | android-34/src/android/database/DataSetObservable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/database/DataSetObservable.java | MIT |
public void notifyInvalidated() {
synchronized (mObservers) {
for (int i = mObservers.size() - 1; i >= 0; i--) {
mObservers.get(i).onInvalidated();
}
}
} |
Invokes {@link DataSetObserver#onInvalidated} on each observer.
Called when the data set is no longer valid and cannot be queried again,
such as when the data set has been closed.
| DataSetObservable::notifyInvalidated | java | Reginer/aosp-android-jar | android-34/src/android/database/DataSetObservable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/database/DataSetObservable.java | MIT |
public IntentFilterPolicyKey(@NonNull String identifier) {
super(identifier);
mFilter = null;
} |
@hide
| IntentFilterPolicyKey::IntentFilterPolicyKey | java | Reginer/aosp-android-jar | android-35/src/android/app/admin/IntentFilterPolicyKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/app/admin/IntentFilterPolicyKey.java | MIT |
public SHA256Digest()
{
reset();
} |
Standard constructor
| SHA256Digest::SHA256Digest | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | MIT |
public SHA256Digest(SHA256Digest t)
{
super(t);
copyIn(t);
} |
Copy constructor. This will copy the state of the provided
message digest.
| SHA256Digest::SHA256Digest | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | MIT |
public SHA256Digest(byte[] encodedState)
{
super(encodedState);
H1 = Pack.bigEndianToInt(encodedState, 16);
H2 = Pack.bigEndianToInt(encodedState, 20);
H3 = Pack.bigEndianToInt(encodedState, 24);
H4 = Pack.bigEndianToInt(encodedState, 28);
H5 = Pack.bigEndianToInt(encodedState, 32);
H6 = Pack.bigEndianToInt(encodedState, 36);
H7 = Pack.bigEndianToInt(encodedState, 40);
H8 = Pack.bigEndianToInt(encodedState, 44);
xOff = Pack.bigEndianToInt(encodedState, 48);
for (int i = 0; i != xOff; i++)
{
X[i] = Pack.bigEndianToInt(encodedState, 52 + (i * 4));
}
} |
State constructor - create a digest initialised with the state of a previous one.
@param encodedState the encoded state from the originating digest.
| SHA256Digest::SHA256Digest | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | MIT |
public void reset()
{
super.reset();
/* SHA-256 initial hash value
* The first 32 bits of the fractional parts of the square roots
* of the first eight prime numbers
*/
H1 = 0x6a09e667;
H2 = 0xbb67ae85;
H3 = 0x3c6ef372;
H4 = 0xa54ff53a;
H5 = 0x510e527f;
H6 = 0x9b05688c;
H7 = 0x1f83d9ab;
H8 = 0x5be0cd19;
xOff = 0;
for (int i = 0; i != X.length; i++)
{
X[i] = 0;
}
} |
reset the chaining variables
| SHA256Digest::reset | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | MIT |
private static int Ch(int x, int y, int z)
{
return (x & y) ^ ((~x) & z);
// return z ^ (x & (y ^ z));
} |
reset the chaining variables
public void reset()
{
super.reset();
/* SHA-256 initial hash value
The first 32 bits of the fractional parts of the square roots
of the first eight prime numbers
H1 = 0x6a09e667;
H2 = 0xbb67ae85;
H3 = 0x3c6ef372;
H4 = 0xa54ff53a;
H5 = 0x510e527f;
H6 = 0x9b05688c;
H7 = 0x1f83d9ab;
H8 = 0x5be0cd19;
xOff = 0;
for (int i = 0; i != X.length; i++)
{
X[i] = 0;
}
}
protected void processBlock()
{
//
// expand 16 word block into 64 word blocks.
//
for (int t = 16; t <= 63; t++)
{
X[t] = Theta1(X[t - 2]) + X[t - 7] + Theta0(X[t - 15]) + X[t - 16];
}
//
// set up working variables.
//
int a = H1;
int b = H2;
int c = H3;
int d = H4;
int e = H5;
int f = H6;
int g = H7;
int h = H8;
int t = 0;
for(int i = 0; i < 8; i ++)
{
// t = 8 * i
h += Sum1(e) + Ch(e, f, g) + K[t] + X[t];
d += h;
h += Sum0(a) + Maj(a, b, c);
++t;
// t = 8 * i + 1
g += Sum1(d) + Ch(d, e, f) + K[t] + X[t];
c += g;
g += Sum0(h) + Maj(h, a, b);
++t;
// t = 8 * i + 2
f += Sum1(c) + Ch(c, d, e) + K[t] + X[t];
b += f;
f += Sum0(g) + Maj(g, h, a);
++t;
// t = 8 * i + 3
e += Sum1(b) + Ch(b, c, d) + K[t] + X[t];
a += e;
e += Sum0(f) + Maj(f, g, h);
++t;
// t = 8 * i + 4
d += Sum1(a) + Ch(a, b, c) + K[t] + X[t];
h += d;
d += Sum0(e) + Maj(e, f, g);
++t;
// t = 8 * i + 5
c += Sum1(h) + Ch(h, a, b) + K[t] + X[t];
g += c;
c += Sum0(d) + Maj(d, e, f);
++t;
// t = 8 * i + 6
b += Sum1(g) + Ch(g, h, a) + K[t] + X[t];
f += b;
b += Sum0(c) + Maj(c, d, e);
++t;
// t = 8 * i + 7
a += Sum1(f) + Ch(f, g, h) + K[t] + X[t];
e += a;
a += Sum0(b) + Maj(b, c, d);
++t;
}
H1 += a;
H2 += b;
H3 += c;
H4 += d;
H5 += e;
H6 += f;
H7 += g;
H8 += h;
//
// reset the offset and clean out the word buffer.
//
xOff = 0;
for (int i = 0; i < 16; i++)
{
X[i] = 0;
}
}
/* SHA-256 functions | SHA256Digest::Ch | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/digests/SHA256Digest.java | MIT |
boolean isIgnoring(WindowContainer wc) {
// Some heuristics to avoid unnecessary work:
// 1. For now, require an explicit acknowledgement of potential "parallelism" across
// hierarchy levels (horizontal).
if (!mIgnoreIndirectMembers) return false;
// 2. Don't check WindowStates since they are below the relevant abstraction level (
// anything activity/token and above).
if (wc.asWindowState() != null) return false;
// Obviously, don't ignore anything that is directly part of this group.
return wc.mSyncGroup != this;
} |
Check if the sync-group ignores a particular container. This is used to allow syncs at
different levels to run in parallel. The primary example is Recents while an activity
sync is happening.
| SyncGroup::isIgnoring | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
private boolean tryFinish() {
if (!mReady) return false;
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: onSurfacePlacement checking %s",
mSyncId, mRootMembers);
if (!mDependencies.isEmpty()) {
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Unfinished dependencies: %s",
mSyncId, mDependencies);
return false;
}
for (int i = mRootMembers.size() - 1; i >= 0; --i) {
final WindowContainer wc = mRootMembers.valueAt(i);
if (!wc.isSyncFinished(this)) {
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Unfinished container: %s",
mSyncId, wc);
return false;
}
}
finishNow();
return true;
} |
Check if the sync-group ignores a particular container. This is used to allow syncs at
different levels to run in parallel. The primary example is Recents while an activity
sync is happening.
boolean isIgnoring(WindowContainer wc) {
// Some heuristics to avoid unnecessary work:
// 1. For now, require an explicit acknowledgement of potential "parallelism" across
// hierarchy levels (horizontal).
if (!mIgnoreIndirectMembers) return false;
// 2. Don't check WindowStates since they are below the relevant abstraction level (
// anything activity/token and above).
if (wc.asWindowState() != null) return false;
// Obviously, don't ignore anything that is directly part of this group.
return wc.mSyncGroup != this;
}
/** @return `true` if it finished. | SyncGroup::tryFinish | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
private boolean setReady(boolean ready) {
if (mReady == ready) {
return false;
}
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Set ready %b", mSyncId, ready);
mReady = ready;
if (ready) {
mWm.mWindowPlacerLocked.requestTraversal();
}
return true;
} |
Check if the sync-group ignores a particular container. This is used to allow syncs at
different levels to run in parallel. The primary example is Recents while an activity
sync is happening.
boolean isIgnoring(WindowContainer wc) {
// Some heuristics to avoid unnecessary work:
// 1. For now, require an explicit acknowledgement of potential "parallelism" across
// hierarchy levels (horizontal).
if (!mIgnoreIndirectMembers) return false;
// 2. Don't check WindowStates since they are below the relevant abstraction level (
// anything activity/token and above).
if (wc.asWindowState() != null) return false;
// Obviously, don't ignore anything that is directly part of this group.
return wc.mSyncGroup != this;
}
/** @return `true` if it finished.
private boolean tryFinish() {
if (!mReady) return false;
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: onSurfacePlacement checking %s",
mSyncId, mRootMembers);
if (!mDependencies.isEmpty()) {
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Unfinished dependencies: %s",
mSyncId, mDependencies);
return false;
}
for (int i = mRootMembers.size() - 1; i >= 0; --i) {
final WindowContainer wc = mRootMembers.valueAt(i);
if (!wc.isSyncFinished(this)) {
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Unfinished container: %s",
mSyncId, wc);
return false;
}
}
finishNow();
return true;
}
private void finishNow() {
if (mTraceName != null) {
Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, mTraceName, mSyncId);
}
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Finished!", mSyncId);
SurfaceControl.Transaction merged = mWm.mTransactionFactory.get();
if (mOrphanTransaction != null) {
merged.merge(mOrphanTransaction);
}
for (WindowContainer wc : mRootMembers) {
wc.finishSync(merged, this, false /* cancel */);
}
final ArraySet<WindowContainer> wcAwaitingCommit = new ArraySet<>();
for (WindowContainer wc : mRootMembers) {
wc.waitForSyncTransactionCommit(wcAwaitingCommit);
}
class CommitCallback implements Runnable {
// Can run a second time if the action completes after the timeout.
boolean ran = false;
public void onCommitted(SurfaceControl.Transaction t) {
synchronized (mWm.mGlobalLock) {
if (ran) {
return;
}
mHandler.removeCallbacks(this);
ran = true;
for (WindowContainer wc : wcAwaitingCommit) {
wc.onSyncTransactionCommitted(t);
}
t.apply();
wcAwaitingCommit.clear();
}
}
// Called in timeout
@Override
public void run() {
// Sometimes we get a trace, sometimes we get a bugreport without
// a trace. Since these kind of ANRs can trigger such an issue,
// try and ensure we will have some visibility in both cases.
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "onTransactionCommitTimeout");
Slog.e(TAG, "WM sent Transaction to organized, but never received" +
" commit callback. Application ANR likely to follow.");
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
synchronized (mWm.mGlobalLock) {
onCommitted(merged.mNativeObject != 0
? merged : mWm.mTransactionFactory.get());
}
}
};
CommitCallback callback = new CommitCallback();
merged.addTransactionCommittedListener(Runnable::run,
() -> callback.onCommitted(new SurfaceControl.Transaction()));
mHandler.postDelayed(callback, BLAST_TIMEOUT_DURATION);
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "onTransactionReady");
mListener.onTransactionReady(mSyncId, merged);
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
mActiveSyncs.remove(this);
mHandler.removeCallbacks(mOnTimeout);
// Immediately start the next pending sync-transaction if there is one.
if (mActiveSyncs.size() == 0 && !mPendingSyncSets.isEmpty()) {
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "PendingStartTransaction found");
final PendingSyncSet pt = mPendingSyncSets.remove(0);
pt.mStartSync.run();
if (mActiveSyncs.size() == 0) {
throw new IllegalStateException("Pending Sync Set didn't start a sync.");
}
// Post this so that the now-playing transition setup isn't interrupted.
mHandler.post(() -> {
synchronized (mWm.mGlobalLock) {
pt.mApplySync.run();
}
});
}
// Notify idle listeners
for (int i = mOnIdleListeners.size() - 1; i >= 0; --i) {
// If an idle listener adds a sync, though, then stop notifying.
if (mActiveSyncs.size() > 0) break;
mOnIdleListeners.get(i).run();
}
}
/** returns true if readiness changed. | SyncGroup::setReady | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
SyncGroup prepareSyncSet(TransactionReadyListener listener, String name) {
return new SyncGroup(listener, mNextSyncId++, name);
} |
Prepares a {@link SyncGroup} that is not active yet. Caller must call {@link #startSyncSet}
before calling {@link #addToSyncSet(int, WindowContainer)} on any {@link WindowContainer}.
| SyncGroup::prepareSyncSet | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
void abort(int id) {
final SyncGroup group = getSyncGroup(id);
group.finishNow();
removeFromDependencies(group);
} |
Aborts the sync (ie. it doesn't wait for ready or anything to finish)
| SyncGroup::abort | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
private void removeFromDependencies(SyncGroup group) {
boolean anyChange = false;
for (int i = 0; i < mActiveSyncs.size(); ++i) {
final SyncGroup active = mActiveSyncs.get(i);
if (!active.mDependencies.remove(group)) continue;
if (!active.mDependencies.isEmpty()) continue;
anyChange = true;
}
if (!anyChange) return;
mWm.mWindowPlacerLocked.requestTraversal();
} |
Just removes `group` from any dependency lists. Does not try to evaluate anything. However,
it will schedule traversals if any groups were changed in a way that could make them ready.
| SyncGroup::removeFromDependencies | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
void tryFinishForTest(int syncId) {
getSyncSet(syncId).tryFinish();
} |
Just removes `group` from any dependency lists. Does not try to evaluate anything. However,
it will schedule traversals if any groups were changed in a way that could make them ready.
private void removeFromDependencies(SyncGroup group) {
boolean anyChange = false;
for (int i = 0; i < mActiveSyncs.size(); ++i) {
final SyncGroup active = mActiveSyncs.get(i);
if (!active.mDependencies.remove(group)) continue;
if (!active.mDependencies.isEmpty()) continue;
anyChange = true;
}
if (!anyChange) return;
mWm.mWindowPlacerLocked.requestTraversal();
}
void onSurfacePlacement() {
if (mActiveSyncs.isEmpty()) return;
// queue in-order since we want interdependent syncs to become ready in the same order they
// started in.
mTmpFinishQueue.addAll(mActiveSyncs);
// There shouldn't be any dependency cycles or duplicates, but add an upper-bound just
// in case. Assuming absolute worst case, each visit will try and revisit everything
// before it, so n + (n-1) + (n-2) ... = (n+1)*n/2
int visitBounds = ((mActiveSyncs.size() + 1) * mActiveSyncs.size()) / 2;
while (!mTmpFinishQueue.isEmpty()) {
if (visitBounds <= 0) {
Slog.e(TAG, "Trying to finish more syncs than theoretically possible. This "
+ "should never happen. Most likely a dependency cycle wasn't detected.");
}
--visitBounds;
final SyncGroup group = mTmpFinishQueue.remove(0);
final int grpIdx = mActiveSyncs.indexOf(group);
// Skip if it's already finished:
if (grpIdx < 0) continue;
if (!group.tryFinish()) continue;
// Finished, so update dependencies of any prior groups and retry if unblocked.
int insertAt = 0;
for (int i = 0; i < mActiveSyncs.size(); ++i) {
final SyncGroup active = mActiveSyncs.get(i);
if (!active.mDependencies.remove(group)) continue;
// Anything afterwards is already in queue.
if (i >= grpIdx) continue;
if (!active.mDependencies.isEmpty()) continue;
// `active` became unblocked so it can finish, since it started earlier, it should
// be checked next to maintain order.
mTmpFinishQueue.add(insertAt, mActiveSyncs.get(i));
insertAt += 1;
}
}
}
/** Only use this for tests! | SyncGroup::tryFinishForTest | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
void queueSyncSet(@NonNull Runnable startSync, @NonNull Runnable applySync) {
final PendingSyncSet pt = new PendingSyncSet();
pt.mStartSync = startSync;
pt.mApplySync = applySync;
mPendingSyncSets.add(pt);
} |
Queues a sync operation onto this engine. It will wait until any current/prior sync-sets
have finished to run. This is needed right now because currently {@link BLASTSyncEngine}
only supports 1 sync at a time.
Code-paths should avoid using this unless absolutely necessary. Usually, we use this for
difficult edge-cases that we hope to clean-up later.
@param startSync will be called immediately when the {@link BLASTSyncEngine} is free to
"reserve" the {@link BLASTSyncEngine} by calling one of the
{@link BLASTSyncEngine#startSyncSet} variants.
@param applySync will be posted to the main handler after {@code startSync} has been
called. This is posted so that it doesn't interrupt any clean-up for the
prior sync-set.
| SyncGroup::queueSyncSet | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
boolean hasPendingSyncSets() {
return !mPendingSyncSets.isEmpty();
} |
Queues a sync operation onto this engine. It will wait until any current/prior sync-sets
have finished to run. This is needed right now because currently {@link BLASTSyncEngine}
only supports 1 sync at a time.
Code-paths should avoid using this unless absolutely necessary. Usually, we use this for
difficult edge-cases that we hope to clean-up later.
@param startSync will be called immediately when the {@link BLASTSyncEngine} is free to
"reserve" the {@link BLASTSyncEngine} by calling one of the
{@link BLASTSyncEngine#startSyncSet} variants.
@param applySync will be posted to the main handler after {@code startSync} has been
called. This is posted so that it doesn't interrupt any clean-up for the
prior sync-set.
void queueSyncSet(@NonNull Runnable startSync, @NonNull Runnable applySync) {
final PendingSyncSet pt = new PendingSyncSet();
pt.mStartSync = startSync;
pt.mApplySync = applySync;
mPendingSyncSets.add(pt);
}
/** @return {@code true} if there are any sync-sets waiting to start. | SyncGroup::hasPendingSyncSets | java | Reginer/aosp-android-jar | android-34/src/com/android/server/wm/BLASTSyncEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/BLASTSyncEngine.java | MIT |
public LegacyPermission(@NonNull PermissionInfo permissionInfo, @PermissionType int type,
int uid, @NonNull int[] gids) {
mPermissionInfo = permissionInfo;
mType = type;
mUid = uid;
mGids = gids;
} |
Create a new instance of this class.
@param permissionInfo the {@link PermissionInfo} for the permission
@param type the type of the permission
@param uid the UID defining the permission
@param gids the GIDs associated with the permission
| LegacyPermission::LegacyPermission | java | Reginer/aosp-android-jar | android-32/src/com/android/server/pm/permission/LegacyPermission.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/pm/permission/LegacyPermission.java | MIT |
public int getType() {
return mType;
} |
Get the type of this mission.
@return the type
| LegacyPermission::getType | java | Reginer/aosp-android-jar | android-32/src/com/android/server/pm/permission/LegacyPermission.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/pm/permission/LegacyPermission.java | MIT |
public static boolean read(@NonNull Map<String, LegacyPermission> out,
@NonNull TypedXmlPullParser parser) {
final String tagName = parser.getName();
if (!tagName.equals(TAG_ITEM)) {
return false;
}
final String name = parser.getAttributeValue(null, ATTR_NAME);
final String packageName = parser.getAttributeValue(null, ATTR_PACKAGE);
final String ptype = parser.getAttributeValue(null, "type");
if (name == null || packageName == null) {
PackageManagerService.reportSettingsProblem(Log.WARN,
"Error in package manager settings: permissions has" + " no name at "
+ parser.getPositionDescription());
return false;
}
final boolean dynamic = "dynamic".equals(ptype);
LegacyPermission bp = out.get(name);
// If the permission is builtin, do not clobber it.
if (bp == null || bp.mType != TYPE_CONFIG) {
bp = new LegacyPermission(name.intern(), packageName,
dynamic ? TYPE_DYNAMIC : TYPE_MANIFEST);
}
bp.mPermissionInfo.protectionLevel = readInt(parser, null, "protection",
PermissionInfo.PROTECTION_NORMAL);
bp.mPermissionInfo.protectionLevel = PermissionInfo.fixProtectionLevel(
bp.mPermissionInfo.protectionLevel);
if (dynamic) {
bp.mPermissionInfo.icon = readInt(parser, null, "icon", 0);
bp.mPermissionInfo.nonLocalizedLabel = parser.getAttributeValue(null, "label");
}
out.put(bp.mPermissionInfo.name, bp);
return true;
} |
@hide
| LegacyPermission::read | java | Reginer/aosp-android-jar | android-32/src/com/android/server/pm/permission/LegacyPermission.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/pm/permission/LegacyPermission.java | MIT |
public void write(@NonNull TypedXmlSerializer serializer) throws IOException {
if (mPermissionInfo.packageName == null) {
return;
}
serializer.startTag(null, TAG_ITEM);
serializer.attribute(null, ATTR_NAME, mPermissionInfo.name);
serializer.attribute(null, ATTR_PACKAGE, mPermissionInfo.packageName);
if (mPermissionInfo.protectionLevel != PermissionInfo.PROTECTION_NORMAL) {
serializer.attributeInt(null, "protection", mPermissionInfo.protectionLevel);
}
if (mType == TYPE_DYNAMIC) {
serializer.attribute(null, "type", "dynamic");
if (mPermissionInfo.icon != 0) {
serializer.attributeInt(null, "icon", mPermissionInfo.icon);
}
if (mPermissionInfo.nonLocalizedLabel != null) {
serializer.attribute(null, "label", mPermissionInfo.nonLocalizedLabel.toString());
}
}
serializer.endTag(null, TAG_ITEM);
} |
@hide
| LegacyPermission::write | java | Reginer/aosp-android-jar | android-32/src/com/android/server/pm/permission/LegacyPermission.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/pm/permission/LegacyPermission.java | MIT |
public boolean dump(@NonNull PrintWriter pw, @NonNull String packageName,
@NonNull Set<String> permissionNames, boolean readEnforced, boolean printedSomething,
@NonNull DumpState dumpState) {
if (packageName != null && !packageName.equals(mPermissionInfo.packageName)) {
return false;
}
if (permissionNames != null && !permissionNames.contains(mPermissionInfo.name)) {
return false;
}
if (!printedSomething) {
if (dumpState.onTitlePrinted()) {
pw.println();
}
pw.println("Permissions:");
}
pw.print(" Permission ["); pw.print(mPermissionInfo.name); pw.print("] (");
pw.print(Integer.toHexString(System.identityHashCode(this)));
pw.println("):");
pw.print(" sourcePackage="); pw.println(mPermissionInfo.packageName);
pw.print(" uid="); pw.print(mUid);
pw.print(" gids="); pw.print(Arrays.toString(mGids));
pw.print(" type="); pw.print(mType);
pw.print(" prot=");
pw.println(PermissionInfo.protectionToString(mPermissionInfo.protectionLevel));
if (mPermissionInfo != null) {
pw.print(" perm="); pw.println(mPermissionInfo);
if ((mPermissionInfo.flags & PermissionInfo.FLAG_INSTALLED) == 0
|| (mPermissionInfo.flags & PermissionInfo.FLAG_REMOVED) != 0) {
pw.print(" flags=0x"); pw.println(Integer.toHexString(mPermissionInfo.flags));
}
}
if (Objects.equals(mPermissionInfo.name,
android.Manifest.permission.READ_EXTERNAL_STORAGE)) {
pw.print(" enforced=");
pw.println(readEnforced);
}
return true;
} |
@hide
| LegacyPermission::dump | java | Reginer/aosp-android-jar | android-32/src/com/android/server/pm/permission/LegacyPermission.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/pm/permission/LegacyPermission.java | MIT |
public static AbstractAsset create(JSONObject asset)
throws AssociationServiceException {
String namespace = asset.optString(StatementUtils.NAMESPACE_FIELD, null);
if (namespace == null) {
throw new AssociationServiceException(String.format(
FIELD_NOT_STRING_FORMAT_STRING, StatementUtils.NAMESPACE_FIELD));
}
if (namespace.equals(StatementUtils.NAMESPACE_WEB)) {
return WebAsset.create(asset);
} else if (namespace.equals(StatementUtils.NAMESPACE_ANDROID_APP)) {
return AndroidAppAsset.create(asset);
} else {
throw new AssociationServiceException("Namespace " + namespace + " is not supported.");
}
} |
Checks that the input is a valid asset with purposes.
@throws AssociationServiceException if the asset is not well formatted.
| AssetFactory::create | java | Reginer/aosp-android-jar | android-32/src/com/android/statementservice/retriever/AssetFactory.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/statementservice/retriever/AssetFactory.java | MIT |
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector(2);
v.add(algId);
v.add(data);
return new DERSequence(v);
} |
Produce an object suitable for an ASN1OutputStream.
<pre>
EncryptedPrivateKeyInfo ::= SEQUENCE {
encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
encryptedData EncryptedData
}
EncryptedData ::= OCTET STRING
KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
... -- For local profiles
}
</pre>
| EncryptedPrivateKeyInfo::toASN1Primitive | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java | MIT |
public DefaultHandler2 () { } |
This class extends the SAX2 base handler class to support the
SAX2 {@link LexicalHandler}, {@link DeclHandler}, and
{@link EntityResolver2} extensions. Except for overriding the
original SAX1 {@link DefaultHandler#resolveEntity resolveEntity()}
method the added handler methods just return. Subclassers may
override everything on a method-by-method basis.
<blockquote>
<em>This module, both source code and documentation, is in the
Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
</blockquote>
<p> <em>Note:</em> this class might yet learn that the
<em>ContentHandler.setDocumentLocator()</em> call might be passed a
{@link Locator2} object, and that the
<em>ContentHandler.startElement()</em> call might be passed a
{@link Attributes2} object.
@since SAX 2.0 (extensions 1.1 alpha)
@author David Brownell
@version TBS
public class DefaultHandler2 extends DefaultHandler
implements LexicalHandler, DeclHandler, EntityResolver2
{
/** Constructs a handler which ignores all parsing events. | DefaultHandler2::DefaultHandler2 | java | Reginer/aosp-android-jar | android-31/src/org/xml/sax/ext/DefaultHandler2.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/xml/sax/ext/DefaultHandler2.java | MIT |
public InputSource getExternalSubset (String name, String baseURI)
throws SAXException, IOException
{ return null; } |
Tells the parser that if no external subset has been declared
in the document text, none should be used.
@param name Identifies the document root element. This name comes
from a DOCTYPE declaration (where available) or from the actual
root element. The parameter is ignored.
@param baseURI The document's base URI, serving as an additional
hint for selecting the external subset. This is always an absolute
URI, unless it is null because the XMLReader was given an InputSource
without one. The parameter is ignored.
@return null (always).
@exception SAXException Any SAX exception, possibly wrapping
another exception.
@exception IOException Probably indicating a failure to create
a new InputStream or Reader, or an illegal URL.
| DefaultHandler2::getExternalSubset | java | Reginer/aosp-android-jar | android-31/src/org/xml/sax/ext/DefaultHandler2.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/xml/sax/ext/DefaultHandler2.java | MIT |
public InputSource resolveEntity (String name, String publicId,
String baseURI, String systemId)
throws SAXException, IOException
{ return null; } |
Tells the parser to resolve the systemId against the baseURI
and read the entity text from that resulting absolute URI.
Note that because the older
{@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()},
method is overridden to call this one, this method may sometimes
be invoked with null <em>name</em> and <em>baseURI</em>, and
with the <em>systemId</em> already absolutized.
@param name Identifies the external entity being resolved.
Either "[dtd]" for the external subset, or a name starting
with "%" to indicate a parameter entity, or else the name of
a general entity. This is never null when invoked by a SAX2
parser.
@param publicId The public identifier of the external entity being
referenced (normalized as required by the XML specification), or
null if none was supplied.
@param baseURI The URI with respect to which relative systemIDs
are interpreted. This is always an absolute URI, unless it is
null (likely because the XMLReader was given an InputSource without
one). This URI is defined by the XML specification to be the one
associated with the "<" starting the relevant declaration.
@param systemId The system identifier of the external entity
being referenced; either a relative or absolute URI.
This is never null when invoked by a SAX2 parser; only declared
entities, and any external subset, are resolved by such parsers.
@return An InputSource object describing the new input source.
@exception SAXException Any SAX exception, possibly wrapping
another exception.
@exception IOException Probably indicating a failure to create
a new InputStream or Reader, or an illegal URL.
| DefaultHandler2::resolveEntity | java | Reginer/aosp-android-jar | android-31/src/org/xml/sax/ext/DefaultHandler2.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/xml/sax/ext/DefaultHandler2.java | MIT |
public InputSource resolveEntity (String publicId, String systemId)
throws SAXException, IOException
{ return resolveEntity (null, publicId, null, systemId); } |
Invokes
{@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
with null entity name and base URI.
You only need to override that method to use this class.
@param publicId The public identifier of the external entity being
referenced (normalized as required by the XML specification), or
null if none was supplied.
@param systemId The system identifier of the external entity
being referenced; either a relative or absolute URI.
This is never null when invoked by a SAX2 parser; only declared
entities, and any external subset, are resolved by such parsers.
@return An InputSource object describing the new input source.
@exception SAXException Any SAX exception, possibly wrapping
another exception.
@exception IOException Probably indicating a failure to create
a new InputStream or Reader, or an illegal URL.
| DefaultHandler2::resolveEntity | java | Reginer/aosp-android-jar | android-31/src/org/xml/sax/ext/DefaultHandler2.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/xml/sax/ext/DefaultHandler2.java | MIT |
public static String toSentenceCase(String str, Locale locale) {
// Titlecases only the character at index 0, don't touch anything else
return CaseMap.toTitle().wholeString().noLowercase().apply(locale, null, str);
} |
Sentence-case (first character uppercased).
@param str the string to sentence-case.
@param locale the locale used for the case conversion.
@return the string converted to sentence-case.
| LocaleHelper::toSentenceCase | java | Reginer/aosp-android-jar | android-31/src/com/android/internal/app/LocaleHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/internal/app/LocaleHelper.java | MIT |
public static String getDisplayName(Locale locale, boolean sentenceCase) {
return getDisplayName(locale, Locale.getDefault(), sentenceCase);
} |
Returns the locale localized for display in the default locale.
@param locale the locale whose name is to be displayed.
@param sentenceCase true if the result should be sentence-cased
@return the localized name of the locale.
| LocaleHelper::getDisplayName | java | Reginer/aosp-android-jar | android-31/src/com/android/internal/app/LocaleHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/internal/app/LocaleHelper.java | MIT |
public static String getDisplayCountry(Locale locale) {
return ULocale.getDisplayCountry(locale.toLanguageTag(), ULocale.getDefault());
} |
Returns a locale's country localized for display in the default locale.
@param locale the locale whose country will be displayed.
@return the localized country name.
| LocaleHelper::getDisplayCountry | java | Reginer/aosp-android-jar | android-31/src/com/android/internal/app/LocaleHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/internal/app/LocaleHelper.java | MIT |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.