Follow-up from bug 1181660. Currently we assume the user is using a restricted profile whenever we find a restriction in the system's list of restrictions (getUserRestrictions()). As soon as bug 1180653 lands we will store our restrictions in the user manager too. After that we can check getApplicationRestrictions() to see if our app is restricted and then assume the profile is restricted.
Additionally we could think of making isUserRestricted() not accessible from other class. Instead callers should ask for a specific restriction instead of implementing their own logic.
We now have (and will have) code that should not run for restricted profiles (no matter what restrictions are in place).