use of android.annotation.SystemApi in project android_frameworks_base by ResurrectionRemix.
the class AccountManager method startUpdateCredentialsSession.
/**
* Asks the user to enter a new password for an account but not updating the
* saved credentials for the account until {@link #finishSession} is called.
* <p>
* This method may be called from any thread, but the returned
* {@link AccountManagerFuture} must not be used on the main thread.
* <p>
* <b>NOTE:</b> The saved credentials for the account alone will not be
* updated by calling this API alone. #finishSession should be called after
* this to update local credentials
*
* @param account The account to update credentials for
* @param authTokenType The credentials entered must allow an auth token of
* this type to be created (but no actual auth token is
* returned); may be null
* @param options Authenticator-specific options for the request; may be
* null or empty
* @param activity The {@link Activity} context to use for launching a new
* authenticator-defined sub-Activity to prompt the user to enter
* a password; used only to call startActivity(); if null, the
* prompt will not be launched directly, but the necessary
* {@link Intent} will be returned to the caller instead
* @param callback Callback to invoke when the request completes, null for
* no callback
* @param handler {@link Handler} identifying the callback thread, null for
* the main thread
* @return An {@link AccountManagerFuture} which resolves to a Bundle with
* these fields if an activity was supplied and user was
* successfully re-authenticated to the account:
* <ul>
* <li>{@link #KEY_ACCOUNT_SESSION_BUNDLE} - encrypted Bundle for
* updating the local credentials on device later.
* <li>{@link #KEY_ACCOUNT_STATUS_TOKEN} - optional, token to check
* status of the account
* </ul>
* If no activity was specified, the returned Bundle contains
* {@link #KEY_INTENT} with the {@link Intent} needed to launch the
* password prompt. If an error occurred,
* {@link AccountManagerFuture#getResult()} throws:
* <ul>
* <li>{@link AuthenticatorException} if the authenticator failed to
* respond
* <li>{@link OperationCanceledException} if the operation was
* canceled for any reason, including the user canceling the
* password prompt
* <li>{@link IOException} if the authenticator experienced an I/O
* problem verifying the password, usually because of network
* trouble
* </ul>
* @see #finishSession
* @hide
*/
@SystemApi
public AccountManagerFuture<Bundle> startUpdateCredentialsSession(final Account account, final String authTokenType, final Bundle options, final Activity activity, final AccountManagerCallback<Bundle> callback, final Handler handler) {
if (account == null) {
throw new IllegalArgumentException("account is null");
}
// Always include the calling package name. This just makes life easier
// down stream.
final Bundle optionsIn = new Bundle();
if (options != null) {
optionsIn.putAll(options);
}
optionsIn.putString(KEY_ANDROID_PACKAGE_NAME, mContext.getPackageName());
return new AmsTask(activity, handler, callback) {
@Override
public void doWork() throws RemoteException {
mService.startUpdateCredentialsSession(mResponse, account, authTokenType, activity != null, optionsIn);
}
}.start();
}
use of android.annotation.SystemApi in project android_frameworks_base by ResurrectionRemix.
the class AbstractAccountAuthenticator method isCredentialsUpdateSuggested.
/**
* Checks if update of the account credentials is suggested.
*
* @param response to send the result back to the AccountManager, will never be null.
* @param account the account to check, will never be null
* @param statusToken a String of token to check if update of credentials is suggested.
* @return a Bundle result or null if the result is to be returned via the response. The result
* will contain either:
* <ul>
* <li>{@link AccountManager#KEY_BOOLEAN_RESULT}, true if update of account's
* credentials is suggested, false otherwise
* <li>{@link AccountManager#KEY_ERROR_CODE} and
* {@link AccountManager#KEY_ERROR_MESSAGE} to indicate an error
* </ul>
* @throws NetworkErrorException if the authenticator could not honor the request due to a
* network error
* @hide
*/
@SystemApi
public Bundle isCredentialsUpdateSuggested(final AccountAuthenticatorResponse response, Account account, String statusToken) throws NetworkErrorException {
Bundle result = new Bundle();
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
return result;
}
use of android.annotation.SystemApi in project android_frameworks_base by DirtyUnicorns.
the class NotificationListenerService method getActiveNotifications.
/**
* Request one or more notifications by key. Useful if you have been keeping track of
* notifications but didn't want to retain the bits, and now need to go back and extract
* more data out of those notifications.
*
* @hide
*
* @param keys the keys of the notifications to request
* @param trim trim of the notifications to be returned. See <code>TRIM_*</code> constants.
* @return An array of notifications corresponding to the requested keys, in the
* same order as the key list.
*/
@SystemApi
public StatusBarNotification[] getActiveNotifications(String[] keys, int trim) {
if (!isBound())
return null;
try {
ParceledListSlice<StatusBarNotification> parceledList = getNotificationInterface().getActiveNotificationsFromListener(mWrapper, keys, trim);
List<StatusBarNotification> list = parceledList.getList();
ArrayList<StatusBarNotification> corruptNotifications = null;
int N = list.size();
for (int i = 0; i < N; i++) {
StatusBarNotification sbn = list.get(i);
Notification notification = sbn.getNotification();
try {
// convert icon metadata to legacy format for older clients
createLegacyIconExtras(notification);
// populate remote views for older clients.
maybePopulateRemoteViews(notification);
} catch (IllegalArgumentException e) {
if (corruptNotifications == null) {
corruptNotifications = new ArrayList<>(N);
}
corruptNotifications.add(sbn);
Log.w(TAG, "onNotificationPosted: can't rebuild notification from " + sbn.getPackageName());
}
}
if (corruptNotifications != null) {
list.removeAll(corruptNotifications);
}
return list.toArray(new StatusBarNotification[list.size()]);
} catch (android.os.RemoteException ex) {
Log.v(TAG, "Unable to contact notification manager", ex);
}
return null;
}
use of android.annotation.SystemApi in project android_frameworks_base by DirtyUnicorns.
the class AudioPolicy method createAudioTrackSource.
/**
* Create an {@link AudioTrack} instance that is associated with the given {@link AudioMix}.
* Audio buffers played through the created instance will be sent to the given mix
* to be recorded through the recording APIs.
* @param mix a non-null {@link AudioMix} instance whose routing flags was defined with
* {@link AudioMix#ROUTE_FLAG_LOOP_BACK}, previously added to this policy.
* @return a new {@link AudioTrack} instance whose data format is the one defined in the
* {@link AudioMix}, or null if this policy was not successfully registered
* with {@link AudioManager#registerAudioPolicy(AudioPolicy)}.
* @throws IllegalArgumentException
*/
@SystemApi
public AudioTrack createAudioTrackSource(AudioMix mix) throws IllegalArgumentException {
if (!policyReadyToUse()) {
Log.e(TAG, "Cannot create AudioTrack source for AudioMix");
return null;
}
checkMixReadyToUse(mix, true);
// create the AudioTrack, configured for loop back, using the same format as the mix
AudioTrack at = new AudioTrack(new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_VIRTUAL_SOURCE).addTag(addressForTag(mix)).build(), mix.getFormat(), AudioTrack.getMinBufferSize(mix.getFormat().getSampleRate(), mix.getFormat().getChannelMask(), mix.getFormat().getEncoding()), AudioTrack.MODE_STREAM, AudioManager.AUDIO_SESSION_ID_GENERATE);
return at;
}
use of android.annotation.SystemApi in project android_frameworks_base by DirtyUnicorns.
the class AbstractAccountAuthenticator method isCredentialsUpdateSuggested.
/**
* Checks if update of the account credentials is suggested.
*
* @param response to send the result back to the AccountManager, will never be null.
* @param account the account to check, will never be null
* @param statusToken a String of token to check if update of credentials is suggested.
* @return a Bundle result or null if the result is to be returned via the response. The result
* will contain either:
* <ul>
* <li>{@link AccountManager#KEY_BOOLEAN_RESULT}, true if update of account's
* credentials is suggested, false otherwise
* <li>{@link AccountManager#KEY_ERROR_CODE} and
* {@link AccountManager#KEY_ERROR_MESSAGE} to indicate an error
* </ul>
* @throws NetworkErrorException if the authenticator could not honor the request due to a
* network error
* @hide
*/
@SystemApi
public Bundle isCredentialsUpdateSuggested(final AccountAuthenticatorResponse response, Account account, String statusToken) throws NetworkErrorException {
Bundle result = new Bundle();
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
return result;
}
Aggregations