Commit Graph

24 Commits

Author SHA1 Message Date
baldurk 13c1cf6ad4 Return ReplayStatus when launching/injecting, use to indicate JDWP error
* If android studio or other android tools are open when a package is
  launched for debugging, they greedily jump on it and connect which
  prevents us from connecting.
2018-02-20 11:54:57 +00:00
baldurk ea929668a7 Create android package data directory in case app doesn't do it natively 2018-02-15 16:43:11 +00:00
baldurk 04fac1d6f8 Use android properties to pass capture options to the device 2018-02-14 19:22:23 +00:00
baldurk 60324e7e38 Add a small sleep into JDWP connection code to workaround JVM bugs
* It's unknown why this matters but on some android devices adding a
  small sleep prevents problems with JDWP replies not coming through.
2018-02-13 21:10:12 +00:00
baldurk 8622471277 Reset android vulkan layer property as late as possible
* We can't reliably know when we can safely remove the layer property
  at capture time because it's impossible to know if an android app will
  use vulkan or not. So instead we fall back to unsetting it whenever we
  need to - before opening a capture or when shutting down the remote
  server (in case after capturing, no frame capture was actually opened)
* This means that if the UI crashes without unsetting it, we will poison
  the state, but this seems unavoidable.
2018-02-09 14:02:31 +00:00
baldurk f2bd4b0351 Detect ls errors that appear on stdout instead of stderr 2018-02-09 10:51:45 +00:00
baldurk 0c89fac9b5 Make adb devices execute silently because otherwise it spams the log 2018-02-07 14:20:00 +00:00
baldurk bbb4fed8e1 De-prioritise our bundled android tools unless there's no other option
* This prevents our adb from fighting a system adb if it's used outside
  of renderdoc.
2018-02-02 18:40:29 +00:00
baldurk 84ea588036 Move android support files into /plugins/android/ in the build
* We also don't copy out of the android SDK anymore as that has a
  licensing impact. Instead we ship our own builds from a local AOSP
  checkout, the same way as other plugins.
2018-02-01 20:21:50 +00:00
baldurk b7e6d33f0f Fix incorrect size check (checking string length instead of line count) 2018-01-31 18:24:14 +00:00
baldurk b7aa522769 Wait for the API to be presenting before android package is "started"
* This closely resembles the behaviour before, when at least for vulkan
  the library wouldn't be loaded and open the connection until the
  instance is created and the layer is loaded.
* When injecting our libraries, the connection is made very early but it
  may be some time before the program initialises vulkan - we can't
  setprop debug.vulkan.layers back to empty until it has, so instead we
  wait for the API to be presenting.
2018-01-31 14:39:06 +00:00
baldurk 1778e4028d Don't do any injection if the library is already present
* We assume that if the user injected libVkLayer_GLES_RenderDoc.so then
  it's either a vulkan app and that's sufficient, or they linked
  against it.
* Injecting our libraries over the top of that could cause problems -
  at worst crashes, or at best we could end up with nested hooking with
  double overhead, or the loaded renderdoc library won't be the one that
  hooks and the workflow will break.
2018-01-31 14:36:56 +00:00
baldurk 969fdaa499 Add the ability to patch android binary XML manifests in-place
* This lets us add the debuggable flag we need, at the cost of needing
  to re-sign the APK. It works in many cases although sometimes it does
  fail - but this is provided just as a 'best effort' and not as a
  recommended workflow.
2018-01-29 22:37:55 +00:00
baldurk 83d921ea84 Install if we don't have all the server ABIs correctly 2018-01-29 22:22:26 +00:00
baldurk 280fe9ade2 clang compile fix - add braces around initialisation of union 2018-01-26 22:15:59 +00:00
baldurk ec7b2807d0 Build each architecture into its own APK
* This means we can have all the architectures we care about installed,
  and load the right library regardless of what the app does.
2018-01-26 21:19:16 +00:00
baldurk 077402bf11 Add failsafe so we don't wait the whole timeout if an apk closes/crashes 2018-01-26 21:19:15 +00:00
baldurk cb34a2daea Revamp android patching to only check for (& change) the debuggable flag
* We don't consider anything else, this includes permissions or the
  library being present. Since we no longer expect to patch in the
  library we also don't check its version (however we leave the tag in
  case it is useful in the future).
* If the user has root access we will never warn, assuming the injection
  will work fine even without the debuggable flag.
2018-01-26 21:19:14 +00:00
baldurk a019797f88 Move vulkan layer name and android library filename to global defines 2018-01-26 21:19:13 +00:00
baldurk 047bff7261 Add an new android hooking method using JDWP to inject & PLT hooks
* This is based on the GAPID method of injection, using the same steps
  to connect with JDWP and debug the application, breakpointing on key
  init-time steps to patch vulkan layer search paths and load libraries
  from our installed apk.
* We diverge by then using PLT hooks instead of trampolines to hook the
  EGL/GL calls - and so we also hook dlopen.
* This should work on any debuggable application - not currently checked
  but does not replace/break any of the previous injection, which can
  still work.
2018-01-26 21:19:13 +00:00
baldurk ec71b05173 Split out android patching code into separate file 2018-01-26 16:30:47 +00:00
baldurk 5527c57e68 Split out some miscellaneous utility functions
* We also wrap up and cache the fetching of friendly names by serial
  number to avoid some adb traffic.
2018-01-26 16:30:16 +00:00
baldurk 1be3e8bfac Split out handling of android tools: locating&precedence, executing, etc 2018-01-26 16:24:54 +00:00
baldurk ae7300e524 Move android files to separate subfolder 2018-01-26 15:49:09 +00:00