Search in sources :

Example 11 with InstalledAppInfo

use of com.lody.virtual.remote.InstalledAppInfo in project VirtualApp by asLody.

the class AppRepository method convertPackageInfoToAppData.

private List<AppInfo> convertPackageInfoToAppData(Context context, List<PackageInfo> pkgList, boolean fastOpen) {
    PackageManager pm = context.getPackageManager();
    List<AppInfo> list = new ArrayList<>(pkgList.size());
    String hostPkg = VirtualCore.get().getHostPkg();
    for (PackageInfo pkg : pkgList) {
        // ignore the host package
        if (hostPkg.equals(pkg.packageName)) {
            continue;
        }
        // ignore the System package
        if (isSystemApplication(pkg)) {
            continue;
        }
        ApplicationInfo applicationInfo = pkg.applicationInfo;
        String path = applicationInfo.sourceDir;
        if (path == null) {
            continue;
        }
        AppInfo info = new AppInfo();
        info.packageName = pkg.packageName;
        info.fastOpen = fastOpen;
        info.path = path;
        info.icon = applicationInfo.loadIcon(pm);
        info.name = applicationInfo.loadLabel(pm);
        InstalledAppInfo installedAppInfo = VirtualCore.get().getInstalledAppInfo(pkg.packageName, 0);
        if (installedAppInfo != null) {
            info.cloneCount = installedAppInfo.getInstalledUsers().length;
        }
        list.add(info);
    }
    return list;
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) ArrayList(java.util.ArrayList) ApplicationInfo(android.content.pm.ApplicationInfo) InstalledAppInfo(com.lody.virtual.remote.InstalledAppInfo) InstalledAppInfo(com.lody.virtual.remote.InstalledAppInfo) AppInfo(io.virtualapp.home.models.AppInfo)

Aggregations

InstalledAppInfo (com.lody.virtual.remote.InstalledAppInfo)11 ArrayList (java.util.ArrayList)4 ApplicationInfo (android.content.pm.ApplicationInfo)3 PackageManager (android.content.pm.PackageManager)3 IOException (java.io.IOException)3 Intent (android.content.Intent)2 AssetManager (android.content.res.AssetManager)2 Resources (android.content.res.Resources)2 Bitmap (android.graphics.Bitmap)2 VPackageManager (com.lody.virtual.client.ipc.VPackageManager)2 VPackage (com.lody.virtual.server.pm.parser.VPackage)2 DexFile (dalvik.system.DexFile)2 AppData (io.virtualapp.home.models.AppData)2 MultiplePackageAppData (io.virtualapp.home.models.MultiplePackageAppData)2 PackageAppData (io.virtualapp.home.models.PackageAppData)2 File (java.io.File)2 Activity (android.app.Activity)1 PackageInfo (android.content.pm.PackageInfo)1 VirtualCore (com.lody.virtual.client.core.VirtualCore)1 VUserInfo (com.lody.virtual.os.VUserInfo)1