如题,程序是内置在手机里的,具有系统权限,现在想搞搞删除系统应用的功能
目前有这个想法,和命令删除系统应用一样,先rm system/app/xxx.apk 然后使用uninstall卸载
不过试了下 发现删除apk没成功 那后续的也就没戏了
有知道或者做过的大神么 注意是代码里执行的 android系统应用
目前有这个想法,和命令删除系统应用一样,先rm system/app/xxx.apk 然后使用uninstall卸载
不过试了下 发现删除apk没成功 那后续的也就没戏了
有知道或者做过的大神么 注意是代码里执行的 android系统应用
知道的牛人不吝赐教啊
感谢两位的回复,这些都试过了
目前的指令是这样的
按顺序
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system\n
chmod 777 /system/app/xxx.apk\n
rm /system/app/xxx.apk\n
exit\n另外 To 文艺青年 只删除并没有卸载干净 在data下还有残留文件 需要卸载才能清理掉
感谢两位的回复,这些都试过了
目前的指令是这样的
按顺序
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system\n
chmod 777 /system/app/xxx.apk\n
rm /system/app/xxx.apk\n
exit\n另外 To 文艺青年 只删除并没有卸载干净 在data下还有残留文件 需要卸载才能清理掉
现在能删掉了吧,给分吧。
感谢两位的回复,这些都试过了
目前的指令是这样的
按顺序
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system\n
chmod 777 /system/app/xxx.apk\n
rm /system/app/xxx.apk\n
exit\n另外 To 文艺青年 只删除并没有卸载干净 在data下还有残留文件 需要卸载才能清理掉
现在能删掉了吧,给分吧。
删除个蛋啊 不是说了不行
执行su root后, 直接执行pm命令删除即可 但是pm命令删除好像不能清楚data数据命令:system/bin/pm uninstall xxx 或者 stem/bin/pm uninstall -k xxxpm uninstall: removes a package from the system. Options:
-k: keep the data and cache directories around after package removal.
执行su root后, 直接执行pm命令删除即可 但是pm命令删除好像不能清楚data数据命令:system/bin/pm uninstall xxx 或者 stem/bin/pm uninstall -k xxxpm uninstall: removes a package from the system. Options:
-k: keep the data and cache directories around after package removal.
之前静默安装时试过pm install 不过没成功 这次是删除系统应用 这个估计也无力
感谢两位的回复,这些都试过了
目前的指令是这样的
按顺序
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system\n
chmod 777 /system/app/xxx.apk\n
rm /system/app/xxx.apk\n
exit\n另外 To 文艺青年 只删除并没有卸载干净 在data下还有残留文件 需要卸载才能清理掉
现在能删掉了吧,给分吧。
删除个蛋啊 不是说了不行我试了,可以删除的。。你把你的log给我看看
执行su root后, 直接执行pm命令删除即可 但是pm命令删除好像不能清楚data数据命令:system/bin/pm uninstall xxx 或者 stem/bin/pm uninstall -k xxxpm uninstall: removes a package from the system. Options:
-k: keep the data and cache directories around after package removal.
之前静默安装时试过pm install 不过没成功 这次是删除系统应用 这个估计也无力pm uninstall命令没用的,那是卸载第三方应用
另外,我就是因为什么log都没,所以无法确定到底是哪一步出现了问题
执行这种命令 怎么能看到log 这个不是很了解
只知道结果是没删除
public class ScriptUtil {
public static final String REMOVE_APP_LIMIT = "chmod 771 /data/app \n";
public static final String ADD_APP_LIMIT = "chmod 551 /data/app \n";
public static final String TAG = "ScriptUtil";
/**
* 输出信息接口的对象
*/
private ScriptHandler scriptHandler = null;
/**
* Handler对象
*/
private Handler handler = null;
/**
* 输入的命令
*/
private String strCommand = null; /**
* constructor
*
* @param strCommand
* 所执行的命令
* @param scriptHandler
* 输出信息接口对象
*/
public ScriptUtil(String strCommand, ScriptHandler scriptHandler) {
this.scriptHandler = scriptHandler;
this.strCommand = strCommand;
} public ScriptUtil() {
// TODO Auto-generated constructor stub
} /**
* 关键方法:执行命令
*/
public void execCommand() {
handler = new Handler();
ShellCommandThread thread = new ShellCommandThread();
thread.start();
} /**
* 该线程进行io操作
*/
private class ShellCommandThread extends Thread {
/**
* 进程对象
*/
private Process process = null;
/**
* 正确信息缓冲流
*/
private BufferedReader brCorrect = null;
/**
* 错误信息缓冲流
*/
private BufferedReader brError = null; private DataOutputStream dos = null;
/**
* 0:成功 非0:失败
*/
int code = -1; @Override
public void run() {
try {
process = Runtime.getRuntime().exec("su"); dos = new DataOutputStream(process.getOutputStream()); dos.writeBytes(strCommand + " "); brCorrect = new BufferedReader(new InputStreamReader(
process.getInputStream()));
brError = new BufferedReader(new InputStreamReader(
process.getErrorStream()));
String strTemp = new String(); dos.flush(); dos.close(); StringBuffer strTempCorrect = new StringBuffer();
StringBuffer strTempError = new StringBuffer();
while ((strTemp = brCorrect.readLine()) != null) {
strTempCorrect = strTempCorrect.append(strTemp + "\n");
}
strTemp = new String();
while ((strTemp = brError.readLine()) != null) {
strTempError = strTempError.append(strTemp + "\n");
}
code = process.waitFor();
Log.d(TAG, "code :" + code);
Log.d(TAG, "strTempCorrect " + strTempCorrect.toString());
Log.e(TAG, "strTempError " + strTempError.toString());
handler.post(new ScriptRunnable(code,
strTempCorrect.toString(), strTempError.toString())); } catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
try {
if (brCorrect != null) {
brCorrect.close();
brCorrect = null;
}
if (brError != null) {
brError.close();
brError = null;
}
if (dos != null) {
dos.close();
dos = null;
}
if (process != null) {
process = null;
} } catch (IOException e) {
e.printStackTrace();
}
}
}
} private class ScriptRunnable implements Runnable {
private int resultCode;
private String strCorrect;
private String strError; /**
* constructor
*
* @param resultCode
* 待定
* @param strCorrect
* 正确操作的信息输出
* @param strError
* 错误操作的信息输出
*/
public ScriptRunnable(int resultCode, String strCorrect, String strError) {
this.resultCode = resultCode;
this.strCorrect = strCorrect;
this.strError = strError;
} @Override
public void run() {
if ((strCorrect.equals("")) && (!strError.equals(""))
&& (resultCode != 0)) {
scriptHandler.onFailed(strError);
} else {
scriptHandler.onSuccess(strCorrect);
}
}
} /**
* 操作正确及错误信息的接口
*/
public interface ScriptHandler { /**
*
* @param succesMsg
* 正确操作的输出信息
*/
void onSuccess(String strCorrect); /**
*
* @param failedMsg
* 错误操作的输出信息
*/
void onFailed(String strError); // void onTimeOut(String timeOutMsg);
}
}
我现在能保证的是 程序是push到system/app的 并且是有platform签名的 手机是root的 在命令行都行 怎样能得到root权限
另外 貌似我下载了一些需要root权限的程序 结果都说获取失败 莫非是手机原因?
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while((line = br.readLine()) != null){
Log.i(TAG, line);
}proc.getErrorStream()可以得到执行命令错误的讯息
我现在能保证的是 程序是push到system/app的 并且是有platform签名的 手机是root的 在命令行都行 怎样能得到root权限
另外 貌似我下载了一些需要root权限的程序 结果都说获取失败 莫非是手机原因?看看授权管理软件,是不是拒绝授权了
我现在能保证的是 程序是push到system/app的 并且是有platform签名的 手机是root的 在命令行都行 怎样能得到root权限
另外 貌似我下载了一些需要root权限的程序 结果都说获取失败 莫非是手机原因?看看授权管理软件,是不是拒绝授权了
额 我的测试机上基本没装那些安全软件 授权软件也木有 用了下你发的代码 显示 10061 not allowed to su 看来是获取权限失败了
-c 指示后面连接command
-c 指示后面连接command
嗯 得到的信息一致 not allowed to su 看来得换个能用的手机测试了
嗯 了解 下了个root工具看了下 发现手机已root 但是就是执行su失败 真纠结