use of android.content.pm.ProviderInfo in project VirtualXposed by android-hacker.
the class ProviderIntentResolver method newResult.
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
protected ResolveInfo newResult(VPackage.ProviderIntentInfo filter, int match, int userId) {
final VPackage.ProviderComponent provider = filter.provider;
PackageSetting ps = (PackageSetting) provider.owner.mExtras;
ProviderInfo pi = PackageParserEx.generateProviderInfo(provider, mFlags, ps.readUserState(userId), userId);
if (pi == null) {
return null;
}
final ResolveInfo res = new ResolveInfo();
res.providerInfo = pi;
if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
res.filter = filter.filter;
}
res.priority = filter.filter.getPriority();
res.preferredOrder = provider.owner.mPreferredOrder;
res.match = match;
res.isDefault = filter.hasDefault;
res.labelRes = filter.labelRes;
res.nonLocalizedLabel = filter.nonLocalizedLabel;
res.icon = filter.icon;
return res;
}
use of android.content.pm.ProviderInfo in project VirtualXposed by android-hacker.
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 VirtualXposed by android-hacker.
the class VPackageManagerService method resolveContentProvider.
@Override
public ProviderInfo resolveContentProvider(String name, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
synchronized (mPackages) {
final VPackage.ProviderComponent provider = mProvidersByAuthority.get(name);
if (provider != null) {
PackageSetting ps = (PackageSetting) provider.owner.mExtras;
ProviderInfo providerInfo = PackageParserEx.generateProviderInfo(provider, flags, ps.readUserState(userId), userId);
if (providerInfo != null) {
VPackage p = mPackages.get(providerInfo.packageName);
PackageSetting settings = (PackageSetting) p.mExtras;
ComponentFixer.fixComponentInfo(settings, providerInfo, userId);
return providerInfo;
}
}
}
return null;
}
use of android.content.pm.ProviderInfo in project VirtualXposed by android-hacker.
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;
}
use of android.content.pm.ProviderInfo in project VirtualXposed by android-hacker.
the class PackageParserEx method generatePackageInfo.
public static PackageInfo generatePackageInfo(VPackage p, int flags, long firstInstallTime, long lastUpdateTime, PackageUserState state, int userId) {
if (!checkUseInstalledOrHidden(state, flags)) {
return null;
}
if (p.mSignatures == null) {
readSignature(p);
}
PackageInfo pi = new PackageInfo();
pi.packageName = p.packageName;
pi.versionCode = p.mVersionCode;
pi.sharedUserLabel = p.mSharedUserLabel;
pi.versionName = p.mVersionName;
pi.sharedUserId = p.mSharedUserId;
pi.sharedUserLabel = p.mSharedUserLabel;
pi.applicationInfo = generateApplicationInfo(p, flags, state, userId);
pi.firstInstallTime = firstInstallTime;
pi.lastUpdateTime = lastUpdateTime;
if (p.requestedPermissions != null && !p.requestedPermissions.isEmpty()) {
String[] requestedPermissions = new String[p.requestedPermissions.size()];
p.requestedPermissions.toArray(requestedPermissions);
pi.requestedPermissions = requestedPermissions;
}
if ((flags & PackageManager.GET_GIDS) != 0) {
pi.gids = PackageParserCompat.GIDS;
}
if ((flags & PackageManager.GET_CONFIGURATIONS) != 0) {
int N = p.configPreferences != null ? p.configPreferences.size() : 0;
if (N > 0) {
pi.configPreferences = new ConfigurationInfo[N];
p.configPreferences.toArray(pi.configPreferences);
}
N = p.reqFeatures != null ? p.reqFeatures.size() : 0;
if (N > 0) {
pi.reqFeatures = new FeatureInfo[N];
p.reqFeatures.toArray(pi.reqFeatures);
}
}
if ((flags & PackageManager.GET_ACTIVITIES) != 0) {
final int N = p.activities.size();
if (N > 0) {
int num = 0;
final ActivityInfo[] res = new ActivityInfo[N];
for (int i = 0; i < N; i++) {
final VPackage.ActivityComponent a = p.activities.get(i);
res[num++] = generateActivityInfo(a, flags, state, userId);
}
pi.activities = res;
}
}
if ((flags & PackageManager.GET_RECEIVERS) != 0) {
final int N = p.receivers.size();
if (N > 0) {
int num = 0;
final ActivityInfo[] res = new ActivityInfo[N];
for (int i = 0; i < N; i++) {
final VPackage.ActivityComponent a = p.receivers.get(i);
res[num++] = generateActivityInfo(a, flags, state, userId);
}
pi.receivers = res;
}
}
if ((flags & PackageManager.GET_SERVICES) != 0) {
final int N = p.services.size();
if (N > 0) {
int num = 0;
final ServiceInfo[] res = new ServiceInfo[N];
for (int i = 0; i < N; i++) {
final VPackage.ServiceComponent s = p.services.get(i);
res[num++] = generateServiceInfo(s, flags, state, userId);
}
pi.services = res;
}
}
if ((flags & PackageManager.GET_PROVIDERS) != 0) {
final int N = p.providers.size();
if (N > 0) {
int num = 0;
final ProviderInfo[] res = new ProviderInfo[N];
for (int i = 0; i < N; i++) {
final VPackage.ProviderComponent pr = p.providers.get(i);
res[num++] = generateProviderInfo(pr, flags, state, userId);
}
pi.providers = res;
}
}
if ((flags & PackageManager.GET_INSTRUMENTATION) != 0) {
int N = p.instrumentation.size();
if (N > 0) {
pi.instrumentation = new InstrumentationInfo[N];
for (int i = 0; i < N; i++) {
pi.instrumentation[i] = generateInstrumentationInfo(p.instrumentation.get(i), flags);
}
}
}
if ((flags & PackageManager.GET_SIGNATURES) != 0) {
int N = (p.mSignatures != null) ? p.mSignatures.length : 0;
if (N > 0) {
pi.signatures = new Signature[N];
System.arraycopy(p.mSignatures, 0, pi.signatures, 0, N);
}
}
return pi;
}
Aggregations