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


Java RootTools.isAccessGiven方法代碼示例

本文整理匯總了Java中com.stericson.RootTools.RootTools.isAccessGiven方法的典型用法代碼示例。如果您正苦於以下問題:Java RootTools.isAccessGiven方法的具體用法?Java RootTools.isAccessGiven怎麽用?Java RootTools.isAccessGiven使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.stericson.RootTools.RootTools的用法示例。


在下文中一共展示了RootTools.isAccessGiven方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: doInBackground

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
protected PartitionInfo doInBackground(final File... params) {
    final String path = params[0].getAbsolutePath();
    final StatFsCompat statFs = new StatFsCompat(path);
    final long valueTotal = statFs.getTotalBytes();
    final long valueAvail = statFs.getAvailableBytes();
    final long valueUsed = valueTotal - valueAvail;
    String[] permission = null;
    String perm;

    if (RootTools.isAccessGiven())
        permission = RootCommands.getFileProperties(params[0]);

    perm = permission != null ? permission[0] : Permissions.getBasicPermission(params[0]);

    return new PartitionInfo(path, perm, valueTotal,
            statFs.getBlockSizeLong(), statFs.getFreeBytes(), valueUsed);
}
 
開發者ID:wade-fs,項目名稱:MediaManager,代碼行數:19,代碼來源:DirectoryInfoDialog.java

示例3: 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

示例4: 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

示例5: getAlarmStats

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public ArrayList<Alarm> getAlarmStats() {
    ArrayList<Alarm> myWakelocks = new ArrayList<>();
    ArrayList<StatElement> alarms;
    if (RootTools.isAccessGiven()) {
        alarms = AlarmsDumpsys.getAlarms(true);
    } else {
        return myWakelocks;
    }

    for (StatElement statElement : alarms) {

        Alarm alarm = (Alarm) statElement;
        //alarm.getMaxValue();
        if (alarm.getWakeups() > 0) myWakelocks.add(alarm);
    }
    Collections.sort(myWakelocks);

    return myWakelocks;
}
 
開發者ID:rahulkumar66,項目名稱:Performance-Tweaker,代碼行數:20,代碼來源:BatteryStatsUtils.java

示例6: hasRootAccess

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public static boolean hasRootAccess() {
    if (mRootAccess != null)
        return mRootAccess;
    try {
        mRootAccess = RootTools.isAccessGiven();
    } catch (Exception e) {
        mRootAccess = false;
    }
    return mRootAccess;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:11,代碼來源:FileUtils.java

示例7: isRootGranted

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
static boolean isRootGranted()
{
    RootShell.debugMode = rootToolsDebug;

    //synchronized (PPApplication.rootMutex) {

    if (_isRooted()) {
        try {
            PPApplication.logE("PPApplication.isRootGranted", "start isAccessGiven");
            //grantChecking = true;
                /*try {
                    RootTools.closeAllShells();
                } catch (IOException e) {
                    e.printStackTrace();
                }*/
            if (RootTools.isAccessGiven()) {
                // root is granted
                PPApplication.logE("PPApplication.isRootGranted", "root granted");
                return true;
            } else {
                // grant declined
                PPApplication.logE("PPApplication.isRootGranted", "root NOT granted");
                return false;
            }
        } catch (Exception e) {
            Log.e("PPApplication.isRootGranted", "Error on run su: " + e.toString());
            return false;
        }
    }
    else {
        PPApplication.logE("PPApplication.isRootGranted", "not rooted");
        return false;
    }
    //}
}
 
開發者ID:henrichg,項目名稱:PhoneProfiles,代碼行數:36,代碼來源:PPApplication.java

示例8: isRootGranted

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
static boolean isRootGranted()
{
    RootShell.debugMode = rootToolsDebug;

    //synchronized (PPApplication.rootMutex) {

        if (_isRooted()) {
            try {
                PPApplication.logE("PPApplication.isRootGranted", "start isAccessGiven");
                //grantChecking = true;
                /*try {
                    RootTools.closeAllShells();
                } catch (IOException e) {
                    e.printStackTrace();
                }*/
                if (RootTools.isAccessGiven()) {
                    // root is granted
                    PPApplication.logE("PPApplication.isRootGranted", "root granted");
                    return true;
                } else {
                    // grant denied
                    PPApplication.logE("PPApplication.isRootGranted", "root NOT granted");
                    return false;
                }
            } catch (Exception e) {
                Log.e("PPApplication.isRootGranted", "Error on run su: " + e.toString());
                return false;
            }
        }
        else {
            PPApplication.logE("PPApplication.isRootGranted", "not rooted");
            return false;
        }
    //}
}
 
開發者ID:henrichg,項目名稱:PhoneProfilesPlus,代碼行數:36,代碼來源:PPApplication.java

示例9: doInBackground

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
protected Void doInBackground(Void... voids) {
    hasRoot = RootTools.isAccessGiven();
    hasBusyBox = RootTools.isBusyboxAvailable() || RootTools.findBinary("toybox");

    return null;
}
 
開發者ID:rahulkumar66,項目名稱:Performance-Tweaker,代碼行數:8,代碼來源:MainActivity.java

示例10: 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

示例11: onActivate

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
public boolean onActivate() {
	super.onActivate();

	boolean isRootAccess = RootTools.isAccessGiven();
	if (!isRootAccess) {
		Context c = getActivity();
		Toast.makeText(c, c.getString(R.string.error_root_access), Toast.LENGTH_LONG).show();
	}
	
	return isRootAccess;
}
 
開發者ID:PaulAnnekov,項目名稱:nfcunlocker,代碼行數:13,代碼來源:InputUnlock.java

示例12: 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

示例13: checkRootAccess

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
private static void checkRootAccess() throws SystemAppManagementException
{
    if (!RootTools.isAccessGiven())
    {
        throw new SystemAppManagementException("Unable to obtain root access.  Please make sure you grant this app root authority");
    }
}
 
開發者ID:GSamLabs,項目名稱:GSamBatteryMonitor-RootCompanion,代碼行數:8,代碼來源:SystemAppUtilities.java

示例14: requestRootAndShowErrorOnRejection

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
private void requestRootAndShowErrorOnRejection() {
	if (!RootTools.isAccessGiven()) {
		new RootUnavailableDialogFragment().show(getFragmentManager(), null);
	} else {
		DialogFragment fragment = (DialogFragment) getFragmentManager().findFragmentByTag(
				RootUnavailableDialogFragment.TAG);
		if (fragment != null) {
			fragment.dismiss();
		}
	}
}
 
開發者ID:danhawkes,項目名稱:mac-hopper,代碼行數:12,代碼來源:CountdownFragment.java

示例15: 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


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