use of com.google.android.gms.common.data.DataHolder 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);
if (context.checkCallingPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
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);
}
}
use of com.google.android.gms.common.data.DataHolder in project android_packages_apps_GmsCore by microg.
the class PeopleServiceImpl method loadCircles.
@Override
public void loadCircles(IPeopleCallbacks callbacks, String account, String pageGaiaId, String circleId, int type, String var6, boolean var7) throws RemoteException {
Log.d(TAG, "loadCircles: " + account + ", " + pageGaiaId + ", " + circleId + ", " + type + ", " + var6 + ", " + var7);
PackageUtils.assertExtendedAccess(context);
try {
DatabaseHelper databaseHelper = new DatabaseHelper(context);
Cursor owner = databaseHelper.getOwner(account);
int ownerId = -1;
if (owner.moveToNext()) {
ownerId = owner.getInt(0);
}
owner.close();
Bundle extras = new Bundle();
DataHolder dataHolder = new DataHolder(databaseHelper.getCircles(ownerId, circleId, type), 0, extras);
callbacks.onDataHolder(0, new Bundle(), dataHolder);
databaseHelper.close();
} catch (Exception e) {
Log.w(TAG, e);
}
}
use of com.google.android.gms.common.data.DataHolder in project GmsCore by microg.
the class WearableImpl method getDataItemsByUriAsHolder.
public DataHolder getDataItemsByUriAsHolder(Uri uri, String packageName) {
String firstSignature;
try {
firstSignature = PackageUtils.firstSignatureDigest(context, packageName);
} catch (Exception e) {
return null;
}
Cursor dataHolderItems = nodeDatabase.getDataItemsForDataHolderByHostAndPath(packageName, firstSignature, fixHost(uri.getHost(), false), uri.getPath());
DataHolder dataHolder = new DataHolder(dataHolderItems, 0, null);
Log.d(TAG, "Returning data holder of size " + dataHolder.getCount() + " for query " + uri);
return dataHolder;
}
use of com.google.android.gms.common.data.DataHolder in project 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);
if (context.checkCallingPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
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);
}
}
use of com.google.android.gms.common.data.DataHolder in project GmsCore by microg.
the class PeopleServiceImpl method loadCircles.
@Override
public void loadCircles(IPeopleCallbacks callbacks, String account, String pageGaiaId, String circleId, int type, String var6, boolean var7) throws RemoteException {
Log.d(TAG, "loadCircles: " + account + ", " + pageGaiaId + ", " + circleId + ", " + type + ", " + var6 + ", " + var7);
PackageUtils.assertExtendedAccess(context);
try {
DatabaseHelper databaseHelper = new DatabaseHelper(context);
Cursor owner = databaseHelper.getOwner(account);
int ownerId = -1;
if (owner.moveToNext()) {
ownerId = owner.getInt(0);
}
owner.close();
Bundle extras = new Bundle();
DataHolder dataHolder = new DataHolder(databaseHelper.getCircles(ownerId, circleId, type), 0, extras);
callbacks.onDataHolder(0, new Bundle(), dataHolder);
databaseHelper.close();
} catch (Exception e) {
Log.w(TAG, e);
}
}
Aggregations