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 static Bundle putMonitoringExtra(Bundle extras, String key, boolean value) { if (extras == null) { extras = new Bundle(); } extras.putBoolean(key, value); return extras; }
Adds given key-value pair in the bundle and returns the bundle. If bundle was null it will be created. @param extras - bundle where to add key-value to, if null a new bundle will be created. @param key - key. @param value - value. @return extras if it was not null and new bundle otherwise.
BackupManagerMonitorUtils::putMonitoringExtra
java
Reginer/aosp-android-jar
android-32/src/com/android/server/backup/utils/BackupManagerMonitorUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/backup/utils/BackupManagerMonitorUtils.java
MIT
public hc_textindexsizeerroffsetoutofbounds(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", true); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
hc_textindexsizeerroffsetoutofbounds::hc_textindexsizeerroffsetoutofbounds
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_textindexsizeerroffsetoutofbounds.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_textindexsizeerroffsetoutofbounds.java
MIT
public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; Text textNode; Text splitNode; doc = (Document) load("hc_staff", true); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = (Text) nameNode.getFirstChild(); { boolean success = false; try { splitNode = textNode.splitText(300); } 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_textindexsizeerroffsetoutofbounds::runTest
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_textindexsizeerroffsetoutofbounds.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_textindexsizeerroffsetoutofbounds.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerroffsetoutofbounds"; }
Gets URI that identifies the test. @return uri identifier of test
hc_textindexsizeerroffsetoutofbounds::getTargetURI
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_textindexsizeerroffsetoutofbounds.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_textindexsizeerroffsetoutofbounds.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(hc_textindexsizeerroffsetoutofbounds.class, args); }
Runs this test from the command line. @param args command line arguments
hc_textindexsizeerroffsetoutofbounds::main
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_textindexsizeerroffsetoutofbounds.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_textindexsizeerroffsetoutofbounds.java
MIT
public void onConnected() { }
Called when the Android system connects to service. <p>You should generally do initialization here rather than in {@link #onCreate}.
getSimpleName::onConnected
java
Reginer/aosp-android-jar
android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
MIT
public final boolean requestAutofill(@NonNull ComponentName activityComponent, @NonNull AutofillId autofillId) { final AutofillProxy proxy = mAutofillProxyForLastRequest; if (proxy == null || !proxy.mComponentName.equals(activityComponent) || !proxy.mFocusedId.equals(autofillId)) { return false; } try { return proxy.requestAutofill(); } catch (RemoteException e) { e.rethrowFromSystemServer(); } return false; }
The child class of the service can call this method to initiate a new Autofill flow. If all conditions are met, it will make a request to the client app process to explicitly cancel the current autofill session and create a new session. For example, an augmented autofill service may notice some events which make it think a good time to provide updated augmented autofill suggestions. <p> The request would be respected only if the previous augmented autofill request was made for the same {@code activityComponent} and {@code autofillId}, and the field is currently on focus. <p> The request would cancel the current session and start a new autofill flow. It doesn't guarantee that the {@link AutofillManager} will proceed with the request. @param activityComponent the client component for which the autofill is requested for @param autofillId the client field id for which the autofill is requested for @return true if the request makes the {@link AutofillManager} start a new Autofill flow, false otherwise.
getSimpleName::requestAutofill
java
Reginer/aosp-android-jar
android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
MIT
public void onFillRequest(@NonNull FillRequest request, @NonNull CancellationSignal cancellationSignal, @NonNull FillController controller, @NonNull FillCallback callback) { }
Asks the service to handle an "augmented" autofill request. <p>This method is called when the "stantard" autofill service cannot handle a request, which typically occurs when: <ul> <li>Service does not recognize what should be autofilled. <li>Service does not have data to fill the request. <li>Service denylisted that app (or activity) for autofill. <li>App disabled itself for autofill. </ul> <p>Differently from the standard autofill workflow, on augmented autofill the service is responsible to generate the autofill UI and request the Android system to autofill the activity when the user taps an action in that UI (through the {@link FillController#autofill(List)} method). <p>The service <b>MUST</b> call {@link FillCallback#onSuccess(android.service.autofill.augmented.FillResponse)} as soon as possible, passing {@code null} when it cannot fulfill the request. @param request the request to handle. @param cancellationSignal signal for observing cancellation requests. The system will use this to notify you that the fill result is no longer needed and you should stop handling this fill request in order to save resources. @param controller object used to interact with the autofill system. @param callback object used to notify the result of the request. Service <b>must</b> call {@link FillCallback#onSuccess(android.service.autofill.augmented.FillResponse)}.
getSimpleName::onFillRequest
java
Reginer/aosp-android-jar
android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
MIT
public void onDisconnected() { }
Called when the Android system disconnects from the service. <p> At this point this service may no longer be an active {@link AugmentedAutofillService}. It should not make calls on {@link AutofillManager} that requires the caller to be the current service.
getSimpleName::onDisconnected
java
Reginer/aosp-android-jar
android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
MIT
protected final void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.print("Service component: "); pw.println( ComponentName.flattenToShortString(mServiceComponentName)); if (mAutofillProxies != null) { final int size = mAutofillProxies.size(); pw.print("Number proxies: "); pw.println(size); for (int i = 0; i < size; i++) { final int sessionId = mAutofillProxies.keyAt(i); final AutofillProxy proxy = mAutofillProxies.valueAt(i); pw.print(i); pw.print(") SessionId="); pw.print(sessionId); pw.println(":"); proxy.dump(" ", pw); } } dump(pw, args); }
Called when the Android system disconnects from the service. <p> At this point this service may no longer be an active {@link AugmentedAutofillService}. It should not make calls on {@link AutofillManager} that requires the caller to be the current service. public void onDisconnected() { } private void handleOnConnected(boolean debug, boolean verbose) { if (sDebug || debug) { Log.d(TAG, "handleOnConnected(): debug=" + debug + ", verbose=" + verbose); } sDebug = debug; sVerbose = verbose; onConnected(); } private void handleOnDisconnected() { onDisconnected(); } private void handleOnFillRequest(int sessionId, @NonNull IBinder client, int taskId, @NonNull ComponentName componentName, @NonNull AutofillId focusedId, @Nullable AutofillValue focusedValue, long requestTime, @Nullable InlineSuggestionsRequest inlineSuggestionsRequest, @NonNull IFillCallback callback) { if (mAutofillProxies == null) { mAutofillProxies = new SparseArray<>(); } final ICancellationSignal transport = CancellationSignal.createTransport(); final CancellationSignal cancellationSignal = CancellationSignal.fromTransport(transport); AutofillProxy proxy = mAutofillProxies.get(sessionId); if (proxy == null) { proxy = new AutofillProxy(sessionId, client, taskId, mServiceComponentName, componentName, focusedId, focusedValue, requestTime, callback, cancellationSignal); mAutofillProxies.put(sessionId, proxy); } else { // TODO(b/123099468): figure out if it's ok to reuse the proxy; add logging if (sDebug) Log.d(TAG, "Reusing proxy for session " + sessionId); proxy.update(focusedId, focusedValue, callback, cancellationSignal); } try { callback.onCancellable(transport); } catch (RemoteException e) { e.rethrowFromSystemServer(); } mAutofillProxyForLastRequest = proxy; onFillRequest(new FillRequest(proxy, inlineSuggestionsRequest), cancellationSignal, new FillController(proxy), new FillCallback(proxy)); } private void handleOnDestroyAllFillWindowsRequest() { if (mAutofillProxies != null) { final int size = mAutofillProxies.size(); for (int i = 0; i < size; i++) { final int sessionId = mAutofillProxies.keyAt(i); final AutofillProxy proxy = mAutofillProxies.valueAt(i); if (proxy == null) { // TODO(b/123100811): this might be fine, in which case we should logv it Log.w(TAG, "No proxy for session " + sessionId); return; } if (proxy.mCallback != null) { try { if (!proxy.mCallback.isCompleted()) { proxy.mCallback.cancel(); } } catch (Exception e) { Log.e(TAG, "failed to check current pending request status", e); } } proxy.destroy(); } mAutofillProxies.clear(); mAutofillProxyForLastRequest = null; } } private void handleOnUnbind() { if (mAutofillProxies == null) { if (sDebug) Log.d(TAG, "onUnbind(): no proxy to destroy"); return; } final int size = mAutofillProxies.size(); if (sDebug) Log.d(TAG, "onUnbind(): destroying " + size + " proxies"); for (int i = 0; i < size; i++) { final AutofillProxy proxy = mAutofillProxies.valueAt(i); try { proxy.destroy(); } catch (Exception e) { Log.w(TAG, "error destroying " + proxy); } } mAutofillProxies = null; mAutofillProxyForLastRequest = null; } @Override /** @hide
getSimpleName::dump
java
Reginer/aosp-android-jar
android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
MIT
protected void dump(@NonNull PrintWriter pw, @SuppressWarnings("unused") @NonNull String[] args) { pw.print(getClass().getName()); pw.println(": nothing to dump"); }
Implementation specific {@code dump}. The child class can override the method to provide additional information about the Service's state into the dumpsys output. @param pw The PrintWriter to which you should dump your state. This will be closed for you after you return. @param args additional arguments to the dump request.
getSimpleName::dump
java
Reginer/aosp-android-jar
android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/service/autofill/augmented/AugmentedAutofillService.java
MIT
protected Transformer() { }
Default constructor is protected on purpose.
Transformer::Transformer
java
Reginer/aosp-android-jar
android-31/src/javax/xml/transform/Transformer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/xml/transform/Transformer.java
MIT
public void reset() { // implementors should override this method throw new UnsupportedOperationException( "This Transformer, \"" + this.getClass().getName() + "\", does not support the reset functionality." + " Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\"" + " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\"" ); }
<p>Reset this <code>Transformer</code> to its original configuration.</p> <p><code>Transformer</code> is reset to the same state as when it was created with {@link TransformerFactory#newTransformer()}, {@link TransformerFactory#newTransformer(Source source)} or {@link Templates#newTransformer()}. <code>reset()</code> is designed to allow the reuse of existing <code>Transformer</code>s thus saving resources associated with the creation of new <code>Transformer</code>s.</p> <p>The reset <code>Transformer</code> is not guaranteed to have the same {@link URIResolver} or {@link ErrorListener} <code>Object</code>s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal <code>URIResolver</code> and <code>ErrorListener</code>.</p> @since 1.5
Transformer::reset
java
Reginer/aosp-android-jar
android-31/src/javax/xml/transform/Transformer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/javax/xml/transform/Transformer.java
MIT
private final DisplayBlanker mDisplayBlanker = new DisplayBlanker() { // Synchronized to avoid race conditions when updating multiple display states. @Override public synchronized void requestDisplayState(int displayId, int state, float brightness, float sdrBrightness) { boolean allInactive = true; boolean allOff = true; final boolean stateChanged; synchronized (mSyncRoot) { final int index = mDisplayStates.indexOfKey(displayId); if (index > -1) { final int currentState = mDisplayStates.valueAt(index); stateChanged = state != currentState; if (stateChanged) { final int size = mDisplayStates.size(); for (int i = 0; i < size; i++) { final int displayState = i == index ? state : mDisplayStates.valueAt(i); if (displayState != Display.STATE_OFF) { allOff = false; } if (Display.isActiveState(displayState)) { allInactive = false; } if (!allOff && !allInactive) { break; } } } } else { stateChanged = false; } } // The order of operations is important for legacy reasons. if (state == Display.STATE_OFF) { requestDisplayStateInternal(displayId, state, brightness, sdrBrightness); } if (stateChanged) { mDisplayPowerCallbacks.onDisplayStateChange(allInactive, allOff); } if (state != Display.STATE_OFF) { requestDisplayStateInternal(displayId, state, brightness, sdrBrightness); } } };
Contains all the {@link LogicalDisplay} instances and is responsible for mapping {@link DisplayDevice}s to {@link LogicalDisplay}s. DisplayManagerService listens to display event on this object. private final LogicalDisplayMapper mLogicalDisplayMapper; // List of all display transaction listeners. private final CopyOnWriteArrayList<DisplayTransactionListener> mDisplayTransactionListeners = new CopyOnWriteArrayList<>(); /** List of all display group listeners. private final CopyOnWriteArrayList<DisplayGroupListener> mDisplayGroupListeners = new CopyOnWriteArrayList<>(); /** All {@link DisplayPowerController}s indexed by {@link LogicalDisplay} ID. private final SparseArray<DisplayPowerControllerInterface> mDisplayPowerControllers = new SparseArray<>(); /** {@link DisplayBlanker} used by all {@link DisplayPowerController}s.
DisplayManagerService::DisplayBlanker
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/DisplayManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/DisplayManagerService.java
MIT
private void getNonOverrideDisplayInfoInternal(int displayId, DisplayInfo outInfo) { synchronized (mSyncRoot) { final LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked(displayId); if (display != null) { display.getNonOverrideDisplayInfoLocked(outInfo); } } }
@see DisplayManagerInternal#getNonOverrideDisplayInfo(int, DisplayInfo)
mInputManagerInternal::getNonOverrideDisplayInfoInternal
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/DisplayManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/DisplayManagerService.java
MIT
public boolean notifyDisplayEventAsync(int displayId, @DisplayEvent int event) { if (!shouldSendEvent(event)) { if (extraLogging(mPackageName)) { Slog.i(TAG, "Not sending displayEvent: " + event + " due to mask:" + mEventsMask); } if (Trace.isTagEnabled(Trace.TRACE_TAG_POWER)) { Trace.instant(Trace.TRACE_TAG_POWER, "notifyDisplayEventAsync#notSendingEvent=" + event + ",mEventsMask=" + mEventsMask); } return true; } try { mCallback.onDisplayEvent(displayId, event); return true; } catch (RemoteException ex) { Slog.w(TAG, "Failed to notify process " + mPid + " that displays changed, assuming it died.", ex); binderDied(); return false; } }
@return {@code false} if RemoteException happens; otherwise {@code true} for success.
CallbackRecord::notifyDisplayEventAsync
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/DisplayManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/DisplayManagerService.java
MIT
public void showNotification(@NonNull NotificationEntry entry) { mLogger.logShowNotification(entry); addAlertEntry(entry); updateNotification(entry.getKey(), true /* alert */); entry.setInterruption(); }
Called when posting a new notification that should alert the user and appear on screen. Adds the notification to be managed. @param entry entry to show
AlertingNotificationManager::showNotification
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public boolean removeNotification(@NonNull String key, boolean releaseImmediately) { mLogger.logRemoveNotification(key, releaseImmediately); AlertEntry alertEntry = mAlertEntries.get(key); if (alertEntry == null) { return true; } if (releaseImmediately || canRemoveImmediately(key)) { removeAlertEntry(key); } else { alertEntry.removeAsSoonAsPossible(); return false; } return true; }
Try to remove the notification. May not succeed if the notification has not been shown long enough and needs to be kept around. @param key the key of the notification to remove @param releaseImmediately force a remove regardless of earliest removal time @return true if notification is removed, false otherwise
AlertingNotificationManager::removeNotification
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public void updateNotification(@NonNull String key, boolean alert) { AlertEntry alertEntry = mAlertEntries.get(key); mLogger.logUpdateNotification(key, alert, alertEntry != null); if (alertEntry == null) { // the entry was released before this update (i.e by a listener) This can happen // with the groupmanager return; } alertEntry.mEntry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); if (alert) { alertEntry.updateEntry(true /* updatePostTime */); } }
Called when the notification state has been updated. @param key the key of the entry that was updated @param alert whether the notification should alert again and force reevaluation of removal time
AlertingNotificationManager::updateNotification
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public void releaseAllImmediately() { mLogger.logReleaseAllImmediately(); // A copy is necessary here as we are changing the underlying map. This would cause // undefined behavior if we iterated over the key set directly. ArraySet<String> keysToRemove = new ArraySet<>(mAlertEntries.keySet()); for (String key : keysToRemove) { removeAlertEntry(key); } }
Clears all managed notifications.
AlertingNotificationManager::releaseAllImmediately
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public boolean hasNotifications() { return !mAlertEntries.isEmpty(); }
Whether or not there are any active alerting notifications. @return true if there is an alert, false otherwise
AlertingNotificationManager::hasNotifications
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public boolean isAlerting(@NonNull String key) { return mAlertEntries.containsKey(key); }
Whether or not the given notification is alerting and managed by this manager. @return true if the notification is alerting
AlertingNotificationManager::isAlerting
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
protected final void addAlertEntry(@NonNull NotificationEntry entry) { AlertEntry alertEntry = createAlertEntry(); alertEntry.setEntry(entry); mAlertEntries.put(entry.getKey(), alertEntry); onAlertEntryAdded(alertEntry); entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); entry.setIsAlerting(true); }
Add a new entry and begin managing it. @param entry the entry to add
AlertingNotificationManager::addAlertEntry
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
protected final void removeAlertEntry(@NonNull String key) { AlertEntry alertEntry = mAlertEntries.get(key); if (alertEntry == null) { return; } NotificationEntry entry = alertEntry.mEntry; // If the notification is animating, we will remove it at the end of the animation. if (entry != null && entry.isExpandAnimationRunning()) { return; } entry.demoteStickyHun(); mAlertEntries.remove(key); onAlertEntryRemoved(alertEntry); entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); alertEntry.reset(); }
Remove a notification and reset the alert entry. @param key key of notification to remove
AlertingNotificationManager::removeAlertEntry
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
protected AlertEntry createAlertEntry() { return new AlertEntry(); }
Returns a new alert entry instance. @return a new AlertEntry
AlertingNotificationManager::createAlertEntry
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public boolean canRemoveImmediately(String key) { AlertEntry alertEntry = mAlertEntries.get(key); return alertEntry == null || alertEntry.wasShownLongEnough() || alertEntry.mEntry.isRowDismissed(); }
Whether or not the alert can be removed currently. If it hasn't been on screen long enough it should not be removed unless forced @param key the key to check if removable @return true if the alert entry can be removed
AlertingNotificationManager::canRemoveImmediately
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public boolean isSticky(String key) { AlertEntry alerting = mAlertEntries.get(key); if (alerting != null) { return alerting.isSticky(); } return false; }
@param key @return true if the entry is (pinned and expanded) or (has an active remote input)
AlertingNotificationManager::isSticky
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public long getEarliestRemovalTime(String key) { AlertEntry alerting = mAlertEntries.get(key); if (alerting != null) { return Math.max(0, alerting.mEarliestRemovaltime - mClock.currentTimeMillis()); } return 0; }
@param key @return When a HUN entry should be removed in milliseconds from now
AlertingNotificationManager::getEarliestRemovalTime
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public void updateEntry(boolean updatePostTime) { mLogger.logUpdateEntry(mEntry, updatePostTime); final long now = mClock.currentTimeMillis(); mEarliestRemovaltime = now + mMinimumDisplayTime; if (updatePostTime) { mPostTime = Math.max(mPostTime, now); } removeAutoRemovalCallbacks(); if (!isSticky()) { final long finishTime = calculateFinishTime(); final long timeLeft = Math.max(finishTime - now, mMinimumDisplayTime); mHandler.postDelayed(mRemoveAlertRunnable, timeLeft); } }
Updates an entry's removal time. @param updatePostTime whether or not to refresh the post time
AlertEntry::updateEntry
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public boolean isSticky() { // This implementation is overridden by HeadsUpManager HeadsUpEntry #isSticky return false; }
Whether or not the notification is "sticky" i.e. should stay on screen regardless of the timer (forever) and should be removed externally. @return true if the notification is sticky
AlertEntry::isSticky
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public boolean wasShownLongEnough() { return mEarliestRemovaltime < mClock.currentTimeMillis(); }
Whether the notification has befen on screen long enough and can be removed. @return true if the notification has been on screen long enough
AlertEntry::wasShownLongEnough
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public void removeAutoRemovalCallbacks() { if (mRemoveAlertRunnable != null) { mHandler.removeCallbacks(mRemoveAlertRunnable); } }
Clear any pending removal runnables.
AlertEntry::removeAutoRemovalCallbacks
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public void removeAsSoonAsPossible() { if (mRemoveAlertRunnable != null) { removeAutoRemovalCallbacks(); final long timeLeft = mEarliestRemovaltime - mClock.currentTimeMillis(); mHandler.postDelayed(mRemoveAlertRunnable, timeLeft); } }
Remove the alert at the earliest allowed removal time.
AlertEntry::removeAsSoonAsPossible
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
protected long calculatePostTime() { return mClock.currentTimeMillis(); }
Calculate what the post time of a notification is at some current time. @return the post time
AlertEntry::calculatePostTime
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
protected long calculateFinishTime() { // Overridden by HeadsUpManager HeadsUpEntry #calculateFinishTime return 0; }
@return When the notification should auto-dismiss itself, based on {@link SystemClock#elapsedRealTime()}
AlertEntry::calculateFinishTime
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/statusbar/AlertingNotificationManager.java
MIT
public static boolean isXML11Space(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_SPACE) != 0); } // isXML11Space(int):boolean
Returns true if the specified character is a space character as amdended in the XML 1.1 specification. @param c The character to check.
XML11Char::isXML11Space
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11Valid(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_VALID) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11Valid(int):boolean
Returns true if the specified character is valid. This method also checks the surrogate character range from 0x10000 to 0x10FFFF. <p> If the program chooses to apply the mask directly to the <code>XML11CHARS</code> array, then they are responsible for checking the surrogate character range. @param c The character to check.
XML11Char::isXML11Valid
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11Invalid(int c) { return !isXML11Valid(c); } // isXML11Invalid(int):boolean
Returns true if the specified character is invalid. @param c The character to check.
XML11Char::isXML11Invalid
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11ValidLiteral(int c) { return ((c < 0x10000 && ((XML11CHARS[c] & MASK_XML11_VALID) != 0 && (XML11CHARS[c] & MASK_XML11_CONTROL) == 0)) || (0x10000 <= c && c <= 0x10FFFF)); } // isXML11ValidLiteral(int):boolean
Returns true if the specified character is valid and permitted outside of a character reference. That is, this method will return false for the same set as isXML11Valid, except it also reports false for "control characters". @param c The character to check.
XML11Char::isXML11ValidLiteral
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11Content(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_CONTENT) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11Content(int):boolean
Returns true if the specified character can be considered content in an external parsed entity. @param c The character to check.
XML11Char::isXML11Content
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11InternalEntityContent(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_CONTENT_INTERNAL) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11InternalEntityContent(int):boolean
Returns true if the specified character can be considered content in an internal parsed entity. @param c The character to check.
XML11Char::isXML11InternalEntityContent
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11NameStart(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NAME_START) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NameStart(int):boolean
Returns true if the specified character is a valid name start character as defined by production [4] in the XML 1.1 specification. @param c The character to check.
XML11Char::isXML11NameStart
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11Name(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NAME) != 0) || (c >= 0x10000 && c < 0xF0000); } // isXML11Name(int):boolean
Returns true if the specified character is a valid name character as defined by production [4a] in the XML 1.1 specification. @param c The character to check.
XML11Char::isXML11Name
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11NCNameStart(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NCNAME_START) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NCNameStart(int):boolean
Returns true if the specified character is a valid NCName start character as defined by production [4] in Namespaces in XML 1.1 recommendation. @param c The character to check.
XML11Char::isXML11NCNameStart
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11NCName(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NCNAME) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NCName(int):boolean
Returns true if the specified character is a valid NCName character as defined by production [5] in Namespaces in XML 1.1 recommendation. @param c The character to check.
XML11Char::isXML11NCName
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11NameHighSurrogate(int c) { return (0xD800 <= c && c <= 0xDB7F); }
Returns whether the given character is a valid high surrogate for a name character. This includes all high surrogates for characters [0x10000-0xEFFFF]. In other words everything excluding planes 15 and 16. @param c The character to check.
XML11Char::isXML11NameHighSurrogate
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11ValidName(String name) { int length = name.length(); if (length == 0) return false; int i = 1; char ch = name.charAt(0); if( !isXML11NameStart(ch) ) { if ( length > 1 && isXML11NameHighSurrogate(ch) ) { char ch2 = name.charAt(1); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NameStart(XMLChar.supplemental(ch, ch2)) ) { return false; } i = 2; } else { return false; } } while (i < length) { ch = name.charAt(i); if ( !isXML11Name(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = name.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11Name(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } ++i; } return true; } // isXML11ValidName(String):boolean
Check to see if a string is a valid Name according to [5] in the XML 1.1 Recommendation @param name string to check @return true if name is a valid Name
XML11Char::isXML11ValidName
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11ValidNCName(String ncName) { int length = ncName.length(); if (length == 0) return false; int i = 1; char ch = ncName.charAt(0); if( !isXML11NCNameStart(ch) ) { if ( length > 1 && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(1); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)) ) { return false; } i = 2; } else { return false; } } while (i < length) { ch = ncName.charAt(i); if ( !isXML11NCName(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCName(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } ++i; } return true; } // isXML11ValidNCName(String):boolean
Check to see if a string is a valid NCName according to [4] from the XML Namespaces 1.1 Recommendation @param ncName string to check @return true if name is a valid NCName
XML11Char::isXML11ValidNCName
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
public static boolean isXML11ValidNmtoken(String nmtoken) { int length = nmtoken.length(); if (length == 0) return false; for (int i = 0; i < length; ++i ) { char ch = nmtoken.charAt(i); if( !isXML11Name(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = nmtoken.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11Name(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } } return true; } // isXML11ValidName(String):boolean
Check to see if a string is a valid Nmtoken according to [7] in the XML 1.1 Recommendation @param nmtoken string to check @return true if nmtoken is a valid Nmtoken
XML11Char::isXML11ValidNmtoken
java
Reginer/aosp-android-jar
android-35/src/org/apache/xml/serializer/utils/XML11Char.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xml/serializer/utils/XML11Char.java
MIT
protected queryData queryLastApp(SQLiteDatabase db, String app_id, String content_type) { if (LOCAL_LOGV) Log.v(LOG_TAG, "queryLastApp app_id: " + app_id + " content_type: " + content_type); Cursor cur = db.query(APPID_TABLE_NAME, new String[] {"install_order", "package_name", "class_name", "app_type", "need_signature", "further_processing"}, "x_wap_application=? and content_type=?", new String[] {app_id, content_type}, null /* groupBy */, null /* having */, "install_order desc" /* orderBy */); queryData ret = null; if (cur.moveToNext()) { ret = new queryData(); ret.installOrder = cur.getInt(cur.getColumnIndex("install_order")); ret.packageName = cur.getString(cur.getColumnIndex("package_name")); ret.className = cur.getString(cur.getColumnIndex("class_name")); ret.appType = cur.getInt(cur.getColumnIndex("app_type")); ret.needSignature = cur.getInt(cur.getColumnIndex("need_signature")); ret.furtherProcessing = cur.getInt(cur.getColumnIndex("further_processing")); } cur.close(); return ret; }
Query the latest receiver application info with supplied application ID and content type. @param app_id application ID to look up @param content_type content type to look up
queryData::queryLastApp
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
protected boolean signatureCheck(String package_name) { PackageManager pm = mContext.getPackageManager(); int match = pm.checkSignatures(mContext.getPackageName(), package_name); if (LOCAL_LOGV) Log.v(LOG_TAG, "compare signature " + mContext.getPackageName() + " and " + package_name + ", match=" + match); return match == PackageManager.SIGNATURE_MATCH; }
Compare the package signature with WapPushManager package
IWapPushManagerStub::signatureCheck
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
public int processMessage(String app_id, String content_type, Intent intent) throws RemoteException { Log.d(LOG_TAG, "wpman processMsg " + app_id + ":" + content_type); WapPushManDBHelper dbh = getDatabase(mContext); SQLiteDatabase db = dbh.getReadableDatabase(); WapPushManDBHelper.queryData lastapp = dbh.queryLastApp(db, app_id, content_type); db.close(); if (lastapp == null) { Log.w(LOG_TAG, "no receiver app found for " + app_id + ":" + content_type); return WapPushManagerParams.APP_QUERY_FAILED; } if (LOCAL_LOGV) Log.v(LOG_TAG, "starting " + lastapp.packageName + "/" + lastapp.className); if (lastapp.needSignature != 0) { if (!signatureCheck(lastapp.packageName)) { return WapPushManagerParams.SIGNATURE_NO_MATCH; } } if (lastapp.appType == WapPushManagerParams.APP_TYPE_ACTIVITY) { //Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(lastapp.packageName, lastapp.className); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { mContext.startActivity(intent); } catch (ActivityNotFoundException e) { Log.w(LOG_TAG, "invalid name " + lastapp.packageName + "/" + lastapp.className); return WapPushManagerParams.INVALID_RECEIVER_NAME; } } else { intent.setClassName(mContext, lastapp.className); intent.setComponent(new ComponentName(lastapp.packageName, lastapp.className)); PackageManager pm = mContext.getPackageManager(); PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); try { ApplicationInfo appInfo = pm.getApplicationInfo(lastapp.packageName, 0); if (appInfo.targetSdkVersion < Build.VERSION_CODES.O || powerManager.isIgnoringBatteryOptimizations(lastapp.packageName)) { if (mContext.startService(intent) == null) { Log.w(LOG_TAG, "invalid name " + lastapp.packageName + "/" + lastapp.className); return WapPushManagerParams.INVALID_RECEIVER_NAME; } } else { if (mContext.startForegroundService(intent) == null) { Log.w(LOG_TAG, "invalid name " + lastapp.packageName + "/" + lastapp.className); return WapPushManagerParams.INVALID_RECEIVER_NAME; } } } catch (NameNotFoundException e) { Log.w(LOG_TAG, "invalid name " + lastapp.packageName + "/" + lastapp.className); return WapPushManagerParams.INVALID_RECEIVER_NAME; } } return WapPushManagerParams.MESSAGE_HANDLED | (lastapp.furtherProcessing == 1 ? WapPushManagerParams.FURTHER_PROCESSING : 0); }
Returns the status value of the message processing. The message will be processed as follows: 1.Look up Application ID Table with x-wap-application-id + content type 2.Check the signature of package name that is found in the Application ID Table by using PackageManager.checkSignature 3.Trigger the Application 4.Returns the process status value.
IWapPushManagerStub::processMessage
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
public boolean addPackage(String x_app_id, String content_type, String package_name, String class_name, int app_type, boolean need_signature, boolean further_processing) { WapPushManDBHelper dbh = getDatabase(mContext); SQLiteDatabase db = dbh.getWritableDatabase(); if (!appTypeCheck(app_type)) { Log.w(LOG_TAG, "invalid app_type " + app_type + ". app_type must be " + WapPushManagerParams.APP_TYPE_ACTIVITY + " or " + WapPushManagerParams.APP_TYPE_SERVICE); return false; } boolean ret = insertPackage(dbh, db, x_app_id, content_type, package_name, class_name, app_type, need_signature, further_processing); db.close(); return ret; }
Returns true if adding the package succeeded.
IWapPushManagerStub::addPackage
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
public boolean updatePackage(String x_app_id, String content_type, String package_name, String class_name, int app_type, boolean need_signature, boolean further_processing) { if (!appTypeCheck(app_type)) { Log.w(LOG_TAG, "invalid app_type " + app_type + ". app_type must be " + WapPushManagerParams.APP_TYPE_ACTIVITY + " or " + WapPushManagerParams.APP_TYPE_SERVICE); return false; } WapPushManDBHelper dbh = getDatabase(mContext); SQLiteDatabase db = dbh.getWritableDatabase(); WapPushManDBHelper.queryData lastapp = dbh.queryLastApp(db, x_app_id, content_type); if (lastapp == null) { db.close(); return false; } ContentValues values = new ContentValues(); String where = "x_wap_application=\'" + x_app_id + "\'" + " and content_type=\'" + content_type + "\'" + " and install_order=" + lastapp.installOrder; values.put("package_name", package_name); values.put("class_name", class_name); values.put("app_type", app_type); values.put("need_signature", need_signature ? 1 : 0); values.put("further_processing", further_processing ? 1 : 0); int num = db.update(APPID_TABLE_NAME, values, where, null); if (LOCAL_LOGV) Log.v(LOG_TAG, "update:" + x_app_id + ":" + content_type + " " + package_name + "." + class_name + ", sq:" + lastapp.installOrder); db.close(); return num > 0; }
Returns true if updating the package succeeded.
IWapPushManagerStub::updatePackage
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
public boolean deletePackage(String x_app_id, String content_type, String package_name, String class_name) { WapPushManDBHelper dbh = getDatabase(mContext); SQLiteDatabase db = dbh.getWritableDatabase(); String where = "x_wap_application=\'" + x_app_id + "\'" + " and content_type=\'" + content_type + "\'" + " and package_name=\'" + package_name + "\'" + " and class_name=\'" + class_name + "\'"; int num_removed = db.delete(APPID_TABLE_NAME, where, null); db.close(); if (LOCAL_LOGV) Log.v(LOG_TAG, "deleted " + num_removed + " rows:" + x_app_id + ":" + content_type + " " + package_name + "." + class_name); return num_removed > 0; }
Returns true if deleting the package succeeded.
IWapPushManagerStub::deletePackage
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
public WapPushManager() { super(); mBinder.mContext = this; }
Default constructor
IWapPushManagerStub::WapPushManager
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
private void migrateWapPushManDBIfNeeded(Context context) { UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE); File file = context.getDatabasePath(DATABASE_NAME); if (!userManager.isUserUnlocked() || !file.exists()) { // Check if the device is unlocked because a legacy database can't access during // DirectBoot. return; } // Migration steps below: // 1. Merge the package info to legacy database if there is any package info which is // registered during DirectBoot. // 2. Move the data base to the device encryped storage. WapPushManDBHelper legacyDbHelper = new WapPushManDBHelper(context); SQLiteDatabase legacyDb = legacyDbHelper.getWritableDatabase(); SQLiteDatabase db = mDbHelper.getWritableDatabase(); Cursor cur = db.query(APPID_TABLE_NAME, null, null, null, null, null, null); while (cur.moveToNext()) { insertPackage(legacyDbHelper, legacyDb, cur.getString(cur.getColumnIndex("x_wap_application")), cur.getString(cur.getColumnIndex("content_type")), cur.getString(cur.getColumnIndex("package_name")), cur.getString(cur.getColumnIndex("class_name")), cur.getInt(cur.getColumnIndex("app_type")), cur.getInt(cur.getColumnIndex("need_signature")) == 1, cur.getInt(cur.getColumnIndex("further_processing")) == 1); } cur.close(); legacyDb.close(); db.close(); context.createDeviceProtectedStorageContext().moveDatabaseFrom(context, DATABASE_NAME); Log.i(LOG_TAG, "Migrated the legacy database."); }
Migrates a legacy database into the device encrypted storage
IWapPushManagerStub::migrateWapPushManDBIfNeeded
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
public boolean verifyData(String x_app_id, String content_type, String package_name, String class_name, int app_type, boolean need_signature, boolean further_processing) { WapPushManDBHelper dbh = getDatabase(this); SQLiteDatabase db = dbh.getReadableDatabase(); WapPushManDBHelper.queryData lastapp = dbh.queryLastApp(db, x_app_id, content_type); if (LOCAL_LOGV) Log.v(LOG_TAG, "verifyData app id: " + x_app_id + " content type: " + content_type + " lastapp: " + lastapp); db.close(); if (lastapp == null) return false; if (LOCAL_LOGV) Log.v(LOG_TAG, "verifyData lastapp.packageName: " + lastapp.packageName + " lastapp.className: " + lastapp.className + " lastapp.appType: " + lastapp.appType + " lastapp.needSignature: " + lastapp.needSignature + " lastapp.furtherProcessing: " + lastapp.furtherProcessing); if (lastapp.packageName.equals(package_name) && lastapp.className.equals(class_name) && lastapp.appType == app_type && lastapp.needSignature == (need_signature ? 1 : 0) && lastapp.furtherProcessing == (further_processing ? 1 : 0)) { return true; } else { return false; } }
This method is used for testing
IWapPushManagerStub::verifyData
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
public boolean isDataExist(String x_app_id, String content_type, String package_name, String class_name) { WapPushManDBHelper dbh = getDatabase(this); SQLiteDatabase db = dbh.getReadableDatabase(); boolean ret = dbh.queryLastApp(db, x_app_id, content_type) != null; db.close(); return ret; }
This method is used for testing
IWapPushManagerStub::isDataExist
java
Reginer/aosp-android-jar
android-34/src/com/android/smspush/WapPushManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/smspush/WapPushManager.java
MIT
private MeasurementCompatibleManager(Context context) { mContext = context; mServiceBinder = ServiceBinder.getServiceBinder( context, AdServicesCommon.ACTION_MEASUREMENT_SERVICE, IMeasurementService.Stub::asInterface); mAdIdManager = new AdIdCompatibleManager(context); }
Create MeasurementCompatibleManager. @hide
MeasurementCompatibleManager::MeasurementCompatibleManager
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
private boolean isAdIdPermissionEnabled(AdId adId) { return !AdId.ZERO_OUT.equals(adId.getAdId()); }
Retrieves an {@link IMeasurementService} implementation @hide @VisibleForTesting @NonNull public IMeasurementService getService() throws IllegalStateException { IMeasurementService service = mServiceBinder.getService(); if (service == null) { throw new IllegalStateException("Unable to find the service"); } return service; } /** Checks if Ad ID permission is enabled.
MeasurementCompatibleManager::isAdIdPermissionEnabled
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
private void register( @NonNull RegistrationRequest registrationRequest, @NonNull IMeasurementService service, @Nullable @CallbackExecutor Executor executor, @Nullable AdServicesOutcomeReceiver<Object, Exception> callback) { Objects.requireNonNull(registrationRequest); requireExecutorForCallback(executor, callback); String registrationType = "source"; if (registrationRequest.getRegistrationType() == RegistrationRequest.REGISTER_TRIGGER) { registrationType = "trigger"; } LogUtil.d("Registering " + registrationType); try { service.register( registrationRequest, generateCallerMetadataWithCurrentTime(), new IMeasurementCallback.Stub() { @Override public void onResult() { if (callback != null) { executor.execute(() -> callback.onResult(new Object())); } } @Override public void onFailure(MeasurementErrorResponse failureParcel) { if (callback != null) { executor.execute( () -> callback.onError( AdServicesStatusUtils.asException( failureParcel))); } } }); } catch (RemoteException e) { LogUtil.e(e, "RemoteException"); if (callback != null) { executor.execute(() -> callback.onError(new IllegalStateException(e))); } } }
Register an attribution source / trigger. @hide
MeasurementCompatibleManager::register
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
private void registerWebSourceWrapper( @NonNull WebSourceRegistrationRequestInternal request, @NonNull IMeasurementService service, @Nullable Executor executor, @NonNull CallerMetadata callerMetadata, @NonNull IMeasurementCallback measurementCallback, @Nullable AdServicesOutcomeReceiver<Object, Exception> callback) { requireExecutorForCallback(executor, callback); try { LogUtil.d("Registering web source"); service.registerWebSource(request, callerMetadata, measurementCallback); } catch (RemoteException e) { LogUtil.e(e, "RemoteException"); if (callback != null) { executor.execute(() -> callback.onError(new IllegalStateException(e))); } } }
Register an attribution source(click or view) from web context. This API will not process any redirects, all registration URLs should be supplied with the request. At least one of appDestination or webDestination parameters are required to be provided. If the registration is successful, {@code callback}'s {@link AdServicesOutcomeReceiver#onResult} is invoked with null. In case of failure, a {@link Exception} is sent through {@code callback}'s {@link AdServicesOutcomeReceiver#onError}. Both success and failure feedback are executed on the provided {@link Executor}. @param request source registration request @param executor used by callback to dispatch results. @param callback intended to notify asynchronously the API result. @RequiresPermission(ACCESS_ADSERVICES_ATTRIBUTION) public void registerWebSource( @NonNull WebSourceRegistrationRequest request, @Nullable Executor executor, @Nullable AdServicesOutcomeReceiver<Object, Exception> callback) { Objects.requireNonNull(request); requireExecutorForCallback(executor, callback); IMeasurementService service = getServiceWrapper(executor, callback); if (service == null) { // Error was sent in the callback by getServiceWrapper call LogUtil.d("Measurement service not found"); return; } CallerMetadata callerMetadata = generateCallerMetadataWithCurrentTime(); IMeasurementCallback measurementCallback = new IMeasurementCallback.Stub() { @Override public void onResult() { if (callback != null) { executor.execute(() -> callback.onResult(new Object())); } } @Override public void onFailure(MeasurementErrorResponse failureParcel) { if (callback != null) { executor.execute( () -> callback.onError( AdServicesStatusUtils.asException( failureParcel))); } } }; final WebSourceRegistrationRequestInternal.Builder builder = new WebSourceRegistrationRequestInternal.Builder( request, getAppPackageName(), getSdkPackageName(), SystemClock.uptimeMillis()); getAdId( (isAdIdEnabled, adIdValue) -> registerWebSourceWrapper( builder.setAdIdPermissionGranted(isAdIdEnabled).build(), service, executor, callerMetadata, measurementCallback, callback)); } /** Wrapper method for registerWebSource.
MeasurementCompatibleManager::registerWebSourceWrapper
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
private void registerWebTriggerWrapper( @NonNull WebTriggerRegistrationRequestInternal request, @NonNull IMeasurementService service, @Nullable Executor executor, @NonNull CallerMetadata callerMetadata, @NonNull IMeasurementCallback measurementCallback, @Nullable AdServicesOutcomeReceiver<Object, Exception> callback) { requireExecutorForCallback(executor, callback); try { LogUtil.d("Registering web trigger"); service.registerWebTrigger(request, callerMetadata, measurementCallback); } catch (RemoteException e) { LogUtil.e(e, "RemoteException"); if (callback != null) { executor.execute(() -> callback.onError(new IllegalStateException(e))); } } }
Register an attribution trigger(click or view) from web context. This API will not process any redirects, all registration URLs should be supplied with the request. If the registration is successful, {@code callback}'s {@link AdServicesOutcomeReceiver#onResult} is invoked with null. In case of failure, a {@link Exception} is sent through {@code callback}'s {@link AdServicesOutcomeReceiver#onError}. Both success and failure feedback are executed on the provided {@link Executor}. @param request trigger registration request @param executor used by callback to dispatch results @param callback intended to notify asynchronously the API result @RequiresPermission(ACCESS_ADSERVICES_ATTRIBUTION) public void registerWebTrigger( @NonNull WebTriggerRegistrationRequest request, @Nullable Executor executor, @Nullable AdServicesOutcomeReceiver<Object, Exception> callback) { Objects.requireNonNull(request); requireExecutorForCallback(executor, callback); IMeasurementService service = getServiceWrapper(executor, callback); if (service == null) { // Error was sent in the callback by getServiceWrapper call LogUtil.d("Measurement service not found"); return; } CallerMetadata callerMetadata = generateCallerMetadataWithCurrentTime(); IMeasurementCallback measurementCallback = new IMeasurementCallback.Stub() { @Override public void onResult() { if (callback != null) { executor.execute(() -> callback.onResult(new Object())); } } @Override public void onFailure(MeasurementErrorResponse failureParcel) { if (callback != null) { executor.execute( () -> callback.onError( AdServicesStatusUtils.asException( failureParcel))); } } }; WebTriggerRegistrationRequestInternal.Builder builder = new WebTriggerRegistrationRequestInternal.Builder( request, getAppPackageName(), getSdkPackageName()); getAdId( (isAdIdEnabled, adIdValue) -> registerWebTriggerWrapper( builder.setAdIdPermissionGranted(isAdIdEnabled).build(), service, executor, callerMetadata, measurementCallback, callback)); } /** Wrapper method for registerWebTrigger.
MeasurementCompatibleManager::registerWebTriggerWrapper
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
private void deleteRegistrations( @NonNull DeletionParam deletionParam, @NonNull @CallbackExecutor Executor executor, @NonNull AdServicesOutcomeReceiver<Object, Exception> callback) { Objects.requireNonNull(deletionParam); Objects.requireNonNull(executor); Objects.requireNonNull(callback); final IMeasurementService service = getServiceWrapper(executor, callback); if (service == null) { // Error was sent in the callback by getServiceWrapper call LogUtil.d("Measurement service not found"); return; } try { service.deleteRegistrations( deletionParam, generateCallerMetadataWithCurrentTime(), new IMeasurementCallback.Stub() { @Override public void onResult() { executor.execute(() -> callback.onResult(new Object())); } @Override public void onFailure(MeasurementErrorResponse failureParcel) { executor.execute( () -> callback.onError( AdServicesStatusUtils.asException( failureParcel))); } }); } catch (RemoteException e) { LogUtil.e(e, "RemoteException"); executor.execute(() -> callback.onError(new IllegalStateException(e))); } }
Delete previously registered data. @hide
MeasurementCompatibleManager::deleteRegistrations
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
public void deleteRegistrations( @NonNull DeletionRequest deletionRequest, @NonNull @CallbackExecutor Executor executor, @NonNull AdServicesOutcomeReceiver<Object, Exception> callback) { deleteRegistrations( new DeletionParam.Builder( deletionRequest.getOriginUris(), deletionRequest.getDomainUris(), deletionRequest.getStart(), deletionRequest.getEnd(), getAppPackageName(), getSdkPackageName()) .setDeletionMode(deletionRequest.getDeletionMode()) .setMatchBehavior(deletionRequest.getMatchBehavior()) .build(), executor, callback); }
Delete previous registrations. If the deletion is successful, the callback's {@link AdServicesOutcomeReceiver#onResult} is invoked with null. In case of failure, a {@link Exception} is sent through the callback's {@link AdServicesOutcomeReceiver#onError}. Both success and failure feedback are executed on the provided {@link Executor}. @param deletionRequest The request for deleting data. @param executor The executor to run callback. @param callback intended to notify asynchronously the API result.
MeasurementCompatibleManager::deleteRegistrations
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
private String getAppPackageName() { SandboxedSdkContext sandboxedSdkContext = SandboxedSdkContextUtils.getAsSandboxedSdkContext(mContext); return sandboxedSdkContext == null ? mContext.getPackageName() : sandboxedSdkContext.getClientPackageName(); }
If the service is in an APK (as opposed to the system service), unbind it from the service to allow the APK process to die. @hide Not sure if we'll need this functionality in the final API. For now, we need it for performance testing to simulate "cold-start" situations. @VisibleForTesting public void unbindFromService() { mServiceBinder.unbindFromService(); } /** Returns the package name of the app from the SDK or app context
MeasurementCompatibleManager::getAppPackageName
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
private String getSdkPackageName() { SandboxedSdkContext sandboxedSdkContext = SandboxedSdkContextUtils.getAsSandboxedSdkContext(mContext); return sandboxedSdkContext == null ? "" : sandboxedSdkContext.getSdkPackageName(); }
If the service is in an APK (as opposed to the system service), unbind it from the service to allow the APK process to die. @hide Not sure if we'll need this functionality in the final API. For now, we need it for performance testing to simulate "cold-start" situations. @VisibleForTesting public void unbindFromService() { mServiceBinder.unbindFromService(); } /** Returns the package name of the app from the SDK or app context private String getAppPackageName() { SandboxedSdkContext sandboxedSdkContext = SandboxedSdkContextUtils.getAsSandboxedSdkContext(mContext); return sandboxedSdkContext == null ? mContext.getPackageName() : sandboxedSdkContext.getClientPackageName(); } /** Returns the package name of the sdk from the SDK or empty if no SDK found
MeasurementCompatibleManager::getSdkPackageName
java
Reginer/aosp-android-jar
android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/measurement/MeasurementCompatibleManager.java
MIT
public ArrayList(int initialCapacity) { if (initialCapacity > 0) { this.elementData = new Object[initialCapacity]; } else if (initialCapacity == 0) { this.elementData = EMPTY_ELEMENTDATA; } else { throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity); } }
Constructs an empty list with the specified initial capacity. @param initialCapacity the initial capacity of the list @throws IllegalArgumentException if the specified initial capacity is negative
ArrayList::ArrayList
java
Reginer/aosp-android-jar
android-33/src/java/util/ArrayList.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/ArrayList.java
MIT
public ArrayList() { this.elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA; }
Constructs an empty list with an initial capacity of ten.
ArrayList::ArrayList
java
Reginer/aosp-android-jar
android-33/src/java/util/ArrayList.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/ArrayList.java
MIT
ArrayListSpliterator(ArrayList<E> list, int origin, int fence, int expectedModCount) { this.list = list; // OK if null unless traversed this.index = origin; this.fence = fence; this.expectedModCount = expectedModCount; }
Creates a <em><a href="Spliterator.html#binding">late-binding</a></em> and <em>fail-fast</em> {@link Spliterator} over the elements in this list. <p>The {@code Spliterator} reports {@link Spliterator#SIZED}, {@link Spliterator#SUBSIZED}, and {@link Spliterator#ORDERED}. Overriding implementations should document the reporting of additional characteristic values. @return a {@code Spliterator} over the elements in this list @since 1.8 @Override public Spliterator<E> spliterator() { return new ArrayListSpliterator<>(this, 0, -1, 0); } /** Index-based split-by-two, lazily initialized Spliterator static final class ArrayListSpliterator<E> implements Spliterator<E> { /* If ArrayLists were immutable, or structurally immutable (no adds, removes, etc), we could implement their spliterators with Arrays.spliterator. Instead we detect as much interference during traversal as practical without sacrificing much performance. We rely primarily on modCounts. These are not guaranteed to detect concurrency violations, and are sometimes overly conservative about within-thread interference, but detect enough problems to be worthwhile in practice. To carry this out, we (1) lazily initialize fence and expectedModCount until the latest point that we need to commit to the state we are checking against; thus improving precision. (This doesn't apply to SubLists, that create spliterators with current non-lazy values). (2) We perform only a single ConcurrentModificationException check at the end of forEach (the most performance-sensitive method). When using forEach (as opposed to iterators), we can normally only detect interference after actions, not before. Further CME-triggering checks apply to all other possible violations of assumptions for example null or too-small elementData array given its size(), that could only have occurred due to interference. This allows the inner loop of forEach to run without any further checks, and simplifies lambda-resolution. While this does entail a number of checks, note that in the common case of list.stream().forEach(a), no checks or other computation occur anywhere other than inside forEach itself. The other less-often-used methods cannot take advantage of most of these streamlinings. private final ArrayList<E> list; private int index; // current index, modified on advance/split private int fence; // -1 until used; then one past last index private int expectedModCount; // initialized when fence set /** Create new spliterator covering the given range
ArrayListSpliterator::ArrayListSpliterator
java
Reginer/aosp-android-jar
android-33/src/java/util/ArrayList.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/util/ArrayList.java
MIT
public PlatformDecryptionKey(int generationId, SecretKey key) { mGenerationId = generationId; mKey = key; }
A new instance. @param generationId The generation ID of the platform key. @param key The key handle in AndroidKeyStore. @hide
PlatformDecryptionKey::PlatformDecryptionKey
java
Reginer/aosp-android-jar
android-31/src/com/android/server/locksettings/recoverablekeystore/PlatformDecryptionKey.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/locksettings/recoverablekeystore/PlatformDecryptionKey.java
MIT
public int getGenerationId() { return mGenerationId; }
Returns the generation ID. @hide
PlatformDecryptionKey::getGenerationId
java
Reginer/aosp-android-jar
android-31/src/com/android/server/locksettings/recoverablekeystore/PlatformDecryptionKey.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/locksettings/recoverablekeystore/PlatformDecryptionKey.java
MIT
public SecretKey getKey() { return mKey; }
Returns the actual key, which can be used to decrypt. @hide
PlatformDecryptionKey::getKey
java
Reginer/aosp-android-jar
android-31/src/com/android/server/locksettings/recoverablekeystore/PlatformDecryptionKey.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/locksettings/recoverablekeystore/PlatformDecryptionKey.java
MIT
public boolean isWaitingForRemoteDisplayChange() { return !mCallbacks.isEmpty(); }
A Remote change is when we are waiting for some registered (remote) {@link IDisplayChangeWindowController} to calculate and return some hierarchy operations to perform in sync with the display change.
RemoteDisplayChangeController::isWaitingForRemoteDisplayChange
java
Reginer/aosp-android-jar
android-34/src/com/android/server/wm/RemoteDisplayChangeController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/RemoteDisplayChangeController.java
MIT
public boolean performRemoteDisplayChange( int fromRotation, int toRotation, @Nullable DisplayAreaInfo newDisplayAreaInfo, ContinueRemoteDisplayChangeCallback callback) { if (mService.mDisplayChangeController == null) { return false; } mCallbacks.add(callback); if (newDisplayAreaInfo != null) { ProtoLog.v(WM_DEBUG_CONFIGURATION, "Starting remote display change: " + "from [rot = %d], " + "to [%dx%d, rot = %d]", fromRotation, newDisplayAreaInfo.configuration.windowConfiguration .getMaxBounds().width(), newDisplayAreaInfo.configuration.windowConfiguration .getMaxBounds().height(), toRotation); } final IDisplayChangeWindowCallback remoteCallback = createCallback(callback); try { mService.mH.removeCallbacks(mTimeoutRunnable); mService.mH.postDelayed(mTimeoutRunnable, REMOTE_DISPLAY_CHANGE_TIMEOUT_MS); mService.mDisplayChangeController.onDisplayChange(mDisplayId, fromRotation, toRotation, newDisplayAreaInfo, remoteCallback); return true; } catch (RemoteException e) { Slog.e(TAG, "Exception while dispatching remote display-change", e); mCallbacks.remove(callback); return false; } }
Starts remote display change @param fromRotation rotation before the change @param toRotation rotation after the change @param newDisplayAreaInfo display area info after change @param callback that will be called after completing remote display change @return true if the change successfully started, false otherwise
RemoteDisplayChangeController::performRemoteDisplayChange
java
Reginer/aosp-android-jar
android-34/src/com/android/server/wm/RemoteDisplayChangeController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/wm/RemoteDisplayChangeController.java
MIT
void filterSms(CarrierSmsFilterCallback smsFilterCallback) { mSmsFilterCallback = smsFilterCallback; if (!mCarrierMessagingServiceWrapper.bindToCarrierMessagingService( mContext, mPackageName, runnable -> runnable.run(), ()-> onServiceReady())) { loge("CarrierSmsFilter::filterSms: bindService() failed for " + mPackageName); smsFilterCallback.onReceiveSmsComplete( CarrierMessagingService.RECEIVE_OPTIONS_DEFAULT); } else { logv("CarrierSmsFilter::filterSms: bindService() succeeded for " + mPackageName); } }
Attempts to bind to a {@link CarrierMessagingService}. Filtering is initiated asynchronously once the service is ready using {@link #onServiceReady()}.
CarrierSmsFilter::filterSms
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/telephony/CarrierServicesSmsFilter.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/telephony/CarrierServicesSmsFilter.java
MIT
private void onServiceReady() { try { log("onServiceReady: calling filterSms on " + mPackageName); mCarrierMessagingServiceWrapper.receiveSms( new MessagePdu(Arrays.asList(mPdus)), mSmsFormat, mDestPort, mPhone.getSubId(), runnable -> runnable.run(), mSmsFilterCallback); } catch (RuntimeException e) { loge("Exception filtering the SMS with " + mPackageName + ": " + e); mSmsFilterCallback.onReceiveSmsComplete( CarrierMessagingService.RECEIVE_OPTIONS_DEFAULT); } }
Invokes the {@code carrierMessagingService} to filter messages. The filtering result is delivered to {@code smsFilterCallback}.
CarrierSmsFilter::onServiceReady
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/telephony/CarrierServicesSmsFilter.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/telephony/CarrierServicesSmsFilter.java
MIT
public static int checkPermissionForDataDelivery(@NonNull Context context, @NonNull Identity identity, @NonNull String permission, @NonNull String reason) { return PermissionChecker.checkPermissionForDataDelivery(context, permission, identity.pid, identity.uid, identity.packageName, identity.attributionTag, reason); }
Checks whether the given identity has the given permission to receive data. @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. @param reason The reason why we're requesting the permission, for auditing purposes. @return The permission check result which is either {@link PermissionChecker#PERMISSION_GRANTED} or {@link PermissionChecker#PERMISSION_SOFT_DENIED} or {@link PermissionChecker#PERMISSION_HARD_DENIED}.
PermissionUtil::checkPermissionForDataDelivery
java
Reginer/aosp-android-jar
android-33/src/android/media/permission/PermissionUtil.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/media/permission/PermissionUtil.java
MIT
public static int checkPermissionForPreflight(@NonNull Context context, @NonNull Identity identity, @NonNull String permission) { return PermissionChecker.checkPermissionForPreflight(context, permission, identity.pid, identity.uid, identity.packageName); }
Checks whether the given identity has the given permission. @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. @return The permission check result which is either {@link PermissionChecker#PERMISSION_GRANTED} or {@link PermissionChecker#PERMISSION_SOFT_DENIED} or {@link PermissionChecker#PERMISSION_HARD_DENIED}.
PermissionUtil::checkPermissionForPreflight
java
Reginer/aosp-android-jar
android-33/src/android/media/permission/PermissionUtil.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/media/permission/PermissionUtil.java
MIT
public processinginstructionsetdatanomodificationallowederrEE(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "staff", true); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
processinginstructionsetdatanomodificationallowederrEE::processinginstructionsetdatanomodificationallowederrEE
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/processinginstructionsetdatanomodificationallowederrEE.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/processinginstructionsetdatanomodificationallowederrEE.java
MIT
public void runTest() throws Throwable { Document doc; NodeList genderList; Node gender; Node entRef; ProcessingInstruction piNode; Node appendedChild; doc = (Document) load("staff", true); genderList = doc.getElementsByTagName("gender"); gender = genderList.item(2); entRef = doc.createEntityReference("ent4"); appendedChild = gender.appendChild(entRef); entRef = gender.getLastChild(); assertNotNull("entRefNotNull", entRef); piNode = (ProcessingInstruction) entRef.getLastChild(); assertNotNull("piNodeNotNull", piNode); { boolean success = false; try { piNode.setData("newData"); } catch (DOMException ex) { success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); } assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); } }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
processinginstructionsetdatanomodificationallowederrEE::runTest
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/processinginstructionsetdatanomodificationallowederrEE.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/processinginstructionsetdatanomodificationallowederrEE.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederrEE"; }
Gets URI that identifies the test. @return uri identifier of test
processinginstructionsetdatanomodificationallowederrEE::getTargetURI
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/processinginstructionsetdatanomodificationallowederrEE.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/processinginstructionsetdatanomodificationallowederrEE.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(processinginstructionsetdatanomodificationallowederrEE.class, args); }
Runs this test from the command line. @param args command line arguments
processinginstructionsetdatanomodificationallowederrEE::main
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/processinginstructionsetdatanomodificationallowederrEE.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/processinginstructionsetdatanomodificationallowederrEE.java
MIT
public EmptyStackException() { }
Constructs a new <code>EmptyStackException</code> with <tt>null</tt> as its error message string.
EmptyStackException::EmptyStackException
java
Reginer/aosp-android-jar
android-32/src/java/util/EmptyStackException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/util/EmptyStackException.java
MIT
public void reverseGeocode(ReverseGeocodeRequest request, IGeocodeCallback callback) { mServiceWatcher.runOnBinder( new ServiceWatcher.BinderOperation() { @Override public void run(IBinder binder) throws RemoteException { IGeocodeProvider.Stub.asInterface(binder).reverseGeocode(request, callback); } @Override public void onError(Throwable t) { try { callback.onError(t.toString()); } catch (RemoteException e) { // ignore } } }); }
Creates and registers this proxy. If no suitable service is available for the proxy, returns null. @Nullable public static ProxyGeocodeProvider createAndRegister(Context context) { ProxyGeocodeProvider proxy = new ProxyGeocodeProvider(context); if (proxy.register()) { return proxy; } else { return null; } } private final ServiceWatcher mServiceWatcher; private ProxyGeocodeProvider(Context context) { mServiceWatcher = ServiceWatcher.create( context, "GeocoderProxy", CurrentUserServiceSupplier.createFromConfig( context, GeocodeProviderBase.ACTION_GEOCODE_PROVIDER, com.android.internal.R.bool.config_enableGeocoderOverlay, com.android.internal.R.string.config_geocoderProviderPackageName), null); } private boolean register() { boolean resolves = mServiceWatcher.checkServiceResolves(); if (resolves) { mServiceWatcher.register(); } return resolves; } /** Reverse geocodes.
ProxyGeocodeProvider::reverseGeocode
java
Reginer/aosp-android-jar
android-35/src/com/android/server/location/provider/proxy/ProxyGeocodeProvider.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/location/provider/proxy/ProxyGeocodeProvider.java
MIT
public void forwardGeocode(ForwardGeocodeRequest request, IGeocodeCallback callback) { mServiceWatcher.runOnBinder( new ServiceWatcher.BinderOperation() { @Override public void run(IBinder binder) throws RemoteException { IGeocodeProvider.Stub.asInterface(binder).forwardGeocode(request, callback); } @Override public void onError(Throwable t) { try { callback.onError(t.toString()); } catch (RemoteException e) { // ignore } } }); }
Creates and registers this proxy. If no suitable service is available for the proxy, returns null. @Nullable public static ProxyGeocodeProvider createAndRegister(Context context) { ProxyGeocodeProvider proxy = new ProxyGeocodeProvider(context); if (proxy.register()) { return proxy; } else { return null; } } private final ServiceWatcher mServiceWatcher; private ProxyGeocodeProvider(Context context) { mServiceWatcher = ServiceWatcher.create( context, "GeocoderProxy", CurrentUserServiceSupplier.createFromConfig( context, GeocodeProviderBase.ACTION_GEOCODE_PROVIDER, com.android.internal.R.bool.config_enableGeocoderOverlay, com.android.internal.R.string.config_geocoderProviderPackageName), null); } private boolean register() { boolean resolves = mServiceWatcher.checkServiceResolves(); if (resolves) { mServiceWatcher.register(); } return resolves; } /** Reverse geocodes. public void reverseGeocode(ReverseGeocodeRequest request, IGeocodeCallback callback) { mServiceWatcher.runOnBinder( new ServiceWatcher.BinderOperation() { @Override public void run(IBinder binder) throws RemoteException { IGeocodeProvider.Stub.asInterface(binder).reverseGeocode(request, callback); } @Override public void onError(Throwable t) { try { callback.onError(t.toString()); } catch (RemoteException e) { // ignore } } }); } /** Forward geocodes.
ProxyGeocodeProvider::forwardGeocode
java
Reginer/aosp-android-jar
android-35/src/com/android/server/location/provider/proxy/ProxyGeocodeProvider.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/location/provider/proxy/ProxyGeocodeProvider.java
MIT
public void setAutoBrightnessState(int targetDisplayState, boolean allowAutoBrightnessWhileDozingConfig, int brightnessReason, int policy, float lastUserSetScreenBrightness, boolean userSetBrightnessChanged) { // We are still in the process of updating the power state, so there's no need to trigger // an update again switchMode(targetDisplayState, /* sendUpdate= */ false); final boolean autoBrightnessEnabledInDoze = allowAutoBrightnessWhileDozingConfig && Display.isDozeState(targetDisplayState); mIsAutoBrightnessEnabled = shouldUseAutoBrightness() && (targetDisplayState == Display.STATE_ON || autoBrightnessEnabledInDoze) && brightnessReason != BrightnessReason.REASON_OVERRIDE && mAutomaticBrightnessController != null; mAutoBrightnessDisabledDueToDisplayOff = shouldUseAutoBrightness() && !(targetDisplayState == Display.STATE_ON || autoBrightnessEnabledInDoze); final int autoBrightnessState = mIsAutoBrightnessEnabled && brightnessReason != BrightnessReason.REASON_FOLLOWER ? AutomaticBrightnessController.AUTO_BRIGHTNESS_ENABLED : mAutoBrightnessDisabledDueToDisplayOff ? AutomaticBrightnessController.AUTO_BRIGHTNESS_OFF_DUE_TO_DISPLAY_STATE : AutomaticBrightnessController.AUTO_BRIGHTNESS_DISABLED; accommodateUserBrightnessChanges(userSetBrightnessChanged, lastUserSetScreenBrightness, policy, targetDisplayState, mBrightnessConfiguration, autoBrightnessState); mIsConfigured = true; }
Sets up the automatic brightness states of this class. Also configures AutomaticBrightnessController accounting for any manual changes made by the user.
AutomaticBrightnessStrategy::setAutoBrightnessState
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public boolean isAutoBrightnessValid() { boolean isValid = false; if (isAutoBrightnessEnabled()) { float brightness = getAutomaticScreenBrightness(null, /* isAutomaticBrightnessAdjusted = */ false); if (BrightnessUtils.isValidBrightnessValue(brightness) || brightness == PowerManager.BRIGHTNESS_OFF_FLOAT) { isValid = true; } } // A change is slow when the auto-brightness was already applied, and there are no new // auto-brightness adjustments from an external client(e.g. Moving the slider). As such, // it is important to record this value before applying the current auto-brightness. mIsSlowChange = hasAppliedAutoBrightness() && !getAutoBrightnessAdjustmentChanged(); setAutoBrightnessApplied(isValid); return isValid; }
Validates if the auto-brightness strategy is valid or not considering the current system state.
AutomaticBrightnessStrategy::isAutoBrightnessValid
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public void setBrightnessConfiguration(BrightnessConfiguration brightnessConfiguration, boolean shouldResetShortTermModel) { mBrightnessConfiguration = brightnessConfiguration; setShouldResetShortTermModel(shouldResetShortTermModel); }
Updates the {@link BrightnessConfiguration} that is currently being used by the associated display.
AutomaticBrightnessStrategy::setBrightnessConfiguration
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public boolean processPendingAutoBrightnessAdjustments() { mAutoBrightnessAdjustmentChanged = false; if (Float.isNaN(mPendingAutoBrightnessAdjustment)) { return false; } if (mAutoBrightnessAdjustment == mPendingAutoBrightnessAdjustment) { mPendingAutoBrightnessAdjustment = Float.NaN; return false; } mAutoBrightnessAdjustment = mPendingAutoBrightnessAdjustment; mPendingAutoBrightnessAdjustment = Float.NaN; mTemporaryAutoBrightnessAdjustment = Float.NaN; mAutoBrightnessAdjustmentChanged = true; return true; }
Promotes the pending auto-brightness adjustments which are yet to be applied to the current adjustments. Note that this is not applying the new adjustments to the AutoBrightness mapping strategies, but is only accommodating the changes in this class.
AutomaticBrightnessStrategy::processPendingAutoBrightnessAdjustments
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public void setAutomaticBrightnessController( AutomaticBrightnessController automaticBrightnessController) { if (automaticBrightnessController == mAutomaticBrightnessController) { return; } if (mAutomaticBrightnessController != null) { mAutomaticBrightnessController.stop(); } mAutomaticBrightnessController = automaticBrightnessController; }
Updates the associated AutomaticBrightnessController
AutomaticBrightnessStrategy::setAutomaticBrightnessController
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public boolean shouldUseAutoBrightness() { return mUseAutoBrightness; }
Returns if the auto-brightness of the associated display has been enabled or not
AutomaticBrightnessStrategy::shouldUseAutoBrightness
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public void setUseAutoBrightness(boolean useAutoBrightness) { mUseAutoBrightness = useAutoBrightness; }
Sets the auto-brightness state of the associated display. Called when the user makes a change in the system setting to enable/disable the auto-brightness.
AutomaticBrightnessStrategy::setUseAutoBrightness
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public boolean isShortTermModelActive() { return mIsShortTermModelActive; }
Returns if the user made brightness change events(Typically when they interact with the brightness slider) were accommodated in the auto-brightness mapping strategies. This doesn't account for the latest changes that have been made by the user.
AutomaticBrightnessStrategy::isShortTermModelActive
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public void updatePendingAutoBrightnessAdjustments() { final float adj = Settings.System.getFloatForUser(mContext.getContentResolver(), Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f, UserHandle.USER_CURRENT); mPendingAutoBrightnessAdjustment = Float.isNaN(adj) ? Float.NaN : BrightnessUtils.clampBrightnessAdjustment(adj); }
Sets the pending auto-brightness adjustments in the system settings. Executed when there is a change in the brightness system setting, or when there is a user switch.
AutomaticBrightnessStrategy::updatePendingAutoBrightnessAdjustments
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public void setTemporaryAutoBrightnessAdjustment(float temporaryAutoBrightnessAdjustment) { mTemporaryAutoBrightnessAdjustment = temporaryAutoBrightnessAdjustment; }
Sets the temporary auto-brightness adjustments
AutomaticBrightnessStrategy::setTemporaryAutoBrightnessAdjustment
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public void dump(PrintWriter writer) { writer.println("AutomaticBrightnessStrategy:"); writer.println(" mDisplayId=" + mDisplayId); writer.println(" mAutoBrightnessAdjustment=" + mAutoBrightnessAdjustment); writer.println(" mPendingAutoBrightnessAdjustment=" + mPendingAutoBrightnessAdjustment); writer.println( " mTemporaryAutoBrightnessAdjustment=" + mTemporaryAutoBrightnessAdjustment); writer.println(" mShouldResetShortTermModel=" + mShouldResetShortTermModel); writer.println(" mAppliedAutoBrightness=" + mAppliedAutoBrightness); writer.println(" mAutoBrightnessAdjustmentChanged=" + mAutoBrightnessAdjustmentChanged); writer.println(" mAppliedTemporaryAutoBrightnessAdjustment=" + mAppliedTemporaryAutoBrightnessAdjustment); writer.println(" mUseAutoBrightness=" + mUseAutoBrightness); writer.println(" mWasShortTermModelActive=" + mIsShortTermModelActive); writer.println(" mAutoBrightnessAdjustmentReasonsFlags=" + mAutoBrightnessAdjustmentReasonsFlags); }
Dumps the state of this class.
AutomaticBrightnessStrategy::dump
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public boolean getAutoBrightnessAdjustmentChanged() { return mAutoBrightnessAdjustmentChanged; }
Indicates if any auto-brightness adjustments have happened since the last auto-brightness was set.
AutomaticBrightnessStrategy::getAutoBrightnessAdjustmentChanged
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT
public boolean isTemporaryAutoBrightnessAdjustmentApplied() { return mAppliedTemporaryAutoBrightnessAdjustment; }
Returns whether the latest temporary auto-brightness adjustments have been applied or not
AutomaticBrightnessStrategy::isTemporaryAutoBrightnessAdjustmentApplied
java
Reginer/aosp-android-jar
android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/display/brightness/strategy/AutomaticBrightnessStrategy.java
MIT