當前位置: 首頁>>代碼示例>>Java>>正文


Java RootTools.isRootAvailable方法代碼示例

本文整理匯總了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();
  }
}
 
開發者ID:greybirdsoft-open,項目名稱:genki,代碼行數:23,代碼來源:GenkiInstance.java

示例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();
        }
    }
}
 
開發者ID:sh2zqp,項目名稱:MobilePhoneSafeProtector,代碼行數:28,代碼來源:EngineUtil.java

示例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();

	}

}
 
開發者ID:mridang,項目名稱:dashclock-warning,代碼行數:21,代碼來源:WarningWidget.java

示例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();
}
 
開發者ID:ittianyu,項目名稱:MobileGuard,代碼行數:39,代碼來源:SoftwareManagerActivity.java

示例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);
	}
}
 
開發者ID:790710371,項目名稱:bangbanghelper,代碼行數:15,代碼來源:MainActivity.java

示例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();
    }
}
 
開發者ID:790710371,項目名稱:bangbanghelper,代碼行數:38,代碼來源:InstallXposedAty.java

示例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 "";
}
 
開發者ID:t0mm13b,項目名稱:DmesgLogViewer,代碼行數:16,代碼來源:DmesgWrapper.java

示例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;
}
 
開發者ID:Fusion,項目名稱:BambooGarden,代碼行數:13,代碼來源:Garden.java

示例9: isRootable

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean isRootable() {
    return ((boolean) map.get(KEY_ENABLE_ROOT)) && RootTools.isRootAvailable() && RootTools.isAccessGiven();
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:4,代碼來源:Pref.java

示例10: checkRootAvailable

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public static boolean checkRootAvailable()
{
    return RootTools.isRootAvailable();
}
 
開發者ID:Takhion,項目名稱:android-tetheringfixer,代碼行數:5,代碼來源:Fixer.java

示例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;
	
}
 
開發者ID:rahulkumar66,項目名稱:Performance-Tweaker,代碼行數:42,代碼來源:RootShell.java

示例12: phoneRooted

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean phoneRooted()
{
	return RootTools.isRootAvailable();
}
 
開發者ID:rahulkumar66,項目名稱:Performance-Tweaker,代碼行數:5,代碼來源:RootShell.java

示例13: hasRootPermissions

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean hasRootPermissions()
{
	return ((m_shell != null) && (RootTools.isRootAvailable()));
}
 
開發者ID:rahulkumar66,項目名稱:Performance-Tweaker,代碼行數:5,代碼來源:RootShell.java

示例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();
}
 
開發者ID:GSamLabs,項目名稱:GSamBatteryMonitor-RootCompanion,代碼行數:9,代碼來源:SystemAppUtilities.java


注:本文中的com.stericson.RootTools.RootTools.isRootAvailable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。