virtual uint64_t getSecureUserId(uint32_t uid) { uint64_t sid = read_sid(uid); if (sid == 0) { // might be a work profile, look up the parent sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = sm->getService(String16("user")); sp<IUserManager> um = interface_cast<IUserManager>(binder); int32_t parent = um->getCredentialOwnerProfile(uid); if (parent < 0) { return 0; } else if (parent != (int32_t) uid) { return read_sid(parent); } } return sid; }
/* read value from SIDs */ int cw_openpci_read(WORD addr, int chipno) { /* check if chipno and addr is valid */ if (chipno < MAXSID && addr < 0x20) { /* if addr is from read-only register, perform a read read */ if (addr >= 0x19 && addr <= 0x1C && sidfh >= 0) { addr += chipno * 0x20; sidbuf[addr] = read_sid(addr); } else { addr += chipno*0x20; } /* take value from sidbuf[] */ return sidbuf[addr]; } return 0; }