本文整理匯總了Java中com.stericson.RootTools.RootTools.debugMode方法的典型用法代碼示例。如果您正苦於以下問題:Java RootTools.debugMode方法的具體用法?Java RootTools.debugMode怎麽用?Java RootTools.debugMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.stericson.RootTools.RootTools
的用法示例。
在下文中一共展示了RootTools.debugMode方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isNativeToolsReady
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean isNativeToolsReady(int nativeToolsId, Context context) {
RootTools.log("Preparing Native Tools");
InternalVariables.nativeToolsReady = false;
Installer installer;
try {
installer = new Installer(context);
} catch (IOException ex) {
if (RootTools.debugMode) {
ex.printStackTrace();
}
return false;
}
if (installer.isBinaryInstalled("nativetools")) {
InternalVariables.nativeToolsReady = true;
} else {
InternalVariables.nativeToolsReady = installer.installBinary(nativeToolsId,
"nativetools", "700");
}
return InternalVariables.nativeToolsReady;
}
示例2: onCreate
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
public void onCreate() {
if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
StrictMode.setVmPolicy(buildStrictModeVmPolicy().build());
}
super.onCreate();
ActivityMonitor.init(this);
RootTools.handlerEnabled = false;
RootTools.debugMode = BuildConfig.DEBUG;
Environment.init(this);
PFMTextUtils.init(this);
ensureNoShellUsedIfNoBusybox();
registerActivityLifecycleCallbacks(this);
}
示例3: installBinary
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This method can be used to unpack a binary from the raw resources folder and store it in
* /data/data/app.package/files/ This is typically useful if you provide your own C- or
* C++-based binary. This binary can then be executed using sendShell() and its full path.
*
* @param context the current activity's <code>Context</code>
* @param sourceId resource id; typically <code>R.raw.id</code>
* @param destName destination file name; appended to /data/data/app.package/files/
* @param mode chmod value for this file
* @return a <code>boolean</code> which indicates whether or not we were able to create the new
* file.
*/
public boolean installBinary(Context context, int sourceId, String destName, String mode) {
Installer installer;
try {
installer = new Installer(context);
} catch (IOException ex) {
if (RootTools.debugMode) {
ex.printStackTrace();
}
return false;
}
return (installer.installBinary(sourceId, destName, mode));
}
示例4: isBinaryAvailable
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This method checks whether a binary is installed.
*
* @param context the current activity's <code>Context</code>
* @param binaryName binary file name; appended to /data/data/app.package/files/
* @return a <code>boolean</code> which indicates whether or not
* the binary already exists.
*/
public boolean isBinaryAvailable(Context context, String binaryName) {
Installer installer;
try {
installer = new Installer(context);
} catch (IOException ex) {
if (RootTools.debugMode) {
ex.printStackTrace();
}
return false;
}
return (installer.isBinaryInstalled(binaryName));
}
示例5: installBinary
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This method can be used to unpack a binary from the raw resources folder and store it in
* /data/data/app.package/files/ This is typically useful if you provide your own C- or
* C++-based binary. This binary can then be executed using sendShell() and its full path.
*
* @param context the current activity's <code>Context</code>
* @param sourceId resource id; typically <code>R.raw.id</code>
* @param destName destination file name; appended to /data/data/app.package/files/
* @param mode chmod value for this file
* @return a <code>boolean</code> which indicates whether or not we were able to create the new
* file.
*/
public boolean installBinary(Context context, int sourceId, String destName, String mode) {
Installer installer;
try {
installer = new Installer(context);
} catch (IOException ex) {
if (RootTools.debugMode) {
ex.printStackTrace();
}
return false;
}
return (installer.installBinary(sourceId, destName, mode));
}
示例6: isBinaryAvailable
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This method checks whether a binary is installed.
*
* @param context the current activity's <code>Context</code>
* @param binaryName binary file name; appended to /data/data/app.package/files/
* @return a <code>boolean</code> which indicates whether or not
* the binary already exists.
*/
public boolean isBinaryAvailable(Context context, String binaryName) {
Installer installer;
try {
installer = new Installer(context);
} catch (IOException ex) {
if (RootTools.debugMode) {
ex.printStackTrace();
}
return false;
}
return (installer.isBinaryInstalled(binaryName));
}
示例7: onCreate
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
RootTools.debugMode = false;
checkForRoot();
}
示例8: getSymlink
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This will return a String that represent the symlink for a specified file.
* <p/>
*
* @param file file to get the Symlink for. (must have absolute path)
* @return <code>String</code> a String that represent the symlink for a specified file or an
* empty string if no symlink exists.
*/
public String getSymlink(String file) {
RootTools.log("Looking for Symlink for " + file);
try {
final List<String> results = new ArrayList<String>();
Command command = new Command(Constants.GSYM, false, "ls -l " + file) {
@Override
public void commandOutput(int id, String line) {
if (id == Constants.GSYM) {
if (!line.trim().equals("")) {
results.add(line);
}
}
super.commandOutput(id, line);
}
};
Shell.startRootShell().add(command);
commandWait(Shell.startRootShell(), command);
String[] symlink = results.get(0).split(" ");
if (symlink.length > 2 && symlink[symlink.length - 2].equals("->")) {
RootTools.log("Symlink found.");
String final_symlink;
if (!symlink[symlink.length - 1].equals("") && !symlink[symlink.length - 1].contains("/")) {
//We assume that we need to get the path for this symlink as it is probably not absolute.
List<String> paths = RootShell.findBinary(symlink[symlink.length - 1], true);
if (paths.size() > 0) {
//We return the first found location.
final_symlink = paths.get(0) + symlink[symlink.length - 1];
} else {
//we couldnt find a path, return the symlink by itself.
final_symlink = symlink[symlink.length - 1];
}
} else {
final_symlink = symlink[symlink.length - 1];
}
return final_symlink;
}
} catch (Exception e) {
if (RootTools.debugMode) {
e.printStackTrace();
}
}
RootTools.log("Symlink not found");
return "";
}
示例9: Genki
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public Genki(Builder builder) {
RootTools.debugMode = builder.isDebug;
}
示例10: getSymlink
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This will return a String that represent the symlink for a specified file.
* <p/>
*
* @param file file to get the Symlink for. (must have absolute path)
* @return <code>String</code> a String that represent the symlink for a specified file or an
* empty string if no symlink exists.
*/
public String getSymlink(String file) {
RootTools.log("Looking for Symlink for " + file);
try {
final List<String> results = new ArrayList<String>();
CommandCapture command = new CommandCapture(Constants.GSYM, false, "ls -l " + file) {
@Override
public void output(int id, String line) {
if (id == Constants.GSYM) {
if (!line.trim().equals("")) {
results.add(line);
}
}
}
};
Shell.startRootShell().add(command);
commandWait(Shell.startRootShell(), command);
String[] symlink = results.get(0).split(" ");
if (symlink.length > 2 && symlink[symlink.length - 2].equals("->")) {
RootTools.log("Symlink found.");
String final_symlink;
if (!symlink[symlink.length - 1].equals("") && !symlink[symlink.length - 1].contains("/")) {
//We assume that we need to get the path for this symlink as it is probably not absolute.
findBinary(symlink[symlink.length - 1]);
if (RootTools.lastFoundBinaryPaths.size() > 0) {
//We return the first found location.
final_symlink = RootTools.lastFoundBinaryPaths.get(0) + "/" + symlink[symlink.length - 1];
} else {
//we couldnt find a path, return the symlink by itself.
final_symlink = symlink[symlink.length - 1];
}
} else {
final_symlink = symlink[symlink.length - 1];
}
return final_symlink;
}
} catch (Exception e) {
if (RootTools.debugMode)
e.printStackTrace();
}
RootTools.log("Symlink not found");
return "";
}
示例11: onCreate
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_container);
RootTools.debugMode = false;
boolean access = RootTools.isAccessGiven();
boolean busybox = RootTools.isBusyboxAvailable();
if(!access) {
showRootWarning();
}
if(!busybox) {
showBusyBoxWarning();
}
mContainer = (FrameLayout) findViewById(R.id.activity_container);
mContext = this;
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
View v = this.getLayoutInflater().inflate(R.layout.menu_list, null, false);
menulist = (ListView) v.findViewById(R.id.navbarlist);
db = new DatabaseHandler(this);
vddDb = new VddDatabaseHandler(this);
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT_RIGHT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
//menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setBehindWidthRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(v);
View vv = this.getLayoutInflater().inflate(R.layout.menu_glossary, null, false);
mGlossaryContainer = (FrameLayout) vv.findViewById(R.id.menu_frame);
menu.setSecondaryMenu(vv);
menu.setSecondaryShadowDrawable(R.drawable.shadow_right);
mAdapter = new CustomArrayAdapter(
this,
R.layout.menu_main_list_item,
getResources().getStringArray(R.array.menu_entries),
getResources().getStringArray(R.array.menu_descs),
getResources().getStringArray(R.array.menu_colors),
icons);
menulist.setAdapter(mAdapter);
menulist.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
menulist.setOnItemClickListener(this);
colors = getResources().getStringArray(R.array.menu_colors);
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment prefs = new TimeInState();
CpuGlossaryFragment glo = new CpuGlossaryFragment();
ft.replace(R.id.activity_container,prefs);
ft.replace(R.id.menu_frame, glo);
ft.commit();
setAppTheme();
mountPartitions();
copyHelpers();
}
示例12: getSymlink
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This will return a String that represent the symlink for a specified file.
* <p/>
*
* @param file file to get the Symlink for. (must have absolute path)
* @return <code>String</code> a String that represent the symlink for a specified file or an
* empty string if no symlink exists.
*/
public String getSymlink(String file) {
RootTools.log("Looking for Symlink for " + file);
try {
final List<String> results = new ArrayList<String>();
CommandCapture command = new CommandCapture(Constants.GSYM, false, "ls -l " + file) {
@Override
public void output(int id, String line) {
if (id == Constants.GSYM) {
if (!line.trim().equals("")) {
results.add(line);
}
}
}
};
Shell.startRootShell().add(command);
commandWait(command);
String[] symlink = results.get(0).split(" ");
if (symlink.length > 2 && symlink[symlink.length - 2].equals("->")) {
RootTools.log("Symlink found.");
String final_symlink = "";
if (!symlink[symlink.length - 1].equals("") && !symlink[symlink.length - 1].contains("/")) {
//We assume that we need to get the path for this symlink as it is probably not absolute.
findBinary(symlink[symlink.length - 1]);
if (RootTools.lastFoundBinaryPaths.size() > 0) {
//We return the first found location.
final_symlink = RootTools.lastFoundBinaryPaths.get(0) + "/" + symlink[symlink.length - 1];
} else {
//we couldnt find a path, return the symlink by itself.
final_symlink = symlink[symlink.length - 1];
}
} else {
final_symlink = symlink[symlink.length - 1];
}
return final_symlink;
}
} catch (Exception e) {
if (RootTools.debugMode)
e.printStackTrace();
}
RootTools.log("Symlink not found");
return "";
}
示例13: onCreate
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
mListView = (ListView) findViewById(R.id.deviceList);
mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
mProgressBarTitle = (TextView) findViewById(R.id.progressBarTitle);
mAdapter = new ArrayAdapter<UsbDevice>(this, android.R.layout.simple_expandable_list_item_2, mEntries) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final TwoLineListItem row;
if (convertView == null){
final LayoutInflater inflater =
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = (TwoLineListItem) inflater.inflate(android.R.layout.simple_list_item_2, null);
} else {
row = (TwoLineListItem) convertView;
}
final UsbDevice device = mEntries.get(position);
final String title = String.format("Vendor 0x%s Product 0x%s",
HexDump.toHexString((short) device.getVendorId()),
HexDump.toHexString((short) device.getProductId()));
row.getText1().setText(title);
final String subtitle = DeviceUtils.getInstance().getDeviceDesc(device.getVendorId(), device.getProductId());
// final String subtitle = device.getDeviceId() + " " + device.getDeviceName() + " " + device.getDeviceProtocol();
row.getText2().setText(subtitle);
return row;
}
};
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
RootTools.log("Pressed item " + position);
if (position >= mEntries.size()) {
RootTools.log("Illegal position.");
return;
}
// IDeviceHelper.getInstance().getDeviceId(getApplicationContext());
IDeviceHelper.getInstance().getDeviceInfo(getApplicationContext());
}
});
//init usbmuxd
RootTools.debugMode = true;
IDeviceHelper.getInstance().initUsbMuxd(getApplicationContext());
}