If possible, I'd like my Graphene OS phone to automatically notify emergency services if it detects a car crash.

Pixel phones on stock android have a Personal Safety app that can do this, so I installed it on a profile with google play services. After adding Contacts and Phone permissions, the app can launch without crashing. Unfortunately, the app's main activity shows up blank (just a placeholder image), and its Safety Settings menu has no listed items. This happens even when allowing all permissions.

Is it possible to support Google's Personal Safety app in Graphene OS, or does it inherently require privileged access to hardware?
Is there an alternative way to detect car crashes and notify emergency services?

I didn't know the answer, but was curious so I did some digging.

Oddly enough, no it doesn't seem to need crazy hardware access (or at least as far as I could tell). I guess it just watches your location and detects if you go from fast to not fast very quickly, paired with a movement sensor, among other things that don't need system permissions.

What it does require, though, is Google Services Framework, Google Play Services (probably), and some system-level permissions to your phone state. The app needs access to see if you're on a phone call, then access to end or make other phone calls to emergency numbers. These special phone privileges can't be granted by the user via the app settings.

The reason you just see a generic card is because the app errors out when it can't access your phone state and just sits there, half loaded.

Also, the app requires a creepy permission to see what user you're using and to manage the users on the device. Very invasive if you ask me. Or maybe it's just to make sure you're not having fun when it's not safe to do so (an Android Easter Egg).

    Just so every time some jackass cuts you off and you have to slam on the brakes and the phone goes flying, you end up with cops tailing you. This sounds like a seriously bad idea. Who wants to deal with cops?

      unwat Thanks for looking into it!

      If the detection system really is that simple, it's a shame the app requires such invasive permissions. Hoping this changes in the future or a good alternative comes out.

      abcZ There's a timer that runs so you can stop the automatic call if you're conscious and mobile and the phone isn't stuck somewhere inaccessible. If I'm not able to access the phone, I'd rather assume the worst. This is a privacy sacrifice I'm willing to make.

      Last time I was in a crash, bystanders did nothing, but we were thankfully able to call 911 ourselves. If something like this happens again but I'm too injured or unconscious to get help myself, I don't want to rely on the goodness of strangers to be alive the next day.

      19 days later

      For anyone who's looking for an app that does crash detection I found OpenRoad which claims not to sell any user information. I'm willing to make the tradeoff in this case.

      19 days later

      unwat I did some digging myself recently and have similar findings.

      The UI sits half-loaded due to at least these two failed method calls: TelecomManager.isInEmergencyCall() and UserManager.getUserName().

      TelecomManager.isInEmergencyCall() is strangely missing from online documentation and requires MODIFY_PHONE_STATE. I wonder why just READ_PHONE_STATE would be insufficient.

      UserManager.getUserName() requires MANAGE_USERS, CREATE_USERS, QUERY_USERS, or GET_ACCOUNTS_PRIVILEGED. I'm guessing this is used to display "Hi <username>" in the UI, as seen in the play store screenshots. I find it funny that this app partly breaks due to not being able to say Hi.

      Anyway, given these permissions can't be granted by the user, does this app essentially need some kind of gmscompat-like layer in order to work in Graphene OS?

        kyuweftea

        Yes, they'd definitely have to do something similar to make these features work. That said, I don't know the limitations of the binder stuff they do with GmsCompat, so I don't know if it's possible or not.