Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 401aa509 authored by Robin Lee's avatar Robin Lee
Browse files

Check AID_RADIO correctly

AID_RADIO is just an appId. It has a different UID assigned
for each user on the device. When checking if the caller is
radio, extract the AID first and just check that.

This is a followup to some earlier targeted fixes to these
checks that partially/fully missed multiuser cases:

 - Ide5e9218811e110997fed19f43eb6a5fdc5812ec
 - I740b4f5acb88821197e3c4023a4032babd48ec5a
 - If5c721c9acfc78f1cbc35c3056adad95a4604f8b

This fixes a 10 second black screen caused by the dialer app
timing out while it waits, futilely, for media.metrics to become
visible to its process.

Repro as follows (must be on a secondary user):

 - adb shell am switch-user 10
 - adb shell pm clear com.android.phone
 - adb shell am start -n com.android.phone/.EmergencyDialer

Flag: EXEMPT trivial bugfix
Fix: 352390759
Test: Manual invocation of emergency dialer per above instructions
Change-Id: I2c8a6cc0459a6b46f482797e1456e30a70a43622
parent 4427c3ff
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -334,22 +334,22 @@ bool BaseItem::isEnabled() {

    // This is checked only once in the lifetime of the process.
    const uid_t uid = getuid();
    switch (uid) {
    case AID_RADIO:     // telephony subsystem, RIL
    const uid_t appid = multiuser_get_app_id(uid);

    if (appid == AID_RADIO) {
        // telephony subsystem, RIL
        return false;
    default:
    }

    if (appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END) {
        // Some isolated processes can access the audio system; see
        // AudioSystem::setAudioFlingerBinder (currently only the HotwordDetectionService). Instead
        // of also allowing access to the MediaMetrics service, it's simpler to just disable it for
        // now.
        // TODO(b/190151205): Either allow the HotwordDetectionService to access MediaMetrics or
        // make this disabling specific to that process.
        uid_t appid = multiuser_get_app_id(uid);
        if (appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END) {
        return false;
    }
        break;
    }

    int enabled = property_get_int32(Item::EnabledProperty, -1);
    if (enabled == -1) {