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 Builder(@NonNull PrinterId printerId) { if (printerId == null) { throw new IllegalArgumentException("printerId cannot be null."); } mPrototype = new PrinterCapabilitiesInfo(); }
Creates a new instance. @param printerId The printer id. Cannot be <code>null</code>. @throws IllegalArgumentException If the printer id is <code>null</code>.
Builder::Builder
java
Reginer/aosp-android-jar
android-35/src/android/print/PrinterCapabilitiesInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/print/PrinterCapabilitiesInfo.java
MIT
public @NonNull Builder addMediaSize(@NonNull MediaSize mediaSize, boolean isDefault) { if (mPrototype.mMediaSizes == null) { mPrototype.mMediaSizes = new ArrayList<MediaSize>(); } final int insertionIndex = mPrototype.mMediaSizes.size(); mPrototype.mMediaSizes.add(mediaSize); if (isDefault) { throwIfDefaultAlreadySpecified(PROPERTY_MEDIA_SIZE); mPrototype.mDefaults[PROPERTY_MEDIA_SIZE] = insertionIndex; } return this; }
Adds a supported media size. <p> <strong>Required:</strong> Yes </p> @param mediaSize A media size. @param isDefault Whether this is the default. @return This builder. @throws IllegalArgumentException If set as default and there is already a default. @see PrintAttributes.MediaSize
Builder::addMediaSize
java
Reginer/aosp-android-jar
android-35/src/android/print/PrinterCapabilitiesInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/print/PrinterCapabilitiesInfo.java
MIT
public @NonNull Builder addResolution(@NonNull Resolution resolution, boolean isDefault) { if (mPrototype.mResolutions == null) { mPrototype.mResolutions = new ArrayList<Resolution>(); } final int insertionIndex = mPrototype.mResolutions.size(); mPrototype.mResolutions.add(resolution); if (isDefault) { throwIfDefaultAlreadySpecified(PROPERTY_RESOLUTION); mPrototype.mDefaults[PROPERTY_RESOLUTION] = insertionIndex; } return this; }
Adds a supported resolution. <p> <strong>Required:</strong> Yes </p> @param resolution A resolution. @param isDefault Whether this is the default. @return This builder. @throws IllegalArgumentException If set as default and there is already a default. @see PrintAttributes.Resolution
Builder::addResolution
java
Reginer/aosp-android-jar
android-35/src/android/print/PrinterCapabilitiesInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/print/PrinterCapabilitiesInfo.java
MIT
public @NonNull Builder setMinMargins(@NonNull Margins margins) { if (margins == null) { throw new IllegalArgumentException("margins cannot be null"); } mPrototype.mMinMargins = margins; return this; }
Sets the minimal margins. These are the minimal margins the printer physically supports. <p> <strong>Required:</strong> Yes </p> @param margins The margins. @return This builder. @throws IllegalArgumentException If margins are <code>null</code>. @see PrintAttributes.Margins
Builder::setMinMargins
java
Reginer/aosp-android-jar
android-35/src/android/print/PrinterCapabilitiesInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/print/PrinterCapabilitiesInfo.java
MIT
public @NonNull Builder setColorModes(@ColorMode int colorModes, @ColorMode int defaultColorMode) { enforceValidMask(colorModes, (currentMode) -> PrintAttributes.enforceValidColorMode(currentMode)); PrintAttributes.enforceValidColorMode(defaultColorMode); mPrototype.mColorModes = colorModes; mPrototype.mDefaults[PROPERTY_COLOR_MODE] = defaultColorMode; return this; }
Sets the color modes. <p> <strong>Required:</strong> Yes </p> @param colorModes The color mode bit mask. @param defaultColorMode The default color mode. @return This builder. <p> <strong>Note:</strong> On platform version 19 (Kitkat) specifying only PrintAttributes#COLOR_MODE_MONOCHROME leads to a print spooler crash. Hence, you should declare either both color modes or PrintAttributes#COLOR_MODE_COLOR. </p> @throws IllegalArgumentException If color modes contains an invalid mode bit or if the default color mode is invalid. @see PrintAttributes#COLOR_MODE_COLOR @see PrintAttributes#COLOR_MODE_MONOCHROME
Builder::setColorModes
java
Reginer/aosp-android-jar
android-35/src/android/print/PrinterCapabilitiesInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/print/PrinterCapabilitiesInfo.java
MIT
public @NonNull Builder setDuplexModes(@DuplexMode int duplexModes, @DuplexMode int defaultDuplexMode) { enforceValidMask(duplexModes, (currentMode) -> PrintAttributes.enforceValidDuplexMode(currentMode)); PrintAttributes.enforceValidDuplexMode(defaultDuplexMode); mPrototype.mDuplexModes = duplexModes; mPrototype.mDefaults[PROPERTY_DUPLEX_MODE] = defaultDuplexMode; return this; }
Sets the duplex modes. <p> <strong>Required:</strong> No </p> @param duplexModes The duplex mode bit mask. @param defaultDuplexMode The default duplex mode. @return This builder. @throws IllegalArgumentException If duplex modes contains an invalid mode bit or if the default duplex mode is invalid. @see PrintAttributes#DUPLEX_MODE_NONE @see PrintAttributes#DUPLEX_MODE_LONG_EDGE @see PrintAttributes#DUPLEX_MODE_SHORT_EDGE
Builder::setDuplexModes
java
Reginer/aosp-android-jar
android-35/src/android/print/PrinterCapabilitiesInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/print/PrinterCapabilitiesInfo.java
MIT
public @NonNull PrinterCapabilitiesInfo build() { if (mPrototype.mMediaSizes == null || mPrototype.mMediaSizes.isEmpty()) { throw new IllegalStateException("No media size specified."); } if (mPrototype.mDefaults[PROPERTY_MEDIA_SIZE] == DEFAULT_UNDEFINED) { throw new IllegalStateException("No default media size specified."); } if (mPrototype.mResolutions == null || mPrototype.mResolutions.isEmpty()) { throw new IllegalStateException("No resolution specified."); } if (mPrototype.mDefaults[PROPERTY_RESOLUTION] == DEFAULT_UNDEFINED) { throw new IllegalStateException("No default resolution specified."); } if (mPrototype.mColorModes == 0) { throw new IllegalStateException("No color mode specified."); } if (mPrototype.mDefaults[PROPERTY_COLOR_MODE] == DEFAULT_UNDEFINED) { throw new IllegalStateException("No default color mode specified."); } if (mPrototype.mDuplexModes == 0) { setDuplexModes(PrintAttributes.DUPLEX_MODE_NONE, PrintAttributes.DUPLEX_MODE_NONE); } if (mPrototype.mMinMargins == null) { throw new IllegalArgumentException("margins cannot be null"); } return mPrototype; }
Crates a new {@link PrinterCapabilitiesInfo} enforcing that all required properties have been specified. See individual methods in this class for reference about required attributes. <p> <strong>Note:</strong> If you do not add supported duplex modes, {@link android.print.PrintAttributes#DUPLEX_MODE_NONE} will set as the only supported mode and also as the default duplex mode. </p> @return A new {@link PrinterCapabilitiesInfo}. @throws IllegalStateException If a required attribute was not specified.
Builder::build
java
Reginer/aosp-android-jar
android-35/src/android/print/PrinterCapabilitiesInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/print/PrinterCapabilitiesInfo.java
MIT
public @UserAssignmentResult int assignUserToDisplayOnStart(@UserIdInt int userId, @UserIdInt int unResolvedProfileGroupId, @UserStartMode int userStartMode, int displayId, boolean isAlwaysVisible) { Preconditions.checkArgument(!isSpecialUserId(userId), "user id cannot be generic: %d", userId); validateUserStartMode(userStartMode); // This method needs to perform 4 actions: // // 1. Check if the user can be started given the provided arguments // 2. If it can, decide whether it's visible or not (which is the return value) // 3. Update the current user / profiles state // 4. Update the users on secondary display state (if applicable) // // Notice that steps 3 and 4 should be done atomically (i.e., while holding mLock), so the // previous steps are delegated to other methods (canAssignUserToDisplayLocked() and // getUserVisibilityOnStartLocked() respectively). int profileGroupId = resolveProfileGroupId(userId, unResolvedProfileGroupId, isAlwaysVisible); if (DBG) { Slogf.d(TAG, "assignUserToDisplayOnStart(%d, %d, %s, %d): actualProfileGroupId=%d", userId, unResolvedProfileGroupId, userStartModeToString(userStartMode), displayId, profileGroupId); } int result; IntArray visibleUsersBefore, visibleUsersAfter; synchronized (mLock) { result = getUserVisibilityOnStartLocked(userId, profileGroupId, userStartMode, displayId); if (DBG) { Slogf.d(TAG, "result of getUserVisibilityOnStartLocked(%s)", userAssignmentResultToString(result)); } if (result == USER_ASSIGNMENT_RESULT_FAILURE || result == USER_ASSIGNMENT_RESULT_SUCCESS_ALREADY_VISIBLE) { return result; } int mappingResult = canAssignUserToDisplayLocked(userId, profileGroupId, userStartMode, displayId); if (DBG) { Slogf.d(TAG, "mapping result: %s", secondaryDisplayMappingStatusToString(mappingResult)); } if (mappingResult == SECONDARY_DISPLAY_MAPPING_FAILED) { return USER_ASSIGNMENT_RESULT_FAILURE; } visibleUsersBefore = getVisibleUsers(); // Set current user / started users state switch (userStartMode) { case USER_START_MODE_FOREGROUND: mCurrentUserId = userId; // Fallthrough case USER_START_MODE_BACKGROUND_VISIBLE: if (DBG) { Slogf.d(TAG, "adding visible user / profile group id mapping (%d -> %d)", userId, profileGroupId); } mStartedVisibleProfileGroupIds.put(userId, profileGroupId); break; case USER_START_MODE_BACKGROUND: if (mStartedInvisibleProfileUserIds != null && isProfile(userId, profileGroupId)) { Slogf.d(TAG, "adding user %d to list of invisible profiles", userId); mStartedInvisibleProfileUserIds.add(userId); } break; default: Slogf.wtf(TAG, "invalid userStartMode passed to assignUserToDisplayOnStart: " + "%d", userStartMode); } // Set user / display state switch (mappingResult) { case SECONDARY_DISPLAY_MAPPING_NEEDED: if (DBG) { Slogf.d(TAG, "adding user / display mapping (%d -> %d)", userId, displayId); } mUsersAssignedToDisplayOnStart.put(userId, displayId); break; case SECONDARY_DISPLAY_MAPPING_NOT_NEEDED: if (DBG) { // Don't need to do set state because methods (such as isUserVisible()) // already know that the current user (and their profiles) is assigned to // the default display. Slogf.d(TAG, "don't need to update mUsersOnSecondaryDisplays"); } break; default: Slogf.wtf(TAG, "invalid resut from canAssignUserToDisplayLocked: %d", mappingResult); } visibleUsersAfter = getVisibleUsers(); } dispatchVisibilityChanged(visibleUsersBefore, visibleUsersAfter); if (DBG) { Slogf.d(TAG, "returning %s", userAssignmentResultToString(result)); } return result; }
See {@link UserManagerInternal#assignUserToDisplayOnStart(int, int, int, int)}.
getSimpleName::assignUserToDisplayOnStart
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public boolean assignUserToExtraDisplay(@UserIdInt int userId, int displayId) { if (DBG) { Slogf.d(TAG, "assignUserToExtraDisplay(%d, %d)", userId, displayId); } if (!mVisibleBackgroundUsersEnabled) { Slogf.w(TAG, "assignUserToExtraDisplay(%d, %d): called when not supported", userId, displayId); return false; } if (displayId == INVALID_DISPLAY) { Slogf.w(TAG, "assignUserToExtraDisplay(%d, %d): called with INVALID_DISPLAY", userId, displayId); return false; } if (displayId == DEFAULT_DISPLAY) { Slogf.w(TAG, "assignUserToExtraDisplay(%d, %d): DEFAULT_DISPLAY is automatically " + "assigned to current user", userId, displayId); return false; } synchronized (mLock) { if (!isUserVisible(userId)) { Slogf.w(TAG, "assignUserToExtraDisplay(%d, %d): failed because user is not visible", userId, displayId); return false; } if (isStartedVisibleProfileLocked(userId)) { Slogf.w(TAG, "assignUserToExtraDisplay(%d, %d): failed because user is a profile", userId, displayId); return false; } if (mExtraDisplaysAssignedToUsers.get(displayId, USER_NULL) == userId) { Slogf.w(TAG, "assignUserToExtraDisplay(%d, %d): failed because user is already " + "assigned to that display", userId, displayId); return false; } // First check if the user started on display int userAssignedToDisplay = getUserStartedOnDisplay(displayId); if (userAssignedToDisplay != USER_NULL) { Slogf.w(TAG, "assignUserToExtraDisplay(%d, %d): failed because display was assigned" + " to user %d on start", userId, displayId, userAssignedToDisplay); return false; } // Then if was assigned extra userAssignedToDisplay = mExtraDisplaysAssignedToUsers.get(userId, USER_NULL); if (userAssignedToDisplay != USER_NULL) { Slogf.w(TAG, "assignUserToExtraDisplay(%d, %d): failed because user %d was already " + "assigned that extra display", userId, displayId, userAssignedToDisplay); return false; } if (DBG) { Slogf.d(TAG, "addding %d -> %d to mExtraDisplaysAssignedToUsers", displayId, userId); } mExtraDisplaysAssignedToUsers.put(displayId, userId); } return true; }
See {@link UserManagerInternal#assignUserToExtraDisplay(int, int)}.
getSimpleName::assignUserToExtraDisplay
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public boolean unassignUserFromExtraDisplay(@UserIdInt int userId, int displayId) { if (DBG) { Slogf.d(TAG, "unassignUserFromExtraDisplay(%d, %d)", userId, displayId); } if (!mVisibleBackgroundUsersEnabled) { Slogf.w(TAG, "unassignUserFromExtraDisplay(%d, %d): called when not supported", userId, displayId); return false; } synchronized (mLock) { int assignedUserId = mExtraDisplaysAssignedToUsers.get(displayId, USER_NULL); if (assignedUserId == USER_NULL) { Slogf.w(TAG, "unassignUserFromExtraDisplay(%d, %d): not assigned to any user", userId, displayId); return false; } if (assignedUserId != userId) { Slogf.w(TAG, "unassignUserFromExtraDisplay(%d, %d): was assigned to user %d", userId, displayId, assignedUserId); return false; } if (DBG) { Slogf.d(TAG, "removing %d from map", displayId); } mExtraDisplaysAssignedToUsers.delete(displayId); } return true; }
See {@link UserManagerInternal#unassignUserFromExtraDisplay(int, int)}.
getSimpleName::unassignUserFromExtraDisplay
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public void unassignUserFromDisplayOnStop(@UserIdInt int userId) { if (DBG) { Slogf.d(TAG, "unassignUserFromDisplayOnStop(%d)", userId); } IntArray visibleUsersBefore, visibleUsersAfter; synchronized (mLock) { visibleUsersBefore = getVisibleUsers(); unassignUserFromAllDisplaysOnStopLocked(userId); visibleUsersAfter = getVisibleUsers(); } dispatchVisibilityChanged(visibleUsersBefore, visibleUsersAfter); }
See {@link UserManagerInternal#unassignUserFromDisplayOnStop(int)}.
getSimpleName::unassignUserFromDisplayOnStop
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public boolean isUserVisible(@UserIdInt int userId) { // For optimization (as most devices don't support visible background users), check for // current foreground user and their profiles first if (isCurrentUserOrRunningProfileOfCurrentUser(userId)) { if (VERBOSE) { Slogf.v(TAG, "isUserVisible(%d): true to current user or profile", userId); } return true; } if (!mVisibleBackgroundUsersEnabled) { if (VERBOSE) { Slogf.v(TAG, "isUserVisible(%d): false for non-current user (or its profiles) when" + " device doesn't support visible background users", userId); } return false; } synchronized (mLock) { int profileGroupId; synchronized (mLock) { profileGroupId = mStartedVisibleProfileGroupIds.get(userId, NO_PROFILE_GROUP_ID); } if (isProfile(userId, profileGroupId)) { return isUserAssignedToDisplayOnStartLocked(profileGroupId); } return isUserAssignedToDisplayOnStartLocked(userId); } }
See {@link UserManagerInternal#isUserVisible(int)}.
getSimpleName::isUserVisible
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
private boolean isParentVisibleOnDisplay(@UserIdInt int profileGroupId, int displayId) { if (profileGroupId == ALWAYS_VISIBLE_PROFILE_GROUP_ID) { return true; } // The profileGroupId is the user (for a non-profile) or its parent (for a profile), // so query whether it is visible. return isUserVisible(profileGroupId, displayId); }
Returns whether the given profileGroupId - i.e. the user (for a non-profile), or its parent (for a profile) - is visible on the given display.
getSimpleName::isParentVisibleOnDisplay
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public boolean isUserVisible(@UserIdInt int userId, int displayId) { if (displayId == INVALID_DISPLAY) { return false; } // For optimization (as most devices don't support visible background users), check for // current user and profile first. Current user is always visible on: // - Default display // - Secondary displays when device doesn't support visible bg users // - Or when explicitly added (which is checked below) if (isCurrentUserOrRunningProfileOfCurrentUser(userId) && (displayId == DEFAULT_DISPLAY || !mVisibleBackgroundUsersEnabled)) { if (VERBOSE) { Slogf.v(TAG, "isUserVisible(%d, %d): returning true for current user/profile", userId, displayId); } return true; } if (!mVisibleBackgroundUsersEnabled) { if (DBG) { Slogf.d(TAG, "isUserVisible(%d, %d): returning false as device does not support" + " visible background users", userId, displayId); } return false; } synchronized (mLock) { int profileGroupId; synchronized (mLock) { profileGroupId = mStartedVisibleProfileGroupIds.get(userId, NO_PROFILE_GROUP_ID); } if (isProfile(userId, profileGroupId)) { return isFullUserVisibleOnBackgroundLocked(profileGroupId, displayId); } return isFullUserVisibleOnBackgroundLocked(userId, displayId); } }
See {@link UserManagerInternal#isUserVisible(int, int)}.
getSimpleName::isUserVisible
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public int getMainDisplayAssignedToUser(@UserIdInt int userId) { if (isCurrentUserOrRunningProfileOfCurrentUser(userId)) { if (mVisibleBackgroundUserOnDefaultDisplayEnabled) { // When device supports visible bg users on default display, the default display is // assigned to the current user, unless a user is started visible on it int userStartedOnDefaultDisplay; synchronized (mLock) { userStartedOnDefaultDisplay = getUserStartedOnDisplay(DEFAULT_DISPLAY); } if (userStartedOnDefaultDisplay != USER_NULL) { if (DBG) { Slogf.d(TAG, "getMainDisplayAssignedToUser(%d): returning INVALID_DISPLAY " + "for current user user %d was started on DEFAULT_DISPLAY", userId, userStartedOnDefaultDisplay); } return INVALID_DISPLAY; } } return DEFAULT_DISPLAY; } if (!mVisibleBackgroundUsersEnabled) { return INVALID_DISPLAY; } synchronized (mLock) { return mUsersAssignedToDisplayOnStart.get(userId, INVALID_DISPLAY); } }
See {@link UserManagerInternal#getMainDisplayAssignedToUser(int)}.
getSimpleName::getMainDisplayAssignedToUser
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public @UserIdInt int getUserAssignedToDisplay(@UserIdInt int displayId) { return getUserAssignedToDisplay(displayId, /* returnCurrentUserByDefault= */ true); }
See {@link UserManagerInternal#getUserAssignedToDisplay(int)}.
getSimpleName::getUserAssignedToDisplay
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
private @UserIdInt int getUserStartedOnDisplay(@UserIdInt int displayId) { return getUserAssignedToDisplay(displayId, /* returnCurrentUserByDefault= */ false); }
Gets the user explicitly assigned to a display.
getSimpleName::getUserStartedOnDisplay
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
private @UserIdInt int getUserAssignedToDisplay(@UserIdInt int displayId, boolean returnCurrentUserByDefault) { if (returnCurrentUserByDefault && ((displayId == DEFAULT_DISPLAY && !mVisibleBackgroundUserOnDefaultDisplayEnabled || !mVisibleBackgroundUsersEnabled))) { return getCurrentUserId(); } synchronized (mLock) { for (int i = 0; i < mUsersAssignedToDisplayOnStart.size(); i++) { if (mUsersAssignedToDisplayOnStart.valueAt(i) != displayId) { continue; } int userId = mUsersAssignedToDisplayOnStart.keyAt(i); if (!isStartedVisibleProfileLocked(userId)) { return userId; } else if (DBG) { Slogf.d(TAG, "getUserAssignedToDisplay(%d): skipping user %d because it's " + "a profile", displayId, userId); } } } if (!returnCurrentUserByDefault) { if (DBG) { Slogf.d(TAG, "getUserAssignedToDisplay(%d): no user assigned to display, returning " + "USER_NULL instead", displayId); } return USER_NULL; } int currentUserId = getCurrentUserId(); if (DBG) { Slogf.d(TAG, "getUserAssignedToDisplay(%d): no user assigned to display, returning " + "current user (%d) instead", displayId, currentUserId); } return currentUserId; }
Gets the user explicitly assigned to a display, or the current user when no user is assigned to it (and {@code returnCurrentUserByDefault} is {@code true}).
getSimpleName::getUserAssignedToDisplay
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public IntArray getVisibleUsers() { // TODO(b/258054362): this method's performance is O(n2), as it interacts through all users // here, then again on isUserVisible(). We could "fix" it to be O(n), but given that the // number of users is too small, the gain is probably not worth the increase on complexity. IntArray visibleUsers = new IntArray(); synchronized (mLock) { for (int i = 0; i < mStartedVisibleProfileGroupIds.size(); i++) { int userId = mStartedVisibleProfileGroupIds.keyAt(i); if (isUserVisible(userId)) { visibleUsers.add(userId); } } } return visibleUsers; }
Gets the ids of the visible users.
getSimpleName::getVisibleUsers
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public void addListener(UserVisibilityListener listener) { if (DBG) { Slogf.d(TAG, "adding listener %s", listener); } synchronized (mLock) { mListeners.add(listener); } }
Adds a {@link UserVisibilityListener listener}.
getSimpleName::addListener
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
public void removeListener(UserVisibilityListener listener) { if (DBG) { Slogf.d(TAG, "removing listener %s", listener); } synchronized (mLock) { mListeners.remove(listener); } }
Removes a {@link UserVisibilityListener listener}.
getSimpleName::removeListener
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
void onSystemUserVisibilityChanged(boolean visible) { dispatchVisibilityChanged(mListeners, USER_SYSTEM, visible); }
Nofify all listeners that the system user visibility changed.
getSimpleName::onSystemUserVisibilityChanged
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
private void dispatchVisibilityChanged(IntArray visibleUsersBefore, IntArray visibleUsersAfter) { if (visibleUsersBefore == null) { // Optimization - it's only null when listeners is empty if (DBG) { Slogf.d(TAG, "dispatchVisibilityChanged(): ignoring, no listeners"); } return; } CopyOnWriteArrayList<UserVisibilityListener> listeners = mListeners; if (DBG) { Slogf.d(TAG, "dispatchVisibilityChanged(): visibleUsersBefore=%s, visibleUsersAfter=%s, " + "%d listeners (%s)", visibleUsersBefore, visibleUsersAfter, listeners.size(), listeners); } for (int i = 0; i < visibleUsersBefore.size(); i++) { int userId = visibleUsersBefore.get(i); if (visibleUsersAfter.indexOf(userId) == -1) { dispatchVisibilityChanged(listeners, userId, /* visible= */ false); } } for (int i = 0; i < visibleUsersAfter.size(); i++) { int userId = visibleUsersAfter.get(i); if (visibleUsersBefore.indexOf(userId) == -1) { dispatchVisibilityChanged(listeners, userId, /* visible= */ true); } } }
Nofify all listeners about the visibility changes from before / after a change of state.
getSimpleName::dispatchVisibilityChanged
java
Reginer/aosp-android-jar
android-35/src/com/android/server/pm/UserVisibilityMediator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/pm/UserVisibilityMediator.java
MIT
private MapEntryLite( WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue) { this.metadata = new Metadata<K, V>(keyType, defaultKey, valueType, defaultValue); this.key = defaultKey; this.value = defaultValue; }
Implements the lite version of map entry messages. <p>This class serves as an utility class to help do serialization/parsing of map entries. It's used in generated code and also in the full version MapEntry message. <p>Protobuf internal. Users shouldn't use. public class MapEntryLite<K, V> { static class Metadata<K, V> { public final WireFormat.FieldType keyType; public final K defaultKey; public final WireFormat.FieldType valueType; public final V defaultValue; public Metadata( WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue) { this.keyType = keyType; this.defaultKey = defaultKey; this.valueType = valueType; this.defaultValue = defaultValue; } } private static final int KEY_FIELD_NUMBER = 1; private static final int VALUE_FIELD_NUMBER = 2; private final Metadata<K, V> metadata; private final K key; private final V value; /** Creates a default MapEntryLite message instance.
Metadata::MapEntryLite
java
Reginer/aosp-android-jar
android-35/src/com/google/protobuf/MapEntryLite.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/protobuf/MapEntryLite.java
MIT
private MapEntryLite(Metadata<K, V> metadata, K key, V value) { this.metadata = metadata; this.key = key; this.value = value; }
Implements the lite version of map entry messages. <p>This class serves as an utility class to help do serialization/parsing of map entries. It's used in generated code and also in the full version MapEntry message. <p>Protobuf internal. Users shouldn't use. public class MapEntryLite<K, V> { static class Metadata<K, V> { public final WireFormat.FieldType keyType; public final K defaultKey; public final WireFormat.FieldType valueType; public final V defaultValue; public Metadata( WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue) { this.keyType = keyType; this.defaultKey = defaultKey; this.valueType = valueType; this.defaultValue = defaultValue; } } private static final int KEY_FIELD_NUMBER = 1; private static final int VALUE_FIELD_NUMBER = 2; private final Metadata<K, V> metadata; private final K key; private final V value; /** Creates a default MapEntryLite message instance. private MapEntryLite( WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue) { this.metadata = new Metadata<K, V>(keyType, defaultKey, valueType, defaultValue); this.key = defaultKey; this.value = defaultValue; } /** Creates a new MapEntryLite message.
Metadata::MapEntryLite
java
Reginer/aosp-android-jar
android-35/src/com/google/protobuf/MapEntryLite.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/protobuf/MapEntryLite.java
MIT
public static <K, V> MapEntryLite<K, V> newDefaultInstance( WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue) { return new MapEntryLite<K, V>(keyType, defaultKey, valueType, defaultValue); }
Creates a default MapEntryLite message instance. <p>This method is used by generated code to create the default instance for a map entry message. The created default instance should be used to create new map entry messages of the same type. For each map entry message, only one default instance should be created.
Metadata::newDefaultInstance
java
Reginer/aosp-android-jar
android-35/src/com/google/protobuf/MapEntryLite.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/protobuf/MapEntryLite.java
MIT
public void serializeTo(CodedOutputStream output, int fieldNumber, K key, V value) throws IOException { output.writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED); output.writeUInt32NoTag(computeSerializedSize(metadata, key, value)); writeTo(output, metadata, key, value); }
Serializes the provided key and value as though they were wrapped by a {@link MapEntryLite} to the output stream. This helper method avoids allocation of a {@link MapEntryLite} built with a key and value and is called from generated code directly.
Metadata::serializeTo
java
Reginer/aosp-android-jar
android-35/src/com/google/protobuf/MapEntryLite.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/protobuf/MapEntryLite.java
MIT
public int computeMessageSize(int fieldNumber, K key, V value) { return CodedOutputStream.computeTagSize(fieldNumber) + CodedOutputStream.computeLengthDelimitedFieldSize( computeSerializedSize(metadata, key, value)); }
Computes the message size for the provided key and value as though they were wrapped by a {@link MapEntryLite}. This helper method avoids allocation of a {@link MapEntryLite} built with a key and value and is called from generated code directly.
Metadata::computeMessageSize
java
Reginer/aosp-android-jar
android-35/src/com/google/protobuf/MapEntryLite.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/protobuf/MapEntryLite.java
MIT
public Map.Entry<K, V> parseEntry(ByteString bytes, ExtensionRegistryLite extensionRegistry) throws IOException { return parseEntry(bytes.newCodedInput(), metadata, extensionRegistry); }
Parses an entry off of the input as a {@link Map.Entry}. This helper requires an allocation so using {@link #parseInto} is preferred if possible.
Metadata::parseEntry
java
Reginer/aosp-android-jar
android-35/src/com/google/protobuf/MapEntryLite.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/protobuf/MapEntryLite.java
MIT
public void parseInto( MapFieldLite<K, V> map, CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException { int length = input.readRawVarint32(); final int oldLimit = input.pushLimit(length); K key = metadata.defaultKey; V value = metadata.defaultValue; while (true) { int tag = input.readTag(); if (tag == 0) { break; } if (tag == WireFormat.makeTag(KEY_FIELD_NUMBER, metadata.keyType.getWireType())) { key = parseField(input, extensionRegistry, metadata.keyType, key); } else if (tag == WireFormat.makeTag(VALUE_FIELD_NUMBER, metadata.valueType.getWireType())) { value = parseField(input, extensionRegistry, metadata.valueType, value); } else { if (!input.skipField(tag)) { break; } } } input.checkLastTagWas(0); input.popLimit(oldLimit); map.put(key, value); }
Parses an entry off of the input into the map. This helper avoids allocation of a {@link MapEntryLite} by parsing directly into the provided {@link MapFieldLite}.
Metadata::parseInto
java
Reginer/aosp-android-jar
android-35/src/com/google/protobuf/MapEntryLite.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/protobuf/MapEntryLite.java
MIT
Metadata<K, V> getMetadata() { return metadata; }
Parses an entry off of the input into the map. This helper avoids allocation of a {@link MapEntryLite} by parsing directly into the provided {@link MapFieldLite}. public void parseInto( MapFieldLite<K, V> map, CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException { int length = input.readRawVarint32(); final int oldLimit = input.pushLimit(length); K key = metadata.defaultKey; V value = metadata.defaultValue; while (true) { int tag = input.readTag(); if (tag == 0) { break; } if (tag == WireFormat.makeTag(KEY_FIELD_NUMBER, metadata.keyType.getWireType())) { key = parseField(input, extensionRegistry, metadata.keyType, key); } else if (tag == WireFormat.makeTag(VALUE_FIELD_NUMBER, metadata.valueType.getWireType())) { value = parseField(input, extensionRegistry, metadata.valueType, value); } else { if (!input.skipField(tag)) { break; } } } input.checkLastTagWas(0); input.popLimit(oldLimit); map.put(key, value); } /** For experimental runtime internal use only.
Metadata::getMetadata
java
Reginer/aosp-android-jar
android-35/src/com/google/protobuf/MapEntryLite.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/google/protobuf/MapEntryLite.java
MIT
public static @NonNull X509Certificate getTestOnlyInsecureCertificate() { return parseBase64Certificate(TEST_ONLY_INSECURE_CERTIFICATE_BASE64); }
TODO: Add insecure certificate to TestApi. @hide
TrustedRootCertificates::getTestOnlyInsecureCertificate
java
Reginer/aosp-android-jar
android-34/src/android/security/keystore/recovery/TrustedRootCertificates.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/security/keystore/recovery/TrustedRootCertificates.java
MIT
public static @NonNull Map<String, X509Certificate> getRootCertificates() { return new ArrayMap(ALL_ROOT_CERTIFICATES); }
Returns all available root certificates, keyed by alias.
TrustedRootCertificates::getRootCertificates
java
Reginer/aosp-android-jar
android-34/src/android/security/keystore/recovery/TrustedRootCertificates.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/security/keystore/recovery/TrustedRootCertificates.java
MIT
public static @NonNull X509Certificate getRootCertificate(String alias) { return ALL_ROOT_CERTIFICATES.get(alias); }
Gets a root certificate referenced by the given {@code alias}. @param alias the alias of the certificate @return the certificate referenced by the alias, or null if such a certificate doesn't exist.
TrustedRootCertificates::getRootCertificate
java
Reginer/aosp-android-jar
android-34/src/android/security/keystore/recovery/TrustedRootCertificates.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/security/keystore/recovery/TrustedRootCertificates.java
MIT
public @AppSetIdScope int getAppSetIdScope() { return mAppSetIdScope; }
Returns the error message associated with this result. <p>If {@link #isSuccess} is {@code true}, the error message is always {@code null}. The error message may be {@code null} even if {@link #isSuccess} is {@code false}. @Nullable public String getErrorMessage() { return mErrorMessage; } /** Returns the AppSetId associated with this result. @NonNull public String getAppSetId() { return mAppSetId; } /** Returns the AppSetId scope associated with this result.
GetAppSetIdResult::getAppSetIdScope
java
Reginer/aosp-android-jar
android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
MIT
public @NonNull Builder setStatusCode(@AdServicesStatusUtils.StatusCode int statusCode) { mStatusCode = statusCode; return this; }
Builder for {@link GetAppSetIdResult} objects. @hide public static final class Builder { private @AdServicesStatusUtils.StatusCode int mStatusCode; @Nullable private String mErrorMessage; @NonNull private String mAppSetId; private @AppSetIdScope int mAppSetIdScope; public Builder() {} /** Set the Result Code.
Builder::setStatusCode
java
Reginer/aosp-android-jar
android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
MIT
public @NonNull Builder setErrorMessage(@Nullable String errorMessage) { mErrorMessage = errorMessage; return this; }
Builder for {@link GetAppSetIdResult} objects. @hide public static final class Builder { private @AdServicesStatusUtils.StatusCode int mStatusCode; @Nullable private String mErrorMessage; @NonNull private String mAppSetId; private @AppSetIdScope int mAppSetIdScope; public Builder() {} /** Set the Result Code. public @NonNull Builder setStatusCode(@AdServicesStatusUtils.StatusCode int statusCode) { mStatusCode = statusCode; return this; } /** Set the Error Message.
Builder::setErrorMessage
java
Reginer/aosp-android-jar
android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
MIT
public @NonNull Builder setAppSetId(@NonNull String appSetId) { mAppSetId = appSetId; return this; }
Builder for {@link GetAppSetIdResult} objects. @hide public static final class Builder { private @AdServicesStatusUtils.StatusCode int mStatusCode; @Nullable private String mErrorMessage; @NonNull private String mAppSetId; private @AppSetIdScope int mAppSetIdScope; public Builder() {} /** Set the Result Code. public @NonNull Builder setStatusCode(@AdServicesStatusUtils.StatusCode int statusCode) { mStatusCode = statusCode; return this; } /** Set the Error Message. public @NonNull Builder setErrorMessage(@Nullable String errorMessage) { mErrorMessage = errorMessage; return this; } /** Set the appSetId.
Builder::setAppSetId
java
Reginer/aosp-android-jar
android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
MIT
public @NonNull Builder setAppSetIdScope(@AppSetIdScope int scope) { mAppSetIdScope = scope; return this; }
Builder for {@link GetAppSetIdResult} objects. @hide public static final class Builder { private @AdServicesStatusUtils.StatusCode int mStatusCode; @Nullable private String mErrorMessage; @NonNull private String mAppSetId; private @AppSetIdScope int mAppSetIdScope; public Builder() {} /** Set the Result Code. public @NonNull Builder setStatusCode(@AdServicesStatusUtils.StatusCode int statusCode) { mStatusCode = statusCode; return this; } /** Set the Error Message. public @NonNull Builder setErrorMessage(@Nullable String errorMessage) { mErrorMessage = errorMessage; return this; } /** Set the appSetId. public @NonNull Builder setAppSetId(@NonNull String appSetId) { mAppSetId = appSetId; return this; } /** Set the appSetId scope field.
Builder::setAppSetIdScope
java
Reginer/aosp-android-jar
android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
MIT
public @NonNull GetAppSetIdResult build() { if (mAppSetId == null) { throw new IllegalArgumentException("appSetId is null"); } return new GetAppSetIdResult(mStatusCode, mErrorMessage, mAppSetId, mAppSetIdScope); }
Builder for {@link GetAppSetIdResult} objects. @hide public static final class Builder { private @AdServicesStatusUtils.StatusCode int mStatusCode; @Nullable private String mErrorMessage; @NonNull private String mAppSetId; private @AppSetIdScope int mAppSetIdScope; public Builder() {} /** Set the Result Code. public @NonNull Builder setStatusCode(@AdServicesStatusUtils.StatusCode int statusCode) { mStatusCode = statusCode; return this; } /** Set the Error Message. public @NonNull Builder setErrorMessage(@Nullable String errorMessage) { mErrorMessage = errorMessage; return this; } /** Set the appSetId. public @NonNull Builder setAppSetId(@NonNull String appSetId) { mAppSetId = appSetId; return this; } /** Set the appSetId scope field. public @NonNull Builder setAppSetIdScope(@AppSetIdScope int scope) { mAppSetIdScope = scope; return this; } /** Builds a {@link GetAppSetIdResult} instance.
Builder::build
java
Reginer/aosp-android-jar
android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/adservices/appsetid/GetAppSetIdResult.java
MIT
public static int transcodeToUTF16(byte[] utf8, char[] utf16) { int i = 0, j = 0; while (i < utf8.length) { byte codeUnit = utf8[i++]; if (codeUnit >= 0) { if (j >= utf16.length) { return -1; } utf16[j++] = (char)codeUnit; continue; } short first = firstUnitTable[codeUnit & 0x7F]; int codePoint = first >>> 8; byte state = (byte)first; while (state >= 0) { if (i >= utf8.length) { return -1; } codeUnit = utf8[i++]; codePoint = (codePoint << 6) | (codeUnit & 0x3F); state = transitionTable[state + ((codeUnit & 0xFF) >>> 4)]; } if (state == S_ERR) { return -1; } if (codePoint <= 0xFFFF) { if (j >= utf16.length) { return -1; } // Code points from U+D800 to U+DFFF are caught by the DFA utf16[j++] = (char)codePoint; } else { if (j >= utf16.length - 1) { return -1; } // Code points above U+10FFFF are caught by the DFA utf16[j++] = (char)(0xD7C0 + (codePoint >>> 10)); utf16[j++] = (char)(0xDC00 | (codePoint & 0x3FF)); } } return j; }
Transcode a UTF-8 encoding into a UTF-16 representation. In the general case the output {@code utf16} array should be at least as long as the input {@code utf8} one to handle arbitrary inputs. The number of output UTF-16 code units is returned, or -1 if any errors are encountered (in which case an arbitrary amount of data may have been written into the output array). Errors that will be detected are malformed UTF-8, including incomplete, truncated or "overlong" encodings, and unmappable code points. In particular, no unmatched surrogates will be produced. An error will also result if {@code utf16} is found to be too small to store the complete output. @param utf8 A non-null array containing a well-formed UTF-8 encoding. @param utf16 A non-null array, at least as long as the {@code utf8} array in order to ensure the output will fit. @return The number of UTF-16 code units written to {@code utf16} (beginning from index 0), or else -1 if the input was either malformed or encoded any unmappable characters, or if the {@code utf16} is too small.
UTF8::transcodeToUTF16
java
Reginer/aosp-android-jar
android-34/src/com/android/org/bouncycastle/util/encoders/UTF8.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/org/bouncycastle/util/encoders/UTF8.java
MIT
public documentcreateentityreference(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
documentcreateentityreference::documentcreateentityreference
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/documentcreateentityreference.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/documentcreateentityreference.java
MIT
public void runTest() throws Throwable { Document doc; EntityReference newEntRefNode; String entRefValue; String entRefName; int entRefType; doc = (Document) load("staff", true); newEntRefNode = doc.createEntityReference("ent1"); assertNotNull("createdEntRefNotNull", newEntRefNode); entRefValue = newEntRefNode.getNodeValue(); assertNull("value", entRefValue); entRefName = newEntRefNode.getNodeName(); assertEquals("name", "ent1", entRefName); entRefType = (int) newEntRefNode.getNodeType(); assertEquals("type", 5, entRefType); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
documentcreateentityreference::runTest
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/documentcreateentityreference.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/documentcreateentityreference.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreference"; }
Gets URI that identifies the test. @return uri identifier of test
documentcreateentityreference::getTargetURI
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/documentcreateentityreference.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/documentcreateentityreference.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(documentcreateentityreference.class, args); }
Runs this test from the command line. @param args command line arguments
documentcreateentityreference::main
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/documentcreateentityreference.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/documentcreateentityreference.java
MIT
public LongAtomicFormula(@Key int key) { super(key); checkArgument( key == VERSION_CODE, "Key %s cannot be used with LongAtomicFormula", keyToString(key)); mValue = null; mOperator = null; }
Constructs an empty {@link LongAtomicFormula}. This should only be used as a base. <p>This formula will always return false. @throws IllegalArgumentException if {@code key} cannot be used with long value
LongAtomicFormula::LongAtomicFormula
java
Reginer/aosp-android-jar
android-31/src/android/content/integrity/AtomicFormula.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/content/integrity/AtomicFormula.java
MIT
public LongAtomicFormula(@Key int key, @Operator int operator, long value) { super(key); checkArgument( key == VERSION_CODE, "Key %s cannot be used with LongAtomicFormula", keyToString(key)); checkArgument( isValidOperator(operator), "Unknown operator: %d", operator); mOperator = operator; mValue = value; }
Constructs a new {@link LongAtomicFormula}. <p>This formula will hold if and only if the corresponding information of an install specified by {@code key} is of the correct relationship to {@code value} as specified by {@code operator}. @throws IllegalArgumentException if {@code key} cannot be used with long value
LongAtomicFormula::LongAtomicFormula
java
Reginer/aosp-android-jar
android-31/src/android/content/integrity/AtomicFormula.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/content/integrity/AtomicFormula.java
MIT
public StringAtomicFormula(@Key int key) { super(key); checkArgument( key == PACKAGE_NAME || key == APP_CERTIFICATE || key == INSTALLER_CERTIFICATE || key == INSTALLER_NAME || key == STAMP_CERTIFICATE_HASH, "Key %s cannot be used with StringAtomicFormula", keyToString(key)); mValue = null; mIsHashedValue = null; }
Constructs an empty {@link StringAtomicFormula}. This should only be used as a base. <p>An empty formula will always match to false. @throws IllegalArgumentException if {@code key} cannot be used with string value
StringAtomicFormula::StringAtomicFormula
java
Reginer/aosp-android-jar
android-31/src/android/content/integrity/AtomicFormula.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/content/integrity/AtomicFormula.java
MIT
public StringAtomicFormula(@Key int key, @NonNull String value, boolean isHashed) { super(key); checkArgument( key == PACKAGE_NAME || key == APP_CERTIFICATE || key == INSTALLER_CERTIFICATE || key == INSTALLER_NAME || key == STAMP_CERTIFICATE_HASH, "Key %s cannot be used with StringAtomicFormula", keyToString(key)); mValue = value; mIsHashedValue = isHashed; }
Constructs a new {@link StringAtomicFormula}. <p>This formula will hold if and only if the corresponding information of an install specified by {@code key} equals {@code value}. @throws IllegalArgumentException if {@code key} cannot be used with string value
StringAtomicFormula::StringAtomicFormula
java
Reginer/aosp-android-jar
android-31/src/android/content/integrity/AtomicFormula.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/content/integrity/AtomicFormula.java
MIT
public StringAtomicFormula(@Key int key, @NonNull String value) { super(key); checkArgument( key == PACKAGE_NAME || key == APP_CERTIFICATE || key == INSTALLER_CERTIFICATE || key == INSTALLER_NAME || key == STAMP_CERTIFICATE_HASH, "Key %s cannot be used with StringAtomicFormula", keyToString(key)); mValue = hashValue(key, value); mIsHashedValue = (key == APP_CERTIFICATE || key == INSTALLER_CERTIFICATE || key == STAMP_CERTIFICATE_HASH) || !mValue.equals(value); }
Constructs a new {@link StringAtomicFormula} together with handling the necessary hashing for the given key. <p>The value will be automatically hashed with SHA256 and the hex digest will be computed when the key is PACKAGE_NAME or INSTALLER_NAME and the value is more than 32 characters. <p>The APP_CERTIFICATES, INSTALLER_CERTIFICATES, and STAMP_CERTIFICATE_HASH are always delivered in hashed form. So the isHashedValue is set to true by default. @throws IllegalArgumentException if {@code key} cannot be used with string value.
StringAtomicFormula::StringAtomicFormula
java
Reginer/aosp-android-jar
android-31/src/android/content/integrity/AtomicFormula.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/content/integrity/AtomicFormula.java
MIT
public BooleanAtomicFormula(@Key int key) { super(key); checkArgument( key == PRE_INSTALLED || key == STAMP_TRUSTED, String.format( "Key %s cannot be used with BooleanAtomicFormula", keyToString(key))); mValue = null; }
Constructs an empty {@link BooleanAtomicFormula}. This should only be used as a base. <p>An empty formula will always match to false. @throws IllegalArgumentException if {@code key} cannot be used with boolean value
BooleanAtomicFormula::BooleanAtomicFormula
java
Reginer/aosp-android-jar
android-31/src/android/content/integrity/AtomicFormula.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/content/integrity/AtomicFormula.java
MIT
public BooleanAtomicFormula(@Key int key, boolean value) { super(key); checkArgument( key == PRE_INSTALLED || key == STAMP_TRUSTED, String.format( "Key %s cannot be used with BooleanAtomicFormula", keyToString(key))); mValue = value; }
Constructs a new {@link BooleanAtomicFormula}. <p>This formula will hold if and only if the corresponding information of an install specified by {@code key} equals {@code value}. @throws IllegalArgumentException if {@code key} cannot be used with boolean value
BooleanAtomicFormula::BooleanAtomicFormula
java
Reginer/aosp-android-jar
android-31/src/android/content/integrity/AtomicFormula.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/content/integrity/AtomicFormula.java
MIT
default boolean isLogToAny() { return isLogToLogcat() || isLogToProto(); }
returns true is any logging is enabled for this group.
isLogToAny
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/protolog/common/IProtoLogGroup.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/protolog/common/IProtoLogGroup.java
MIT
private TemporalQueries() { }
Private constructor since this is a utility class.
TemporalQueries::TemporalQueries
java
Reginer/aosp-android-jar
android-31/src/java/time/temporal/TemporalQueries.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/temporal/TemporalQueries.java
MIT
public static TemporalQuery<ZoneId> zoneId() { return TemporalQueries.ZONE_ID; }
A strict query for the {@code ZoneId}. <p> This queries a {@code TemporalAccessor} for the zone. The zone is only returned if the date-time conceptually contains a {@code ZoneId}. It will not be returned if the date-time only conceptually has an {@code ZoneOffset}. Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, but an {@link java.time.OffsetDateTime} will return null. <p> In most cases, applications should use {@link #zone()} as this query is too strict. <p> The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> {@code LocalDate} returns null<br> {@code LocalTime} returns null<br> {@code LocalDateTime} returns null<br> {@code ZonedDateTime} returns the associated zone<br> {@code OffsetTime} returns null<br> {@code OffsetDateTime} returns null<br> {@code ChronoLocalDate} returns null<br> {@code ChronoLocalDateTime} returns null<br> {@code ChronoZonedDateTime} returns the associated zone<br> {@code Era} returns null<br> {@code DayOfWeek} returns null<br> {@code Month} returns null<br> {@code Year} returns null<br> {@code YearMonth} returns null<br> {@code MonthDay} returns null<br> {@code ZoneOffset} returns null<br> {@code Instant} returns null<br> @return a query that can obtain the zone ID of a temporal, not null
TemporalQueries::zoneId
java
Reginer/aosp-android-jar
android-31/src/java/time/temporal/TemporalQueries.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/temporal/TemporalQueries.java
MIT
public static TemporalQuery<Chronology> chronology() { return TemporalQueries.CHRONO; }
A query for the {@code Chronology}. <p> This queries a {@code TemporalAccessor} for the chronology. If the target {@code TemporalAccessor} represents a date, or part of a date, then it should return the chronology that the date is expressed in. As a result of this definition, objects only representing time, such as {@code LocalTime}, will return null. <p> The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> {@code LocalDate} returns {@code IsoChronology.INSTANCE}<br> {@code LocalTime} returns null (does not represent a date)<br> {@code LocalDateTime} returns {@code IsoChronology.INSTANCE}<br> {@code ZonedDateTime} returns {@code IsoChronology.INSTANCE}<br> {@code OffsetTime} returns null (does not represent a date)<br> {@code OffsetDateTime} returns {@code IsoChronology.INSTANCE}<br> {@code ChronoLocalDate} returns the associated chronology<br> {@code ChronoLocalDateTime} returns the associated chronology<br> {@code ChronoZonedDateTime} returns the associated chronology<br> {@code Era} returns the associated chronology<br> {@code DayOfWeek} returns null (shared across chronologies)<br> {@code Month} returns {@code IsoChronology.INSTANCE}<br> {@code Year} returns {@code IsoChronology.INSTANCE}<br> {@code YearMonth} returns {@code IsoChronology.INSTANCE}<br> {@code MonthDay} returns null {@code IsoChronology.INSTANCE}<br> {@code ZoneOffset} returns null (does not represent a date)<br> {@code Instant} returns null (does not represent a date)<br> <p> The method {@link java.time.chrono.Chronology#from(TemporalAccessor)} can be used as a {@code TemporalQuery} via a method reference, {@code Chronology::from}. That method is equivalent to this query, except that it throws an exception if a chronology cannot be obtained. @return a query that can obtain the chronology of a temporal, not null
TemporalQueries::chronology
java
Reginer/aosp-android-jar
android-31/src/java/time/temporal/TemporalQueries.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/temporal/TemporalQueries.java
MIT
public static TemporalQuery<TemporalUnit> precision() { return TemporalQueries.PRECISION; }
A query for the smallest supported unit. <p> This queries a {@code TemporalAccessor} for the time precision. If the target {@code TemporalAccessor} represents a consistent or complete date-time, date or time then this must return the smallest precision actually supported. Note that fields such as {@code NANO_OF_DAY} and {@code NANO_OF_SECOND} are defined to always return ignoring the precision, thus this is the only way to find the actual smallest supported unit. For example, were {@code GregorianCalendar} to implement {@code TemporalAccessor} it would return a precision of {@code MILLIS}. <p> The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> {@code LocalDate} returns {@code DAYS}<br> {@code LocalTime} returns {@code NANOS}<br> {@code LocalDateTime} returns {@code NANOS}<br> {@code ZonedDateTime} returns {@code NANOS}<br> {@code OffsetTime} returns {@code NANOS}<br> {@code OffsetDateTime} returns {@code NANOS}<br> {@code ChronoLocalDate} returns {@code DAYS}<br> {@code ChronoLocalDateTime} returns {@code NANOS}<br> {@code ChronoZonedDateTime} returns {@code NANOS}<br> {@code Era} returns {@code ERAS}<br> {@code DayOfWeek} returns {@code DAYS}<br> {@code Month} returns {@code MONTHS}<br> {@code Year} returns {@code YEARS}<br> {@code YearMonth} returns {@code MONTHS}<br> {@code MonthDay} returns null (does not represent a complete date or time)<br> {@code ZoneOffset} returns null (does not represent a date or time)<br> {@code Instant} returns {@code NANOS}<br> @return a query that can obtain the precision of a temporal, not null
TemporalQueries::precision
java
Reginer/aosp-android-jar
android-31/src/java/time/temporal/TemporalQueries.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/temporal/TemporalQueries.java
MIT
public static TemporalQuery<ZoneId> zone() { return TemporalQueries.ZONE; }
A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}. <p> This queries a {@code TemporalAccessor} for the zone. It first tries to obtain the zone, using {@link #zoneId()}. If that is not found it tries to obtain the {@link #offset()}. Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, while an {@link java.time.OffsetDateTime} will return the result of {@code getOffset()}. <p> In most cases, applications should use this query rather than {@code #zoneId()}. <p> The method {@link ZoneId#from(TemporalAccessor)} can be used as a {@code TemporalQuery} via a method reference, {@code ZoneId::from}. That method is equivalent to this query, except that it throws an exception if a zone cannot be obtained. @return a query that can obtain the zone ID or offset of a temporal, not null
TemporalQueries::zone
java
Reginer/aosp-android-jar
android-31/src/java/time/temporal/TemporalQueries.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/temporal/TemporalQueries.java
MIT
public static TemporalQuery<ZoneOffset> offset() { return TemporalQueries.OFFSET; }
A query for {@code ZoneOffset} returning null if not found. <p> This returns a {@code TemporalQuery} that can be used to query a temporal object for the offset. The query will return null if the temporal object cannot supply an offset. <p> The query implementation examines the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} field and uses it to create a {@code ZoneOffset}. <p> The method {@link java.time.ZoneOffset#from(TemporalAccessor)} can be used as a {@code TemporalQuery} via a method reference, {@code ZoneOffset::from}. This query and {@code ZoneOffset::from} will return the same result if the temporal object contains an offset. If the temporal object does not contain an offset, then the method reference will throw an exception, whereas this query will return null. @return a query that can obtain the offset of a temporal, not null
TemporalQueries::offset
java
Reginer/aosp-android-jar
android-31/src/java/time/temporal/TemporalQueries.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/temporal/TemporalQueries.java
MIT
public static TemporalQuery<LocalDate> localDate() { return TemporalQueries.LOCAL_DATE; }
A query for {@code LocalDate} returning null if not found. <p> This returns a {@code TemporalQuery} that can be used to query a temporal object for the local date. The query will return null if the temporal object cannot supply a local date. <p> The query implementation examines the {@link ChronoField#EPOCH_DAY EPOCH_DAY} field and uses it to create a {@code LocalDate}. <p> The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a {@code TemporalQuery} via a method reference, {@code LocalDate::from}. This query and {@code LocalDate::from} will return the same result if the temporal object contains a date. If the temporal object does not contain a date, then the method reference will throw an exception, whereas this query will return null. @return a query that can obtain the date of a temporal, not null
TemporalQueries::localDate
java
Reginer/aosp-android-jar
android-31/src/java/time/temporal/TemporalQueries.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/temporal/TemporalQueries.java
MIT
public static TemporalQuery<LocalTime> localTime() { return TemporalQueries.LOCAL_TIME; }
A query for {@code LocalTime} returning null if not found. <p> This returns a {@code TemporalQuery} that can be used to query a temporal object for the local time. The query will return null if the temporal object cannot supply a local time. <p> The query implementation examines the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field and uses it to create a {@code LocalTime}. <p> The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a {@code TemporalQuery} via a method reference, {@code LocalTime::from}. This query and {@code LocalTime::from} will return the same result if the temporal object contains a time. If the temporal object does not contain a time, then the method reference will throw an exception, whereas this query will return null. @return a query that can obtain the time of a temporal, not null
TemporalQueries::localTime
java
Reginer/aosp-android-jar
android-31/src/java/time/temporal/TemporalQueries.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/temporal/TemporalQueries.java
MIT
public Result isTap(List<MotionEvent> motionEvents, double falsePenalty) { if (motionEvents.isEmpty()) { return falsed(0, "no motion events"); } float downX = motionEvents.get(0).getX(); float downY = motionEvents.get(0).getY(); for (MotionEvent event : motionEvents) { String reason; if (Math.abs(event.getX() - downX) >= mTouchSlop) { reason = "dX too big for a tap: " + Math.abs(event.getX() - downX) + "vs " + mTouchSlop; return falsed(falsePenalty, reason); } else if (Math.abs(event.getY() - downY) >= mTouchSlop) { reason = "dY too big for a tap: " + Math.abs(event.getY() - downY) + " vs " + mTouchSlop; return falsed(falsePenalty, reason); } } return Result.passed(0); }
Falsing classifier that accepts or rejects a gesture as a tap. public abstract class TapClassifier extends FalsingClassifier{ private final float mTouchSlop; TapClassifier(FalsingDataProvider dataProvider, float touchSlop) { super(dataProvider); mTouchSlop = touchSlop; } @Override Result calculateFalsingResult( @Classifier.InteractionType int interactionType, double historyBelief, double historyConfidence) { return isTap(getRecentMotionEvents(), 0.5); } /** Given a list of {@link android.view.MotionEvent}'s, returns true if the look like a tap.
TapClassifier::isTap
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/classifier/TapClassifier.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/classifier/TapClassifier.java
MIT
private MidiEvent createScheduledEvent(byte[] msg, int offset, int count, long timestamp) { MidiEvent event; if (count > POOL_EVENT_SIZE) { event = new MidiEvent(msg, offset, count, timestamp); } else { event = (MidiEvent) removeEventfromPool(); if (event == null) { event = new MidiEvent(POOL_EVENT_SIZE); } System.arraycopy(msg, offset, event.data, 0, count); event.count = count; event.setTimestamp(timestamp); } return event; }
Create an event that contains the message.
MidiEvent::createScheduledEvent
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/midi/MidiEventScheduler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/midi/MidiEventScheduler.java
MIT
public MidiReceiver getReceiver() { return mReceiver; }
This MidiReceiver will write date to the scheduling buffer. @return the MidiReceiver
MidiEvent::getReceiver
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/midi/MidiEventScheduler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/midi/MidiEventScheduler.java
MIT
public SoftInputWindow(Context context, String name, int theme, Callback callback, KeyEvent.Callback keyEventCallback, KeyEvent.DispatcherState dispatcherState, int windowType, int gravity, boolean takesFocus) { super(context, theme); mName = name; mCallback = callback; mKeyEventCallback = keyEventCallback; mDispatcherState = dispatcherState; mWindowType = windowType; mGravity = gravity; mTakesFocus = takesFocus; initDockWindow(); }
Create a SoftInputWindow that uses a custom style. @param context The Context in which the DockWindow should run. In particular, it uses the window manager and theme from this context to present its UI. @param theme A style resource describing the theme to use for the window. See <a href="{@docRoot}reference/available-resources.html#stylesandthemes">Style and Theme Resources</a> for more information about defining and using styles. This theme is applied on top of the current theme in <var>context</var>. If 0, the default dialog theme will be used.
SoftInputWindow::SoftInputWindow
java
Reginer/aosp-android-jar
android-32/src/android/inputmethodservice/SoftInputWindow.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/inputmethodservice/SoftInputWindow.java
MIT
public void setGravity(int gravity) { WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.gravity = gravity; updateWidthHeight(lp); getWindow().setAttributes(lp); }
Set which boundary of the screen the DockWindow sticks to. @param gravity The boundary of the screen to stick. See {@link android.view.Gravity.LEFT}, {@link android.view.Gravity.TOP}, {@link android.view.Gravity.BOTTOM}, {@link android.view.Gravity.RIGHT}.
SoftInputWindow::setGravity
java
Reginer/aosp-android-jar
android-32/src/android/inputmethodservice/SoftInputWindow.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/inputmethodservice/SoftInputWindow.java
MIT
public SearchManagerService(Context context) { mContext = context; new MyPackageMonitor().register(context, null, UserHandle.ALL, true); new GlobalSearchProviderObserver(context.getContentResolver()); mHandler = BackgroundThread.getHandler(); }
Initializes the Search Manager service in the provided system context. Only one instance of this object should be created! @param context to use for accessing DB, window manager, etc.
Lifecycle::SearchManagerService
java
Reginer/aosp-android-jar
android-32/src/com/android/server/search/SearchManagerService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/search/SearchManagerService.java
MIT
boolean writeDeviceOwner() { if (DEBUG) { Log.d(TAG, "Writing to device owner file"); } return new DeviceOwnerReadWriter().writeToFileLocked(); }
@return true upon success, false otherwise.
OwnersData::writeDeviceOwner
java
Reginer/aosp-android-jar
android-33/src/com/android/server/devicepolicy/OwnersData.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/devicepolicy/OwnersData.java
MIT
boolean writeProfileOwner(int userId) { if (DEBUG) { Log.d(TAG, "Writing to profile owner file for user " + userId); } return new ProfileOwnerReadWriter(userId).writeToFileLocked(); }
@return true upon success, false otherwise.
OwnersData::writeProfileOwner
java
Reginer/aosp-android-jar
android-33/src/com/android/server/devicepolicy/OwnersData.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/devicepolicy/OwnersData.java
MIT
public StoreException(String msg, Throwable cause) { super(msg); _e = cause; }
Basic Constructor. @param msg message to be associated with this exception. @param cause the throwable that caused this exception to be raised.
StoreException::StoreException
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/org/bouncycastle/util/StoreException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/util/StoreException.java
MIT
public hc_nodereplacechildinvalidnodetype(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_nodereplacechildinvalidnodetype::hc_nodereplacechildinvalidnodetype
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_nodereplacechildinvalidnodetype.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_nodereplacechildinvalidnodetype.java
MIT
public void runTest() throws Throwable { Document doc; Element rootNode; Node newChild; NodeList elementList; Node oldChild; Node replacedChild; doc = (Document) load("hc_staff", true); newChild = doc.createAttribute("lang"); elementList = doc.getElementsByTagName("p"); oldChild = elementList.item(1); rootNode = (Element) oldChild.getParentNode(); { boolean success = false; try { replacedChild = rootNode.replaceChild(newChild, oldChild); } catch (DOMException ex) { success = (ex.code == DOMException.HIERARCHY_REQUEST_ERR); } assertTrue("throw_HIERARCHY_REQUEST_ERR", success); } }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
hc_nodereplacechildinvalidnodetype::runTest
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_nodereplacechildinvalidnodetype.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_nodereplacechildinvalidnodetype.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildinvalidnodetype"; }
Gets URI that identifies the test. @return uri identifier of test
hc_nodereplacechildinvalidnodetype::getTargetURI
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_nodereplacechildinvalidnodetype.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_nodereplacechildinvalidnodetype.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(hc_nodereplacechildinvalidnodetype.class, args); }
Runs this test from the command line. @param args command line arguments
hc_nodereplacechildinvalidnodetype::main
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_nodereplacechildinvalidnodetype.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_nodereplacechildinvalidnodetype.java
MIT
public static android.hardware.gnss.IGnssPowerIndication asInterface(android.os.IBinder obj) { if ((obj==null)) { return null; } android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (((iin!=null)&&(iin instanceof android.hardware.gnss.IGnssPowerIndication))) { return ((android.hardware.gnss.IGnssPowerIndication)iin); } return new android.hardware.gnss.IGnssPowerIndication.Stub.Proxy(obj); }
Cast an IBinder object into an android.hardware.gnss.IGnssPowerIndication interface, generating a proxy if needed.
Stub::asInterface
java
Reginer/aosp-android-jar
android-35/src/android/hardware/gnss/IGnssPowerIndication.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/gnss/IGnssPowerIndication.java
MIT
public static java.lang.String getDefaultTransactionName(int transactionCode) { switch (transactionCode) { case TRANSACTION_setCallback: { return "setCallback"; } case TRANSACTION_requestGnssPowerStats: { return "requestGnssPowerStats"; } case TRANSACTION_getInterfaceVersion: { return "getInterfaceVersion"; } case TRANSACTION_getInterfaceHash: { return "getInterfaceHash"; } default: { return null; } } }
Cast an IBinder object into an android.hardware.gnss.IGnssPowerIndication interface, generating a proxy if needed. public static android.hardware.gnss.IGnssPowerIndication asInterface(android.os.IBinder obj) { if ((obj==null)) { return null; } android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (((iin!=null)&&(iin instanceof android.hardware.gnss.IGnssPowerIndication))) { return ((android.hardware.gnss.IGnssPowerIndication)iin); } return new android.hardware.gnss.IGnssPowerIndication.Stub.Proxy(obj); } @Override public android.os.IBinder asBinder() { return this; } /** @hide
Stub::getDefaultTransactionName
java
Reginer/aosp-android-jar
android-35/src/android/hardware/gnss/IGnssPowerIndication.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/gnss/IGnssPowerIndication.java
MIT
public java.lang.String getTransactionName(int transactionCode) { return this.getDefaultTransactionName(transactionCode); }
Cast an IBinder object into an android.hardware.gnss.IGnssPowerIndication interface, generating a proxy if needed. public static android.hardware.gnss.IGnssPowerIndication asInterface(android.os.IBinder obj) { if ((obj==null)) { return null; } android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (((iin!=null)&&(iin instanceof android.hardware.gnss.IGnssPowerIndication))) { return ((android.hardware.gnss.IGnssPowerIndication)iin); } return new android.hardware.gnss.IGnssPowerIndication.Stub.Proxy(obj); } @Override public android.os.IBinder asBinder() { return this; } /** @hide public static java.lang.String getDefaultTransactionName(int transactionCode) { switch (transactionCode) { case TRANSACTION_setCallback: { return "setCallback"; } case TRANSACTION_requestGnssPowerStats: { return "requestGnssPowerStats"; } case TRANSACTION_getInterfaceVersion: { return "getInterfaceVersion"; } case TRANSACTION_getInterfaceHash: { return "getInterfaceHash"; } default: { return null; } } } /** @hide
Stub::getTransactionName
java
Reginer/aosp-android-jar
android-35/src/android/hardware/gnss/IGnssPowerIndication.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/gnss/IGnssPowerIndication.java
MIT
public int getMaxTransactionId() { return 16777214; }
Cast an IBinder object into an android.hardware.gnss.IGnssPowerIndication interface, generating a proxy if needed. public static android.hardware.gnss.IGnssPowerIndication asInterface(android.os.IBinder obj) { if ((obj==null)) { return null; } android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (((iin!=null)&&(iin instanceof android.hardware.gnss.IGnssPowerIndication))) { return ((android.hardware.gnss.IGnssPowerIndication)iin); } return new android.hardware.gnss.IGnssPowerIndication.Stub.Proxy(obj); } @Override public android.os.IBinder asBinder() { return this; } /** @hide public static java.lang.String getDefaultTransactionName(int transactionCode) { switch (transactionCode) { case TRANSACTION_setCallback: { return "setCallback"; } case TRANSACTION_requestGnssPowerStats: { return "requestGnssPowerStats"; } case TRANSACTION_getInterfaceVersion: { return "getInterfaceVersion"; } case TRANSACTION_getInterfaceHash: { return "getInterfaceHash"; } default: { return null; } } } /** @hide public java.lang.String getTransactionName(int transactionCode) { return this.getDefaultTransactionName(transactionCode); } @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException { java.lang.String descriptor = DESCRIPTOR; if (code >= android.os.IBinder.FIRST_CALL_TRANSACTION && code <= android.os.IBinder.LAST_CALL_TRANSACTION) { data.enforceInterface(descriptor); } if (code == INTERFACE_TRANSACTION) { reply.writeString(descriptor); return true; } else if (code == TRANSACTION_getInterfaceVersion) { reply.writeNoException(); reply.writeInt(getInterfaceVersion()); return true; } else if (code == TRANSACTION_getInterfaceHash) { reply.writeNoException(); reply.writeString(getInterfaceHash()); return true; } switch (code) { case TRANSACTION_setCallback: { android.hardware.gnss.IGnssPowerIndicationCallback _arg0; _arg0 = android.hardware.gnss.IGnssPowerIndicationCallback.Stub.asInterface(data.readStrongBinder()); data.enforceNoDataAvail(); this.setCallback(_arg0); reply.writeNoException(); break; } case TRANSACTION_requestGnssPowerStats: { this.requestGnssPowerStats(); break; } default: { return super.onTransact(code, data, reply, flags); } } return true; } private static class Proxy implements android.hardware.gnss.IGnssPowerIndication { private android.os.IBinder mRemote; Proxy(android.os.IBinder remote) { mRemote = remote; } private int mCachedVersion = -1; private String mCachedHash = "-1"; @Override public android.os.IBinder asBinder() { return mRemote; } public java.lang.String getInterfaceDescriptor() { return DESCRIPTOR; } @Override public void setCallback(android.hardware.gnss.IGnssPowerIndicationCallback callback) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(asBinder()); android.os.Parcel _reply = android.os.Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeStrongInterface(callback); boolean _status = mRemote.transact(Stub.TRANSACTION_setCallback, _data, _reply, 0); if (!_status) { throw new android.os.RemoteException("Method setCallback is unimplemented."); } _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } @Override public void requestGnssPowerStats() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(asBinder()); try { _data.writeInterfaceToken(DESCRIPTOR); boolean _status = mRemote.transact(Stub.TRANSACTION_requestGnssPowerStats, _data, null, android.os.IBinder.FLAG_ONEWAY); if (!_status) { throw new android.os.RemoteException("Method requestGnssPowerStats is unimplemented."); } } finally { _data.recycle(); } } @Override public int getInterfaceVersion() throws android.os.RemoteException { if (mCachedVersion == -1) { android.os.Parcel data = android.os.Parcel.obtain(asBinder()); android.os.Parcel reply = android.os.Parcel.obtain(); try { data.writeInterfaceToken(DESCRIPTOR); boolean _status = mRemote.transact(Stub.TRANSACTION_getInterfaceVersion, data, reply, 0); reply.readException(); mCachedVersion = reply.readInt(); } finally { reply.recycle(); data.recycle(); } } return mCachedVersion; } @Override public synchronized String getInterfaceHash() throws android.os.RemoteException { if ("-1".equals(mCachedHash)) { android.os.Parcel data = android.os.Parcel.obtain(asBinder()); android.os.Parcel reply = android.os.Parcel.obtain(); try { data.writeInterfaceToken(DESCRIPTOR); boolean _status = mRemote.transact(Stub.TRANSACTION_getInterfaceHash, data, reply, 0); reply.readException(); mCachedHash = reply.readString(); } finally { reply.recycle(); data.recycle(); } } return mCachedHash; } } static final int TRANSACTION_setCallback = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); static final int TRANSACTION_requestGnssPowerStats = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); static final int TRANSACTION_getInterfaceVersion = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16777214); static final int TRANSACTION_getInterfaceHash = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16777213); /** @hide
Proxy::getMaxTransactionId
java
Reginer/aosp-android-jar
android-35/src/android/hardware/gnss/IGnssPowerIndication.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/gnss/IGnssPowerIndication.java
MIT
public characterdatadeletedatamiddle(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
characterdatadeletedatamiddle::characterdatadeletedatamiddle
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/characterdatadeletedatamiddle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/characterdatadeletedatamiddle.java
MIT
public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String childData; doc = (Document) load("staff", true); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); child.deleteData(16, 8); childData = child.getData(); assertEquals("characterdataDeleteDataMiddleAssert", "1230 North Ave. Texas 98551", childData); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
characterdatadeletedatamiddle::runTest
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/characterdatadeletedatamiddle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/characterdatadeletedatamiddle.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatamiddle"; }
Gets URI that identifies the test. @return uri identifier of test
characterdatadeletedatamiddle::getTargetURI
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/characterdatadeletedatamiddle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/characterdatadeletedatamiddle.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(characterdatadeletedatamiddle.class, args); }
Runs this test from the command line. @param args command line arguments
characterdatadeletedatamiddle::main
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/characterdatadeletedatamiddle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/characterdatadeletedatamiddle.java
MIT
public WakelockController(int displayId, DisplayManagerInternal.DisplayPowerCallbacks callbacks) { mDisplayId = displayId; mTag = "WakelockController[" + mDisplayId + "]"; mDisplayPowerCallbacks = callbacks; mSuspendBlockerIdUnfinishedBusiness = "[" + displayId + "]unfinished business"; mSuspendBlockerIdOnStateChanged = "[" + displayId + "]on state changed"; mSuspendBlockerIdProxPositive = "[" + displayId + "]prox positive"; mSuspendBlockerIdProxNegative = "[" + displayId + "]prox negative"; mSuspendBlockerIdProxDebounce = "[" + displayId + "]prox debounce"; }
The constructor of WakelockController. Manages the initialization of all the local entities needed for its appropriate functioning.
WakelockController::WakelockController
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
public boolean acquireWakelock(@WAKE_LOCK_TYPE int wakelock) { return acquireWakelockInternal(wakelock); }
A utility to acquire a wakelock @param wakelock The type of Wakelock to be acquired @return True of the wakelock is successfully acquired. False if it is already acquired
WakelockController::acquireWakelock
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
public boolean releaseWakelock(@WAKE_LOCK_TYPE int wakelock) { return releaseWakelockInternal(wakelock); }
A utility to release a wakelock @param wakelock The type of Wakelock to be released @return True of an acquired wakelock is successfully released. False if it is already acquired
WakelockController::releaseWakelock
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
public void releaseAll() { for (int i = WAKE_LOCK_PROXIMITY_POSITIVE; i <= WAKE_LOCK_MAX; i++) { releaseWakelockInternal(i); } }
A utility to release all the wakelock acquired by the system
WakelockController::releaseAll
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean acquireProxPositiveSuspendBlocker() { if (!mIsProximityPositiveAcquired) { mDisplayPowerCallbacks.acquireSuspendBlocker(mSuspendBlockerIdProxPositive); mIsProximityPositiveAcquired = true; return true; } return false; }
Acquires the proximity positive wakelock and notifies the PowerManagerService about the changes.
WakelockController::acquireProxPositiveSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean acquireStateChangedSuspendBlocker() { // Grab a wake lock if we have change of the display state if (!mOnStateChangedPending) { if (DEBUG) { Slog.d(mTag, "State Changed..."); } mDisplayPowerCallbacks.acquireSuspendBlocker(mSuspendBlockerIdOnStateChanged); mOnStateChangedPending = true; return true; } return false; }
Acquires the state change wakelock and notifies the PowerManagerService about the changes.
WakelockController::acquireStateChangedSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean releaseStateChangedSuspendBlocker() { if (mOnStateChangedPending) { mDisplayPowerCallbacks.releaseSuspendBlocker(mSuspendBlockerIdOnStateChanged); mOnStateChangedPending = false; return true; } return false; }
Releases the state change wakelock and notifies the PowerManagerService about the changes.
WakelockController::releaseStateChangedSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean acquireUnfinishedBusinessSuspendBlocker() { // Grab a wake lock if we have unfinished business. if (!mUnfinishedBusiness) { if (DEBUG) { Slog.d(mTag, "Unfinished business..."); } mDisplayPowerCallbacks.acquireSuspendBlocker(mSuspendBlockerIdUnfinishedBusiness); mUnfinishedBusiness = true; return true; } return false; }
Acquires the unfinished business wakelock and notifies the PowerManagerService about the changes.
WakelockController::acquireUnfinishedBusinessSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean releaseUnfinishedBusinessSuspendBlocker() { if (mUnfinishedBusiness) { if (DEBUG) { Slog.d(mTag, "Finished business..."); } mDisplayPowerCallbacks.releaseSuspendBlocker(mSuspendBlockerIdUnfinishedBusiness); mUnfinishedBusiness = false; return true; } return false; }
Releases the unfinished business wakelock and notifies the PowerManagerService about the changes.
WakelockController::releaseUnfinishedBusinessSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean releaseProxPositiveSuspendBlocker() { if (mIsProximityPositiveAcquired) { mDisplayPowerCallbacks.releaseSuspendBlocker(mSuspendBlockerIdProxPositive); mIsProximityPositiveAcquired = false; return true; } return false; }
Releases the proximity positive wakelock and notifies the PowerManagerService about the changes.
WakelockController::releaseProxPositiveSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean acquireProxNegativeSuspendBlocker() { if (!mIsProximityNegativeAcquired) { mDisplayPowerCallbacks.acquireSuspendBlocker(mSuspendBlockerIdProxNegative); mIsProximityNegativeAcquired = true; return true; } return false; }
Acquires the proximity negative wakelock and notifies the PowerManagerService about the changes.
WakelockController::acquireProxNegativeSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean releaseProxNegativeSuspendBlocker() { if (mIsProximityNegativeAcquired) { mDisplayPowerCallbacks.releaseSuspendBlocker(mSuspendBlockerIdProxNegative); mIsProximityNegativeAcquired = false; return true; } return false; }
Releases the proximity negative wakelock and notifies the PowerManagerService about the changes.
WakelockController::releaseProxNegativeSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean acquireProxDebounceSuspendBlocker() { if (!mHasProximityDebounced) { mDisplayPowerCallbacks.acquireSuspendBlocker(mSuspendBlockerIdProxDebounce); mHasProximityDebounced = true; return true; } return false; }
Acquires the proximity debounce wakelock and notifies the PowerManagerService about the changes.
WakelockController::acquireProxDebounceSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
private boolean releaseProxDebounceSuspendBlocker() { if (mHasProximityDebounced) { mDisplayPowerCallbacks.releaseSuspendBlocker(mSuspendBlockerIdProxDebounce); mHasProximityDebounced = false; return true; } return false; }
Releases the proximity debounce wakelock and notifies the PowerManagerService about the changes.
WakelockController::releaseProxDebounceSuspendBlocker
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
public Runnable getOnProximityPositiveRunnable() { return () -> { if (mIsProximityPositiveAcquired) { mIsProximityPositiveAcquired = false; mDisplayPowerCallbacks.onProximityPositive(); mDisplayPowerCallbacks.releaseSuspendBlocker(mSuspendBlockerIdProxPositive); } }; }
Gets the Runnable to be executed when the proximity becomes positive.
WakelockController::getOnProximityPositiveRunnable
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
public Runnable getOnStateChangedRunnable() { return () -> { if (mOnStateChangedPending) { mOnStateChangedPending = false; mDisplayPowerCallbacks.onStateChanged(); mDisplayPowerCallbacks.releaseSuspendBlocker(mSuspendBlockerIdOnStateChanged); } }; }
Gets the Runnable to be executed when the display state changes
WakelockController::getOnStateChangedRunnable
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
public Runnable getOnProximityNegativeRunnable() { return () -> { if (mIsProximityNegativeAcquired) { mIsProximityNegativeAcquired = false; mDisplayPowerCallbacks.onProximityNegative(); mDisplayPowerCallbacks.releaseSuspendBlocker(mSuspendBlockerIdProxNegative); } }; }
Gets the Runnable to be executed when the proximity becomes negative.
WakelockController::getOnProximityNegativeRunnable
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT
public void dumpLocal(PrintWriter pw) { pw.println("WakelockController State:"); pw.println(" mDisplayId=" + mDisplayId); pw.println(" mUnfinishedBusiness=" + hasUnfinishedBusiness()); pw.println(" mOnStateChangePending=" + isOnStateChangedPending()); pw.println(" mOnProximityPositiveMessages=" + isProximityPositiveAcquired()); pw.println(" mOnProximityNegativeMessages=" + isProximityNegativeAcquired()); }
Dumps the current state of this
WakelockController::dumpLocal
java
Reginer/aosp-android-jar
android-34/src/com/android/server/display/WakelockController.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/display/WakelockController.java
MIT