Search in sources :

Example 6 with PackageAppData

use of io.virtualapp.home.models.PackageAppData in project VirtualApp by asLody.

the class AppRepository method getVirtualApps.

@Override
public Promise<List<AppData>, Throwable, Void> getVirtualApps() {
    return VUiKit.defer().when(() -> {
        List<InstalledAppInfo> infos = VirtualCore.get().getInstalledApps(0);
        List<AppData> models = new ArrayList<>();
        for (InstalledAppInfo info : infos) {
            if (!VirtualCore.get().isPackageLaunchable(info.packageName)) {
                continue;
            }
            PackageAppData data = new PackageAppData(mContext, info);
            if (VirtualCore.get().isAppInstalledAsUser(0, info.packageName)) {
                models.add(data);
            }
            int[] userIds = info.getInstalledUsers();
            for (int userId : userIds) {
                if (userId != 0) {
                    models.add(new MultiplePackageAppData(data, userId));
                }
            }
        }
        return models;
    });
}
Also used : MultiplePackageAppData(io.virtualapp.home.models.MultiplePackageAppData) PackageAppData(io.virtualapp.home.models.PackageAppData) AppData(io.virtualapp.home.models.AppData) InstalledAppInfo(com.lody.virtual.remote.InstalledAppInfo) ArrayList(java.util.ArrayList) MultiplePackageAppData(io.virtualapp.home.models.MultiplePackageAppData) MultiplePackageAppData(io.virtualapp.home.models.MultiplePackageAppData) PackageAppData(io.virtualapp.home.models.PackageAppData)

Aggregations

MultiplePackageAppData (io.virtualapp.home.models.MultiplePackageAppData)6 PackageAppData (io.virtualapp.home.models.PackageAppData)6 InstalledAppInfo (com.lody.virtual.remote.InstalledAppInfo)4 AppData (io.virtualapp.home.models.AppData)4 ArrayList (java.util.ArrayList)3 VirtualCore (com.lody.virtual.client.core.VirtualCore)2 VUserInfo (com.lody.virtual.os.VUserInfo)2 VUserManager (com.lody.virtual.os.VUserManager)2 InstallResult (com.lody.virtual.remote.InstallResult)2 VCommends (io.virtualapp.VCommends)2 VUiKit (io.virtualapp.abs.ui.VUiKit)2 AppInfoLite (io.virtualapp.home.models.AppInfoLite)2 PackageAppDataStorage (io.virtualapp.home.repo.PackageAppDataStorage)2 IOException (java.io.IOException)2 Activity (android.app.Activity)1 Context (android.content.Context)1 Intent (android.content.Intent)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 Bitmap (android.graphics.Bitmap)1