本文整理匯總了Java中com.stericson.RootTools.RootTools.isRootAvailable方法的典型用法代碼示例。如果您正苦於以下問題:Java RootTools.isRootAvailable方法的具體用法?Java RootTools.isRootAvailable怎麽用?Java RootTools.isRootAvailable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.stericson.RootTools.RootTools
的用法示例。
在下文中一共展示了RootTools.isRootAvailable方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkRootFromRootTools
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
private void checkRootFromRootTools() {
RootStatus rootStatus;
if (RootTools.isRootAvailable()) {
try {
if (RootTools.isAccessGiven()) {
rootStatus = RootStatus.ROOT_GRANT;
} else {
rootStatus = RootStatus.ROOT_DENIED;
}
} catch (Exception e) {
rootStatus = RootStatus.ROOT_DENIED;
}
} else {
rootStatus = RootStatus.ROOT_DENIED;
}
if (rootStatus == RootStatus.ROOT_GRANT) {
rootListener.onRootAndBusyBoxOk();
} else {
rootListener.onRootDenied();
}
}
示例2: unInstallApplication
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* 卸載應用
*/
public static void unInstallApplication(Context context,AppInfo appInfo) {
if (appInfo.isUserApp()) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:" + appInfo.getPackageName()));
context.startActivity(intent);
} else {
//係統應用需要root權限,利用linux命令刪除文件
if (!RootTools.isRootAvailable()) {
Toast.makeText(context,"卸載係統應用,必須要獲得root權限",Toast.LENGTH_SHORT).show();
return;
}
try {
if (!RootTools.isAccessGiven()) {
Toast.makeText(context,"請授權黑馬小衛士root權限",Toast.LENGTH_SHORT).show();
return;
}
RootTools.sendShell("mount -o remount ,rw /system",3000);
RootTools.sendShell("rm -r " + appInfo.getApkPath(),30000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例3: onInitialize
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
protected void onInitialize(boolean booReconnect) {
Log.d(getTag(), "Initializing");
if (RootTools.isRootAvailable() && RootTools.isAccessGiven()) {
Log.i(getTag(), "Starting the logcat monitoring service");
if (!this.thrWorker.isAlive()) {
this.thrWorker.start();
}
super.onInitialize(booReconnect);
} else {
Log.w(getTag(), "The device is not rooted or root access was denied");
Toast.makeText(getApplicationContext(), R.string.unrooted_error, Toast.LENGTH_LONG).show();
}
}
示例4: initData
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* 2
*/
@Override
protected void initData() {
// check whether root
root = RootTools.isRootAvailable();
// get free space
long romFreeSpace = AppManagerEngine.getRomFreeSpace();
long sdCardFreeSpace = AppManagerEngine.getSdCardFreeSpace();
// set space info to TextView
tvRomFreeSpace.setText(getString(R.string.rom_free_space) + Formatter.formatFileSize(this, romFreeSpace));
tvSdCardFreeSpace.setText(getString(R.string.sd_card_free_space) + Formatter.formatFileSize(this, sdCardFreeSpace));
// if the thread is running, no need to start a new thread
if (null != initDateThread && initDateThread.isAlive()) {
return;
}
// start a new thread
// the following operator are time consuming, need run on child thread
initDateThread = new Thread() {
@Override
public void run() {
// get apps info
AppManagerEngine.getInstalledAppInfo(
SoftwareManagerActivity.this,
new AppManagerEngine.AppInfoListener() {
@Override
public void onGetInfoCompleted(List<AppInfoBean> apps) {
initAppsInfo(apps);
}
});
}
};
initDateThread.start();
}
示例5: onResume
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
protected void onResume() {
super.onResume();
Log.e(TAG,"正在執行onResum");
sharedPreferences = getSharedPreferences(Config.ID,MODE_PRIVATE);
boolean isRoot = RootTools.isRootAvailable();
String isXposedInstalled = sharedPreferences.getString(Config.KEY_IS_INSTALL_XPOSED,Config.VALUE_NOT_INSTALLED);
String isModuleInstalled =getResult();
Log.e(TAG,"正在進行判斷:"+"isXposedInstalled:"+isXposedInstalled+"\t+isModuleInstalled:"+isModuleInstalled);
if(isRoot==true&&isXposedInstalled.equals("已安裝")&&isModuleInstalled.equals("已安裝")){
btn_install_xposed.setText("已安裝");
btn_install_xposed.setEnabled(false);
}
}
示例6: onResume
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
protected void onResume() {
super.onResume();
boolean isRoot =RootTools.isRootAvailable();
if (isRoot == true) {
btn_isRoot.setText("已root");
btn_isRoot.setEnabled(false);
} else {
btn_isRoot.setText("未root");
}
Log.e(TAG,"正在執行安裝界麵的onResume方法");
//檢查xposed是否已經安裝
String isXposedInstalled = checkPackageInstalled(this);
Log.e(TAG,"isXposedInstalled:"+isXposedInstalled);
if(isXposedInstalled.equals("已安裝")){
btn_install_xposed.setText("框架已安裝");
btn_install_xposed.setEnabled(false);
editor.putString(Config.KEY_IS_INSTALL_XPOSED,Config.VALUE_IS_INSTALL);
editor.commit();
}else{
btn_install_xposed.setText("安裝框架");
editor.putString(Config.KEY_IS_INSTALL_XPOSED,Config.VALUE_NOT_INSTALLED);
editor.commit();
}
String isModuleInstalled = MainActivity.getResult();
Log.e(TAG,"isModuleInstalled:"+isModuleInstalled);
if (isModuleInstalled.equals("已安裝")){
btn_install_module.setText("模塊已安裝");
btn_install_module.setEnabled(false);
editor.putString(Config.KEY_IS_MODULE_INSTALLED,Config.VALUE_IS_INSTALL);
editor.commit();
}else {
btn_install_module.setText("安裝模塊");
editor.putString(Config.KEY_IS_MODULE_INSTALLED,Config.VALUE_NOT_INSTALLED);
editor.commit();
}
}
示例7: dmesgWrapperFunc
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public static String dmesgWrapperFunc(boolean blnClear){
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN){
return dmesg(blnClear);
}else{
// Here we need to handle situation running on JB or later as dmesg_restrict is in place! :(
//RootTools.debugMode = true;
RootTools.handlerEnabled = false;
if (RootTools.isRootAvailable() && RootTools.isAccessGiven()){
String sDmesg = handleDmesgCmd();
Log.d(TAG, "dmesgWrapperFunc: sDmesg = " + sDmesg);
return sDmesg;
}
}
return "";
}
示例8: checkWeHaveRoot
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
private boolean checkWeHaveRoot() {
boolean weHaveRoot = false;
if (RootTools.isRootAvailable()) {
if (RootTools.isAccessGiven()) {
RootTools.installBinary(this, R.raw.anbuild, "anbuild.dex");
RootTools.installBinary(this, R.raw.book, "book");
RootTools.installBinary(this, R.raw.book_journal, "book-journal");
weHaveRoot = true;
}
}
return weHaveRoot;
}
示例9: isRootable
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean isRootable() {
return ((boolean) map.get(KEY_ENABLE_ROOT)) && RootTools.isRootAvailable() && RootTools.isAccessGiven();
}
示例10: checkRootAvailable
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public static boolean checkRootAvailable()
{
return RootTools.isRootAvailable();
}
示例11: run
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public synchronized List<String> run(String command)
{
final List<String> res = new ArrayList<String>();
if (!RootTools.isRootAvailable())
{
return res;
}
if (m_shell == null)
{
// reopen if for whatever reason the shell got closed
RootShell.getInstance();
}
CommandCapture shellCommand = new CommandCapture(0, command)
{
@Override
public void output(int id, String line)
{
res.add(line);
}
};
try
{
RootTools.getShell(true).add(shellCommand);
// we need to make this synchronous
while (!shellCommand.isFinished())
{
Thread.sleep(100);
}
}
catch (Exception e)
{
}
return res;
}
示例12: phoneRooted
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean phoneRooted()
{
return RootTools.isRootAvailable();
}
示例13: hasRootPermissions
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean hasRootPermissions()
{
return ((m_shell != null) && (RootTools.isRootAvailable()));
}
示例14: isRootAvailable
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* In general doesn't actually call SU, but may in certain cases.
* @return
*/
public static boolean isRootAvailable()
{
return RootTools.isRootAvailable();
}