use of android.content.pm.ProviderInfo in project VirtualApp by asLody.
the class VClientImpl method installContentProviders.
private void installContentProviders(Context app, List<ProviderInfo> providers) {
long origId = Binder.clearCallingIdentity();
Object mainThread = VirtualCore.mainThread();
try {
for (ProviderInfo cpi : providers) {
try {
ActivityThread.installProvider(mainThread, app, cpi, null);
} catch (Throwable e) {
e.printStackTrace();
}
}
} finally {
Binder.restoreCallingIdentity(origId);
}
}
use of android.content.pm.ProviderInfo in project VirtualApp by asLody.
the class VClientImpl method fixInstalledProviders.
private void fixInstalledProviders() {
clearSettingProvider();
Map clientMap = ActivityThread.mProviderMap.get(VirtualCore.mainThread());
for (Object clientRecord : clientMap.values()) {
if (BuildCompat.isOreo()) {
IInterface provider = ActivityThread.ProviderClientRecordJB.mProvider.get(clientRecord);
Object holder = ActivityThread.ProviderClientRecordJB.mHolder.get(clientRecord);
if (holder == null) {
continue;
}
ProviderInfo info = ContentProviderHolderOreo.info.get(holder);
if (!info.authority.startsWith(VASettings.STUB_CP_AUTHORITY)) {
provider = ProviderHook.createProxy(true, info.authority, provider);
ActivityThread.ProviderClientRecordJB.mProvider.set(clientRecord, provider);
ContentProviderHolderOreo.provider.set(holder, provider);
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
IInterface provider = ActivityThread.ProviderClientRecordJB.mProvider.get(clientRecord);
Object holder = ActivityThread.ProviderClientRecordJB.mHolder.get(clientRecord);
if (holder == null) {
continue;
}
ProviderInfo info = IActivityManager.ContentProviderHolder.info.get(holder);
if (!info.authority.startsWith(VASettings.STUB_CP_AUTHORITY)) {
provider = ProviderHook.createProxy(true, info.authority, provider);
ActivityThread.ProviderClientRecordJB.mProvider.set(clientRecord, provider);
IActivityManager.ContentProviderHolder.provider.set(holder, provider);
}
} else {
String authority = ActivityThread.ProviderClientRecord.mName.get(clientRecord);
IInterface provider = ActivityThread.ProviderClientRecord.mProvider.get(clientRecord);
if (provider != null && !authority.startsWith(VASettings.STUB_CP_AUTHORITY)) {
provider = ProviderHook.createProxy(true, authority, provider);
ActivityThread.ProviderClientRecord.mProvider.set(clientRecord, provider);
}
}
}
}
use of android.content.pm.ProviderInfo in project VirtualApp by asLody.
the class VPackageManagerService method queryIntentContentProviders.
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public List<ResolveInfo> queryIntentContentProviders(Intent intent, String resolvedType, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
ComponentName comp = intent.getComponent();
if (comp == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
if (intent.getSelector() != null) {
intent = intent.getSelector();
comp = intent.getComponent();
}
}
}
if (comp != null) {
final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
final ProviderInfo pi = getProviderInfo(comp, flags, userId);
if (pi != null) {
final ResolveInfo ri = new ResolveInfo();
ri.providerInfo = pi;
list.add(ri);
}
return list;
}
// reader
synchronized (mPackages) {
String pkgName = intent.getPackage();
if (pkgName == null) {
return mProviders.queryIntent(intent, resolvedType, flags, userId);
}
final VPackage pkg = mPackages.get(pkgName);
if (pkg != null) {
return mProviders.queryIntentForPackage(intent, resolvedType, flags, pkg.providers, userId);
}
return Collections.emptyList();
}
}
use of android.content.pm.ProviderInfo in project VirtualApp by asLody.
the class VPackageManagerService method getProviderInfo.
@Override
public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
synchronized (mPackages) {
VPackage p = mPackages.get(component.getPackageName());
if (p != null) {
PackageSetting ps = (PackageSetting) p.mExtras;
VPackage.ProviderComponent provider = mProvidersByComponent.get(component);
if (provider != null) {
ProviderInfo providerInfo = PackageParserEx.generateProviderInfo(provider, flags, ps.readUserState(userId), userId);
ComponentFixer.fixComponentInfo(ps, providerInfo, userId);
return providerInfo;
}
}
}
return null;
}
use of android.content.pm.ProviderInfo in project VirtualApp by asLody.
the class PackageParserEx method generateProviderInfo.
public static ProviderInfo generateProviderInfo(VPackage.ProviderComponent p, int flags, PackageUserState state, int userId) {
if (p == null)
return null;
if (!checkUseInstalledOrHidden(state, flags)) {
return null;
}
// Make shallow copies so we can store the metadata safely
ProviderInfo pi = new ProviderInfo(p.info);
if ((flags & PackageManager.GET_META_DATA) != 0 && (p.metaData != null)) {
pi.metaData = p.metaData;
}
if ((flags & PackageManager.GET_URI_PERMISSION_PATTERNS) == 0) {
pi.uriPermissionPatterns = null;
}
pi.applicationInfo = generateApplicationInfo(p.owner, flags, state, userId);
return pi;
}
Aggregations