Running Command Line from Android App on Chromebook

116 views
Skip to first unread message

Roger Gagnon

unread,
Mar 31, 2022, 4:55:12 PM3/31/22
to Chromium OS Development

I have an Android App that runs on a Chromebook as Device Administrator (BIND_DEVICE_ADMIN, DeviceAdminReceiver etc.). The purpose in gaining that level of access was to be able to run commands like ...

  1. cat /dump_vpd_log --full -stdout
  2. dmidecode --type 17
  3. battery_test 10
  4. memory test
  5. storage_test_1
  6. storage_test_2

This is all to collect system and diagnostic data on the chromebook, power wash it and report the data back via WiFi to a server that collects the information and records the erasure and device specs for re-use or re-sale. I have the app asking for the Device Administrator Privileges and that part works as does the data transfer at the end. Getting the data I need from the other commands doesn't work, it always crashes with "permission denied" errors. I tried "sudo" in front of the commands and that crashes with "permission denied" as well. I assumed having Device Administrator Privileges was the issue and now that I have them, nothing changed, same errors.

Has anyone ever tried this and gotten it working? Any guidance would be much appreciated!

Thank you!

Mike Frysinger

unread,
Mar 31, 2022, 5:08:33 PM3/31/22
to Roger Gagnon, Chromium OS Development
by design, what you're trying won't work.  Android runs in an isolated environment from CrOS.  historically that was a container (akin to Docker if you're familiar with that), but we're moving it to a VM.  we don't need to get into the exact details/schedule on a per-device basis since it doesn't matter for your particular question here.

that means all code that executes inside of Android has no access to the CrOS filesystem or any of its programs.  i'm not sure why you're getting permission denied errors, but even if that were resolved, you'd still be left with "file not found" errors.

it also means you don't get access to real hardware, only virtualized hardware.  so something like dmidecode, if you could get it to run, might return info about the VM itself, not the actual hardware which i suspect is what you want.
-mike

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
https://groups.google.com/a/chromium.org/group/chromium-os-dev

Ian Williams

unread,
May 6, 2022, 10:04:51 PM5/6/22
to Chromium OS Development, Mike Frysinger, Chromium OS Development, extreme...@gmail.com
Piggybacking off of this discussion, is there any hope for chrome.processes to be available on the stable channel? It's been a dev API for a decade and it'd be really useful if Chrome OS devs had just a little more power to gauge the system without exposing it to crippling bugs. 
Reply all
Reply to author
Forward
0 new messages