Search in sources :

Example 1 with AccountMetadata

use of com.google.android.gms.people.model.AccountMetadata in project android_packages_apps_GmsCore by microg.

the class PeopleServiceImpl method loadOwners.

@SuppressWarnings("MissingPermission")
@Override
public void loadOwners(final IPeopleCallbacks callbacks, boolean var2, boolean var3, final String accountName, String var5, int sortOrder) {
    Log.d(TAG, "loadOwners: " + var2 + ", " + var3 + ", " + accountName + ", " + var5 + ", " + sortOrder);
    PackageUtils.assertExtendedAccess(context);
    AccountManager accountManager = AccountManager.get(context);
    Bundle accountMetadata = new Bundle();
    String accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;
    for (Account account : accountManager.getAccountsByType(accountType)) {
        if (accountName == null || account.name.equals(accountName)) {
            accountMetadata.putParcelable(account.name, new AccountMetadata());
        }
    }
    Bundle extras = new Bundle();
    extras.putBundle("account_metadata", accountMetadata);
    try {
        DatabaseHelper databaseHelper = new DatabaseHelper(context);
        DataHolder dataHolder = new DataHolder(databaseHelper.getOwners(), 0, extras);
        Log.d(TAG, "loadOwners[result]: " + dataHolder);
        callbacks.onDataHolder(0, extras, dataHolder);
        databaseHelper.close();
    } catch (Exception e) {
        Log.w(TAG, e);
    }
}
Also used : Account(android.accounts.Account) Bundle(android.os.Bundle) DataHolder(com.google.android.gms.common.data.DataHolder) AccountMetadata(com.google.android.gms.people.model.AccountMetadata) AccountManager(android.accounts.AccountManager) RemoteException(android.os.RemoteException)

Aggregations

Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 Bundle (android.os.Bundle)1 RemoteException (android.os.RemoteException)1 DataHolder (com.google.android.gms.common.data.DataHolder)1 AccountMetadata (com.google.android.gms.people.model.AccountMetadata)1