use of com.lody.virtual.remote.InstalledAppInfo 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;
}
use of com.lody.virtual.remote.InstalledAppInfo in project VirtualApp by asLody.
the class VirtualCore method getResources.
public Resources getResources(String pkg) {
InstalledAppInfo installedAppInfo = getInstalledAppInfo(pkg, 0);
if (installedAppInfo != null) {
AssetManager assets = mirror.android.content.res.AssetManager.ctor.newInstance();
mirror.android.content.res.AssetManager.addAssetPath.call(assets, installedAppInfo.apkPath);
Resources hostRes = context.getResources();
return new Resources(assets, hostRes.getDisplayMetrics(), hostRes.getConfiguration());
}
return null;
}
use of com.lody.virtual.remote.InstalledAppInfo in project VirtualApp by asLody.
the class VirtualCore method removeShortcut.
public boolean removeShortcut(int userId, String packageName, Intent splash, OnEmitShortcutListener listener) {
InstalledAppInfo setting = getInstalledAppInfo(packageName, 0);
if (setting == null) {
return false;
}
ApplicationInfo appInfo = setting.getApplicationInfo(userId);
PackageManager pm = context.getPackageManager();
String name;
try {
CharSequence sequence = appInfo.loadLabel(pm);
name = sequence.toString();
} catch (Throwable e) {
return false;
}
if (listener != null) {
String newName = listener.getName(name);
if (newName != null) {
name = newName;
}
}
Intent targetIntent = getLaunchIntent(packageName, userId);
if (targetIntent == null) {
return false;
}
Intent shortcutIntent = new Intent();
shortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
shortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
if (splash != null) {
shortcutIntent.putExtra("_VA_|_splash_", splash.toUri(0));
}
shortcutIntent.putExtra("_VA_|_intent_", targetIntent);
shortcutIntent.putExtra("_VA_|_uri_", targetIntent.toUri(0));
shortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
addIntent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
context.sendBroadcast(addIntent);
return true;
}
use of com.lody.virtual.remote.InstalledAppInfo in project VirtualApp by asLody.
the class NativeEngine method startDexOverride.
public static void startDexOverride() {
List<InstalledAppInfo> installedAppInfos = VirtualCore.get().getInstalledApps(0);
sDexOverrideMap = new HashMap<>(installedAppInfos.size());
for (InstalledAppInfo info : installedAppInfos) {
try {
sDexOverrideMap.put(new File(info.apkPath).getCanonicalPath(), info);
} catch (IOException e) {
e.printStackTrace();
}
}
}
use of com.lody.virtual.remote.InstalledAppInfo in project VirtualApp by asLody.
the class AppAccountParser method getResources.
@Override
public Resources getResources(Context context, ApplicationInfo appInfo) throws Exception {
InstalledAppInfo appSetting = VAppManagerService.get().getInstalledAppInfo(appInfo.packageName, 0);
if (appSetting != null) {
AssetManager assets = mirror.android.content.res.AssetManager.ctor.newInstance();
mirror.android.content.res.AssetManager.addAssetPath.call(assets, appSetting.apkPath);
Resources hostRes = context.getResources();
return new Resources(assets, hostRes.getDisplayMetrics(), hostRes.getConfiguration());
}
return null;
}
Aggregations