当我尝试使用android'am'命令启动一个活动时,在4.2平台下是错误的(我试过,在2.3版本下没问题)。代码是这样的
out = process.getOutputStream();
out.write(("am start -a android.intent.action.VIEW -n com.android.browser/com.android.browser.BrowserActivity\n").getBytes());
out.flush();
InputStream in = process.getInputStream();
BufferedReader re = new BufferedReader(new InputStreamReader(in));
String line = null;
while((line = re.readLine()) != null) {
Log.d("conio","[result]"+line);
}
错误是这样的:
java.lang.SecurityException: Permission Denial: startActivity asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:1921)
at com.android.commands.am.Am.runStart(Am.java:494)
at com.android.commands.am.Am.run(Am.java:109)
at com.android.commands.am.Am.main(Am.java:82)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
at dalvik.system.NativeStart.main(Native Method)
我想知道
1.用户-2和0是什么意思?
2.在哪里可以找到有关这些ID的详细信息?
3.我该怎么办,只需添加权限?我不想添加我对它们一无所知的权限。谁能帮助我,非常感谢!