2

Just for Android, for example ActivityThread could run in app process and system process, and ActivityManagerService is running in another, how could I know which process the class is running in.

Take the following scenario for example, Context.startService method is actually implemented by ActivityManagerService.startService, I want to know the detail, so I want to debug ActivityManagerService, but I don't know which process to debug, how can I know which process the ActivityManagerService is running in, and other class as well, I want to know how, not what.

twlkyao
  • 14,302
  • 7
  • 27
  • 44
  • Please outline what you are trying to do, Android is a unix based system, see also whoami – Jay Jan 20 '21 at 03:32
  • @Jay Sometimes I need to debug in some system class, only if I know which process the class is running in, I could set the debug the right process. – twlkyao Jan 20 '21 at 06:16
  • Its PID? what are you trying to do where the PID does not give you the user? See also https://stackoverflow.com/questions/9378021/how-to-get-process-details-from-its-pid/13780824 I propose that as the answer to this question in its current form and I move to close this question as a duplicate with only 1 point of bounty. – Jay Jan 20 '21 at 03:34
  • @Jay It's not about pid,I update the question. – twlkyao Jan 20 '21 at 09:25
  • Is this what you are looking for: https://stackoverflow.com/a/55842542/13121971 – UrbanR Jan 20 '21 at 09:30
  • @UrbanR No, this is used in the code that I can modify – twlkyao Jan 20 '21 at 09:43
  • 1
    even if you can get the id of this process you can not simply debug it as it's not yours and not built in debug mode – Muhannad Fakhouri Jan 26 '21 at 14:57
  • @MuhannadFakhouri I'd agree... there seems to be some misconception. – Martin Zeitler Jan 26 '21 at 17:49

1 Answers1

0

I found some ways, read the source code, and find the manifest of the apk, but this will only work for code under packages dir

twlkyao
  • 14,302
  • 7
  • 27
  • 44