• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RootManager类的典型用法和代码示例

java 2次浏览

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

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

示例1: withData

点赞 3

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
private void withData(AppsModel model, ApplicationInfo packageInfo, File file, FileUtil fileUtil, int count) throws Exception {
    File dataFolder = new File(packageInfo.dataDir);
    File dataFile = new File(fileUtil.getBaseFolderName() + model.getPackageName());
    boolean z = RootManager.getInstance().copyFile(dataFolder.getPath(), fileUtil.getBaseFolderName());
    ZipParameters parameters = new ZipParameters();
    parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
    parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_FASTEST);
    if (z) {
        if (dataFile.exists()) {
            zipData.addFolder(dataFile, parameters);
            FileUtils.deleteDirectory(dataFile);
        }
    }
    ProgressModel progressModel = new ProgressModel();
    progressModel.setProgress(count);
    progressModel.setFileName(model.getAppName());
    publishProgress(progressModel);
}
 

开发者ID:k0shk0sh,
项目名称:KAM,
代码行数:19,
代码来源:BackupAppsTasker.java

示例2: getShell

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
@Override
public Shell getShell() {
    return new AsyncShell() {
        @Override
        public boolean exec(String command, FeedbackReceiver receiver) {
            Result result = RootManager.getInstance().runCommand(command);
            if (receiver != null) receiver.onFeedback(result.getMessage());
            return result.getResult();
        }
    };
}
 

开发者ID:NickAndroid,
项目名称:Scalpel_Android,
代码行数:12,
代码来源:ChrisRootRequester.java

示例3: doInBackground

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
@Override
protected Boolean doInBackground(Context... params) {
    if (AppHelper.isRoot()) {
        AppHelper.setRootEnabled(params[0], RootManager.getInstance().obtainPermission());
    }
    return null;
}
 

开发者ID:k0shk0sh,
项目名称:KAM,
代码行数:8,
代码来源:RootChecker.java

示例4: checkForRoot

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
public boolean checkForRoot() {
    return RootManager.getInstance().hasRooted();
}
 

开发者ID:sarbajitsaha,
项目名称:Batch-Uninstaller,
代码行数:4,
代码来源:MainActivity.java

示例5: requestRoot

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
@Override
public boolean requestRoot() {
    return RootManager.getInstance().obtainPermission();
}
 

开发者ID:NickAndroid,
项目名称:Scalpel_Android,
代码行数:5,
代码来源:ChrisRootRequester.java

示例6: installSilently

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
public static Result installSilently(@NonNull File filename) {
    return RootManager.getInstance().installPackage(filename.getPath());
}
 

开发者ID:k0shk0sh,
项目名称:NewKam,
代码行数:4,
代码来源:ApkHelper.java

示例7: uninstallApkSilently

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
public static Result uninstallApkSilently(@NonNull String apkPath) {
    return RootManager.getInstance().uninstallPackage(apkPath);
}
 

开发者ID:k0shk0sh,
项目名称:NewKam,
代码行数:4,
代码来源:ApkHelper.java

示例8: isDeviceRooted

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
public static boolean isDeviceRooted() {
    return RootManager.getInstance().hasRooted() || doesFileExists(KEY_SU);
}
 

开发者ID:k0shk0sh,
项目名称:NewKam,
代码行数:4,
代码来源:RootHelper.java

示例9: obtainRoot

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
public static boolean obtainRoot() {
    return RootManager.getInstance().obtainPermission();
}
 

开发者ID:k0shk0sh,
项目名称:NewKam,
代码行数:4,
代码来源:RootHelper.java

示例10: installApkSilently

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
public static Result installApkSilently(String apkPath) {
    return RootManager.getInstance().installPackage(apkPath);
}
 

开发者ID:k0shk0sh,
项目名称:KAM,
代码行数:4,
代码来源:AppHelper.java

示例11: uninstallApkSilently

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
public static Result uninstallApkSilently(String apkPath) {
    return RootManager.getInstance().uninstallPackage(apkPath);
}
 

开发者ID:k0shk0sh,
项目名称:KAM,
代码行数:4,
代码来源:AppHelper.java

示例12: isRoot

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
public static boolean isRoot() {
    return RootManager.getInstance().hasRooted();
}
 

开发者ID:k0shk0sh,
项目名称:KAM,
代码行数:4,
代码来源:AppHelper.java

示例13: doInBackground

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
@Override
    protected ProgressModel doInBackground(Context... params) {
        try {
            FileUtil fileUtil = new FileUtil();
            boolean withData = AppHelper.isRestoreData(params[0]);
            if (withData) RootManager.getInstance().obtainPermission();
            File zipFile = new File(fileUtil.getBaseFolderName() + "backup.zip");
            if (!zipFile.exists()) {
//                if (withData) {
//                    withData();
//                }
                return error("Backup Folder Doe Not Exits!");
            }
            zFile = new ZipFile(zipFile);
            List fileHeaderList = zFile.getFileHeaders();
            ProgressModel progressModel = new ProgressModel();
            progressModel.setMax(fileHeaderList.size());
            publishProgress(progressModel);
            for (int i = 0; i < fileHeaderList.size(); i++) {
                if (isCancelled()) {
                    return error("cancelled");
                }
                FileHeader fileHeader = (FileHeader) fileHeaderList.get(i);
                zFile.extractFile(fileHeader, fileUtil.getBaseFolderName());
                progressModel = new ProgressModel();
                progressModel.setProgress(i);
                progressModel.setFileName(fileHeader.getFileName());
                publishProgress(progressModel);
                if (AppHelper.isRoot()) {
                    Result result = AppHelper.installApkSilently(new File(fileUtil.getBaseFolderName() + fileHeader.getFileName()).getPath());
                    if (result != null && result.getStatusCode() == Result.ResultEnum.INSTALL_SUCCESS.getStatusCode()) {
                        boolean deleteApk = new File(fileUtil.getBaseFolderName() + fileHeader.getFileName()).delete();
                    }
                } else {
                    progressModel.setFilePath(fileUtil.getBaseFolderName() + fileHeader.getFileName());
                }
            }
            zipFile.delete();
        } catch (Exception e) {
            e.printStackTrace();
            return error(e.getMessage());
        }
        return null;
    }
 

开发者ID:k0shk0sh,
项目名称:KAM,
代码行数:45,
代码来源:RestoreAppsTasker.java

示例14: copyFileToData

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
private void copyFileToData(String base, String file) throws Exception {
        RootManager.getInstance().copyFile(base + File.separator + file, " /data/data/" + file);
        FileUtils.forceDelete(new File(base + File.separator + file));
//        Log.e("Result", result.getMessage() + "  " + result.getStatusCode());
    }
 

开发者ID:k0shk0sh,
项目名称:KAM,
代码行数:6,
代码来源:RestoreAppsTasker.java

示例15: doInBackground

点赞 2

import com.chrisplus.rootmanager.RootManager; //导入依赖的package包/类
@Override
protected ProgressModel doInBackground(Void... params) {
    List<AppsModel> appsModelList;
    if (appsModels == null) {
        appsModelList = new AppListCreator(context).getAppList();
    } else {
        appsModelList = appsModels;
    }
    if (appsModelList == null) {
        return onError("Apps Are Empty, Please select ones");
    }
    ProgressModel progressModel = new ProgressModel();
    progressModel.setMax(appsModelList.size());
    publishProgress(progressModel);
    try {
        FileUtil fileUtil = new FileUtil();
        File zipFileName = new File(fileUtil.getBaseFolderName() + "backup.zip");
        File zipFileData = new File(fileUtil.getBaseFolderName() + "data.zip");
        zipFile = new ZipFile(zipFileName);
        zipData = new ZipFile(zipFileData);
        if (!zipData.isValidZipFile()) {
            if (zipData.getFile() != null && zipData.getFile().exists())
                zipData.getFile().delete();
        }
        if (!zipFile.isValidZipFile()) {
            if (zipFile.getFile() != null && zipFile.getFile().exists())
                zipFile.getFile().delete();
        }
        int count = 0;
        boolean withData = AppHelper.isBackupData(context);
        if (withData) RootManager.getInstance().obtainPermission();
        for (AppsModel model : appsModelList) {
            if (isCancelled()) {
                return onError("cancelled");
            }
            if (model != null) {
                ApplicationInfo packageInfo = context.getPackageManager().getApplicationInfo(model.getPackageName(), 0);
                File file = new File(packageInfo.sourceDir);
                if (file.exists()) {
                    count++;
                    File fileToSave = fileUtil.generateFile(model.getAppName());
                    progressModel = new ProgressModel();
                    progressModel.setProgress(count);
                    progressModel.setFileName(fileToSave.getName());
                    publishProgress(progressModel);
                    ZipParameters parameters = new ZipParameters();
                    parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
                    parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_FASTEST);
                    parameters.setSourceExternalStream(true);
                    parameters.setFileNameInZip(fileToSave.getName().replaceAll(" ", ""));
                    zipFile.addFile(file, parameters);
                    progressModel = new ProgressModel();
                    progressModel.setProgress(count);
                    progressModel.setFileName(fileToSave.getName());
                    publishProgress(progressModel);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        return onError(e.getMessage());
    }

    return null;
}
 

开发者ID:k0shk0sh,
项目名称:KAM,
代码行数:66,
代码来源:BackupAppsTasker.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)