1 #ifndef ANDROID_DVR_TRUSTED_UIDS_H_ 2 #define ANDROID_DVR_TRUSTED_UIDS_H_ 3 4 #include <sys/types.h> 5 6 namespace android { 7 namespace dvr { 8 9 /** 10 * Tells if a provided UID can be trusted to access restricted VR APIs. 11 * 12 * UID trust is based on the android.permission.RESTRICTED_VR_ACCESS permission. 13 * AID_SYSTEM and AID_ROOT are automatically trusted by Android. 14 * 15 * UIDs are guaranteed not to be reused until the next reboot even in case 16 * of package reinstall. For performance reasons this method caches results by 17 * default, as otherwise every check would trigger a Java call. 18 * 19 * This function is thread-safe. 20 * 21 * @param uid The uid to check. 22 * @param use_cache If true any cached result for the provided uid will be 23 * reused. If false this call will reach the Application Manager Service 24 * in Java to get updated values. Any updates will be stored in the cache. 25 * @return true if the uid is trusted, false if not or if the VR Manager Service 26 * could not be reached to verify the uid. 27 */ 28 bool IsTrustedUid(uid_t uid, bool use_cache = true); 29 30 } // namespace dvr 31 } // namespace android 32 33 #endif // ANDROID_DVR_TRUSTED_UIDS_H_ 34