Cache AppOp mode to reduce binder calls to the system server
This CL contains following changes to cache AppOp mode value in AppOpsManager: 1) Create a new IpcDataCache in AppOpsManager to cache op mode by uid, packageName, opCode, virtualDeviceId and attributionTag. 2) Unify mode checking logic between checkOp and noteOp in the system service in getAppOpModeRaw. The changes include: * checkOperation used to return default mode if uidState is null or package doesn't belong to the uid. Now it returns MODE_IGNORED. * isOpRestrictedDueToSuspend used to only apply to checkOperation, now it applies to noteOperation as well. * When checking if a package can bypass user's restriction on an op, we didn't account for the attributionTag for checkOperation, now we will. 3) Skip two location app ops for caching due to they are affected by attributionTag change described in #2 4) Invalidate cache when op mode value changes, op restriction changes. 5) Use cache only in various checkOp APIs for now. noteOp API change will come later. Skip cache for in-process binder calls Flag: android.permission.flags.appop_mode_caching_enabled Bug: 366013082 Test: presubmit Change-Id: Ifba35afa6ed7fe1f3d2fd583015179364e70b883
Loading
Please register or sign in to comment