Search in sources :

Example 6 with VPackage

use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.

the class VAppManagerService method getInstalledAppsAsUser.

@Override
public List<InstalledAppInfo> getInstalledAppsAsUser(int userId, int flags) {
    List<InstalledAppInfo> infoList = new ArrayList<>(getInstalledAppCount());
    for (VPackage p : PackageCacheManager.PACKAGE_CACHE.values()) {
        PackageSetting setting = (PackageSetting) p.mExtras;
        boolean visible = setting.isInstalled(userId);
        if ((flags & VirtualCore.GET_HIDDEN_APP) == 0 && setting.isHidden(userId)) {
            visible = false;
        }
        if (visible) {
            infoList.add(setting.getAppInfo(flags));
        }
    }
    return infoList;
}
Also used : VPackage(com.lody.virtual.server.pm.parser.VPackage) ArrayList(java.util.ArrayList) InstalledAppInfo(com.lody.virtual.remote.InstalledAppInfo)

Example 7 with VPackage

use of com.lody.virtual.server.pm.parser.VPackage 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 null;
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) VPackage(com.lody.virtual.server.pm.parser.VPackage) ProviderInfo(android.content.pm.ProviderInfo) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) TargetApi(android.annotation.TargetApi)

Example 8 with VPackage

use of com.lody.virtual.server.pm.parser.VPackage 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;
}
Also used : VPackage(com.lody.virtual.server.pm.parser.VPackage) ProviderInfo(android.content.pm.ProviderInfo)

Example 9 with VPackage

use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.

the class VPackageManagerService method queryIntentReceivers.

@Override
public List<ResolveInfo> queryIntentReceivers(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) {
        List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        ActivityInfo ai = getReceiverInfo(comp, flags, userId);
        if (ai != null) {
            ResolveInfo ri = new ResolveInfo();
            ri.activityInfo = ai;
            list.add(ri);
        }
        return list;
    }
    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mReceivers.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mReceivers.queryIntentForPackage(intent, resolvedType, flags, pkg.receivers, userId);
        }
        return null;
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) ActivityInfo(android.content.pm.ActivityInfo) VPackage(com.lody.virtual.server.pm.parser.VPackage) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName)

Example 10 with VPackage

use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.

the class PackagePersistenceLayer method writePersistenceData.

@Override
public void writePersistenceData(Parcel p) {
    synchronized (PackageCacheManager.PACKAGE_CACHE) {
        p.writeInt(PackageCacheManager.PACKAGE_CACHE.size());
        for (VPackage pkg : PackageCacheManager.PACKAGE_CACHE.values()) {
            PackageSetting ps = (PackageSetting) pkg.mExtras;
            ps.writeToParcel(p, 0);
        }
    }
}
Also used : VPackage(com.lody.virtual.server.pm.parser.VPackage)

Aggregations

VPackage (com.lody.virtual.server.pm.parser.VPackage)23 ArrayList (java.util.ArrayList)10 ActivityInfo (android.content.pm.ActivityInfo)5 ComponentName (android.content.ComponentName)4 ResolveInfo (android.content.pm.ResolveInfo)4 ProviderInfo (android.content.pm.ProviderInfo)3 ServiceInfo (android.content.pm.ServiceInfo)2 InstalledAppInfo (com.lody.virtual.remote.InstalledAppInfo)2 VParceledListSlice (com.lody.virtual.remote.VParceledListSlice)2 File (java.io.File)2 TargetApi (android.annotation.TargetApi)1 BroadcastReceiver (android.content.BroadcastReceiver)1 IntentFilter (android.content.IntentFilter)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageInfo (android.content.pm.PackageInfo)1 InstallResult (com.lody.virtual.remote.InstallResult)1 PackageSetting (com.lody.virtual.server.pm.PackageSetting)1 IOException (java.io.IOException)1