use of android.content.ContentProviderClient in project DroidPlugin by DroidPluginTeam.
the class ContentProviderCompat method crazyAcquireContentProvider.
public static ContentProviderClient crazyAcquireContentProvider(Context context, Uri uri) {
ContentProviderClient client = acquireContentProviderClient(context, uri);
if (client == null) {
int retry = 0;
while (retry < 5 && client == null) {
SystemClock.sleep(100);
retry++;
client = acquireContentProviderClient(context, uri);
}
}
return client;
}
use of android.content.ContentProviderClient in project UnityModManager by xausky.
the class VClientImpl method acquireProviderClient.
@Override
public IBinder acquireProviderClient(ProviderInfo info) {
if (mTempLock != null) {
mTempLock.block();
}
if (!isBound()) {
VClientImpl.get().bindApplication(info.packageName, info.processName);
}
IInterface provider = null;
String[] authorities = info.authority.split(";");
String authority = authorities.length == 0 ? info.authority : authorities[0];
ContentResolver resolver = VirtualCore.get().getContext().getContentResolver();
ContentProviderClient client = null;
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
client = resolver.acquireUnstableContentProviderClient(authority);
} else {
client = resolver.acquireContentProviderClient(authority);
}
} catch (Throwable e) {
e.printStackTrace();
}
if (client != null) {
provider = mirror.android.content.ContentProviderClient.mContentProvider.get(client);
client.release();
}
return provider != null ? provider.asBinder() : null;
}
use of android.content.ContentProviderClient in project UnityModManager by xausky.
the class ContentProviderCompat method crazyAcquireContentProvider.
public static ContentProviderClient crazyAcquireContentProvider(Context context, Uri uri) {
ContentProviderClient client = acquireContentProviderClient(context, uri);
if (client == null) {
int retry = 0;
while (retry < 5 && client == null) {
SystemClock.sleep(100);
retry++;
client = acquireContentProviderClient(context, uri);
}
}
return client;
}
use of android.content.ContentProviderClient in project VirtualApp by asLody.
the class ContentProviderCompat method crazyAcquireContentProvider.
public static ContentProviderClient crazyAcquireContentProvider(Context context, Uri uri) {
ContentProviderClient client = acquireContentProviderClient(context, uri);
if (client == null) {
int retry = 0;
while (retry < 5 && client == null) {
SystemClock.sleep(100);
retry++;
client = acquireContentProviderClient(context, uri);
}
}
return client;
}
use of android.content.ContentProviderClient in project VirtualApp by asLody.
the class ContentProviderCompat method call.
public static Bundle call(Context context, Uri uri, String method, String arg, Bundle extras) {
if (VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return context.getContentResolver().call(uri, method, arg, extras);
}
ContentProviderClient client = crazyAcquireContentProvider(context, uri);
Bundle res = null;
try {
res = client.call(method, arg, extras);
} catch (RemoteException e) {
e.printStackTrace();
} finally {
releaseQuietly(client);
}
return res;
}
Aggregations