public void invalidateAccessToken(Account account, Bundle options) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
if (account != null) {
_data.writeInt(1);
account.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
if (options != null) {
_data.writeInt(1);
options.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
this.mRemote.transact(4, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
java类android.accounts.Account的实例源码
IXiaomiAuthService.java 文件源码
项目:boohee_v5.6
阅读 21
收藏 0
点赞 0
评论 0
SyncAdapter.java 文件源码
项目:simplest-sync-adapter
阅读 66
收藏 0
点赞 0
评论 0
/**
* Called by the Android system in response to a request to run the sync adapter. The work
* required to read data from the network, parse it, and store it in the content provider
* should be done here. Extending AbstractThreadedSyncAdapter ensures that all methods within SyncAdapter
* run on a background thread. For this reason, blocking I/O and other long-running tasks can be
* run <em>in situ</em>, and you don't have to set up a separate thread for them.
*
* <p>
* <p>This is where we actually perform any work required to perform a sync.
* {@link AbstractThreadedSyncAdapter} guarantees that this will be called on a non-UI thread,
* so it is safe to perform blocking I/O here.
* <p>
*
* <p>The syncResult argument allows you to pass information back to the method that triggered
* the sync.
*/
@Override
public void onPerformSync(Account account, Bundle extras, String authority,
ContentProviderClient provider, SyncResult syncResult) {
// Your code to sync data
// between mobile database and
// the server goes here.
for (int i = 0; i < 15; i++) {
try {
Thread.sleep(1000);
Log.i(TAG, ">>>> sleeping the thread: " + (i + 1));
} catch (InterruptedException e) {
e.printStackTrace();
}
} // end for
// write DB data sanity checks at the end.
}
IXiaomiAuthService.java 文件源码
项目:boohee_v5.6
阅读 22
收藏 0
点赞 0
评论 0
public void invalidateAccessToken(Account account, Bundle options) throws
RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
if (account != null) {
_data.writeInt(1);
account.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
if (options != null) {
_data.writeInt(1);
options.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
this.mRemote.transact(4, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
VAccountManagerService.java 文件源码
项目:container
阅读 27
收藏 0
点赞 0
评论 0
private Account renameAccountInternal(int userId, Account accountToRename, String newName) {
// TODO: Cancel Notification
synchronized (accountsByUserId) {
VAccount vAccount = getAccount(userId, accountToRename);
if (vAccount != null) {
vAccount.previousName = vAccount.name;
vAccount.name = newName;
serializeAllAccounts();
Account newAccount = new Account(vAccount.name, vAccount.type);
synchronized (authTokenRecords) {
for (AuthTokenRecord record : authTokenRecords) {
if (record.userId == userId && record.account.equals(accountToRename)) {
record.account = newAccount;
}
}
}
sendAccountsChangedBroadcast(userId);
return newAccount;
}
}
return accountToRename;
}
ChooseTypeAndAccountActivity.java 文件源码
项目:TPlayer
阅读 25
收藏 0
点赞 0
评论 0
/**
* Returns a set of whitelisted accounts given by the intent or null if none specified by the
* intent.
*/
private Set<Account> getAllowableAccountSet(final Intent intent) {
Set<Account> setOfAllowableAccounts = null;
final ArrayList<Parcelable> validAccounts =
intent.getParcelableArrayListExtra(EXTRA_ALLOWABLE_ACCOUNTS_ARRAYLIST);
if (validAccounts != null) {
setOfAllowableAccounts = new HashSet<>(validAccounts.size());
for (Parcelable parcelable : validAccounts) {
setOfAllowableAccounts.add((Account) parcelable);
}
}
return setOfAllowableAccounts;
}
VAccountManagerService.java 文件源码
项目:VirtualHook
阅读 40
收藏 0
点赞 0
评论 0
private void setPasswordInternal(int userId, Account account, String password) {
synchronized (accountsByUserId) {
VAccount vAccount = getAccount(userId, account);
if (vAccount != null) {
vAccount.password = password;
vAccount.authTokens.clear();
saveAllAccounts();
synchronized (authTokenRecords) {
Iterator<AuthTokenRecord> iterator = authTokenRecords.iterator();
while (iterator.hasNext()) {
AuthTokenRecord record = iterator.next();
if (record.userId == userId && record.account.equals(account)) {
iterator.remove();
}
}
}
sendAccountsChangedBroadcast(userId);
}
}
}
GoogleSignInOnSubscribeBase.java 文件源码
项目:RxGooglePhotos
阅读 27
收藏 0
点赞 0
评论 0
protected void handleSignInResult(GoogleSignInResult result) {
Schedulers.newThread()
.scheduleDirect(() -> {
if (result.isSuccess()) {
if (result.getSignInAccount() != null && result.getSignInAccount().getAccount() != null) {
Account account = result.getSignInAccount().getAccount();
try {
String token = GoogleAuthUtil.getToken(activity, account, "oauth2:" + SCOPE_PICASA);
emitter.onSuccess(new GoogleSignIn.SignInAccount(token, result.getSignInAccount()));
} catch (IOException | GoogleAuthException e) {
emitter.onError(new SignInException("SignIn", e));
}
} else {
emitter.onError(new SignInException("SignIn", "getSignInAccount is null!", 0));
}
} else {
if (result.getStatus().getStatusCode() == CommonStatusCodes.SIGN_IN_REQUIRED) {
emitter.onError(new SignInRequiredException());
} else {
emitter.onError(new SignInException("SignIn", result.getStatus().getStatusMessage(), result.getStatus().getStatusCode()));
}
}
});
}
VAccountManagerService.java 文件源码
项目:VirtualHook
阅读 34
收藏 0
点赞 0
评论 0
private String getCustomAuthToken(int userId, Account account, String authTokenType, String packageName) {
AuthTokenRecord record = new AuthTokenRecord(userId, account, authTokenType, packageName);
String authToken = null;
long now = System.currentTimeMillis();
synchronized (authTokenRecords) {
Iterator<AuthTokenRecord> iterator = authTokenRecords.iterator();
while (iterator.hasNext()) {
AuthTokenRecord one = iterator.next();
if (one.expiryEpochMillis > 0 && one.expiryEpochMillis < now) {
iterator.remove();
} else if (record.equals(one)) {
authToken = record.authToken;
}
}
}
return authToken;
}
VAccountManagerService.java 文件源码
项目:VirtualHook
阅读 32
收藏 0
点赞 0
评论 0
public void confirmCredentials(int userId, IAccountManagerResponse response, final Account account, final Bundle options, final boolean expectActivityLaunch) {
if (response == null) throw new IllegalArgumentException("response is null");
if (account == null) throw new IllegalArgumentException("account is null");
AuthenticatorInfo info = getAuthenticatorInfo(account.type);
if (info == null) {
try {
response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
} catch (RemoteException e) {
e.printStackTrace();
}
return;
}
new Session(response, userId, info, expectActivityLaunch, true, account.name, true, true) {
@Override
public void run() throws RemoteException {
mAuthenticator.confirmCredentials(this, account, options);
}
}.bind();
}
XGoogleAuthUtil.java 文件源码
项目:XPrivacy
阅读 21
收藏 0
点赞 0
评论 0
@Override
protected void after(XParam param) throws Throwable {
if (mMethod == Methods.getToken || mMethod == Methods.getTokenWithNotification) {
if (param.args.length > 1) {
String accountName = null;
if (param.args[1] instanceof String)
accountName = (String) param.args[1];
else if (param.args[1] instanceof Account)
accountName = ((Account) param.args[1]).type;
if (param.getResult() != null && isRestrictedExtra(param, accountName))
param.setThrowable(new IOException("XPrivacy"));
}
} else
Util.log(this, Log.WARN, "Unknown method=" + param.method.getName());
}
VAccountManagerService.java 文件源码
项目:VirtualHook
阅读 35
收藏 0
点赞 0
评论 0
private Account renameAccountInternal(int userId, Account accountToRename, String newName) {
// TODO: Cancel Notification
synchronized (accountsByUserId) {
VAccount vAccount = getAccount(userId, accountToRename);
if (vAccount != null) {
vAccount.previousName = vAccount.name;
vAccount.name = newName;
saveAllAccounts();
Account newAccount = new Account(vAccount.name, vAccount.type);
synchronized (authTokenRecords) {
for (AuthTokenRecord record : authTokenRecords) {
if (record.userId == userId && record.account.equals(accountToRename)) {
record.account = newAccount;
}
}
}
sendAccountsChangedBroadcast(userId);
return newAccount;
}
}
return accountToRename;
}
VAccountManagerService.java 文件源码
项目:container
阅读 37
收藏 0
点赞 0
评论 0
public void confirmCredentials(int userId, IAccountManagerResponse response, final Account account, final Bundle options, final boolean expectActivityLaunch) {
if (response == null) throw new IllegalArgumentException("response is null");
if (account == null) throw new IllegalArgumentException("account is null");
AuthenticatorInfo info = getAuthenticatorInfo(account.type);
if(info == null) {
try {
response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
} catch(RemoteException e) {
e.printStackTrace();
}
return;
}
new Session(response, userId, info, expectActivityLaunch, true, account.name, true, true) {
@Override
public void run() throws RemoteException {
mAuthenticator.confirmCredentials(this, account, options);
}
}.bind();
}
VAccountManagerService.java 文件源码
项目:TPlayer
阅读 28
收藏 0
点赞 0
评论 0
@Override
public String peekAuthToken(int userId, Account account, String authTokenType) {
if (account == null) throw new IllegalArgumentException("account is null");
if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
synchronized (accountsByUserId) {
VAccount vAccount = getAccount(userId, account);
if (vAccount != null) {
return vAccount.authTokens.get(authTokenType);
}
return null;
}
}
VAccountManager.java 文件源码
项目:VirtualHook
阅读 21
收藏 0
点赞 0
评论 0
public void getAuthToken(IAccountManagerResponse response, Account account, String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, Bundle loginOptions) {
try {
getRemote().getAuthToken(VUserHandle.myUserId(), response, account, authTokenType, notifyOnAuthFailure, expectActivityLaunch, loginOptions);
} catch (RemoteException e) {
e.printStackTrace();
}
}
VAccountManagerService.java 文件源码
项目:TPlayer
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void updateCredentials(int userId, final IAccountManagerResponse response, final Account account,
final String authTokenType, final boolean expectActivityLaunch,
final Bundle loginOptions) {
if (response == null) throw new IllegalArgumentException("response is null");
if (account == null) throw new IllegalArgumentException("account is null");
if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
AuthenticatorInfo info = this.getAuthenticatorInfo(account.type);
if (info == null) {
try {
response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
} catch (RemoteException e) {
e.printStackTrace();
}
return;
}
new Session(response, userId, info, expectActivityLaunch, false, account.name) {
@Override
public void run() throws RemoteException {
mAuthenticator.updateCredentials(this, account, authTokenType, loginOptions);
}
@Override
protected String toDebugString(long now) {
if (loginOptions != null) loginOptions.keySet();
return super.toDebugString(now) + ", updateCredentials"
+ ", " + account
+ ", authTokenType " + authTokenType
+ ", loginOptions " + loginOptions;
}
}.bind();
}
ICalSyncAdapter.java 文件源码
项目:EasyAppleSyncAdapter
阅读 23
收藏 0
点赞 0
评论 0
@Override
protected void syncLocalAndRemoteCollections(Account account, ContentProviderClient provider)
throws CalendarStorageException {
LocalCalendar[] localCalendarData = getLocalCalendarList(account, provider);
CalendarData remoteCalendarData = getRemoteCollectionList(account);
updateLocalCalendars(account, localCalendarData, remoteCalendarData.getCollections(), provider);
}
AccountManagerPatch.java 文件源码
项目:container
阅读 23
收藏 0
点赞 0
评论 0
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
Account accountToRename = (Account) args[0];
String newName = (String) args[1];
int userId = (int) args[2];
return method.invoke(who, args);
}
AccountPrefsUtils.java 文件源码
项目:GeekZone
阅读 22
收藏 0
点赞 0
评论 0
/**
* Get an {@link String} that will be deobfuscated by
* {@link SecurityUtils#deobfuscate(String, Context)}.
*
* @see AccountPreferences#getString(String, String)
* @see SecurityUtils#deobfuscate(String, Context)
*/
public static String getStringObfuscated(String key, String defaultValue, Account account,
Context context) {
String value = getString(key, null, account, context);
if (value != null) {
try {
return com.hanyee.androidlib.utils.SecurityUtils.deobfuscate(value, context);
} catch (GeneralSecurityException e) {
com.hanyee.androidlib.utils.BuildUtils.throwOrPrint(e);
}
}
return defaultValue;
}
VAccountManager.java 文件源码
项目:TPlayer
阅读 33
收藏 0
点赞 0
评论 0
public boolean addAccountExplicitly(Account account, String password, Bundle extras) {
try {
return getRemote().addAccountExplicitly(VUserHandle.myUserId(), account, password, extras);
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
}
}
AccountChooser.java 文件源码
项目:appinventor-extensions
阅读 23
收藏 0
点赞 0
评论 0
private Account chooseAccount(String accountName, Account[] accounts) {
for (Account account : accounts) {
if (account.name.equals(accountName)) {
Log.i(LOG_TAG, "chose account: " + accountName);
return account;
}
}
return null;
}
StubAuthenticator.java 文件源码
项目:leoapp-sources
阅读 21
收藏 0
点赞 0
评论 0
@Override
public Bundle confirmCredentials(
AccountAuthenticatorResponse r,
Account account,
Bundle bundle) throws NetworkErrorException {
return null;
}
VAccount.java 文件源码
项目:container
阅读 22
收藏 0
点赞 0
评论 0
public VAccount(int userId, Account account) {
this.userId = userId;
name = account.name;
type = account.type;
authTokens = new HashMap<>();
userDatas = new HashMap<>();
}
CalendarSyncAdapter.java 文件源码
项目:FBEventSync
阅读 26
收藏 0
点赞 0
评论 0
static public void requestSync(Context context) {
String accountType = context.getResources().getString(R.string.account_type);
Logger logger = Logger.getInstance(context);
for (Account account : AccountManager.get(context).getAccountsByType(accountType)){
Bundle extras = new Bundle();
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
ContentResolver.requestSync(account, CalendarContract.AUTHORITY, extras);
logger.info(TAG, "Explicitly requested sync for account %s", account.name);
}
}
VAccountManagerService.java 文件源码
项目:VirtualHook
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void updateCredentials(int userId, final IAccountManagerResponse response, final Account account,
final String authTokenType, final boolean expectActivityLaunch,
final Bundle loginOptions) {
if (response == null) throw new IllegalArgumentException("response is null");
if (account == null) throw new IllegalArgumentException("account is null");
if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
AuthenticatorInfo info = this.getAuthenticatorInfo(account.type);
if (info == null) {
try {
response.onError(ERROR_CODE_BAD_ARGUMENTS, "account.type does not exist");
} catch (RemoteException e) {
e.printStackTrace();
}
return;
}
new Session(response, userId, info, expectActivityLaunch, false, account.name) {
@Override
public void run() throws RemoteException {
mAuthenticator.updateCredentials(this, account, authTokenType, loginOptions);
}
@Override
protected String toDebugString(long now) {
if (loginOptions != null) loginOptions.keySet();
return super.toDebugString(now) + ", updateCredentials"
+ ", " + account
+ ", authTokenType " + authTokenType
+ ", loginOptions " + loginOptions;
}
}.bind();
}
VAccountManager.java 文件源码
项目:VirtualHook
阅读 22
收藏 0
点赞 0
评论 0
public void confirmCredentials(IAccountManagerResponse response, Account account, Bundle options, boolean expectActivityLaunch) {
try {
getRemote().confirmCredentials(VUserHandle.myUserId(), response, account, options, expectActivityLaunch);
} catch (RemoteException e) {
e.printStackTrace();
}
}
FlowzrSyncTask.java 文件源码
项目:financisto1-holo
阅读 22
收藏 0
点赞 0
评论 0
protected Object work(Context context, DatabaseAdapter dba, String... params) throws ImportExportException {
AccountManager accountManager = AccountManager.get(context);
android.accounts.Account[] accounts = accountManager.getAccountsByType("com.google");
String accountName=MyPreferences.getFlowzrAccount(context);
if (accountName == null) {
NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(context,
FlowzrSyncActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
Builder mNotifyBuilder = new NotificationCompat.Builder(context);
mNotifyBuilder
.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.icon)
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentTitle(context.getString(R.string.flowzr_sync))
.setContentText(
context.getString(R.string.flowzr_choose_account));
nm.notify(0, mNotifyBuilder.build());
Log.i("Financisto","account name is null");
throw new ImportExportException(R.string.flowzr_choose_account);
}
Account useCredential = null;
for (int i = 0; i < accounts.length; i++) {
if (accountName.equals(((android.accounts.Account) accounts[i]).name)) {
useCredential=accounts[i];
}
}
accountManager.getAuthToken(useCredential, "ah", false, new GetAuthTokenCallback(), null);
return null;
}
SyncContext.java 文件源码
项目:FBEventSync
阅读 36
收藏 0
点赞 0
评论 0
public SyncContext(Context context, Account account, String accessToken,
ContentProviderClient providerClient, SyncResult syncResult, Logger logger) {
mContext = context;
mAccount = account;
mAccessToken = accessToken;
mProviderClient = providerClient;
mSyncResult = syncResult;
mLogger = logger;
}
SyncInfo.java 文件源码
项目:TPlayer
阅读 25
收藏 0
点赞 0
评论 0
public SyncInfo(int authorityId, Account account, String authority,
long startTime) {
this.authorityId = authorityId;
this.account = account;
this.authority = authority;
this.startTime = startTime;
}
VAccountManager.java 文件源码
项目:container
阅读 25
收藏 0
点赞 0
评论 0
public Account[] getAccounts(String type) {
try {
return getRemote().getAccounts(VUserHandle.myUserId(), type);
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
}
}
AccountManagerStub.java 文件源码
项目:VirtualHook
阅读 27
收藏 0
点赞 0
评论 0
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
IAccountManagerResponse response = (IAccountManagerResponse) args[0];
Account account = (Account) args[1];
String authTokenType = (String) args[2];
boolean notifyOnAuthFailure = (boolean) args[3];
boolean expectActivityLaunch = (boolean) args[4];
Bundle options = (Bundle) args[5];
Mgr.getAuthToken(response, account, authTokenType, notifyOnAuthFailure, expectActivityLaunch, options);
return 0;
}