本文整理匯總了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();
}
}
示例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);
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
//}
}
示例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;
}
//}
}
示例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;
}
示例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 "";
}
示例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;
}
示例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;
}
示例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");
}
}
示例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();
}
}
}
示例15: isRootable
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean isRootable() {
return ((boolean) map.get(KEY_ENABLE_ROOT)) && RootTools.isRootAvailable() && RootTools.isAccessGiven();
}