java - Cp command android from assets folder -
i want know if it's possible execute "cp" linux command re-create file assets folder of app /system/bin partition (obviously root access).
utility.exec("cp <file:///android_asset/my_file> /system/bin");
this code valid re-create files assets system/bin?
here clean example, assuming root acquired :
assetmanager assetmanager = context.getassets(); inputstream = null; outputstream os = null; seek { = assetmanager.open("my_file"); os = new fileoutputstream("/system/bin/my_file"); byte[] buffer = new byte[1024]; int length; // re-create file content in bytes while ((length = is.read(buffer)) > 0) { os.write(buffer, 0, length); } } grab (exception e) { // dealing exception, log or } { if (is != null) seek { is.close(); } grab (ioexception e) {} if (os != null) seek { os.close(); } grab (ioexception e) {} }
java android linux
No comments:
Post a Comment