code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public void start(Cleaner cleaner, ThreadFactory threadFactory) { if (getCleanerImpl(cleaner) != this) { throw new AssertionError("wrong cleaner"); } // schedule a nop cleaning action for the cleaner, so the associated thread // will continue to run at least until the cleaner is reclaimable. new CleanerCleanable(cleaner); if (threadFactory == null) { threadFactory = CleanerImpl.InnocuousThreadFactory.factory(); } // now that there's at least one cleaning action, for the cleaner, // we can start the associated thread, which runs until // all cleaning actions have been run. Thread thread = threadFactory.newThread(this); thread.setDaemon(true); thread.start(); }
Starts the Cleaner implementation. Ensure this is the CleanerImpl for the Cleaner. When started waits for Cleanables to be queued. @param cleaner the cleaner @param threadFactory the thread factory
CleanerImpl::start
java
Reginer/aosp-android-jar
android-35/src/jdk/internal/ref/CleanerImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/jdk/internal/ref/CleanerImpl.java
MIT
public void start(Cleaner cleaner) { if (getCleanerImpl(cleaner) != this) { throw new AssertionError("wrong cleaner"); } }
Starts the Cleaner implementation. Does not need a thread factory as it should be used in the system cleaner only. @param cleaner the cleaner @hide
CleanerImpl::start
java
Reginer/aosp-android-jar
android-35/src/jdk/internal/ref/CleanerImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/jdk/internal/ref/CleanerImpl.java
MIT
public PhantomCleanableRef(Object obj, Cleaner cleaner, Runnable action) { super(obj, cleaner); this.action = action; }
Constructor for a phantom cleanable reference. @param obj the object to monitor @param cleaner the cleaner @param action the action Runnable
PhantomCleanableRef::PhantomCleanableRef
java
Reginer/aosp-android-jar
android-35/src/jdk/internal/ref/CleanerImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/jdk/internal/ref/CleanerImpl.java
MIT
PhantomCleanableRef() { super(); this.action = null; }
Constructor used only for root of phantom cleanable list.
PhantomCleanableRef::PhantomCleanableRef
java
Reginer/aosp-android-jar
android-35/src/jdk/internal/ref/CleanerImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/jdk/internal/ref/CleanerImpl.java
MIT
public PlatformEncryptionKey(int generationId, SecretKey key) { mGenerationId = generationId; mKey = key; }
A new instance. @param generationId The generation ID of the key. @param key The secret key handle. Can be used to encrypt WITHOUT requiring screen unlock.
PlatformEncryptionKey::PlatformEncryptionKey
java
Reginer/aosp-android-jar
android-35/src/com/android/server/locksettings/recoverablekeystore/PlatformEncryptionKey.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/locksettings/recoverablekeystore/PlatformEncryptionKey.java
MIT
public int getGenerationId() { return mGenerationId; }
Returns the generation ID of the key.
PlatformEncryptionKey::getGenerationId
java
Reginer/aosp-android-jar
android-35/src/com/android/server/locksettings/recoverablekeystore/PlatformEncryptionKey.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/locksettings/recoverablekeystore/PlatformEncryptionKey.java
MIT
public SecretKey getKey() { return mKey; }
Returns the actual key, which can only be used to encrypt.
PlatformEncryptionKey::getKey
java
Reginer/aosp-android-jar
android-35/src/com/android/server/locksettings/recoverablekeystore/PlatformEncryptionKey.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/locksettings/recoverablekeystore/PlatformEncryptionKey.java
MIT
protected ServerSocketChannel(SelectorProvider provider) { super(provider); }
Initializes a new instance of this class. @param provider The provider that created this channel
ServerSocketChannel::ServerSocketChannel
java
Reginer/aosp-android-jar
android-34/src/java/nio/channels/ServerSocketChannel.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/nio/channels/ServerSocketChannel.java
MIT
public static ServerSocketChannel open() throws IOException { return SelectorProvider.provider().openServerSocketChannel(); }
Opens a server-socket channel. <p> The new channel is created by invoking the {@link java.nio.channels.spi.SelectorProvider#openServerSocketChannel openServerSocketChannel} method of the system-wide default {@link java.nio.channels.spi.SelectorProvider} object. <p> The new channel's socket is initially unbound; it must be bound to a specific address via one of its socket's {@link java.net.ServerSocket#bind(SocketAddress) bind} methods before connections can be accepted. </p> @return A new socket channel @throws IOException If an I/O error occurs
ServerSocketChannel::open
java
Reginer/aosp-android-jar
android-34/src/java/nio/channels/ServerSocketChannel.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/nio/channels/ServerSocketChannel.java
MIT
public final int validOps() { return SelectionKey.OP_ACCEPT; }
Returns an operation set identifying this channel's supported operations. <p> Server-socket channels only support the accepting of new connections, so this method returns {@link SelectionKey#OP_ACCEPT}. </p> @return The valid-operation set
ServerSocketChannel::validOps
java
Reginer/aosp-android-jar
android-34/src/java/nio/channels/ServerSocketChannel.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/nio/channels/ServerSocketChannel.java
MIT
public final ServerSocketChannel bind(SocketAddress local) throws IOException { return bind(local, 0); }
Binds the channel's socket to a local address and configures the socket to listen for connections. <p> An invocation of this method is equivalent to the following: <blockquote><pre> bind(local, 0); </pre></blockquote> @param local The local address to bind the socket, or {@code null} to bind to an automatically assigned socket address @return This channel @throws AlreadyBoundException {@inheritDoc} @throws UnsupportedAddressTypeException {@inheritDoc} @throws ClosedChannelException {@inheritDoc} @throws IOException {@inheritDoc} @throws SecurityException If a security manager has been installed and its {@link SecurityManager#checkListen checkListen} method denies the operation @since 1.7
ServerSocketChannel::bind
java
Reginer/aosp-android-jar
android-34/src/java/nio/channels/ServerSocketChannel.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/nio/channels/ServerSocketChannel.java
MIT
private MbmsStreamingSession(Context context, Executor executor, int subscriptionId, MbmsStreamingSessionCallback callback) { mContext = context; mSubscriptionId = subscriptionId; mInternalCallback = new InternalStreamingSessionCallback(callback, executor); }
Metadata key that specifies the component name of the service to bind to for file-download. @hide @TestApi public static final String MBMS_STREAMING_SERVICE_OVERRIDE_METADATA = "mbms-streaming-service-override"; private static AtomicBoolean sIsInitialized = new AtomicBoolean(false); private AtomicReference<IMbmsStreamingService> mService = new AtomicReference<>(null); private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, "Received death notification"); } }; private InternalStreamingSessionCallback mInternalCallback; private ServiceConnection mServiceConnection; private Set<StreamingService> mKnownActiveStreamingServices = new ArraySet<>(); private final Context mContext; private int mSubscriptionId = INVALID_SUBSCRIPTION_ID; /** @hide
MbmsStreamingSession::MbmsStreamingSession
java
Reginer/aosp-android-jar
android-35/src/android/telephony/MbmsStreamingSession.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/MbmsStreamingSession.java
MIT
public static @Nullable MbmsStreamingSession create(@NonNull Context context, @NonNull Executor executor, int subscriptionId, final @NonNull MbmsStreamingSessionCallback callback) { if (!sIsInitialized.compareAndSet(false, true)) { throw new IllegalStateException("Cannot create two instances of MbmsStreamingSession"); } MbmsStreamingSession session = new MbmsStreamingSession(context, executor, subscriptionId, callback); final int result = session.bindAndInitialize(); if (result != MbmsErrors.SUCCESS) { sIsInitialized.set(false); executor.execute(new Runnable() { @Override public void run() { callback.onError(result, null); } }); return null; } return session; }
Create a new {@link MbmsStreamingSession} using the given subscription ID. Note that this call will bind a remote service. You may not call this method on your app's main thread. You may only have one instance of {@link MbmsStreamingSession} per UID. If you call this method while there is an active instance of {@link MbmsStreamingSession} in your process (in other words, one that has not had {@link #close()} called on it), this method will throw an {@link IllegalStateException}. If you call this method in a different process running under the same UID, an error will be indicated via {@link MbmsStreamingSessionCallback#onError(int, String)}. Note that initialization may fail asynchronously. If you wish to try again after you receive such an asynchronous error, you must call {@link #close()} on the instance of {@link MbmsStreamingSession} that you received before calling this method again. @param context The {@link Context} to use. @param executor The executor on which you wish to execute callbacks. @param subscriptionId The subscription ID to use. @param callback A callback object on which you wish to receive results of asynchronous operations. @return An instance of {@link MbmsStreamingSession}, or null if an error occurred.
MbmsStreamingSession::create
java
Reginer/aosp-android-jar
android-35/src/android/telephony/MbmsStreamingSession.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/MbmsStreamingSession.java
MIT
public static MbmsStreamingSession create(@NonNull Context context, @NonNull Executor executor, @NonNull MbmsStreamingSessionCallback callback) { return create(context, executor, SubscriptionManager.getDefaultSubscriptionId(), callback); }
Create a new {@link MbmsStreamingSession} using the system default data subscription ID. See {@link #create(Context, Executor, int, MbmsStreamingSessionCallback)}.
MbmsStreamingSession::create
java
Reginer/aosp-android-jar
android-35/src/android/telephony/MbmsStreamingSession.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/MbmsStreamingSession.java
MIT
public void close() { try { IMbmsStreamingService streamingService = mService.get(); if (streamingService == null || mServiceConnection == null) { // Ignore and return, assume already disposed. return; } streamingService.dispose(mSubscriptionId); for (StreamingService s : mKnownActiveStreamingServices) { s.getCallback().stop(); } mKnownActiveStreamingServices.clear(); mContext.unbindService(mServiceConnection); } catch (RemoteException e) { // Ignore for now } finally { mService.set(null); sIsInitialized.set(false); mServiceConnection = null; mInternalCallback.stop(); } }
Terminates this instance. Also terminates any streaming services spawned from this instance as if {@link StreamingService#close()} had been called on them. After this method returns, no further callbacks originating from the middleware will be enqueued on the provided instance of {@link MbmsStreamingSessionCallback}, but callbacks that have already been enqueued will still be delivered. It is safe to call {@link #create(Context, Executor, int, MbmsStreamingSessionCallback)} to obtain another instance of {@link MbmsStreamingSession} immediately after this method returns. May throw an {@link IllegalStateException}
MbmsStreamingSession::close
java
Reginer/aosp-android-jar
android-35/src/android/telephony/MbmsStreamingSession.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/MbmsStreamingSession.java
MIT
public void requestUpdateStreamingServices(List<String> serviceClassList) { IMbmsStreamingService streamingService = mService.get(); if (streamingService == null) { throw new IllegalStateException("Middleware not yet bound"); } try { int returnCode = streamingService.requestUpdateStreamingServices( mSubscriptionId, serviceClassList); if (returnCode == MbmsErrors.UNKNOWN) { // Unbind and throw an obvious error close(); throw new IllegalStateException("Middleware must not return an unknown error code"); } if (returnCode != MbmsErrors.SUCCESS) { sendErrorToApp(returnCode, null); } } catch (RemoteException e) { Log.w(LOG_TAG, "Remote process died"); mService.set(null); sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); } }
An inspection API to retrieve the list of streaming media currently be advertised. The results are returned asynchronously via {@link MbmsStreamingSessionCallback#onStreamingServicesUpdated(List)} on the callback provided upon creation. Multiple calls replace the list of service classes of interest. May throw an {@link IllegalArgumentException} or an {@link IllegalStateException}. @param serviceClassList A list of streaming service classes that the app would like updates on. The exact names of these classes should be negotiated with the wireless carrier separately.
MbmsStreamingSession::requestUpdateStreamingServices
java
Reginer/aosp-android-jar
android-35/src/android/telephony/MbmsStreamingSession.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/MbmsStreamingSession.java
MIT
public @Nullable StreamingService startStreaming(StreamingServiceInfo serviceInfo, @NonNull Executor executor, StreamingServiceCallback callback) { IMbmsStreamingService streamingService = mService.get(); if (streamingService == null) { throw new IllegalStateException("Middleware not yet bound"); } InternalStreamingServiceCallback serviceCallback = new InternalStreamingServiceCallback( callback, executor); StreamingService serviceForApp = new StreamingService( mSubscriptionId, streamingService, this, serviceInfo, serviceCallback); mKnownActiveStreamingServices.add(serviceForApp); try { int returnCode = streamingService.startStreaming( mSubscriptionId, serviceInfo.getServiceId(), serviceCallback); if (returnCode == MbmsErrors.UNKNOWN) { // Unbind and throw an obvious error close(); throw new IllegalStateException("Middleware must not return an unknown error code"); } if (returnCode != MbmsErrors.SUCCESS) { sendErrorToApp(returnCode, null); return null; } } catch (RemoteException e) { Log.w(LOG_TAG, "Remote process died"); mService.set(null); sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); return null; } return serviceForApp; }
Starts streaming a requested service, reporting status to the indicated callback. Returns an object used to control that stream. The stream may not be ready for consumption immediately upon return from this method -- wait until the streaming state has been reported via {@link android.telephony.mbms.StreamingServiceCallback#onStreamStateUpdated(int, int)} May throw an {@link IllegalArgumentException} or an {@link IllegalStateException} Asynchronous errors through the callback include any of the errors in {@link MbmsErrors.GeneralErrors} or {@link MbmsErrors.StreamingErrors}. @param serviceInfo The information about the service to stream. @param executor The executor on which you wish to execute callbacks for this stream. @param callback A callback that'll be called when something about the stream changes. @return An instance of {@link StreamingService} through which the stream can be controlled. May be {@code null} if an error occurred.
MbmsStreamingSession::startStreaming
java
Reginer/aosp-android-jar
android-35/src/android/telephony/MbmsStreamingSession.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/MbmsStreamingSession.java
MIT
public void onStreamingServiceStopped(StreamingService service) { mKnownActiveStreamingServices.remove(service); }
Starts streaming a requested service, reporting status to the indicated callback. Returns an object used to control that stream. The stream may not be ready for consumption immediately upon return from this method -- wait until the streaming state has been reported via {@link android.telephony.mbms.StreamingServiceCallback#onStreamStateUpdated(int, int)} May throw an {@link IllegalArgumentException} or an {@link IllegalStateException} Asynchronous errors through the callback include any of the errors in {@link MbmsErrors.GeneralErrors} or {@link MbmsErrors.StreamingErrors}. @param serviceInfo The information about the service to stream. @param executor The executor on which you wish to execute callbacks for this stream. @param callback A callback that'll be called when something about the stream changes. @return An instance of {@link StreamingService} through which the stream can be controlled. May be {@code null} if an error occurred. public @Nullable StreamingService startStreaming(StreamingServiceInfo serviceInfo, @NonNull Executor executor, StreamingServiceCallback callback) { IMbmsStreamingService streamingService = mService.get(); if (streamingService == null) { throw new IllegalStateException("Middleware not yet bound"); } InternalStreamingServiceCallback serviceCallback = new InternalStreamingServiceCallback( callback, executor); StreamingService serviceForApp = new StreamingService( mSubscriptionId, streamingService, this, serviceInfo, serviceCallback); mKnownActiveStreamingServices.add(serviceForApp); try { int returnCode = streamingService.startStreaming( mSubscriptionId, serviceInfo.getServiceId(), serviceCallback); if (returnCode == MbmsErrors.UNKNOWN) { // Unbind and throw an obvious error close(); throw new IllegalStateException("Middleware must not return an unknown error code"); } if (returnCode != MbmsErrors.SUCCESS) { sendErrorToApp(returnCode, null); return null; } } catch (RemoteException e) { Log.w(LOG_TAG, "Remote process died"); mService.set(null); sIsInitialized.set(false); sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null); return null; } return serviceForApp; } /** @hide
MbmsStreamingSession::onStreamingServiceStopped
java
Reginer/aosp-android-jar
android-35/src/android/telephony/MbmsStreamingSession.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/telephony/MbmsStreamingSession.java
MIT
public static Set<Locale> getAvailableLocales() { Locale[] l = DecimalFormatSymbols.getAvailableLocales(); Set<Locale> locales = new HashSet<>(l.length); Collections.addAll(locales, l); return locales; }
Lists all the locales that are supported. <p> The locale 'en_US' will always be present. @return a Set of Locales for which localization is supported
DecimalStyle::getAvailableLocales
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public static DecimalStyle ofDefaultLocale() { return of(Locale.getDefault(Locale.Category.FORMAT)); }
Obtains the DecimalStyle for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale. <p> This method provides access to locale sensitive decimal style symbols. <p> This is equivalent to calling {@link #of(Locale) of(Locale.getDefault(Locale.Category.FORMAT))}. @see java.util.Locale.Category#FORMAT @return the decimal style, not null
DecimalStyle::ofDefaultLocale
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public static DecimalStyle of(Locale locale) { Objects.requireNonNull(locale, "locale"); DecimalStyle info = CACHE.get(locale); if (info == null) { info = create(locale); CACHE.putIfAbsent(locale, info); info = CACHE.get(locale); } return info; }
Obtains the DecimalStyle for the specified locale. <p> This method provides access to locale sensitive decimal style symbols. @param locale the locale, not null @return the decimal style, not null
DecimalStyle::of
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
private DecimalStyle(char zeroChar, char positiveSignChar, char negativeSignChar, char decimalPointChar) { this.zeroDigit = zeroChar; this.positiveSign = positiveSignChar; this.negativeSign = negativeSignChar; this.decimalSeparator = decimalPointChar; }
Restricted constructor. @param zeroChar the character to use for the digit of zero @param positiveSignChar the character to use for the positive sign @param negativeSignChar the character to use for the negative sign @param decimalPointChar the character to use for the decimal point
DecimalStyle::DecimalStyle
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public char getZeroDigit() { return zeroDigit; }
Gets the character that represents zero. <p> The character used to represent digits may vary by culture. This method specifies the zero character to use, which implies the characters for one to nine. @return the character for zero
DecimalStyle::getZeroDigit
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public DecimalStyle withZeroDigit(char zeroDigit) { if (zeroDigit == this.zeroDigit) { return this; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
Returns a copy of the info with a new character that represents zero. <p> The character used to represent digits may vary by culture. This method specifies the zero character to use, which implies the characters for one to nine. @param zeroDigit the character for zero @return a copy with a new character that represents zero, not null
DecimalStyle::withZeroDigit
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public char getPositiveSign() { return positiveSign; }
Gets the character that represents the positive sign. <p> The character used to represent a positive number may vary by culture. This method specifies the character to use. @return the character for the positive sign
DecimalStyle::getPositiveSign
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public DecimalStyle withPositiveSign(char positiveSign) { if (positiveSign == this.positiveSign) { return this; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
Returns a copy of the info with a new character that represents the positive sign. <p> The character used to represent a positive number may vary by culture. This method specifies the character to use. @param positiveSign the character for the positive sign @return a copy with a new character that represents the positive sign, not null
DecimalStyle::withPositiveSign
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public char getNegativeSign() { return negativeSign; }
Gets the character that represents the negative sign. <p> The character used to represent a negative number may vary by culture. This method specifies the character to use. @return the character for the negative sign
DecimalStyle::getNegativeSign
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public DecimalStyle withNegativeSign(char negativeSign) { if (negativeSign == this.negativeSign) { return this; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
Returns a copy of the info with a new character that represents the negative sign. <p> The character used to represent a negative number may vary by culture. This method specifies the character to use. @param negativeSign the character for the negative sign @return a copy with a new character that represents the negative sign, not null
DecimalStyle::withNegativeSign
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public char getDecimalSeparator() { return decimalSeparator; }
Gets the character that represents the decimal point. <p> The character used to represent a decimal point may vary by culture. This method specifies the character to use. @return the character for the decimal point
DecimalStyle::getDecimalSeparator
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public DecimalStyle withDecimalSeparator(char decimalSeparator) { if (decimalSeparator == this.decimalSeparator) { return this; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
Returns a copy of the info with a new character that represents the decimal point. <p> The character used to represent a decimal point may vary by culture. This method specifies the character to use. @param decimalSeparator the character for the decimal point @return a copy with a new character that represents the decimal point, not null
DecimalStyle::withDecimalSeparator
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
int convertToDigit(char ch) { int val = ch - zeroDigit; return (val >= 0 && val <= 9) ? val : -1; }
Checks whether the character is a digit, based on the currently set zero character. @param ch the character to check @return the value, 0 to 9, of the character, or -1 if not a digit
DecimalStyle::convertToDigit
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
String convertNumberToI18N(String numericText) { if (zeroDigit == '0') { return numericText; } int diff = zeroDigit - '0'; char[] array = numericText.toCharArray(); for (int i = 0; i < array.length; i++) { array[i] = (char) (array[i] + diff); } return new String(array); }
Converts the input numeric text to the internationalized form using the zero character. @param numericText the text, consisting of digits 0 to 9, to convert, not null @return the internationalized text, not null
DecimalStyle::convertNumberToI18N
java
Reginer/aosp-android-jar
android-31/src/java/time/format/DecimalStyle.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/java/time/format/DecimalStyle.java
MIT
public MtpDevice(@NonNull UsbDevice device) { Preconditions.checkNotNull(device); mDevice = device; }
MtpClient constructor @param device the {@link android.hardware.usb.UsbDevice} for the MTP or PTP device
MtpDevice::MtpDevice
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public boolean open(@NonNull UsbDeviceConnection connection) { boolean result = false; Context context = connection.getContext(); synchronized (mLock) { if (context != null) { UserManager userManager = (UserManager) context .getSystemService(Context.USER_SERVICE); if (!userManager.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER)) { result = native_open(mDevice.getDeviceName(), connection.getFileDescriptor()); } } if (!result) { connection.close(); } else { mConnection = connection; mCloseGuard.open("close"); } } return result; }
Opens the MTP device. Once the device is open it takes ownership of the {@link android.hardware.usb.UsbDeviceConnection}. The connection will be closed when you call {@link #close()} The connection will also be closed if this method fails. @param connection an open {@link android.hardware.usb.UsbDeviceConnection} for the device @return true if the device was successfully opened.
MtpDevice::open
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public void close() { synchronized (mLock) { if (mConnection != null) { mCloseGuard.close(); native_close(); mConnection.close(); mConnection = null; } } }
Closes all resources related to the MtpDevice object. After this is called, the object can not be used until {@link #open} is called again with a new {@link android.hardware.usb.UsbDeviceConnection}.
MtpDevice::close
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @NonNull String getDeviceName() { return mDevice.getDeviceName(); }
Returns the name of the USB device This returns the same value as {@link android.hardware.usb.UsbDevice#getDeviceName} for the device's {@link android.hardware.usb.UsbDevice} @return the device name
MtpDevice::getDeviceName
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public int getDeviceId() { return mDevice.getDeviceId(); }
Returns the USB ID of the USB device. This returns the same value as {@link android.hardware.usb.UsbDevice#getDeviceId} for the device's {@link android.hardware.usb.UsbDevice} @return the device ID
MtpDevice::getDeviceId
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @Nullable MtpDeviceInfo getDeviceInfo() { return native_get_device_info(); }
Returns the {@link MtpDeviceInfo} for this device @return the device info, or null if fetching device info fails
MtpDevice::getDeviceInfo
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public int setDevicePropertyInitVersion(@NonNull String propertyStr) { return native_set_device_property_init_version(propertyStr); }
Set device property SESSION_INITIATOR_VERSION_INFO @param propertyStr string value for device property SESSION_INITIATOR_VERSION_INFO @return -1 for error, 0 for success {@hide}
MtpDevice::setDevicePropertyInitVersion
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @Nullable int[] getStorageIds() { return native_get_storage_ids(); }
Returns the list of IDs for all storage units on this device Information about each storage unit can be accessed via {@link #getStorageInfo}. @return the list of storage IDs, or null if fetching storage IDs fails
MtpDevice::getStorageIds
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @Nullable int[] getObjectHandles(int storageId, int format, int objectHandle) { return native_get_object_handles(storageId, format, objectHandle); }
Returns the list of object handles for all objects on the given storage unit, with the given format and parent. Information about each object can be accessed via {@link #getObjectInfo}. @param storageId the storage unit to query @param format the format of the object to return, or zero for all formats @param objectHandle the parent object to query, -1 for the storage root, or zero for all objects @return the object handles, or null if fetching object handles fails
MtpDevice::getObjectHandles
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @Nullable byte[] getObject(int objectHandle, int objectSize) { Preconditions.checkArgumentNonnegative(objectSize, "objectSize should not be negative"); return native_get_object(objectHandle, objectSize); }
Returns the data for an object as a byte array. This call may block for an arbitrary amount of time depending on the size of the data and speed of the devices. @param objectHandle handle of the object to read @param objectSize the size of the object (this should match {@link MtpObjectInfo#getCompressedSize}) @return the object's data, or null if reading fails
MtpDevice::getObject
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public long getPartialObject(int objectHandle, long offset, long size, @NonNull byte[] buffer) throws IOException { return native_get_partial_object(objectHandle, offset, size, buffer); }
Obtains object bytes in the specified range and writes it to an array. This call may block for an arbitrary amount of time depending on the size of the data and speed of the devices. @param objectHandle handle of the object to read @param offset Start index of reading range. It must be a non-negative value at most 0xffffffff. @param size Size of reading range. It must be a non-negative value at most Integer.MAX_VALUE or 0xffffffff. If 0xffffffff is specified, the method obtains the full bytes of object. @param buffer Array to write data. @return Size of bytes that are actually read.
MtpDevice::getPartialObject
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public long getPartialObject64(int objectHandle, long offset, long size, @NonNull byte[] buffer) throws IOException { return native_get_partial_object_64(objectHandle, offset, size, buffer); }
Obtains object bytes in the specified range and writes it to an array. This call may block for an arbitrary amount of time depending on the size of the data and speed of the devices. This is a vender-extended operation supported by Android that enables us to pass unsigned 64-bit offset. Check if the MTP device supports the operation by using {@link MtpDeviceInfo#getOperationsSupported()}. @param objectHandle handle of the object to read @param offset Start index of reading range. It must be a non-negative value. @param size Size of reading range. It must be a non-negative value at most Integer.MAX_VALUE. @param buffer Array to write data. @return Size of bytes that are actually read. @see MtpConstants#OPERATION_GET_PARTIAL_OBJECT_64
MtpDevice::getPartialObject64
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @Nullable byte[] getThumbnail(int objectHandle) { return native_get_thumbnail(objectHandle); }
Returns the thumbnail data for an object as a byte array. The size and format of the thumbnail data can be determined via {@link MtpObjectInfo#getThumbCompressedSize} and {@link MtpObjectInfo#getThumbFormat}. For typical devices the format is JPEG. @param objectHandle handle of the object to read @return the object's thumbnail, or null if reading fails
MtpDevice::getThumbnail
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @Nullable MtpStorageInfo getStorageInfo(int storageId) { return native_get_storage_info(storageId); }
Retrieves the {@link MtpStorageInfo} for a storage unit. @param storageId the ID of the storage unit @return the MtpStorageInfo, or null if fetching storage info fails
MtpDevice::getStorageInfo
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @Nullable MtpObjectInfo getObjectInfo(int objectHandle) { return native_get_object_info(objectHandle); }
Retrieves the {@link MtpObjectInfo} for an object. @param objectHandle the handle of the object @return the MtpObjectInfo, or null if fetching object info fails
MtpDevice::getObjectInfo
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public boolean deleteObject(int objectHandle) { return native_delete_object(objectHandle); }
Deletes an object on the device. This call may block, since deleting a directory containing many files may take a long time on some devices. @param objectHandle handle of the object to delete @return true if the deletion succeeds
MtpDevice::deleteObject
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public long getParent(int objectHandle) { return native_get_parent(objectHandle); }
Retrieves the object handle for the parent of an object on the device. @param objectHandle handle of the object to query @return the parent's handle, or zero if it is in the root of the storage
MtpDevice::getParent
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public long getStorageId(int objectHandle) { return native_get_storage_id(objectHandle); }
Retrieves the ID of the storage unit containing the given object on the device. @param objectHandle handle of the object to query @return the object's storage unit ID
MtpDevice::getStorageId
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public boolean importFile(int objectHandle, @NonNull String destPath) { return native_import_file(objectHandle, destPath); }
Copies the data for an object to a file in external storage. This call may block for an arbitrary amount of time depending on the size of the data and speed of the devices. @param objectHandle handle of the object to read @param destPath path to destination for the file transfer. This path should be in the external storage as defined by {@link android.os.Environment#getExternalStorageDirectory} @return true if the file transfer succeeds
MtpDevice::importFile
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public boolean importFile(int objectHandle, @NonNull ParcelFileDescriptor descriptor) { return native_import_file(objectHandle, descriptor.getFd()); }
Copies the data for an object to a file descriptor. This call may block for an arbitrary amount of time depending on the size of the data and speed of the devices. The file descriptor is not closed on completion, and must be done by the caller. @param objectHandle handle of the object to read @param descriptor file descriptor to write the data to for the file transfer. @return true if the file transfer succeeds
MtpDevice::importFile
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public boolean sendObject( int objectHandle, long size, @NonNull ParcelFileDescriptor descriptor) { return native_send_object(objectHandle, size, descriptor.getFd()); }
Copies the data for an object from a file descriptor. This call may block for an arbitrary amount of time depending on the size of the data and speed of the devices. The file descriptor is not closed on completion, and must be done by the caller. @param objectHandle handle of the target file @param size size of the file in bytes @param descriptor file descriptor to read the data from. @return true if the file transfer succeeds
MtpDevice::sendObject
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @Nullable MtpObjectInfo sendObjectInfo(@NonNull MtpObjectInfo info) { return native_send_object_info(info); }
Uploads an object metadata for a new entry. The {@link MtpObjectInfo} can be created with the {@link MtpObjectInfo.Builder} class. The returned {@link MtpObjectInfo} has the new object handle field filled in. @param info metadata of the entry @return object info of the created entry, or null if sending object info fails
MtpDevice::sendObjectInfo
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public @NonNull MtpEvent readEvent(@Nullable CancellationSignal signal) throws IOException { final int handle = native_submit_event_request(); Preconditions.checkState(handle >= 0, "Other thread is reading an event."); if (signal != null) { signal.setOnCancelListener(new CancellationSignal.OnCancelListener() { @Override public void onCancel() { native_discard_event_request(handle); } }); } try { return native_reap_event_request(handle); } finally { if (signal != null) { signal.setOnCancelListener(null); } } }
Reads an event from the device. It blocks the current thread until it gets an event. It throws OperationCanceledException if it is cancelled by signal. @param signal signal for cancellation @return obtained event @throws IOException
MtpDevice::readEvent
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public long getObjectSizeLong(int handle, int format) throws IOException { return native_get_object_size_long(handle, format); }
Returns object size in 64-bit integer. Though MtpObjectInfo#getCompressedSize returns the object size in 32-bit unsigned integer, this method returns the object size in 64-bit integer from the object property. Thus it can fetch 4GB+ object size correctly. If the device does not support objectSize property, it throws IOException. @hide
MtpDevice::getObjectSizeLong
java
Reginer/aosp-android-jar
android-31/src/android/mtp/MtpDevice.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java
MIT
public static final MatchFilter sUrlMatchFilter = new MatchFilter() { public final boolean acceptMatch(CharSequence s, int start, int end) { if (start == 0) { return true; } if (s.charAt(start - 1) == '@') { return false; } return true; } };
Filters out web URL matches that occur after an at-sign (@). This is to prevent turning the domain name in an email address into a web link.
Linkify::MatchFilter
java
Reginer/aosp-android-jar
android-35/src/android/text/util/Linkify.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java
MIT
public static final MatchFilter sPhoneNumberMatchFilter = new MatchFilter() { public final boolean acceptMatch(CharSequence s, int start, int end) { int digitCount = 0; for (int i = start; i < end; i++) { if (Character.isDigit(s.charAt(i))) { digitCount++; if (digitCount >= PHONE_NUMBER_MINIMUM_DIGITS) { return true; } } } return false; } };
Filters out URL matches that don't have enough digits to be a phone number.
Linkify::MatchFilter
java
Reginer/aosp-android-jar
android-35/src/android/text/util/Linkify.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java
MIT
public static final TransformFilter sPhoneNumberTransformFilter = new TransformFilter() { public final String transformUrl(final Matcher match, String url) { return Patterns.digitsAndPlusOnly(match); } };
Transforms matched phone number text into something suitable to be used in a tel: URL. It does this by removing everything but the digits and plus signs. For instance: &apos;+1 (919) 555-1212&apos; becomes &apos;+19195551212&apos;
Linkify::TransformFilter
java
Reginer/aosp-android-jar
android-35/src/android/text/util/Linkify.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java
MIT
public static final boolean addLinks(@NonNull Spannable text, @LinkifyMask int mask) { return addLinks(text, mask, null, null); }
Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links. If the mask is nonzero, it also removes any existing URLSpans attached to the Spannable, to avoid problems if you call it repeatedly on the same text. @param text Spannable whose text is to be marked-up with links @param mask Mask to define which kinds of links will be searched. @return True if at least one link is found and applied. @see #addLinks(Spannable, int, Function)
Linkify::addLinks
java
Reginer/aosp-android-jar
android-35/src/android/text/util/Linkify.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java
MIT
public static final boolean addLinks(@NonNull Spannable text, @LinkifyMask int mask, @Nullable Function<String, URLSpan> urlSpanFactory) { return addLinks(text, mask, null, urlSpanFactory); }
Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links. If the mask is nonzero, it also removes any existing URLSpans attached to the Spannable, to avoid problems if you call it repeatedly on the same text. @param text Spannable whose text is to be marked-up with links @param mask mask to define which kinds of links will be searched @param urlSpanFactory function used to create {@link URLSpan}s @return True if at least one link is found and applied.
Linkify::addLinks
java
Reginer/aosp-android-jar
android-35/src/android/text/util/Linkify.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java
MIT
public boolean isEnabled() { return mIsEnabled; }
Is the preferential network enabled. @return true if enabled else false
PreferentialNetworkServiceConfig::isEnabled
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public boolean isFallbackToDefaultConnectionAllowed() { return mAllowFallbackToDefaultConnection; }
Whether fallback to the device-wide default network is allowed. This boolean configures whether the default connection (e.g. general cell network or wifi) should be used if no preferential network service connection is available. If true, the default connection will be used when no preferential service is available. If false, the UIDs subject to this configuration will have no default network. Note that while this boolean determines whether the UIDs subject to this configuration have a default network in the absence of a preferential service, apps can still explicitly decide to use another network than their default network by requesting them from the system. This boolean does not determine whether the UIDs are blocked from using such other networks. See {@link #shouldBlockNonMatchingNetworks()} for that configuration. @return true if fallback is allowed, else false.
PreferentialNetworkServiceConfig::isFallbackToDefaultConnectionAllowed
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public boolean shouldBlockNonMatchingNetworks() { return mShouldBlockNonMatchingNetworks; }
Whether to block UIDs from using other networks than the preferential service. Apps can inspect the list of available networks on the device and choose to use multiple of them concurrently for performance, privacy or other reasons. This boolean configures whether the concerned UIDs should be blocked from using networks that do not match the configured preferential network service even if these networks are otherwise open to all apps. @return true if UIDs should be blocked from using the other networks, else false.
PreferentialNetworkServiceConfig::shouldBlockNonMatchingNetworks
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public @NonNull int[] getIncludedUids() { return mIncludedUids; }
Get the array of uids that are applicable for the profile preference. {@see #getExcludedUids()} Included UIDs and Excluded UIDs can't both be non-empty. if both are empty, it means this request applies to all uids in the user profile. if included is not empty, then only included UIDs are applied. if excluded is not empty, then it is all uids in the user profile except these UIDs. @return Array of uids applicable for the profile preference. Empty array would mean that this request applies to all uids in the profile.
PreferentialNetworkServiceConfig::getIncludedUids
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public @NonNull int[] getExcludedUids() { return mExcludedUids; }
Get the array of uids that are excluded for the profile preference. {@see #getIncludedUids()} Included UIDs and Excluded UIDs can't both be non-empty. if both are empty, it means this request applies to all uids in the user profile. if included is not empty, then only included UIDs are applied. if excluded is not empty, then it is all uids in the user profile except these UIDs. @return Array of uids that are excluded for the profile preference. Empty array would mean that this request applies to all uids in the profile.
PreferentialNetworkServiceConfig::getExcludedUids
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public @PreferentialNetworkPreferenceId int getNetworkId() { return mNetworkId; }
@return preference enterprise identifier. preference identifier is applicable only if preference network service is enabled
PreferentialNetworkServiceConfig::getNetworkId
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public Builder() {}
Constructs an empty Builder with preferential network disabled by default.
Builder::Builder
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public static PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig( TypedXmlPullParser parser, String tag) throws XmlPullParserException, IOException { int outerDepthDAM = parser.getDepth(); int typeDAM; PreferentialNetworkServiceConfig.Builder resultBuilder = new PreferentialNetworkServiceConfig.Builder(); while ((typeDAM = parser.next()) != END_DOCUMENT && (typeDAM != END_TAG || parser.getDepth() > outerDepthDAM)) { if (typeDAM == END_TAG || typeDAM == TEXT) { continue; } String tagDAM = parser.getName(); if (TAG_CONFIG_ENABLED.equals(tagDAM)) { resultBuilder.setEnabled(parser.getAttributeBoolean(null, ATTR_VALUE, DevicePolicyManager.PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT)); } else if (TAG_NETWORK_ID.equals(tagDAM)) { int val = parser.getAttributeInt(null, ATTR_VALUE, 0); if (val != 0) { resultBuilder.setNetworkId(val); } } else if (TAG_ALLOW_FALLBACK_TO_DEFAULT_CONNECTION.equals(tagDAM)) { resultBuilder.setFallbackToDefaultConnectionAllowed(parser.getAttributeBoolean( null, ATTR_VALUE, true)); } else if (TAG_BLOCK_NON_MATCHING_NETWORKS.equals(tagDAM)) { resultBuilder.setShouldBlockNonMatchingNetworks(parser.getAttributeBoolean( null, ATTR_VALUE, false)); } else if (TAG_INCLUDED_UIDS.equals(tagDAM)) { resultBuilder.setIncludedUids(readStringListToIntArray(parser, TAG_UID)); } else if (TAG_EXCLUDED_UIDS.equals(tagDAM)) { resultBuilder.setExcludedUids(readStringListToIntArray(parser, TAG_UID)); } else { Log.w(LOG_TAG, "Unknown tag under " + tag + ": " + tagDAM); } } return resultBuilder.build(); }
@hide
Builder::getPreferentialNetworkServiceConfig
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public void writeToXml(@NonNull TypedXmlSerializer out) throws IOException { out.startTag(null, TAG_PREFERENTIAL_NETWORK_SERVICE_CONFIG); writeAttributeValueToXml(out, TAG_CONFIG_ENABLED, isEnabled()); writeAttributeValueToXml(out, TAG_NETWORK_ID, getNetworkId()); writeAttributeValueToXml(out, TAG_ALLOW_FALLBACK_TO_DEFAULT_CONNECTION, isFallbackToDefaultConnectionAllowed()); writeAttributeValueToXml(out, TAG_BLOCK_NON_MATCHING_NETWORKS, shouldBlockNonMatchingNetworks()); writeAttributeValuesToXml(out, TAG_INCLUDED_UIDS, TAG_UID, intArrayToStringList(getIncludedUids())); writeAttributeValuesToXml(out, TAG_EXCLUDED_UIDS, TAG_UID, intArrayToStringList(getExcludedUids())); out.endTag(null, TAG_PREFERENTIAL_NETWORK_SERVICE_CONFIG); }
@hide
Builder::writeToXml
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public void dump(IndentingPrintWriter pw) { pw.print("networkId="); pw.println(mNetworkId); pw.print("isEnabled="); pw.println(mIsEnabled); pw.print("allowFallbackToDefaultConnection="); pw.println(mAllowFallbackToDefaultConnection); pw.print("blockNonMatchingNetworks="); pw.println(mShouldBlockNonMatchingNetworks); pw.print("includedUids="); pw.println(Arrays.toString(mIncludedUids)); pw.print("excludedUids="); pw.println(Arrays.toString(mExcludedUids)); }
@hide
Builder::dump
java
Reginer/aosp-android-jar
android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java
MIT
public static void setLoggingLevel() { final int defaultLevel = getDefaultLoggingLevel(); final int level = DeviceConfig.getInt(DeviceConfig.NAMESPACE_CONTENT_CAPTURE, DEVICE_CONFIG_PROPERTY_LOGGING_LEVEL, defaultLevel); setLoggingLevel(level); }
Sets the value of the static logging level constants based on device config.
getSimpleName::setLoggingLevel
java
Reginer/aosp-android-jar
android-32/src/android/view/contentcapture/ContentCaptureHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/contentcapture/ContentCaptureHelper.java
MIT
public static void setLoggingLevel(@LoggingLevel int level) { Log.i(TAG, "Setting logging level to " + getLoggingLevelAsString(level)); sVerbose = sDebug = false; switch (level) { case LOGGING_LEVEL_VERBOSE: sVerbose = true; // fall through case LOGGING_LEVEL_DEBUG: sDebug = true; return; case LOGGING_LEVEL_OFF: // You log nothing, Jon Snow! return; default: Log.w(TAG, "setLoggingLevel(): invalud level: " + level); } }
Sets the value of the static logging level constants based the given level.
getSimpleName::setLoggingLevel
java
Reginer/aosp-android-jar
android-32/src/android/view/contentcapture/ContentCaptureHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/contentcapture/ContentCaptureHelper.java
MIT
public static String getLoggingLevelAsString(@LoggingLevel int level) { switch (level) { case LOGGING_LEVEL_OFF: return "OFF"; case LOGGING_LEVEL_DEBUG: return "DEBUG"; case LOGGING_LEVEL_VERBOSE: return "VERBOSE"; default: return "UNKNOWN-" + level; } }
Gets a user-friendly value for a content capture logging level.
getSimpleName::getLoggingLevelAsString
java
Reginer/aosp-android-jar
android-32/src/android/view/contentcapture/ContentCaptureHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/contentcapture/ContentCaptureHelper.java
MIT
public DataThrottlingEntry(@NonNull DataProfile dataProfile, @Nullable NetworkRequestList networkRequestList, @Nullable DataNetwork dataNetwork, @TransportType int transport, @RetryType int retryType, @ElapsedRealtimeLong long expirationTimeMillis) { this.dataProfile = dataProfile; this.networkRequestList = networkRequestList; this.dataNetwork = dataNetwork; this.transport = transport; this.retryType = retryType; this.expirationTimeMillis = expirationTimeMillis; }
Constructor. @param dataProfile The data profile that is being throttled for setup/handover retry. @param networkRequestList The associated network request list when throttling happened. Should be {@code null} when retry type is {@link ThrottleStatus#RETRY_TYPE_HANDOVER}. @param dataNetwork The data network that is being throttled for handover retry. Should be {@code null} when retryType is {@link ThrottleStatus#RETRY_TYPE_NEW_CONNECTION}. @param transport The transport that the data profile has been throttled on. @param retryType The retry type when throttling expires. @param expirationTimeMillis The expiration elapsed time of data throttling.
DataThrottlingEntry::DataThrottlingEntry
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull List<Long> getRetryIntervalsMillis() { return mRetryIntervalsMillis; }
@return The data network setup retry intervals in milliseconds. If this is empty, then {@link #getMaxRetries()} must return 0.
DataRetryRule::getRetryIntervalsMillis
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public int getMaxRetries() { return mMaxRetries; }
@return The maximum retry times. After reaching the retry times, data retry will not be scheduled with timer. Only environment changes (e.g. Airplane mode, SIM state, RAT, registration state changes, etc..) can trigger the retry. Note that if max retries is 0, then {@link #getRetryIntervalsMillis()} must be {@code null}.
DataRetryRule::getMaxRetries
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public DataSetupRetryRule(@NonNull String ruleString) { super(ruleString); ruleString = ruleString.trim().toLowerCase(Locale.ROOT); String[] expressions = ruleString.split("\\s*,\\s*"); for (String expression : expressions) { String[] tokens = expression.trim().split("\\s*=\\s*"); if (tokens.length != 2) { throw new IllegalArgumentException("illegal rule " + ruleString); } String key = tokens[0].trim(); String value = tokens[1].trim(); try { switch (key) { case RULE_TAG_PERMANENT_FAIL_CAUSES: mFailCauses = Arrays.stream(value.split("\\s*\\|\\s*")) .map(String::trim) .map(Integer::valueOf) .collect(Collectors.toSet()); mIsPermanentFailCauseRule = true; break; case RULE_TAG_CAPABILITIES: mNetworkCapabilities = DataUtils .getNetworkCapabilitiesFromString(value); break; } } catch (Exception e) { e.printStackTrace(); throw new IllegalArgumentException("illegal rule " + ruleString + ", e=" + e); } } if (mFailCauses.isEmpty() && (mNetworkCapabilities.isEmpty() || mNetworkCapabilities.contains(-1))) { throw new IllegalArgumentException("illegal rule " + ruleString + ". Should have either valid network capabilities or fail causes."); } }
Constructor @param ruleString The retry rule in string format. @throws IllegalArgumentException if the string can't be parsed to a retry rule.
DataSetupRetryRule::DataSetupRetryRule
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public boolean isPermanentFailCauseRule() { return mIsPermanentFailCauseRule; }
@return {@code true} if this rule is for permanent fail causes.
DataSetupRetryRule::isPermanentFailCauseRule
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public boolean canBeMatched(@NonNull @NetCapability int networkCapability, @DataFailureCause int cause) { if (!mFailCauses.isEmpty() && !mFailCauses.contains(cause)) { return false; } return mNetworkCapabilities.isEmpty() || mNetworkCapabilities.contains(networkCapability); }
Check if this rule can be matched. @param networkCapability The network capability for matching. @param cause Fail cause from previous setup data request. @return {@code true} if the retry rule can be matched.
DataSetupRetryRule::canBeMatched
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public DataHandoverRetryRule(@NonNull String ruleString) { super(ruleString); }
Constructor @param ruleString The retry rule in string format. @throws IllegalArgumentException if the string can't be parsed to a retry rule.
DataHandoverRetryRule::DataHandoverRetryRule
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public DataRetryEntry(@Nullable DataRetryRule appliedDataRetryRule, long retryDelayMillis) { this.appliedDataRetryRule = appliedDataRetryRule; this.retryDelayMillis = retryDelayMillis; mRetryStateTimestamp = SystemClock.elapsedRealtime(); retryElapsedTime = mRetryStateTimestamp + retryDelayMillis; }
Constructor @param appliedDataRetryRule The applied data retry rule. @param retryDelayMillis The retry delay in milliseconds.
DataRetryEntry::DataRetryEntry
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public void setState(@DataRetryState int state) { mRetryState = state; mRetryStateTimestamp = SystemClock.elapsedRealtime(); }
Set the state of a data retry. @param state The retry state.
DataRetryEntry::setState
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @DataRetryState int getState() { return mRetryState; }
@return Get the retry state.
DataRetryEntry::getState
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public static String retryStateToString(@DataRetryState int retryState) { switch (retryState) { case RETRY_STATE_NOT_RETRIED: return "NOT_RETRIED"; case RETRY_STATE_FAILED: return "FAILED"; case RETRY_STATE_SUCCEEDED: return "SUCCEEDED"; case RETRY_STATE_CANCELLED: return "CANCELLED"; default: return "Unknown(" + retryState + ")"; } }
Convert retry state to string. @param retryState Retry state. @return Retry state in string format.
DataRetryEntry::retryStateToString
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull T setRetryDelay(long retryDelayMillis) { mRetryDelayMillis = retryDelayMillis; return (T) this; }
Set the data retry delay. @param retryDelayMillis The retry delay in milliseconds. @return This builder.
Builder::setRetryDelay
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull T setAppliedRetryRule(@NonNull DataRetryRule dataRetryRule) { mAppliedDataRetryRule = dataRetryRule; return (T) this; }
Set the applied retry rule. @param dataRetryRule The rule that used for this data retry. @return This builder.
Builder::setAppliedRetryRule
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
private DataSetupRetryEntry(@SetupRetryType int setupRetryType, @Nullable NetworkRequestList networkRequestList, @NonNull DataProfile dataProfile, @TransportType int transport, @Nullable DataSetupRetryRule appliedDataSetupRetryRule, long retryDelayMillis) { super(appliedDataSetupRetryRule, retryDelayMillis); this.setupRetryType = setupRetryType; this.networkRequestList = networkRequestList; this.dataProfile = dataProfile; this.transport = transport; }
Constructor @param setupRetryType Data retry type. Could be retry by same data profile or same capabilities. @param networkRequestList The network requests to satisfy when retry happens. @param dataProfile The data profile that will be used for retry. @param transport The transport to retry data setup. @param appliedDataSetupRetryRule The applied data setup retry rule. @param retryDelayMillis The retry delay in milliseconds.
DataSetupRetryEntry::DataSetupRetryEntry
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
private static String retryTypeToString(@SetupRetryType int setupRetryType) { switch (setupRetryType) { case RETRY_TYPE_DATA_PROFILE: return "BY_PROFILE"; case RETRY_TYPE_NETWORK_REQUESTS: return "BY_NETWORK_REQUESTS"; default: return "Unknown(" + setupRetryType + ")"; } }
Convert retry type to string. @param setupRetryType Data setup retry type. @return Retry type in string format.
DataSetupRetryEntry::retryTypeToString
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull Builder<T> setSetupRetryType(@SetupRetryType int setupRetryType) { mSetupRetryType = setupRetryType; return this; }
Set the data retry type. @param setupRetryType Data retry type. Could be retry by same data profile or same capabilities. @return This builder.
Builder::setSetupRetryType
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull Builder<T> setNetworkRequestList( @NonNull NetworkRequestList networkRequestList) { mNetworkRequestList = networkRequestList; return this; }
Set the network capability to satisfy when retry happens. @param networkRequestList The network requests to satisfy when retry happens. @return This builder.
Builder::setNetworkRequestList
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull Builder<T> setDataProfile(@NonNull DataProfile dataProfile) { mDataProfile = dataProfile; return this; }
Set the data profile that will be used for retry. @param dataProfile The data profile that will be used for retry. @return This builder.
Builder::setDataProfile
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull Builder<T> setTransport(@TransportType int transport) { mTransport = transport; return this; }
Set the transport of the data setup retry. @param transport The transport to retry data setup. @return This builder.
Builder::setTransport
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull DataSetupRetryEntry build() { if (mNetworkRequestList == null) { throw new IllegalArgumentException("network request list is not specified."); } if (mTransport != AccessNetworkConstants.TRANSPORT_TYPE_WWAN && mTransport != AccessNetworkConstants.TRANSPORT_TYPE_WLAN) { throw new IllegalArgumentException("Invalid transport type " + mTransport); } if (mSetupRetryType != RETRY_TYPE_DATA_PROFILE && mSetupRetryType != RETRY_TYPE_NETWORK_REQUESTS) { throw new IllegalArgumentException("Invalid setup retry type " + mSetupRetryType); } return new DataSetupRetryEntry(mSetupRetryType, mNetworkRequestList, mDataProfile, mTransport, (DataSetupRetryRule) mAppliedDataRetryRule, mRetryDelayMillis); }
Build the instance of {@link DataSetupRetryEntry}. @return The instance of {@link DataSetupRetryEntry}.
Builder::build
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public DataHandoverRetryEntry(@NonNull DataNetwork dataNetwork, @Nullable DataHandoverRetryRule appliedDataHandoverRetryRule, long retryDelayMillis) { super(appliedDataHandoverRetryRule, retryDelayMillis); this.dataNetwork = dataNetwork; }
Constructor. @param dataNetwork The data network to be retried for handover. @param appliedDataHandoverRetryRule The applied data retry rule. @param retryDelayMillis The retry delay in milliseconds.
DataHandoverRetryEntry::DataHandoverRetryEntry
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull Builder<T> setDataNetwork(@NonNull DataNetwork dataNetwork) { mDataNetwork = dataNetwork; return this; }
Set the data retry type. @param dataNetwork The data network to be retried for handover. @return This builder.
Builder::setDataNetwork
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public @NonNull DataHandoverRetryEntry build() { return new DataHandoverRetryEntry(mDataNetwork, (DataHandoverRetryRule) mAppliedDataRetryRule, mRetryDelayMillis); }
Build the instance of {@link DataHandoverRetryEntry}. @return The instance of {@link DataHandoverRetryEntry}.
Builder::build
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public DataRetryManagerCallback(@NonNull @CallbackExecutor Executor executor) { super(executor); }
Constructor @param executor The executor of the callback.
DataRetryManagerCallback::DataRetryManagerCallback
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public void onDataNetworkSetupRetry(@NonNull DataSetupRetryEntry dataSetupRetryEntry) {}
Called when data setup retry occurs. @param dataSetupRetryEntry The data setup retry entry.
DataRetryManagerCallback::onDataNetworkSetupRetry
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT
public void onDataNetworkHandoverRetry( @NonNull DataHandoverRetryEntry dataHandoverRetryEntry) {}
Called when data handover retry occurs. @param dataHandoverRetryEntry The data handover retry entry.
DataRetryManagerCallback::onDataNetworkHandoverRetry
java
Reginer/aosp-android-jar
android-34/src/com/android/internal/telephony/data/DataRetryManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java
MIT