本文整理汇总了Java中com.lody.virtual.os.VEnvironment.getPackageCacheFile方法的典型用法代码示例。如果您正苦于以下问题:Java VEnvironment.getPackageCacheFile方法的具体用法?Java VEnvironment.getPackageCacheFile怎么用?Java VEnvironment.getPackageCacheFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lody.virtual.os.VEnvironment
的用法示例。
在下文中一共展示了VEnvironment.getPackageCacheFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readPackageCache
import com.lody.virtual.os.VEnvironment; //导入方法依赖的package包/类
public static VPackage readPackageCache(String packageName) {
Parcel p = Parcel.obtain();
try {
File cacheFile = VEnvironment.getPackageCacheFile(packageName);
FileInputStream is = new FileInputStream(cacheFile);
byte[] bytes = FileUtils.toByteArray(is);
is.close();
p.unmarshall(bytes, 0, bytes.length);
p.setDataPosition(0);
if (p.readInt() != 4) {
throw new IllegalStateException("Invalid version.");
}
VPackage pkg = new VPackage(p);
addOwner(pkg);
return pkg;
} catch (Exception e) {
e.printStackTrace();
} finally {
p.recycle();
}
return null;
}
示例2: loadPackageInnerLocked
import com.lody.virtual.os.VEnvironment; //导入方法依赖的package包/类
private boolean loadPackageInnerLocked(PackageSetting ps) {
if (ps.dependSystem) {
if (!VirtualCore.get().isOutsideInstalled(ps.packageName)) {
return false;
}
}
File cacheFile = VEnvironment.getPackageCacheFile(ps.packageName);
VPackage pkg = null;
try {
pkg = PackageParserEx.readPackageCache(ps.packageName);
} catch (Throwable e) {
e.printStackTrace();
}
if (pkg == null || pkg.packageName == null) {
return false;
}
chmodPackageDictionary(cacheFile);
PackageCacheManager.put(pkg, ps);
BroadcastSystem.get().startApp(pkg);
return true;
}