code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public static void run(MediaShellCommand cmd) throws Exception { //---------------------------------------- // Default parameters int stream = AudioManager.STREAM_MUSIC; int volIndex = 5; int mode = 0; int adjDir = AudioManager.ADJUST_RAISE; boolean showUi = false; boolean doGet = false; //---------------------------------------- // read options String option; String adjustment = null; while ((option = cmd.getNextOption()) != null) { switch (option) { case "--show": showUi = true; break; case "--get": doGet = true; cmd.log(LOG_V, "will get volume"); break; case "--stream": stream = Integer.decode(cmd.getNextArgRequired()).intValue(); cmd.log(LOG_V, "will control stream=" + stream + " (" + streamName(stream) + ")"); break; case "--set": volIndex = Integer.decode(cmd.getNextArgRequired()).intValue(); mode = VOLUME_CONTROL_MODE_SET; cmd.log(LOG_V, "will set volume to index=" + volIndex); break; case "--adj": mode = VOLUME_CONTROL_MODE_ADJUST; adjustment = cmd.getNextArgRequired(); cmd.log(LOG_V, "will adjust volume"); break; default: throw new IllegalArgumentException("Unknown argument " + option); } } //------------------------------ // Read options: validation if (mode == VOLUME_CONTROL_MODE_ADJUST) { if (adjustment == null) { cmd.showError("Error: no valid volume adjustment (null)"); return; } switch (adjustment) { case ADJUST_RAISE: adjDir = AudioManager.ADJUST_RAISE; break; case ADJUST_SAME: adjDir = AudioManager.ADJUST_SAME; break; case ADJUST_LOWER: adjDir = AudioManager.ADJUST_LOWER; break; default: cmd.showError("Error: no valid volume adjustment, was " + adjustment + ", expected " + ADJUST_LOWER + "|" + ADJUST_SAME + "|" + ADJUST_RAISE); return; } } //---------------------------------------- // Test initialization cmd.log(LOG_V, "Connecting to AudioService"); IAudioService audioService = IAudioService.Stub.asInterface(ServiceManager.checkService( Context.AUDIO_SERVICE)); if (audioService == null) { cmd.log(LOG_E, BaseCommand.NO_SYSTEM_ERROR_CODE); throw new AndroidException( "Can't connect to audio service; is the system running?"); } if (mode == VOLUME_CONTROL_MODE_SET) { if ((volIndex > audioService.getStreamMaxVolume(stream)) || (volIndex < audioService.getStreamMinVolume(stream))) { cmd.showError(String.format("Error: invalid volume index %d for stream %d " + "(should be in [%d..%d])", volIndex, stream, audioService.getStreamMinVolume(stream), audioService.getStreamMaxVolume(stream))); return; } } //---------------------------------------- // Non-interactive test final int flag = showUi ? AudioManager.FLAG_SHOW_UI : 0; final String pack = cmd.getClass().getPackage().getName(); if (mode == VOLUME_CONTROL_MODE_SET) { audioService.setStreamVolume(stream, volIndex, flag, pack/*callingPackage*/); } else if (mode == VOLUME_CONTROL_MODE_ADJUST) { audioService.adjustStreamVolume(stream, adjDir, flag, pack); } if (doGet) { cmd.log(LOG_V, "volume is " + audioService.getStreamVolume(stream) + " in range [" + audioService.getStreamMinVolume(stream) + ".." + audioService.getStreamMaxVolume(stream) + "]"); } }
Runs a given MediaShellCommand
VolumeCtrl::run
java
Reginer/aosp-android-jar
android-31/src/com/android/server/media/VolumeCtrl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/media/VolumeCtrl.java
MIT
public default int getVendorError() { return 0; }
Returns {@link MediaDrm} plugin vendor defined error code associated with this {@link MediaDrmThrowable}. <p> Please consult the {@link MediaDrm} plugin vendor for details on the error code. @return an error code defined by the {@link MediaDrm} plugin vendor if available, otherwise 0.
getVendorError
java
Reginer/aosp-android-jar
android-35/src/android/media/MediaDrmThrowable.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaDrmThrowable.java
MIT
public default int getOemError() { return 0; }
Returns OEM or SOC specific error code associated with this {@link MediaDrmThrowable}. <p> Please consult the {@link MediaDrm} plugin, chip, or device vendor for details on the error code. @return an OEM or SOC specific error code if available, otherwise 0.
getOemError
java
Reginer/aosp-android-jar
android-35/src/android/media/MediaDrmThrowable.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaDrmThrowable.java
MIT
public default int getErrorContext() { return 0; }
Returns {@link MediaDrm} plugin vendor defined error context associated with this {@link MediaDrmThrowable}. <p> Please consult the {@link MediaDrm} plugin vendor for details on the error context. @return an opaque integer that would help the @{@link MediaDrm} vendor locate the source of the error if available, otherwise 0.
getErrorContext
java
Reginer/aosp-android-jar
android-35/src/android/media/MediaDrmThrowable.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/media/MediaDrmThrowable.java
MIT
public RestrictionsManager(Context context, IRestrictionsManager service) { mContext = context; mService = service; }
@hide
RestrictionsManager::RestrictionsManager
java
Reginer/aosp-android-jar
android-32/src/android/content/RestrictionsManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/RestrictionsManager.java
MIT
public Bundle getApplicationRestrictions() { try { if (mService != null) { return mService.getApplicationRestrictions(mContext.getPackageName()); } } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } return null; }
Returns any available set of application-specific restrictions applicable to this application. @return the application restrictions as a Bundle. Returns null if there are no restrictions.
RestrictionsManager::getApplicationRestrictions
java
Reginer/aosp-android-jar
android-32/src/android/content/RestrictionsManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/RestrictionsManager.java
MIT
public boolean hasRestrictionsProvider() { try { if (mService != null) { return mService.hasRestrictionsProvider(); } } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } return false; }
Called by an application to check if there is an active Restrictions Provider. If there isn't, {@link #requestPermission(String, String, PersistableBundle)} is not available. @return whether there is an active Restrictions Provider.
RestrictionsManager::hasRestrictionsProvider
java
Reginer/aosp-android-jar
android-32/src/android/content/RestrictionsManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/RestrictionsManager.java
MIT
public void requestPermission(String requestType, String requestId, PersistableBundle request) { if (requestType == null) { throw new NullPointerException("requestType cannot be null"); } if (requestId == null) { throw new NullPointerException("requestId cannot be null"); } if (request == null) { throw new NullPointerException("request cannot be null"); } try { if (mService != null) { mService.requestPermission(mContext.getPackageName(), requestType, requestId, request); } } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } }
Called by an application to request permission for an operation. The contents of the request are passed in a Bundle that contains several pieces of data depending on the chosen request type. @param requestType The type of request. The type could be one of the predefined types specified here or a custom type that the specific Restrictions Provider might understand. For custom types, the type name should be namespaced to avoid collisions with predefined types and types specified by other Restrictions Providers. @param requestId A unique id generated by the app that contains sufficient information to identify the parameters of the request when it receives the id in the response. @param request A PersistableBundle containing the data corresponding to the specified request type. The keys for the data in the bundle depend on the request type. @throws IllegalArgumentException if any of the required parameters are missing.
RestrictionsManager::requestPermission
java
Reginer/aosp-android-jar
android-32/src/android/content/RestrictionsManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/RestrictionsManager.java
MIT
public void notifyPermissionResponse(String packageName, PersistableBundle response) { if (packageName == null) { throw new NullPointerException("packageName cannot be null"); } if (response == null) { throw new NullPointerException("request cannot be null"); } if (!response.containsKey(REQUEST_KEY_ID)) { throw new IllegalArgumentException("REQUEST_KEY_ID must be specified"); } if (!response.containsKey(RESPONSE_KEY_RESULT)) { throw new IllegalArgumentException("RESPONSE_KEY_RESULT must be specified"); } try { if (mService != null) { mService.notifyPermissionResponse(packageName, response); } } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } }
Called by the Restrictions Provider to deliver a response to an application. @param packageName the application to deliver the response to. Cannot be null. @param response the bundle containing the response status, request ID and other information. Cannot be null. @throws IllegalArgumentException if any of the required parameters are missing.
RestrictionsManager::notifyPermissionResponse
java
Reginer/aosp-android-jar
android-32/src/android/content/RestrictionsManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/RestrictionsManager.java
MIT
public List<RestrictionEntry> getManifestRestrictions(String packageName) { ApplicationInfo appInfo = null; try { appInfo = mContext.getPackageManager().getApplicationInfo(packageName, PackageManager.GET_META_DATA); } catch (NameNotFoundException pnfe) { throw new IllegalArgumentException("No such package " + packageName); } if (appInfo == null || !appInfo.metaData.containsKey(META_DATA_APP_RESTRICTIONS)) { return null; } XmlResourceParser xml = appInfo.loadXmlMetaData(mContext.getPackageManager(), META_DATA_APP_RESTRICTIONS); return loadManifestRestrictions(packageName, xml); }
Parse and return the list of restrictions defined in the manifest for the specified package, if any. @param packageName The application for which to fetch the restrictions list. @return The list of RestrictionEntry objects created from the XML file specified in the manifest, or null if none was specified.
RestrictionsManager::getManifestRestrictions
java
Reginer/aosp-android-jar
android-32/src/android/content/RestrictionsManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/RestrictionsManager.java
MIT
public static Bundle convertRestrictionsToBundle(List<RestrictionEntry> entries) { final Bundle bundle = new Bundle(); for (RestrictionEntry entry : entries) { addRestrictionToBundle(bundle, entry); } return bundle; }
Converts a list of restrictions to the corresponding bundle, using the following mapping: <table> <tr><th>RestrictionEntry</th><th>Bundle</th></tr> <tr><td>{@link RestrictionEntry#TYPE_BOOLEAN}</td><td>{@link Bundle#putBoolean}</td></tr> <tr><td>{@link RestrictionEntry#TYPE_CHOICE}, {@link RestrictionEntry#TYPE_MULTI_SELECT}</td> <td>{@link Bundle#putStringArray}</td></tr> <tr><td>{@link RestrictionEntry#TYPE_INTEGER}</td><td>{@link Bundle#putInt}</td></tr> <tr><td>{@link RestrictionEntry#TYPE_STRING}</td><td>{@link Bundle#putString}</td></tr> <tr><td>{@link RestrictionEntry#TYPE_BUNDLE}</td><td>{@link Bundle#putBundle}</td></tr> <tr><td>{@link RestrictionEntry#TYPE_BUNDLE_ARRAY}</td> <td>{@link Bundle#putParcelableArray}</td></tr> </table> @param entries list of restrictions
RestrictionsManager::convertRestrictionsToBundle
java
Reginer/aosp-android-jar
android-32/src/android/content/RestrictionsManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/content/RestrictionsManager.java
MIT
public static @NonNull ListEnabledProvidersResponse create(@NonNull List<String> providers) { Objects.requireNonNull(providers, "providers must not be null"); Preconditions.checkCollectionElementsNotNull(providers, /* valueName= */ "providers"); return new ListEnabledProvidersResponse(providers); }
Creates a {@link ListEnabledProvidersResponse} with a list of providers. @throws NullPointerException If args are null.
ListEnabledProvidersResponse::create
java
Reginer/aosp-android-jar
android-34/src/android/credentials/ListEnabledProvidersResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/credentials/ListEnabledProvidersResponse.java
MIT
public @NonNull List<String> getProviderComponentNames() { return mProviders; }
Creates a {@link ListEnabledProvidersResponse} with a list of providers. @throws NullPointerException If args are null. public static @NonNull ListEnabledProvidersResponse create(@NonNull List<String> providers) { Objects.requireNonNull(providers, "providers must not be null"); Preconditions.checkCollectionElementsNotNull(providers, /* valueName= */ "providers"); return new ListEnabledProvidersResponse(providers); } private ListEnabledProvidersResponse(@NonNull List<String> providers) { mProviders = providers; } private ListEnabledProvidersResponse(@NonNull Parcel in) { mProviders = in.createStringArrayList(); } public static final @NonNull Creator<ListEnabledProvidersResponse> CREATOR = new Creator<ListEnabledProvidersResponse>() { @Override public ListEnabledProvidersResponse createFromParcel(Parcel in) { return new ListEnabledProvidersResponse(in); } @Override public ListEnabledProvidersResponse[] newArray(int size) { return new ListEnabledProvidersResponse[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeStringList(mProviders); } /** Returns the list of flattened Credential Manager provider component names as strings.
ListEnabledProvidersResponse::getProviderComponentNames
java
Reginer/aosp-android-jar
android-34/src/android/credentials/ListEnabledProvidersResponse.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/credentials/ListEnabledProvidersResponse.java
MIT
public static <R> AndroidFuture<R> receiveBytes( ThrowingConsumer<ParcelFileDescriptor> ipc, ThrowingFunction<InputStream, R> read) { return new RemoteStream<R, InputStream>( ipc, read, AsyncTask.THREAD_POOL_EXECUTOR, true /* read */) { @Override protected InputStream createStream(ParcelFileDescriptor fd) { return new ParcelFileDescriptor.AutoCloseInputStream(fd); } }; }
Call an IPC, and process incoming bytes as an {@link InputStream} within {@code read}. @param ipc action to perform the IPC. Called directly on the calling thread. @param read action to read from an {@link InputStream}, transforming data into {@code R}. Called asynchronously on the background thread. @param <R> type of the end result of reading the bytes (if any). @return an {@link AndroidFuture} that can be used to track operation's completion and retrieve its result (if any).
RemoteStream::receiveBytes
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/infra/RemoteStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/infra/RemoteStream.java
MIT
public static AndroidFuture<byte[]> receiveBytes(ThrowingConsumer<ParcelFileDescriptor> ipc) { return receiveBytes(ipc, RemoteStream::readAll); }
Call an IPC, and asynchronously return incoming bytes as {@code byte[]}. @param ipc action to perform the IPC. Called directly on the calling thread. @return an {@link AndroidFuture} that can be used to track operation's completion and retrieve its result.
RemoteStream::receiveBytes
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/infra/RemoteStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/infra/RemoteStream.java
MIT
public static byte[] readAll(InputStream inputStream) throws IOException { ByteArrayOutputStream combinedBuffer = new ByteArrayOutputStream(); byte[] buffer = new byte[16 * 1024]; while (true) { int numRead = inputStream.read(buffer); if (numRead == -1) { break; } combinedBuffer.write(buffer, 0, numRead); } return combinedBuffer.toByteArray(); }
Convert a given {@link InputStream} into {@code byte[]}. <p> This doesn't close the given {@link InputStream}
RemoteStream::readAll
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/infra/RemoteStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/infra/RemoteStream.java
MIT
public static <R> AndroidFuture<R> sendBytes( ThrowingConsumer<ParcelFileDescriptor> ipc, ThrowingFunction<OutputStream, R> write) { return new RemoteStream<R, OutputStream>( ipc, write, AsyncTask.THREAD_POOL_EXECUTOR, false /* read */) { @Override protected OutputStream createStream(ParcelFileDescriptor fd) { return new ParcelFileDescriptor.AutoCloseOutputStream(fd); } }; }
Call an IPC, and perform sending bytes via an {@link OutputStream} within {@code write}. @param ipc action to perform the IPC. Called directly on the calling thread. @param write action to write to an {@link OutputStream}, optionally returning operation result as {@code R}. Called asynchronously on the background thread. @param <R> type of the end result of writing the bytes (if any). @return an {@link AndroidFuture} that can be used to track operation's completion and retrieve its result (if any).
RemoteStream::sendBytes
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/infra/RemoteStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/infra/RemoteStream.java
MIT
public static AndroidFuture<Void> sendBytes( ThrowingConsumer<ParcelFileDescriptor> ipc, ThrowingConsumer<OutputStream> write) { return sendBytes(ipc, os -> { write.acceptOrThrow(os); return null; }); }
Same as {@link #sendBytes(ThrowingConsumer, ThrowingFunction)}, but explicitly avoids returning a result.
RemoteStream::sendBytes
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/infra/RemoteStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/infra/RemoteStream.java
MIT
public static AndroidFuture<Void> sendBytes( ThrowingConsumer<ParcelFileDescriptor> ipc, byte[] data) { return sendBytes(ipc, os -> { os.write(data); return null; }); }
Same as {@link #sendBytes(ThrowingConsumer, ThrowingFunction)}, but providing the data to send eagerly as {@code byte[]}.
RemoteStream::sendBytes
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/infra/RemoteStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/infra/RemoteStream.java
MIT
public static DoubleBuffer allocate(int capacity) { if (capacity < 0) throw new IllegalArgumentException(); return new HeapDoubleBuffer(capacity, capacity); }
Allocates a new double buffer. <p> The new buffer's position will be zero, its limit will be its capacity, its mark will be undefined, and each of its elements will be initialized to zero. It will have a {@link #array backing array}, and its {@link #arrayOffset array offset} will be zero. @param capacity The new buffer's capacity, in doubles @return The new double buffer @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
DoubleBuffer::allocate
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public static DoubleBuffer wrap(double[] array, int offset, int length) { try { return new HeapDoubleBuffer(array, offset, length); } catch (IllegalArgumentException x) { throw new IndexOutOfBoundsException(); } }
Wraps a double array into a buffer. <p> The new buffer will be backed by the given double array; that is, modifications to the buffer will cause the array to be modified and vice versa. The new buffer's capacity will be <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit will be <tt>offset + length</tt>, and its mark will be undefined. Its {@link #array backing array} will be the given array, and its {@link #arrayOffset array offset} will be zero. </p> @param array The array that will back the new buffer @param offset The offset of the subarray to be used; must be non-negative and no larger than <tt>array.length</tt>. The new buffer's position will be set to this value. @param length The length of the subarray to be used; must be non-negative and no larger than <tt>array.length - offset</tt>. The new buffer's limit will be set to <tt>offset + length</tt>. @return The new double buffer @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and <tt>length</tt> parameters do not hold
DoubleBuffer::wrap
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public static DoubleBuffer wrap(double[] array) { return wrap(array, 0, array.length); }
Wraps a double array into a buffer. <p> The new buffer will be backed by the given double array; that is, modifications to the buffer will cause the array to be modified and vice versa. The new buffer's capacity and limit will be <tt>array.length</tt>, its position will be zero, and its mark will be undefined. Its {@link #array backing array} will be the given array, and its {@link #arrayOffset array offset>} will be zero. </p> @param array The array that will back this buffer @return The new double buffer
DoubleBuffer::wrap
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public DoubleBuffer get(double[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); int end = offset + length; for (int i = offset; i < end; i++) dst[i] = get(); return this; }
Relative bulk <i>get</i> method. <p> This method transfers doubles from this buffer into the given destination array. If there are fewer doubles remaining in the buffer than are required to satisfy the request, that is, if <tt>length</tt>&nbsp;<tt>&gt;</tt>&nbsp;<tt>remaining()</tt>, then no doubles are transferred and a {@link BufferUnderflowException} is thrown. <p> Otherwise, this method copies <tt>length</tt> doubles from this buffer into the given array, starting at the current position of this buffer and at the given offset in the array. The position of this buffer is then incremented by <tt>length</tt>. <p> In other words, an invocation of this method of the form <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as the loop <pre>{@code for (int i = off; i < off + len; i++) dst[i] = src.get(); }</pre> except that it first checks that there are sufficient doubles in this buffer and it is potentially much more efficient. @param dst The array into which doubles are to be written @param offset The offset within the array of the first double to be written; must be non-negative and no larger than <tt>dst.length</tt> @param length The maximum number of doubles to be written to the given array; must be non-negative and no larger than <tt>dst.length - offset</tt> @return This buffer @throws BufferUnderflowException If there are fewer than <tt>length</tt> doubles remaining in this buffer @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and <tt>length</tt> parameters do not hold
DoubleBuffer::get
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public DoubleBuffer get(double[] dst) { return get(dst, 0, dst.length); }
Relative bulk <i>get</i> method. <p> This method transfers doubles from this buffer into the given destination array. An invocation of this method of the form <tt>src.get(a)</tt> behaves in exactly the same way as the invocation <pre> src.get(a, 0, a.length) </pre> @param dst The destination array @return This buffer @throws BufferUnderflowException If there are fewer than <tt>length</tt> doubles remaining in this buffer
DoubleBuffer::get
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public DoubleBuffer put(DoubleBuffer src) { if (src == this) throw new IllegalArgumentException(); if (isReadOnly()) throw new ReadOnlyBufferException(); int n = src.remaining(); if (n > remaining()) throw new BufferOverflowException(); for (int i = 0; i < n; i++) put(src.get()); return this; }
Relative bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>. <p> This method transfers the doubles remaining in the given source buffer into this buffer. If there are more doubles remaining in the source buffer than in this buffer, that is, if <tt>src.remaining()</tt>&nbsp;<tt>&gt;</tt>&nbsp;<tt>remaining()</tt>, then no doubles are transferred and a {@link BufferOverflowException} is thrown. <p> Otherwise, this method copies <i>n</i>&nbsp;=&nbsp;<tt>src.remaining()</tt> doubles from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by <i>n</i>. <p> In other words, an invocation of this method of the form <tt>dst.put(src)</tt> has exactly the same effect as the loop <pre> while (src.hasRemaining()) dst.put(src.get()); </pre> except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. @param src The source buffer from which doubles are to be read; must not be this buffer @return This buffer @throws BufferOverflowException If there is insufficient space in this buffer for the remaining doubles in the source buffer @throws IllegalArgumentException If the source buffer is this buffer @throws ReadOnlyBufferException If this buffer is read-only
DoubleBuffer::put
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public DoubleBuffer put(double[] src, int offset, int length) { checkBounds(offset, length, src.length); if (length > remaining()) throw new BufferOverflowException(); int end = offset + length; for (int i = offset; i < end; i++) this.put(src[i]); return this; }
Relative bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>. <p> This method transfers doubles into this buffer from the given source array. If there are more doubles to be copied from the array than remain in this buffer, that is, if <tt>length</tt>&nbsp;<tt>&gt;</tt>&nbsp;<tt>remaining()</tt>, then no doubles are transferred and a {@link BufferOverflowException} is thrown. <p> Otherwise, this method copies <tt>length</tt> doubles from the given array into this buffer, starting at the given offset in the array and at the current position of this buffer. The position of this buffer is then incremented by <tt>length</tt>. <p> In other words, an invocation of this method of the form <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as the loop <pre>{@code for (int i = off; i < off + len; i++) dst.put(a[i]); }</pre> except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. @param src The array from which doubles are to be read @param offset The offset within the array of the first double to be read; must be non-negative and no larger than <tt>array.length</tt> @param length The number of doubles to be read from the given array; must be non-negative and no larger than <tt>array.length - offset</tt> @return This buffer @throws BufferOverflowException If there is insufficient space in this buffer @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and <tt>length</tt> parameters do not hold @throws ReadOnlyBufferException If this buffer is read-only
DoubleBuffer::put
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public final DoubleBuffer put(double[] src) { return put(src, 0, src.length); }
Relative bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>. <p> This method transfers the entire content of the given source double array into this buffer. An invocation of this method of the form <tt>dst.put(a)</tt> behaves in exactly the same way as the invocation <pre> dst.put(a, 0, a.length) </pre> @param src The source array @return This buffer @throws BufferOverflowException If there is insufficient space in this buffer @throws ReadOnlyBufferException If this buffer is read-only
DoubleBuffer::put
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public final boolean hasArray() { return (hb != null) && !isReadOnly; }
Tells whether or not this buffer is backed by an accessible double array. <p> If this method returns <tt>true</tt> then the {@link #array() array} and {@link #arrayOffset() arrayOffset} methods may safely be invoked. </p> @return <tt>true</tt> if, and only if, this buffer is backed by an array and is not read-only
DoubleBuffer::hasArray
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public final double[] array() { if (hb == null) throw new UnsupportedOperationException(); if (isReadOnly) throw new ReadOnlyBufferException(); return hb; }
Returns the double array that backs this buffer&nbsp;&nbsp;<i>(optional operation)</i>. <p> Modifications to this buffer's content will cause the returned array's content to be modified, and vice versa. <p> Invoke the {@link #hasArray hasArray} method before invoking this method in order to ensure that this buffer has an accessible backing array. </p> @return The array that backs this buffer @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only @throws UnsupportedOperationException If this buffer is not backed by an accessible array
DoubleBuffer::array
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public final int arrayOffset() { if (hb == null) throw new UnsupportedOperationException(); if (isReadOnly) throw new ReadOnlyBufferException(); return offset; }
Returns the offset within this buffer's backing array of the first element of the buffer&nbsp;&nbsp;<i>(optional operation)</i>. <p> If this buffer is backed by an array then buffer position <i>p</i> corresponds to array index <i>p</i>&nbsp;+&nbsp;<tt>arrayOffset()</tt>. <p> Invoke the {@link #hasArray hasArray} method before invoking this method in order to ensure that this buffer has an accessible backing array. </p> @return The offset within this buffer's array of the first element of the buffer @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only @throws UnsupportedOperationException If this buffer is not backed by an accessible array
DoubleBuffer::arrayOffset
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getClass().getName()); sb.append("[pos="); sb.append(position()); sb.append(" lim="); sb.append(limit()); sb.append(" cap="); sb.append(capacity()); sb.append("]"); return sb.toString(); }
Returns a string summarizing the state of this buffer. @return A summary string
presentAfter::toString
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public int hashCode() { int h = 1; int p = position(); for (int i = limit() - 1; i >= p; i--) h = 31 * h + (int) get(i); return h; }
Returns the current hash code of this buffer. <p> The hash code of a double buffer depends only upon its remaining elements; that is, upon the elements from <tt>position()</tt> up to, and including, the element at <tt>limit()</tt>&nbsp;-&nbsp;<tt>1</tt>. <p> Because buffer hash codes are content-dependent, it is inadvisable to use buffers as keys in hash maps or similar data structures unless it is known that their contents will not change. </p> @return The current hash code of this buffer
presentAfter::hashCode
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public boolean equals(Object ob) { if (this == ob) return true; if (!(ob instanceof DoubleBuffer)) return false; DoubleBuffer that = (DoubleBuffer)ob; if (this.remaining() != that.remaining()) return false; int p = this.position(); for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--) if (!equals(this.get(i), that.get(j))) return false; return true; }
Tells whether or not this buffer is equal to another object. <p> Two double buffers are equal if, and only if, <ol> <li><p> They have the same element type, </p></li> <li><p> They have the same number of remaining elements, and </p></li> <li><p> The two sequences of remaining elements, considered independently of their starting positions, are pointwise equal. This method considers two double elements {@code a} and {@code b} to be equal if {@code (a == b) || (Double.isNaN(a) && Double.isNaN(b))}. The values {@code -0.0} and {@code +0.0} are considered to be equal, unlike {@link Double#equals(Object)}. </p></li> </ol> <p> A double buffer is not equal to any other type of object. </p> @param ob The object to which this buffer is to be compared @return <tt>true</tt> if, and only if, this buffer is equal to the given object
presentAfter::equals
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public int compareTo(DoubleBuffer that) { int n = this.position() + Math.min(this.remaining(), that.remaining()); for (int i = this.position(), j = that.position(); i < n; i++, j++) { int cmp = compare(this.get(i), that.get(j)); if (cmp != 0) return cmp; } return this.remaining() - that.remaining(); }
Compares this buffer to another. <p> Two double buffers are compared by comparing their sequences of remaining elements lexicographically, without regard to the starting position of each sequence within its corresponding buffer. Pairs of {@code double} elements are compared as if by invoking {@link Double#compare(double,double)}, except that {@code -0.0} and {@code 0.0} are considered to be equal. {@code Double.NaN} is considered by this method to be equal to itself and greater than all other {@code double} values (including {@code Double.POSITIVE_INFINITY}). <p> A double buffer is not comparable to any other type of object. @return A negative integer, zero, or a positive integer as this buffer is less than, equal to, or greater than the given buffer
presentAfter::compareTo
java
Reginer/aosp-android-jar
android-32/src/java/nio/DoubleBuffer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/DoubleBuffer.java
MIT
public final void addListener(ScreenInteractiveChangedListener listener) { mListeners.add(listener); }
Add a listener for changes to screen interactive state. Callbacks occur on an unspecified thread.
ScreenInteractiveHelper::addListener
java
Reginer/aosp-android-jar
android-34/src/com/android/server/location/injector/ScreenInteractiveHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/location/injector/ScreenInteractiveHelper.java
MIT
public final void removeListener(ScreenInteractiveChangedListener listener) { mListeners.remove(listener); }
Removes a listener for changes to screen interactive state.
ScreenInteractiveHelper::removeListener
java
Reginer/aosp-android-jar
android-34/src/com/android/server/location/injector/ScreenInteractiveHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/location/injector/ScreenInteractiveHelper.java
MIT
public hc_attrchildnodes2(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_attrchildnodes2::hc_attrchildnodes2
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_attrchildnodes2.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_attrchildnodes2.java
MIT
public void runTest() throws Throwable { Document doc; NodeList acronymList; Node testNode; NamedNodeMap attributes; Attr titleAttr; String value; Text textNode; NodeList childNodes; Node retval; doc = (Document) load("hc_staff", true); acronymList = doc.getElementsByTagName("acronym"); testNode = acronymList.item(3); attributes = testNode.getAttributes(); titleAttr = (Attr) attributes.getNamedItem("title"); childNodes = titleAttr.getChildNodes(); textNode = doc.createTextNode("terday"); retval = titleAttr.appendChild(textNode); assertSize("childNodesSize", 2, childNodes); textNode = (Text) childNodes.item(0); value = textNode.getNodeValue(); assertEquals("child1IsYes", "Yes", value); textNode = (Text) childNodes.item(1); value = textNode.getNodeValue(); assertEquals("child2IsTerday", "terday", value); textNode = (Text) childNodes.item(2); assertNull("thirdItemIsNull", textNode); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
hc_attrchildnodes2::runTest
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_attrchildnodes2.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_attrchildnodes2.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes2"; }
Gets URI that identifies the test. @return uri identifier of test
hc_attrchildnodes2::getTargetURI
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_attrchildnodes2.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_attrchildnodes2.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(hc_attrchildnodes2.class, args); }
Runs this test from the command line. @param args command line arguments
hc_attrchildnodes2::main
java
Reginer/aosp-android-jar
android-33/src/org/w3c/domts/level1/core/hc_attrchildnodes2.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/org/w3c/domts/level1/core/hc_attrchildnodes2.java
MIT
public void close() throws IOException { mSocket.close(); }
Close this output stream and the socket associated with it.
BluetoothOutputStream::close
java
Reginer/aosp-android-jar
android-34/src/android/bluetooth/BluetoothOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/bluetooth/BluetoothOutputStream.java
MIT
public void write(int oneByte) throws IOException { byte[] b = new byte[1]; b[0] = (byte) oneByte; mSocket.write(b, 0, 1); }
Writes a single byte to this stream. Only the least significant byte of the integer {@code oneByte} is written to the stream. @param oneByte the byte to be written. @throws IOException if an error occurs while writing to this stream. @since Android 1.0
BluetoothOutputStream::write
java
Reginer/aosp-android-jar
android-34/src/android/bluetooth/BluetoothOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/bluetooth/BluetoothOutputStream.java
MIT
public void write(byte[] b, int offset, int count) throws IOException { if (b == null) { throw new NullPointerException("buffer is null"); } if ((offset | count) < 0 || count > b.length - offset) { throw new IndexOutOfBoundsException("invalid offset or length"); } mSocket.write(b, offset, count); }
Writes {@code count} bytes from the byte array {@code buffer} starting at position {@code offset} to this stream. @param b the buffer to be written. @param offset the start position in {@code buffer} from where to get bytes. @param count the number of bytes from {@code buffer} to write to this stream. @throws IOException if an error occurs while writing to this stream. @throws IndexOutOfBoundsException if {@code offset < 0} or {@code count < 0}, or if {@code offset + count} is bigger than the length of {@code buffer}. @since Android 1.0
BluetoothOutputStream::write
java
Reginer/aosp-android-jar
android-34/src/android/bluetooth/BluetoothOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/bluetooth/BluetoothOutputStream.java
MIT
public DistributionPoint[] getDistributionPoints() { DistributionPoint[] dp = new DistributionPoint[seq.size()]; for (int i = 0; i != seq.size(); i++) { dp[i] = DistributionPoint.getInstance(seq.getObjectAt(i)); } return dp; }
Return the distribution points making up the sequence. @return DistributionPoint[]
CRLDistPoint::getDistributionPoints
java
Reginer/aosp-android-jar
android-35/src/com/android/org/bouncycastle/asn1/x509/CRLDistPoint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/org/bouncycastle/asn1/x509/CRLDistPoint.java
MIT
public ASN1Primitive toASN1Primitive() { return seq; }
Produce an object suitable for an ASN1OutputStream. <pre> CRLDistPoint ::= SEQUENCE SIZE {1..MAX} OF DistributionPoint </pre>
CRLDistPoint::toASN1Primitive
java
Reginer/aosp-android-jar
android-35/src/com/android/org/bouncycastle/asn1/x509/CRLDistPoint.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/org/bouncycastle/asn1/x509/CRLDistPoint.java
MIT
static Map<String,String> getenv() { // Android-changed: Don't cache the C environment. http://b/201665416 // return theUnmodifiableEnvironment; return Collections.unmodifiableMap(buildEnvironment()); }
/* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. Oracle designates this particular file as subject to the "Classpath" exception as provided by Oracle in the LICENSE file that accompanied this code. This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code). You should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if you need additional information or have any questions. /* We use APIs that access the standard Unix environ array, which is defined by UNIX98 to look like: char **environ; These are unsorted, case-sensitive, null-terminated arrays of bytes of the form FOO=BAR\000 which are usually encoded in the user's default encoding (file.encoding is an excellent choice for encoding/decoding these). However, even though the user cannot directly access the underlying byte representation, we take pains to pass on the child the exact byte representation we inherit from the parent process for any environment name or value not created by Javaland. So we keep track of all the byte representations. Internally, we define the types Variable and Value that exhibit String/byteArray duality. The internal representation of the environment then looks like a Map<Variable,Value>. But we don't expose this to the user -- we only provide a Map<String,String> view, although we could also provide a Map<byte[],byte[]> view. The non-private methods in this class are not for general use even within this package. Instead, they are the system-dependent parts of the system-independent method of the same name. Don't even think of using this class unless your method's name appears below. @author Martin Buchholz @since 1.5 package java.lang; import java.io.*; import java.util.*; final class ProcessEnvironment { // BEGIN Android-removed: Don't cache the C environment. http://b/201665416 // private static final HashMap<Variable,Value> theEnvironment; // private static final Map<String,String> theUnmodifiableEnvironment; // END Android-removed: Don't cache the C environment. http://b/201665416 static final int MIN_NAME_LENGTH = 0; // BEGIN Android-removed: Don't cache the C environment. http://b/201665416 /* static { // We cache the C environment. This means that subsequent calls // to putenv/setenv from C will not be visible from Java code. byte[][] environ = environ(); theEnvironment = new HashMap<>(environ.length/2 + 3); // Read environment variables back to front, // so that earlier variables override later ones. for (int i = environ.length-1; i > 0; i-=2) theEnvironment.put(Variable.valueOf(environ[i-1]), Value.valueOf(environ[i])); theUnmodifiableEnvironment = Collections.unmodifiableMap (new StringEnvironment(theEnvironment)); } /* Only for use by System.getenv(String) * static String getenv(String name) { return theUnmodifiableEnvironment.get(name); } // END Android-removed: Don't cache the C environment. http://b/201665416 // BEGIN Android-added: Don't cache the C environment. http://b/201665416 // Instead, build a new copy each time using the same code as the previous // static initializer. private static Map<String, String> buildEnvironment() { byte[][] environ = environ(); Map<Variable, Value> env = new HashMap<>(environ.length / 2 + 3); // Read environment variables back to front, // so that earlier variables override later ones. for (int i = environ.length-1; i > 0; i-=2) env.put(Variable.valueOf(environ[i-1]), Value.valueOf(environ[i])); return new StringEnvironment(env); } // END Android-added: Don't cache the C environment. http://b/201665416 /* Only for use by System.getenv()
ProcessEnvironment::getenv
java
Reginer/aosp-android-jar
android-35/src/java/lang/ProcessEnvironment.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessEnvironment.java
MIT
static Map<String,String> emptyEnvironment(int capacity) { return new StringEnvironment(new HashMap<Variable,Value>(capacity)); }
/* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. Oracle designates this particular file as subject to the "Classpath" exception as provided by Oracle in the LICENSE file that accompanied this code. This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code). You should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if you need additional information or have any questions. /* We use APIs that access the standard Unix environ array, which is defined by UNIX98 to look like: char **environ; These are unsorted, case-sensitive, null-terminated arrays of bytes of the form FOO=BAR\000 which are usually encoded in the user's default encoding (file.encoding is an excellent choice for encoding/decoding these). However, even though the user cannot directly access the underlying byte representation, we take pains to pass on the child the exact byte representation we inherit from the parent process for any environment name or value not created by Javaland. So we keep track of all the byte representations. Internally, we define the types Variable and Value that exhibit String/byteArray duality. The internal representation of the environment then looks like a Map<Variable,Value>. But we don't expose this to the user -- we only provide a Map<String,String> view, although we could also provide a Map<byte[],byte[]> view. The non-private methods in this class are not for general use even within this package. Instead, they are the system-dependent parts of the system-independent method of the same name. Don't even think of using this class unless your method's name appears below. @author Martin Buchholz @since 1.5 package java.lang; import java.io.*; import java.util.*; final class ProcessEnvironment { // BEGIN Android-removed: Don't cache the C environment. http://b/201665416 // private static final HashMap<Variable,Value> theEnvironment; // private static final Map<String,String> theUnmodifiableEnvironment; // END Android-removed: Don't cache the C environment. http://b/201665416 static final int MIN_NAME_LENGTH = 0; // BEGIN Android-removed: Don't cache the C environment. http://b/201665416 /* static { // We cache the C environment. This means that subsequent calls // to putenv/setenv from C will not be visible from Java code. byte[][] environ = environ(); theEnvironment = new HashMap<>(environ.length/2 + 3); // Read environment variables back to front, // so that earlier variables override later ones. for (int i = environ.length-1; i > 0; i-=2) theEnvironment.put(Variable.valueOf(environ[i-1]), Value.valueOf(environ[i])); theUnmodifiableEnvironment = Collections.unmodifiableMap (new StringEnvironment(theEnvironment)); } /* Only for use by System.getenv(String) * static String getenv(String name) { return theUnmodifiableEnvironment.get(name); } // END Android-removed: Don't cache the C environment. http://b/201665416 // BEGIN Android-added: Don't cache the C environment. http://b/201665416 // Instead, build a new copy each time using the same code as the previous // static initializer. private static Map<String, String> buildEnvironment() { byte[][] environ = environ(); Map<Variable, Value> env = new HashMap<>(environ.length / 2 + 3); // Read environment variables back to front, // so that earlier variables override later ones. for (int i = environ.length-1; i > 0; i-=2) env.put(Variable.valueOf(environ[i-1]), Value.valueOf(environ[i])); return new StringEnvironment(env); } // END Android-added: Don't cache the C environment. http://b/201665416 /* Only for use by System.getenv() static Map<String,String> getenv() { // Android-changed: Don't cache the C environment. http://b/201665416 // return theUnmodifiableEnvironment; return Collections.unmodifiableMap(buildEnvironment()); } /* Only for use by ProcessBuilder.environment() @SuppressWarnings("unchecked") static Map<String,String> environment() { // Android-changed: Don't cache the C environment. http://b/201665416 // return new StringEnvironment // ((Map<Variable,Value>)(theEnvironment.clone())); return buildEnvironment(); } /* Only for use by Runtime.exec(...String[]envp...)
ProcessEnvironment::emptyEnvironment
java
Reginer/aosp-android-jar
android-35/src/java/lang/ProcessEnvironment.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/ProcessEnvironment.java
MIT
public hc_documentcreatecomment(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_documentcreatecomment::hc_documentcreatecomment
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_documentcreatecomment.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_documentcreatecomment.java
MIT
public void runTest() throws Throwable { Document doc; Comment newCommentNode; String newCommentValue; String newCommentName; int newCommentType; doc = (Document) load("hc_staff", true); newCommentNode = doc.createComment("This is a new Comment node"); newCommentValue = newCommentNode.getNodeValue(); assertEquals("value", "This is a new Comment node", newCommentValue); newCommentName = newCommentNode.getNodeName(); assertEquals("strong", "#comment", newCommentName); newCommentType = (int) newCommentNode.getNodeType(); assertEquals("type", 8, newCommentType); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
hc_documentcreatecomment::runTest
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_documentcreatecomment.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_documentcreatecomment.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatecomment"; }
Gets URI that identifies the test. @return uri identifier of test
hc_documentcreatecomment::getTargetURI
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_documentcreatecomment.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_documentcreatecomment.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(hc_documentcreatecomment.class, args); }
Runs this test from the command line. @param args command line arguments
hc_documentcreatecomment::main
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/hc_documentcreatecomment.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_documentcreatecomment.java
MIT
public RemoteEntry( @NonNull Slice slice) { this.mSlice = slice; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mSlice); }
Constructs a RemoteEntry to be displayed on the UI. @param slice the slice containing the metadata to be shown on the UI, must be constructed through the {@link androidx.credentials.provider} Jetpack library; If constructed manually, the {@code slice} object must contain the non-null properties of the {@link androidx.credentials.provider.RemoteEntry} class populated as slice items against specific hints as used in the class's {@code toSlice} method, since the Android System uses this library to parse the {@code slice} and extract the required attributes
RemoteEntry::RemoteEntry
java
Reginer/aosp-android-jar
android-35/src/android/service/credentials/RemoteEntry.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/service/credentials/RemoteEntry.java
MIT
public StreamHandler() { sealed = false; configure(); sealed = true; }
Create a <tt>StreamHandler</tt>, with no current output stream.
StreamHandler::StreamHandler
java
Reginer/aosp-android-jar
android-32/src/java/util/logging/StreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/util/logging/StreamHandler.java
MIT
public StreamHandler(OutputStream out, Formatter formatter) { sealed = false; configure(); setFormatter(formatter); setOutputStream(out); sealed = true; }
Create a <tt>StreamHandler</tt> with a given <tt>Formatter</tt> and output stream. <p> @param out the target output stream @param formatter Formatter to be used to format output
StreamHandler::StreamHandler
java
Reginer/aosp-android-jar
android-32/src/java/util/logging/StreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/util/logging/StreamHandler.java
MIT
protected synchronized void setOutputStream(OutputStream out) throws SecurityException { if (out == null) { throw new NullPointerException(); } flushAndClose(); output = out; doneHeader = false; String encoding = getEncoding(); if (encoding == null) { writer = new OutputStreamWriter(output); } else { try { writer = new OutputStreamWriter(output, encoding); } catch (UnsupportedEncodingException ex) { // This shouldn't happen. The setEncoding method // should have validated that the encoding is OK. throw new Error("Unexpected exception " + ex); } } }
Change the output stream. <P> If there is a current output stream then the <tt>Formatter</tt>'s tail string is written and the stream is flushed and closed. Then the output stream is replaced with the new output stream. @param out New output stream. May not be null. @exception SecurityException if a security manager exists and if the caller does not have <tt>LoggingPermission("control")</tt>.
StreamHandler::setOutputStream
java
Reginer/aosp-android-jar
android-32/src/java/util/logging/StreamHandler.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/util/logging/StreamHandler.java
MIT
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return XBoolean.S_TRUE; }
Execute the function. The function must return a valid object. @param xctxt The current execution context. @return A valid XObject. @throws javax.xml.transform.TransformerException
FuncTrue::execute
java
Reginer/aosp-android-jar
android-34/src/org/apache/xpath/functions/FuncTrue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xpath/functions/FuncTrue.java
MIT
public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op }
No arguments to process, so this does nothing.
FuncTrue::fixupVariables
java
Reginer/aosp-android-jar
android-34/src/org/apache/xpath/functions/FuncTrue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xpath/functions/FuncTrue.java
MIT
private LocaleUtils() { }
Guards this class from being instantiated.
LocaleUtils::LocaleUtils
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static String getUpdatedLanguageForChromium(String language) { // IMPORTANT: Keep in sync with the mapping found in: // build/android/gyp/util/resource_utils.py (Yiddish and Javanese are not possible Android // languages but are possible Chromium languages, they do not need to be kept in sync). switch (language) { case "iw": return "he"; // Hebrew case "ji": return "yi"; // Yiddish case "in": return "id"; // Indonesian case "tl": return "fil"; // Filipino case "jw": return "jv"; // Javanese default: return language; } }
Java keeps deprecated language codes for Hebrew, Yiddish and Indonesian but Chromium uses updated ones. Similarly, Android uses "tl" while Chromium uses "fil" for Tagalog/Filipino. So apply a mapping here. See http://developer.android.com/reference/java/util/Locale.html @return a updated language code for Chromium with given language string.
LocaleUtils::getUpdatedLanguageForChromium
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static String getUpdatedLanguageForAndroid(String language) { // IMPORTANT: Keep in sync with the mapping found in: // build/android/gyp/util/resource_utils.py switch (language) { case "und": return ""; // Undefined case "fil": return "tl"; // Filipino default: return language; } }
Android uses "tl" while Chromium uses "fil" for Tagalog/Filipino. So apply a mapping here. See http://developer.android.com/reference/java/util/Locale.html @return a updated language code for Android with given language string.
LocaleUtils::getUpdatedLanguageForAndroid
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static Locale forLanguageTagCompat(String languageTag) { String[] tag = languageTag.split("-"); if (tag.length == 0) { return new Locale(""); } String language = getUpdatedLanguageForAndroid(tag[0]); if ((language.length() != 2 && language.length() != 3)) { return new Locale(""); } if (tag.length == 1) { return new Locale(language); } String country = tag[1]; if (country.length() != 2 && country.length() != 3) { return new Locale(language); } return new Locale(language, country); }
This function creates a Locale object from xx-XX style string where xx is language code and XX is a country code. This works for API level lower than 21. @return the locale that best represents the language tag.
LocaleUtils::forLanguageTagCompat
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static Locale forLanguageTag(String languageTag) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Locale locale = Locale.forLanguageTag(languageTag); return getUpdatedLocaleForAndroid(locale); } return forLanguageTagCompat(languageTag); }
This function creates a Locale object from xx-XX style string where xx is language code and XX is a country code. @return the locale that best represents the language tag.
LocaleUtils::forLanguageTag
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static String toLanguageTag(Locale locale) { String language = getUpdatedLanguageForChromium(locale.getLanguage()); String country = locale.getCountry(); if (language.equals("no") && country.equals("NO") && locale.getVariant().equals("NY")) { return "nn-NO"; } return country.isEmpty() ? language : language + "-" + country; }
Converts Locale object to the BCP 47 compliant string format. This works for API level lower than 24. Note that for Android M or before, we cannot use Locale.getLanguage() and Locale.toLanguageTag() for this purpose. Since Locale.getLanguage() returns deprecated language code even if the Locale object is constructed with updated language code. As for Locale.toLanguageTag(), it does a special conversion from deprecated language code to updated one, but it is only usable for Android N or after. @return a well-formed IETF BCP 47 language tag with language and country code that represents this locale.
LocaleUtils::toLanguageTag
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static String toBaseLanguage(String languageTag) { int pos = languageTag.indexOf('-'); if (pos < 0) { return languageTag; } return languageTag.substring(0, pos); }
Extracts the base language from a BCP 47 language tag. @param languageTag language tag of the form xx-XX or xx. @return the xx part of the language tag.
LocaleUtils::toBaseLanguage
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static boolean isBaseLanguageEqual(String first, String second) { return TextUtils.equals(toBaseLanguage(first), toBaseLanguage(second)); }
@param first A BCP 47 formated language tag. @param second A BCP 47 formated language tag. @return True if the base language (e.g. "en" for "en-AU") is the same for each tag.
LocaleUtils::isBaseLanguageEqual
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static String getContextLanguage(Context context) { return getConfigurationLanguage(context.getResources().getConfiguration()); }
Return the language tag of the first language in the configuration @param context Context to get language for. @return The BCP 47 tag representation of the context's first locale.
LocaleUtils::getContextLanguage
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static void updateConfig(Context base, Configuration config, String languageTag) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { ApisN.setConfigLocales(base, config, languageTag); } else { config.setLocale(Locale.forLanguageTag(languageTag)); } }
Prepend languageTag to the default locales on config. @param base The Context to use for the base configuration. @param config The Configuration to update. @param languageTag The language to prepend to default locales.
LocaleUtils::updateConfig
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
public static void setDefaultLocalesFromConfiguration(Configuration config) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { ApisN.setLocaleList(config); } else { Locale.setDefault(config.locale); } }
Updates the default Locale/LocaleList to those of config. @param config
LocaleUtils::setDefaultLocalesFromConfiguration
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
static LocaleList prependToLocaleList(String languageTag, LocaleList localeList) { String languageList = localeList.toLanguageTags(); // Remove the first instance of languageTag with associated comma if present. // Pattern example: "(^|,)en-US$|en-US," String pattern = String.format("(^|,)%1$s$|%1$s,", languageTag); languageList = languageList.replaceFirst(pattern, ""); return LocaleList.forLanguageTags( String.format("%1$s,%2$s", languageTag, languageList)); }
Create a new LocaleList with languageTag added to the front. If languageTag is already in the list the existing tag is moved to the front. @param languageTag String of language tag to prepend @param localeList LocaleList to prepend to. @return LocaleList
ApisN::prependToLocaleList
java
Reginer/aosp-android-jar
android-34/src/org/chromium/base/LocaleUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/LocaleUtils.java
MIT
default Deque<E> reversed() { return ReverseOrderDequeView.of(this); }
{@inheritDoc} @implSpec The implementation in this interface returns a reverse-ordered Deque view. The {@code reversed()} method of the view returns a reference to this Deque. Other operations on the view are implemented via calls to public methods on this Deque. The exact relationship between calls on the view and calls on this Deque is unspecified. However, order-sensitive operations generally delegate to the appropriate method with the opposite orientation. For example, calling {@code getFirst} on the view results in a call to {@code getLast} on this Deque. @return a reverse-ordered view of this collection, as a {@code Deque} @since 21
reversed
java
Reginer/aosp-android-jar
android-35/src/java/util/Deque.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/Deque.java
MIT
public attrspecifiedvalue(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", false); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
attrspecifiedvalue::attrspecifiedvalue
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/attrspecifiedvalue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/attrspecifiedvalue.java
MIT
public void runTest() throws Throwable { Document doc; NodeList addressList; Node testNode; NamedNodeMap attributes; Attr domesticAttr; boolean state; doc = (Document) load("staff", false); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(0); attributes = testNode.getAttributes(); domesticAttr = (Attr) attributes.getNamedItem("domestic"); state = domesticAttr.getSpecified(); assertTrue("domesticSpecified", state); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
attrspecifiedvalue::runTest
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/attrspecifiedvalue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/attrspecifiedvalue.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalue"; }
Gets URI that identifies the test. @return uri identifier of test
attrspecifiedvalue::getTargetURI
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/attrspecifiedvalue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/attrspecifiedvalue.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(attrspecifiedvalue.class, args); }
Runs this test from the command line. @param args command line arguments
attrspecifiedvalue::main
java
Reginer/aosp-android-jar
android-32/src/org/w3c/domts/level1/core/attrspecifiedvalue.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/org/w3c/domts/level1/core/attrspecifiedvalue.java
MIT
public Random() { this(seedUniquifier() ^ System.nanoTime()); }
Creates a new random number generator. This constructor sets the seed of the random number generator to a value very likely to be distinct from any other invocation of this constructor.
Random::Random
java
Reginer/aosp-android-jar
android-35/src/java/util/Random.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/Random.java
MIT
public void setClientName(@NonNull String clientName) { synchronized (mLock) { if (mIsDone) { return; } if (DEBUG) { Log.v(TAG, "Setting clientName: " + clientName); } mStats.clientName = clientName; } }
Set client package name @param clientName package name of the client that these stats are associated with.
getSimpleName::setClientName
java
Reginer/aosp-android-jar
android-35/src/android/hardware/camera2/utils/ExtensionSessionStatsAggregator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/camera2/utils/ExtensionSessionStatsAggregator.java
MIT
public void setCaptureFormat(int format) { synchronized (mLock) { if (mIsDone) { return; } if (DEBUG) { Log.v(TAG, "Setting capture format: " + format); } mStats.captureFormat = format; } }
Set the capture format. @param format Format of requested capture.
getSimpleName::setCaptureFormat
java
Reginer/aosp-android-jar
android-35/src/android/hardware/camera2/utils/ExtensionSessionStatsAggregator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/camera2/utils/ExtensionSessionStatsAggregator.java
MIT
public void setExtensionType(int extensionType) { synchronized (mLock) { if (mIsDone) { return; } if (DEBUG) { Log.v(TAG, "Setting type: " + extensionType); } mStats.type = extensionType; } }
Set extension type. @param extensionType Type of extension. Must match one of {@code CameraExtensionCharacteristics#EXTENSION_*}
getSimpleName::setExtensionType
java
Reginer/aosp-android-jar
android-35/src/android/hardware/camera2/utils/ExtensionSessionStatsAggregator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/camera2/utils/ExtensionSessionStatsAggregator.java
MIT
public void commit(boolean isFinal) { // Call binder on a background thread to reduce latencies from metrics logging. mExecutor.execute(() -> { synchronized (mLock) { if (mIsDone) { return; } mIsDone = isFinal; if (DEBUG) { Log.v(TAG, "Committing: " + prettyPrintStats(mStats)); } mStats.key = CameraManager.reportExtensionSessionStats(mStats); } }); }
Asynchronously commits the stats to CameraManager on a background thread. @param isFinal marks the stats as final and prevents any further commits or changes. This should be set to true when the stats are considered final for logging, for example right before the capture session is about to close
getSimpleName::commit
java
Reginer/aosp-android-jar
android-35/src/android/hardware/camera2/utils/ExtensionSessionStatsAggregator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/camera2/utils/ExtensionSessionStatsAggregator.java
MIT
public static String pii(String tag, Object pii) { String val = String.valueOf(pii); if (pii == null || TextUtils.isEmpty(val) || isLoggable(tag, Log.VERBOSE)) { return val; } return "[" + secureHash(val.getBytes()) + "]"; }
Redact personally identifiable information for production users. @param tag used to identify the source of a log message @param pii the personally identifiable information we want to apply secure hash on. @return If tag is loggable in verbose mode or pii is null, return the original input. otherwise return a secure Hash of input pii
Rlog::pii
java
Reginer/aosp-android-jar
android-35/src/android/telephony/Rlog.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/Rlog.java
MIT
public static String pii(boolean enablePiiLogging, Object pii) { String val = String.valueOf(pii); if (pii == null || TextUtils.isEmpty(val) || enablePiiLogging) { return val; } return "[" + secureHash(val.getBytes()) + "]"; }
Redact personally identifiable information for production users. @param enablePiiLogging set when caller explicitly want to enable sensitive logging. @param pii the personally identifiable information we want to apply secure hash on. @return If enablePiiLogging is set to true or pii is null, return the original input. otherwise return a secure Hash of input pii
Rlog::pii
java
Reginer/aosp-android-jar
android-35/src/android/telephony/Rlog.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/Rlog.java
MIT
private static String secureHash(byte[] input) { // Refrain from logging user personal information in user build. if (USER_BUILD) { return "****"; } MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { return "####"; } byte[] result = messageDigest.digest(input); return Base64.encodeToString( result, Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP); }
Returns a secure hash (using the SHA1 algorithm) of the provided input. @return "****" if the build type is user, otherwise the hash @param input the bytes for which the secure hash should be computed.
Rlog::secureHash
java
Reginer/aosp-android-jar
android-35/src/android/telephony/Rlog.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/Rlog.java
MIT
void onRestartButtonClicked() { mOnRestartButtonClicked.accept(Pair.create(getLastTaskInfo(), getTaskListener())); }
Window manager for the Size Compat restart button and Camera Compat control. class CompatUIWindowManager extends CompatUIWindowManagerAbstract { private final CompatUICallback mCallback; private final CompatUIConfiguration mCompatUIConfiguration; private final Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> mOnRestartButtonClicked; // Remember the last reported states in case visibility changes due to keyguard or IME updates. @VisibleForTesting boolean mHasSizeCompat; @VisibleForTesting @CameraCompatControlState int mCameraCompatControlState = CAMERA_COMPAT_CONTROL_HIDDEN; @VisibleForTesting CompatUIHintsState mCompatUIHintsState; @Nullable @VisibleForTesting CompatUILayout mLayout; CompatUIWindowManager(Context context, TaskInfo taskInfo, SyncTransactionQueue syncQueue, CompatUICallback callback, ShellTaskOrganizer.TaskListener taskListener, DisplayLayout displayLayout, CompatUIHintsState compatUIHintsState, CompatUIConfiguration compatUIConfiguration, Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> onRestartButtonClicked) { super(context, taskInfo, syncQueue, taskListener, displayLayout); mCallback = callback; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; mCompatUIHintsState = compatUIHintsState; mCompatUIConfiguration = compatUIConfiguration; mOnRestartButtonClicked = onRestartButtonClicked; } @Override protected int getZOrder() { return TASK_CHILD_LAYER_COMPAT_UI + 1; } @Override protected @Nullable View getLayout() { return mLayout; } @Override protected void removeLayout() { mLayout = null; } @Override protected boolean eligibleToShowLayout() { return mHasSizeCompat || shouldShowCameraControl(); } @Override protected View createLayout() { mLayout = inflateLayout(); mLayout.inject(this); updateVisibilityOfViews(); if (mHasSizeCompat) { mCallback.onSizeCompatRestartButtonAppeared(mTaskId); } return mLayout; } @VisibleForTesting CompatUILayout inflateLayout() { return (CompatUILayout) LayoutInflater.from(mContext).inflate(R.layout.compat_ui_layout, null); } @Override public boolean updateCompatInfo(TaskInfo taskInfo, ShellTaskOrganizer.TaskListener taskListener, boolean canShow) { final boolean prevHasSizeCompat = mHasSizeCompat; final int prevCameraCompatControlState = mCameraCompatControlState; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; if (!super.updateCompatInfo(taskInfo, taskListener, canShow)) { return false; } if (prevHasSizeCompat != mHasSizeCompat || prevCameraCompatControlState != mCameraCompatControlState) { updateVisibilityOfViews(); } return true; } /** Called when the restart button is clicked.
CompatUIWindowManager::onRestartButtonClicked
java
Reginer/aosp-android-jar
android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
MIT
void onCameraTreatmentButtonClicked() { if (!shouldShowCameraControl()) { Log.w(getTag(), "Camera compat shouldn't receive clicks in the hidden state."); return; } // When a camera control is shown, only two states are allowed: "treament applied" and // "treatment suggested". Clicks on the conrol's treatment button toggle between these // two states. mCameraCompatControlState = mCameraCompatControlState == CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED ? CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED : CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED; mCallback.onCameraControlStateUpdated(mTaskId, mCameraCompatControlState); mLayout.updateCameraTreatmentButton(mCameraCompatControlState); }
Window manager for the Size Compat restart button and Camera Compat control. class CompatUIWindowManager extends CompatUIWindowManagerAbstract { private final CompatUICallback mCallback; private final CompatUIConfiguration mCompatUIConfiguration; private final Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> mOnRestartButtonClicked; // Remember the last reported states in case visibility changes due to keyguard or IME updates. @VisibleForTesting boolean mHasSizeCompat; @VisibleForTesting @CameraCompatControlState int mCameraCompatControlState = CAMERA_COMPAT_CONTROL_HIDDEN; @VisibleForTesting CompatUIHintsState mCompatUIHintsState; @Nullable @VisibleForTesting CompatUILayout mLayout; CompatUIWindowManager(Context context, TaskInfo taskInfo, SyncTransactionQueue syncQueue, CompatUICallback callback, ShellTaskOrganizer.TaskListener taskListener, DisplayLayout displayLayout, CompatUIHintsState compatUIHintsState, CompatUIConfiguration compatUIConfiguration, Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> onRestartButtonClicked) { super(context, taskInfo, syncQueue, taskListener, displayLayout); mCallback = callback; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; mCompatUIHintsState = compatUIHintsState; mCompatUIConfiguration = compatUIConfiguration; mOnRestartButtonClicked = onRestartButtonClicked; } @Override protected int getZOrder() { return TASK_CHILD_LAYER_COMPAT_UI + 1; } @Override protected @Nullable View getLayout() { return mLayout; } @Override protected void removeLayout() { mLayout = null; } @Override protected boolean eligibleToShowLayout() { return mHasSizeCompat || shouldShowCameraControl(); } @Override protected View createLayout() { mLayout = inflateLayout(); mLayout.inject(this); updateVisibilityOfViews(); if (mHasSizeCompat) { mCallback.onSizeCompatRestartButtonAppeared(mTaskId); } return mLayout; } @VisibleForTesting CompatUILayout inflateLayout() { return (CompatUILayout) LayoutInflater.from(mContext).inflate(R.layout.compat_ui_layout, null); } @Override public boolean updateCompatInfo(TaskInfo taskInfo, ShellTaskOrganizer.TaskListener taskListener, boolean canShow) { final boolean prevHasSizeCompat = mHasSizeCompat; final int prevCameraCompatControlState = mCameraCompatControlState; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; if (!super.updateCompatInfo(taskInfo, taskListener, canShow)) { return false; } if (prevHasSizeCompat != mHasSizeCompat || prevCameraCompatControlState != mCameraCompatControlState) { updateVisibilityOfViews(); } return true; } /** Called when the restart button is clicked. void onRestartButtonClicked() { mOnRestartButtonClicked.accept(Pair.create(getLastTaskInfo(), getTaskListener())); } /** Called when the camera treatment button is clicked.
CompatUIWindowManager::onCameraTreatmentButtonClicked
java
Reginer/aosp-android-jar
android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
MIT
void onCameraDismissButtonClicked() { if (!shouldShowCameraControl()) { Log.w(getTag(), "Camera compat shouldn't receive clicks in the hidden state."); return; } mCameraCompatControlState = CAMERA_COMPAT_CONTROL_DISMISSED; mCallback.onCameraControlStateUpdated(mTaskId, CAMERA_COMPAT_CONTROL_DISMISSED); mLayout.setCameraControlVisibility(/* show= */ false); }
Window manager for the Size Compat restart button and Camera Compat control. class CompatUIWindowManager extends CompatUIWindowManagerAbstract { private final CompatUICallback mCallback; private final CompatUIConfiguration mCompatUIConfiguration; private final Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> mOnRestartButtonClicked; // Remember the last reported states in case visibility changes due to keyguard or IME updates. @VisibleForTesting boolean mHasSizeCompat; @VisibleForTesting @CameraCompatControlState int mCameraCompatControlState = CAMERA_COMPAT_CONTROL_HIDDEN; @VisibleForTesting CompatUIHintsState mCompatUIHintsState; @Nullable @VisibleForTesting CompatUILayout mLayout; CompatUIWindowManager(Context context, TaskInfo taskInfo, SyncTransactionQueue syncQueue, CompatUICallback callback, ShellTaskOrganizer.TaskListener taskListener, DisplayLayout displayLayout, CompatUIHintsState compatUIHintsState, CompatUIConfiguration compatUIConfiguration, Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> onRestartButtonClicked) { super(context, taskInfo, syncQueue, taskListener, displayLayout); mCallback = callback; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; mCompatUIHintsState = compatUIHintsState; mCompatUIConfiguration = compatUIConfiguration; mOnRestartButtonClicked = onRestartButtonClicked; } @Override protected int getZOrder() { return TASK_CHILD_LAYER_COMPAT_UI + 1; } @Override protected @Nullable View getLayout() { return mLayout; } @Override protected void removeLayout() { mLayout = null; } @Override protected boolean eligibleToShowLayout() { return mHasSizeCompat || shouldShowCameraControl(); } @Override protected View createLayout() { mLayout = inflateLayout(); mLayout.inject(this); updateVisibilityOfViews(); if (mHasSizeCompat) { mCallback.onSizeCompatRestartButtonAppeared(mTaskId); } return mLayout; } @VisibleForTesting CompatUILayout inflateLayout() { return (CompatUILayout) LayoutInflater.from(mContext).inflate(R.layout.compat_ui_layout, null); } @Override public boolean updateCompatInfo(TaskInfo taskInfo, ShellTaskOrganizer.TaskListener taskListener, boolean canShow) { final boolean prevHasSizeCompat = mHasSizeCompat; final int prevCameraCompatControlState = mCameraCompatControlState; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; if (!super.updateCompatInfo(taskInfo, taskListener, canShow)) { return false; } if (prevHasSizeCompat != mHasSizeCompat || prevCameraCompatControlState != mCameraCompatControlState) { updateVisibilityOfViews(); } return true; } /** Called when the restart button is clicked. void onRestartButtonClicked() { mOnRestartButtonClicked.accept(Pair.create(getLastTaskInfo(), getTaskListener())); } /** Called when the camera treatment button is clicked. void onCameraTreatmentButtonClicked() { if (!shouldShowCameraControl()) { Log.w(getTag(), "Camera compat shouldn't receive clicks in the hidden state."); return; } // When a camera control is shown, only two states are allowed: "treament applied" and // "treatment suggested". Clicks on the conrol's treatment button toggle between these // two states. mCameraCompatControlState = mCameraCompatControlState == CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED ? CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED : CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED; mCallback.onCameraControlStateUpdated(mTaskId, mCameraCompatControlState); mLayout.updateCameraTreatmentButton(mCameraCompatControlState); } /** Called when the camera dismiss button is clicked.
CompatUIWindowManager::onCameraDismissButtonClicked
java
Reginer/aosp-android-jar
android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
MIT
void onRestartButtonLongClicked() { if (mLayout == null) { return; } mLayout.setSizeCompatHintVisibility(/* show= */ true); }
Window manager for the Size Compat restart button and Camera Compat control. class CompatUIWindowManager extends CompatUIWindowManagerAbstract { private final CompatUICallback mCallback; private final CompatUIConfiguration mCompatUIConfiguration; private final Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> mOnRestartButtonClicked; // Remember the last reported states in case visibility changes due to keyguard or IME updates. @VisibleForTesting boolean mHasSizeCompat; @VisibleForTesting @CameraCompatControlState int mCameraCompatControlState = CAMERA_COMPAT_CONTROL_HIDDEN; @VisibleForTesting CompatUIHintsState mCompatUIHintsState; @Nullable @VisibleForTesting CompatUILayout mLayout; CompatUIWindowManager(Context context, TaskInfo taskInfo, SyncTransactionQueue syncQueue, CompatUICallback callback, ShellTaskOrganizer.TaskListener taskListener, DisplayLayout displayLayout, CompatUIHintsState compatUIHintsState, CompatUIConfiguration compatUIConfiguration, Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> onRestartButtonClicked) { super(context, taskInfo, syncQueue, taskListener, displayLayout); mCallback = callback; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; mCompatUIHintsState = compatUIHintsState; mCompatUIConfiguration = compatUIConfiguration; mOnRestartButtonClicked = onRestartButtonClicked; } @Override protected int getZOrder() { return TASK_CHILD_LAYER_COMPAT_UI + 1; } @Override protected @Nullable View getLayout() { return mLayout; } @Override protected void removeLayout() { mLayout = null; } @Override protected boolean eligibleToShowLayout() { return mHasSizeCompat || shouldShowCameraControl(); } @Override protected View createLayout() { mLayout = inflateLayout(); mLayout.inject(this); updateVisibilityOfViews(); if (mHasSizeCompat) { mCallback.onSizeCompatRestartButtonAppeared(mTaskId); } return mLayout; } @VisibleForTesting CompatUILayout inflateLayout() { return (CompatUILayout) LayoutInflater.from(mContext).inflate(R.layout.compat_ui_layout, null); } @Override public boolean updateCompatInfo(TaskInfo taskInfo, ShellTaskOrganizer.TaskListener taskListener, boolean canShow) { final boolean prevHasSizeCompat = mHasSizeCompat; final int prevCameraCompatControlState = mCameraCompatControlState; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; if (!super.updateCompatInfo(taskInfo, taskListener, canShow)) { return false; } if (prevHasSizeCompat != mHasSizeCompat || prevCameraCompatControlState != mCameraCompatControlState) { updateVisibilityOfViews(); } return true; } /** Called when the restart button is clicked. void onRestartButtonClicked() { mOnRestartButtonClicked.accept(Pair.create(getLastTaskInfo(), getTaskListener())); } /** Called when the camera treatment button is clicked. void onCameraTreatmentButtonClicked() { if (!shouldShowCameraControl()) { Log.w(getTag(), "Camera compat shouldn't receive clicks in the hidden state."); return; } // When a camera control is shown, only two states are allowed: "treament applied" and // "treatment suggested". Clicks on the conrol's treatment button toggle between these // two states. mCameraCompatControlState = mCameraCompatControlState == CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED ? CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED : CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED; mCallback.onCameraControlStateUpdated(mTaskId, mCameraCompatControlState); mLayout.updateCameraTreatmentButton(mCameraCompatControlState); } /** Called when the camera dismiss button is clicked. void onCameraDismissButtonClicked() { if (!shouldShowCameraControl()) { Log.w(getTag(), "Camera compat shouldn't receive clicks in the hidden state."); return; } mCameraCompatControlState = CAMERA_COMPAT_CONTROL_DISMISSED; mCallback.onCameraControlStateUpdated(mTaskId, CAMERA_COMPAT_CONTROL_DISMISSED); mLayout.setCameraControlVisibility(/* show= */ false); } /** Called when the restart button is long clicked.
CompatUIWindowManager::onRestartButtonLongClicked
java
Reginer/aosp-android-jar
android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
MIT
void onCameraButtonLongClicked() { if (mLayout == null) { return; } mLayout.setCameraCompatHintVisibility(/* show= */ true); }
Window manager for the Size Compat restart button and Camera Compat control. class CompatUIWindowManager extends CompatUIWindowManagerAbstract { private final CompatUICallback mCallback; private final CompatUIConfiguration mCompatUIConfiguration; private final Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> mOnRestartButtonClicked; // Remember the last reported states in case visibility changes due to keyguard or IME updates. @VisibleForTesting boolean mHasSizeCompat; @VisibleForTesting @CameraCompatControlState int mCameraCompatControlState = CAMERA_COMPAT_CONTROL_HIDDEN; @VisibleForTesting CompatUIHintsState mCompatUIHintsState; @Nullable @VisibleForTesting CompatUILayout mLayout; CompatUIWindowManager(Context context, TaskInfo taskInfo, SyncTransactionQueue syncQueue, CompatUICallback callback, ShellTaskOrganizer.TaskListener taskListener, DisplayLayout displayLayout, CompatUIHintsState compatUIHintsState, CompatUIConfiguration compatUIConfiguration, Consumer<Pair<TaskInfo, ShellTaskOrganizer.TaskListener>> onRestartButtonClicked) { super(context, taskInfo, syncQueue, taskListener, displayLayout); mCallback = callback; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; mCompatUIHintsState = compatUIHintsState; mCompatUIConfiguration = compatUIConfiguration; mOnRestartButtonClicked = onRestartButtonClicked; } @Override protected int getZOrder() { return TASK_CHILD_LAYER_COMPAT_UI + 1; } @Override protected @Nullable View getLayout() { return mLayout; } @Override protected void removeLayout() { mLayout = null; } @Override protected boolean eligibleToShowLayout() { return mHasSizeCompat || shouldShowCameraControl(); } @Override protected View createLayout() { mLayout = inflateLayout(); mLayout.inject(this); updateVisibilityOfViews(); if (mHasSizeCompat) { mCallback.onSizeCompatRestartButtonAppeared(mTaskId); } return mLayout; } @VisibleForTesting CompatUILayout inflateLayout() { return (CompatUILayout) LayoutInflater.from(mContext).inflate(R.layout.compat_ui_layout, null); } @Override public boolean updateCompatInfo(TaskInfo taskInfo, ShellTaskOrganizer.TaskListener taskListener, boolean canShow) { final boolean prevHasSizeCompat = mHasSizeCompat; final int prevCameraCompatControlState = mCameraCompatControlState; mHasSizeCompat = taskInfo.topActivityInSizeCompat; mCameraCompatControlState = taskInfo.cameraCompatControlState; if (!super.updateCompatInfo(taskInfo, taskListener, canShow)) { return false; } if (prevHasSizeCompat != mHasSizeCompat || prevCameraCompatControlState != mCameraCompatControlState) { updateVisibilityOfViews(); } return true; } /** Called when the restart button is clicked. void onRestartButtonClicked() { mOnRestartButtonClicked.accept(Pair.create(getLastTaskInfo(), getTaskListener())); } /** Called when the camera treatment button is clicked. void onCameraTreatmentButtonClicked() { if (!shouldShowCameraControl()) { Log.w(getTag(), "Camera compat shouldn't receive clicks in the hidden state."); return; } // When a camera control is shown, only two states are allowed: "treament applied" and // "treatment suggested". Clicks on the conrol's treatment button toggle between these // two states. mCameraCompatControlState = mCameraCompatControlState == CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED ? CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED : CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED; mCallback.onCameraControlStateUpdated(mTaskId, mCameraCompatControlState); mLayout.updateCameraTreatmentButton(mCameraCompatControlState); } /** Called when the camera dismiss button is clicked. void onCameraDismissButtonClicked() { if (!shouldShowCameraControl()) { Log.w(getTag(), "Camera compat shouldn't receive clicks in the hidden state."); return; } mCameraCompatControlState = CAMERA_COMPAT_CONTROL_DISMISSED; mCallback.onCameraControlStateUpdated(mTaskId, CAMERA_COMPAT_CONTROL_DISMISSED); mLayout.setCameraControlVisibility(/* show= */ false); } /** Called when the restart button is long clicked. void onRestartButtonLongClicked() { if (mLayout == null) { return; } mLayout.setSizeCompatHintVisibility(/* show= */ true); } /** Called when either dismiss or treatment camera buttons is long clicked.
CompatUIWindowManager::onCameraButtonLongClicked
java
Reginer/aosp-android-jar
android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/wm/shell/compatui/CompatUIWindowManager.java
MIT
public void setNext(int numOfBits, int value) throws IOException { if (numOfBits <= 0) { return; } // optional: we can do some clever size checking to "OR" an entire segment of bits instead // of setting bits one by one, but it is probably not worth it. int nextBitMask = 1 << (numOfBits - 1); while (numOfBits-- > 0) { setNext((value & nextBitMask) != 0); nextBitMask >>>= 1; } }
Set the next number of bits in the stream to value. @param numOfBits The number of bits used to represent the value. @param value The value to convert to bits.
BitOutputStream::setNext
java
Reginer/aosp-android-jar
android-31/src/com/android/server/integrity/model/BitOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/integrity/model/BitOutputStream.java
MIT
public void setNext(boolean value) throws IOException { int byteToWrite = mNextBitIndex / BYTE_BITS; if (byteToWrite == BUFFER_SIZE) { mOutputStream.write(mBuffer); reset(); byteToWrite = 0; } if (value) { mBuffer[byteToWrite] |= 1 << (BYTE_BITS - 1 - (mNextBitIndex % BYTE_BITS)); } mNextBitIndex++; }
Set the next bit in the stream to value. @param value The value to set the bit to
BitOutputStream::setNext
java
Reginer/aosp-android-jar
android-31/src/com/android/server/integrity/model/BitOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/integrity/model/BitOutputStream.java
MIT
public void setNext() throws IOException { setNext(/* value= */ true); }
Set the next bit in the stream to value. @param value The value to set the bit to public void setNext(boolean value) throws IOException { int byteToWrite = mNextBitIndex / BYTE_BITS; if (byteToWrite == BUFFER_SIZE) { mOutputStream.write(mBuffer); reset(); byteToWrite = 0; } if (value) { mBuffer[byteToWrite] |= 1 << (BYTE_BITS - 1 - (mNextBitIndex % BYTE_BITS)); } mNextBitIndex++; } /** Set the next bit in the stream to true.
BitOutputStream::setNext
java
Reginer/aosp-android-jar
android-31/src/com/android/server/integrity/model/BitOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/integrity/model/BitOutputStream.java
MIT
public void flush() throws IOException { int endByte = mNextBitIndex / BYTE_BITS; if (mNextBitIndex % BYTE_BITS != 0) { // If next bit is not the first bit of a byte, then mNextBitIndex / BYTE_BITS would be // the byte that includes already written bits. We need to increment it so this byte // gets written. endByte++; } mOutputStream.write(mBuffer, 0, endByte); reset(); }
Flush the data written to the underlying {@link java.io.OutputStream}. Any unfinished bytes will be padded with 0.
BitOutputStream::flush
java
Reginer/aosp-android-jar
android-31/src/com/android/server/integrity/model/BitOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/integrity/model/BitOutputStream.java
MIT
private void reset() { mNextBitIndex = 0; Arrays.fill(mBuffer, (byte) 0); }
Flush the data written to the underlying {@link java.io.OutputStream}. Any unfinished bytes will be padded with 0. public void flush() throws IOException { int endByte = mNextBitIndex / BYTE_BITS; if (mNextBitIndex % BYTE_BITS != 0) { // If next bit is not the first bit of a byte, then mNextBitIndex / BYTE_BITS would be // the byte that includes already written bits. We need to increment it so this byte // gets written. endByte++; } mOutputStream.write(mBuffer, 0, endByte); reset(); } /** Reset this output stream to start state.
BitOutputStream::reset
java
Reginer/aosp-android-jar
android-31/src/com/android/server/integrity/model/BitOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/integrity/model/BitOutputStream.java
MIT
Properties getProperties() { return mProperties; }
Returns the full set of properties loaded.
HalInterfaceVersion::getProperties
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssConfiguration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssConfiguration.java
MIT
public int getEsExtensionSec() { return mEsExtensionSec; }
Returns the value of config parameter ES_EXTENSION_SEC. The value is range checked and constrained to min/max limits.
HalInterfaceVersion::getEsExtensionSec
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssConfiguration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssConfiguration.java
MIT
String getSuplHost() { return mProperties.getProperty(CONFIG_SUPL_HOST); }
Returns the value of config parameter SUPL_HOST or {@code null} if no value is provided.
HalInterfaceVersion::getSuplHost
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssConfiguration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssConfiguration.java
MIT
int getSuplPort(int defaultPort) { return getIntConfig(CONFIG_SUPL_PORT, defaultPort); }
Returns the value of config parameter SUPL_PORT or {@code defaultPort} if no value is provided or if there is an error parsing the configured value.
HalInterfaceVersion::getSuplPort
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssConfiguration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssConfiguration.java
MIT
String getC2KHost() { return mProperties.getProperty(CONFIG_C2K_HOST); }
Returns the value of config parameter C2K_HOST or {@code null} if no value is provided.
HalInterfaceVersion::getC2KHost
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssConfiguration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssConfiguration.java
MIT
int getC2KPort(int defaultPort) { return getIntConfig(CONFIG_C2K_PORT, defaultPort); }
Returns the value of config parameter C2K_PORT or {@code defaultPort} if no value is provided or if there is an error parsing the configured value.
HalInterfaceVersion::getC2KPort
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssConfiguration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssConfiguration.java
MIT
int getSuplMode(int defaultMode) { return getIntConfig(CONFIG_SUPL_MODE, defaultMode); }
Returns the value of config parameter SUPL_MODE or {@code defaultMode} if no value is provided or if there is an error parsing the configured value.
HalInterfaceVersion::getSuplMode
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssConfiguration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssConfiguration.java
MIT
public int getSuplEs(int defaultSuplEs) { return getIntConfig(CONFIG_SUPL_ES, defaultSuplEs); }
Returns the value of config parameter SUPL_ES or {@code defaultSuplEs} if no value is provided or if there is an error parsing the configured value.
HalInterfaceVersion::getSuplEs
java
Reginer/aosp-android-jar
android-32/src/com/android/server/location/gnss/GnssConfiguration.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/location/gnss/GnssConfiguration.java
MIT