当前位置: 首页>>代码示例>>Java>>正文


Java VEnvironment类代码示例

本文整理汇总了Java中com.lody.virtual.os.VEnvironment的典型用法代码示例。如果您正苦于以下问题:Java VEnvironment类的具体用法?Java VEnvironment怎么用?Java VEnvironment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VEnvironment类属于com.lody.virtual.os包,在下文中一共展示了VEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveAllAccounts

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
/**
 * Serializing all accounts
 */
private void saveAllAccounts() {
	File accountFile = VEnvironment.getAccountConfigFile();
	Parcel dest = Parcel.obtain();
	try {
		dest.writeInt(1);
		List<VAccount> accounts = new ArrayList<>();
		for (int i = 0; i < this.accountsByUserId.size(); i++) {
			List<VAccount> list = this.accountsByUserId.valueAt(i);
			if (list != null) {
				accounts.addAll(list);
			}
		}
		dest.writeInt(accounts.size());
		for (VAccount account : accounts) {
			account.writeToParcel(dest, 0);
		}
		dest.writeLong(lastAccountChangeTime);
		FileOutputStream fileOutputStream = new FileOutputStream(accountFile);
		fileOutputStream.write(dest.marshall());
		fileOutputStream.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
	dest.recycle();
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:29,代码来源:VAccountManagerService.java

示例2: saveJobs

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
private void saveJobs() {
    File jobFile = VEnvironment.getJobConfigFile();
    Parcel p = Parcel.obtain();
    try {
        p.writeInt(JOB_FILE_VERSION);
        p.writeInt(mJobStore.size());
        for (Map.Entry<JobId, JobConfig> entry : mJobStore.entrySet()) {
            entry.getKey().writeToParcel(p, 0);
            entry.getValue().writeToParcel(p, 0);
        }
        FileOutputStream fos = new FileOutputStream(jobFile);
        fos.write(p.marshall());
        fos.close();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        p.recycle();
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:20,代码来源:VJobSchedulerService.java

示例3: 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;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:23,代码来源:PackageParserEx.java

示例4: readSignature

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
public static void readSignature(VPackage pkg) {
    File signatureFile = VEnvironment.getSignatureFile(pkg.packageName);
    if (!signatureFile.exists()) {
        return;
    }
    Parcel p = Parcel.obtain();
    try {
        FileInputStream fis = new FileInputStream(signatureFile);
        byte[] bytes = FileUtils.toByteArray(fis);
        fis.close();
        p.unmarshall(bytes, 0, bytes.length);
        p.setDataPosition(0);
        pkg.mSignatures = p.createTypedArray(Signature.CREATOR);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        p.recycle();
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:20,代码来源:PackageParserEx.java

示例5: createSessionInternal

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
private int createSessionInternal(SessionParams params, String installerPackageName, int userId)
        throws IOException {
    final int callingUid = VBinder.getCallingUid();
    final int sessionId;
    final PackageInstallerSession session;
    synchronized (mSessions) {
        // Sanity check that installer isn't going crazy
        final int activeCount = getSessionCount(mSessions, callingUid);
        if (activeCount >= MAX_ACTIVE_SESSIONS) {
            throw new IllegalStateException(
                    "Too many active sessions for UID " + callingUid);
        }
        sessionId = allocateSessionIdLocked();
        session = new PackageInstallerSession(mInternalCallback, mContext, mInstallHandler.getLooper(), installerPackageName, sessionId, userId, callingUid, params, VEnvironment.getPackageInstallerStageDir());
    }
    mCallbacks.notifySessionCreated(session.sessionId, session.userId);
    return sessionId;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:19,代码来源:VPackageInstallerService.java

示例6: 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;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:22,代码来源:VAppManagerService.java

示例7: uninstallPackageAsUser

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
@Override
public synchronized boolean uninstallPackageAsUser(String packageName, int userId) {
    if (!VUserManagerService.get().exists(userId)) {
        return false;
    }
    PackageSetting ps = PackageCacheManager.getSetting(packageName);
    if (ps != null) {
        int[] userIds = getPackageInstalledUsers(packageName);
        if (!ArrayUtils.contains(userIds, userId)) {
            return false;
        }
        if (userIds.length == 1) {
            uninstallPackageFully(ps);
        } else {
            // Just hidden it
            VActivityManagerService.get().killAppByPkg(packageName, userId);
            ps.setInstalled(userId, false);
            notifyAppUninstalled(ps, userId);
            mPersistenceLayer.save();
            FileUtils.deleteDir(VEnvironment.getDataUserPackageDirectory(userId, packageName));
        }
        return true;
    }
    return false;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:26,代码来源:VAppManagerService.java

示例8: uninstallPackageFully

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
private void uninstallPackageFully(PackageSetting ps) {
    String packageName = ps.packageName;
    try {
        BroadcastSystem.get().stopApp(packageName);
        VActivityManagerService.get().killAppByPkg(packageName, VUserHandle.USER_ALL);
        VEnvironment.getPackageResourcePath(packageName).delete();
        FileUtils.deleteDir(VEnvironment.getDataAppPackageDirectory(packageName));
        VEnvironment.getOdexFile(packageName).delete();
        for (int id : VUserManagerService.get().getUserIds()) {
            FileUtils.deleteDir(VEnvironment.getDataUserPackageDirectory(id, packageName));
        }
        PackageCacheManager.remove(packageName);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        notifyAppUninstalled(ps, -1);
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:19,代码来源:VAppManagerService.java

示例9: saveAllAccounts

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
/**
 * Serializing all accounts
 */
private void saveAllAccounts() {
    File accountFile = VEnvironment.getAccountConfigFile();
    Parcel dest = Parcel.obtain();
    try {
        dest.writeInt(1);
        List<VAccount> accounts = new ArrayList<>();
        for (int i = 0; i < this.accountsByUserId.size(); i++) {
            List<VAccount> list = this.accountsByUserId.valueAt(i);
            if (list != null) {
                accounts.addAll(list);
            }
        }
        dest.writeInt(accounts.size());
        for (VAccount account : accounts) {
            account.writeToParcel(dest, 0);
        }
        dest.writeLong(lastAccountChangeTime);
        FileOutputStream fileOutputStream = new FileOutputStream(accountFile);
        fileOutputStream.write(dest.marshall());
        fileOutputStream.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    dest.recycle();
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:29,代码来源:VAccountManagerService.java

示例10: serializeAllAccounts

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
/**
 * Serializing all accounts
 */
private void serializeAllAccounts() {
	File accountFile = VEnvironment.getAccountConfigFile();
	Parcel dest = Parcel.obtain();
	try {
		dest.writeInt(1);
		List<VAccount> accounts = new ArrayList<>();
		for (int i = 0; i < this.accountsByUserId.size(); i++) {
			List<VAccount> list = this.accountsByUserId.valueAt(i);
			if (list != null) {
				accounts.addAll(list);
			}
		}
		dest.writeInt(accounts.size());
		for (VAccount account : accounts) {
			account.writeToParcel(dest, 0);
		}
		dest.writeLong(lastAccountChangeTime);
		FileOutputStream fileOutputStream = new FileOutputStream(accountFile);
		fileOutputStream.write(dest.marshall());
		fileOutputStream.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
	dest.recycle();
}
 
开发者ID:codehz,项目名称:container,代码行数:29,代码来源:VAccountManagerService.java

示例11: uninstallApp

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
public boolean uninstallApp(String pkg) {
    synchronized (PackageCache.sPackageCaches) {
        AppSetting setting = findAppInfo(pkg);
        if (setting != null) {
            try {
                BroadcastSystem.get().stopApp(pkg);
                VActivityManagerService.get().killAppByPkg(pkg, VUserHandle.USER_ALL);
                FileUtils.deleteDir(VEnvironment.getDataAppPackageDirectory(pkg));
                VEnvironment.getOdexFile(pkg).delete();
                for (int userId : VUserManagerService.get().getUserIds()) {
                    FileUtils.deleteDir(VEnvironment.getDataUserPackageDirectory(userId, pkg));
                }
                PackageCache.remove(pkg);
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                notifyAppUninstalled(setting);
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:codehz,项目名称:container,代码行数:24,代码来源:VAppManagerService.java

示例12: save

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
private void save() {
    File uidFile = VEnvironment.getUidListFile();
    File bakUidFile = VEnvironment.getBakUidListFile();
    if (uidFile.exists()) {
        if (bakUidFile.exists() && !bakUidFile.delete()) {
            VLog.w(TAG, "Warning: Unable to delete the expired file --\n " + bakUidFile.getPath());
        }
        FileUtils.copyFile(uidFile, bakUidFile);
    }
    try {
        ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(uidFile));
        os.writeInt(mFreeUid);
        os.writeObject(mSharedUserIdMap);
        os.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:codehz,项目名称:container,代码行数:19,代码来源:UidSystem.java

示例13: startIOUniformer

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
@SuppressLint("SdCardPath")
private void startIOUniformer() {
    ApplicationInfo info = mBoundApplication.appInfo;
    int userId = VUserHandle.myUserId();
    NativeEngine.redirectDirectory("/data/data/" + info.packageName, info.dataDir);
    NativeEngine.redirectDirectory("/data/user/0/" + info.packageName, info.dataDir);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        NativeEngine.redirectDirectory("/data/user_de/0/" + info.packageName, info.dataDir);
    }
    String libPath = new File(VEnvironment.getDataAppPackageDirectory(info.packageName), "lib").getAbsolutePath();
    String userLibPath = new File(VEnvironment.getUserSystemDirectory(userId), "lib").getAbsolutePath();
    NativeEngine.redirectDirectory(userLibPath, libPath);
    NativeEngine.redirectDirectory("/data/data/" + info.packageName + "/lib/", libPath);
    NativeEngine.redirectDirectory("/data/user/0/" + info.packageName + "/lib/", libPath);

    NativeEngine.readOnly(VEnvironment.getDataAppDirectory().getPath());
    VirtualStorageManager vsManager = VirtualStorageManager.get();
    String vsPath = vsManager.getVirtualStorage(info.packageName, userId);
    boolean enable = vsManager.isVirtualStorageEnable(info.packageName, userId);
    if (enable && vsPath != null) {
        File vsDirectory = new File(vsPath);
        if (vsDirectory.exists() || vsDirectory.mkdirs()) {
            HashSet<String> mountPoints = getMountPoints();
            for (String mountPoint : mountPoints) {
                NativeEngine.redirectDirectory(mountPoint, vsPath);
            }
        }
    }
    NativeEngine.hook();
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:31,代码来源:VClientImpl.java

示例14: readJobs

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
private void readJobs() {
    File jobFile = VEnvironment.getJobConfigFile();
    if (!jobFile.exists()) {
        return;
    }
    Parcel p = Parcel.obtain();
    try {
        FileInputStream fis = new FileInputStream(jobFile);
        byte[] bytes = new byte[(int) jobFile.length()];
        int len = fis.read(bytes);
        fis.close();
        if (len != bytes.length) {
            throw new IOException("Unable to read job config.");
        }
        p.unmarshall(bytes, 0, bytes.length);
        p.setDataPosition(0);
        int version = p.readInt();
        if (version != JOB_FILE_VERSION) {
            throw new IOException("Bad version of job file: " + version);
        }
        if (!mJobStore.isEmpty()) {
            mJobStore.clear();
        }
        int count = p.readInt();
        for (int i = 0; i < count; i++) {
            JobId jobId = new JobId(p);
            JobConfig config = new JobConfig(p);
            mJobStore.put(jobId, config);
            mGlobalJobId = Math.max(mGlobalJobId, config.virtualJobId);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        p.recycle();
    }

}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:38,代码来源:VJobSchedulerService.java

示例15: initApplicationAsUser

import com.lody.virtual.os.VEnvironment; //导入依赖的package包/类
private static void initApplicationAsUser(ApplicationInfo ai, int userId) {
    ai.dataDir = VEnvironment.getDataUserPackageDirectory(userId, ai.packageName).getPath();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        ApplicationInfoN.deviceEncryptedDataDir.set(ai, ai.dataDir);
        ApplicationInfoN.deviceProtectedDataDir.set(ai, ai.dataDir);
        ApplicationInfoN.credentialEncryptedDataDir.set(ai, ai.dataDir);
        ApplicationInfoN.credentialProtectedDataDir.set(ai, ai.dataDir);
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:10,代码来源:PackageParserEx.java


注:本文中的com.lody.virtual.os.VEnvironment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。