use of android.accounts.Account in project Launcher3 by chislon.
the class LauncherTransitionable method skipCustomClingIfNoAccounts.
private boolean skipCustomClingIfNoAccounts() {
Cling cling = (Cling) findViewById(R.id.workspace_cling);
boolean customCling = cling.getDrawIdentifier().equals("workspace_custom");
if (customCling) {
AccountManager am = AccountManager.get(this);
if (am == null)
return false;
Account[] accounts = am.getAccountsByType("com.google");
return accounts.length == 0;
}
return false;
}
use of android.accounts.Account in project philm by chrisbanes.
the class AndroidAccountManager method removeAccount.
@Override
public void removeAccount(PhilmAccount philmAccount) {
Account account = new Account(philmAccount.getAccountName(), Constants.TRAKT_ACCOUNT_TYPE);
mAccountManager.removeAccount(account, null, null);
}
use of android.accounts.Account in project philm by chrisbanes.
the class AndroidAccountManager method getAccounts.
@Override
public List<PhilmAccount> getAccounts() {
final Account[] accounts = mAccountManager.getAccountsByType(Constants.TRAKT_ACCOUNT_TYPE);
ArrayList<PhilmAccount> philmAccounts = new ArrayList<>(accounts.length);
for (int i = 0; i < accounts.length; i++) {
final Account account = accounts[i];
String password = mAccountManager.getPassword(account);
philmAccounts.add(new PhilmAccount(account.name, password));
}
return philmAccounts;
}
use of android.accounts.Account in project android_frameworks_base by ParanoidAndroid.
the class BugreportReceiver method findSendToAccount.
/**
* Find the best matching {@link Account} based on build properties.
*/
private static Account findSendToAccount(Context context) {
final AccountManager am = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
String preferredDomain = SystemProperties.get("sendbug.preferred.domain");
if (!preferredDomain.startsWith("@")) {
preferredDomain = "@" + preferredDomain;
}
final Account[] accounts = am.getAccounts();
Account foundAccount = null;
for (Account account : accounts) {
if (Patterns.EMAIL_ADDRESS.matcher(account.name).matches()) {
if (!preferredDomain.isEmpty()) {
// looking
if (account.name.endsWith(preferredDomain)) {
return account;
} else {
foundAccount = account;
}
// if we don't have a preferred domain, just return since it looks like
// an email address
} else {
return account;
}
}
}
return foundAccount;
}
use of android.accounts.Account in project android_frameworks_base by ParanoidAndroid.
the class BugreportReceiver method buildSendIntent.
/**
* Build {@link Intent} that can be used to share the given bugreport.
*/
private static Intent buildSendIntent(Context context, Uri bugreportUri, Uri screenshotUri) {
final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setType("application/vnd.android.bugreport");
intent.putExtra(Intent.EXTRA_SUBJECT, bugreportUri.getLastPathSegment());
intent.putExtra(Intent.EXTRA_TEXT, SystemProperties.get("ro.build.description"));
final ArrayList<Uri> attachments = Lists.newArrayList(bugreportUri, screenshotUri);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);
final Account sendToAccount = findSendToAccount(context);
if (sendToAccount != null) {
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { sendToAccount.name });
}
return intent;
}
Aggregations