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

Commit 2373ec9c authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Merge "Fix native permission helper local call handling" am: e315abbb

am: ee04a43b

Change-Id: Ib363bac7d284d83025aa87332d0e59e122071906
parents f8796f58 ee04a43b
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -48,20 +48,24 @@ Status checkPermission(const char* permission) {
}

bool isCallerActiveUser() {
  IPCThreadState* ipcState = IPCThreadState::self();
  IPCThreadState* ipcState = IPCThreadState::selfOrNull();
  if (!ipcState) return true;  // It's a local call

  uid_t callingUid = ipcState->getCallingUid();
  uid_t callingUser = callingUid / PER_USER_RANGE;
  if (!callingUid) return true;  // It's a local call
  if (callingUid == getuid()) return true;  // It's a local call

  return (foregroundUserId == callingUser) || (systemUiUid == callingUid) ||
         (SYSTEM_UID == callingUid);
}

bool isCallerActiveUserOrManagedProfile() {
  IPCThreadState* ipcState = IPCThreadState::self();
  IPCThreadState* ipcState = IPCThreadState::selfOrNull();
  if (!ipcState) return true;  // It's a local call

  uid_t callingUid = ipcState->getCallingUid();
  uid_t callingUser = callingUid / PER_USER_RANGE;
  // if (!callingUid) return true;  // It's a local call
  if (callingUid == getuid()) return true;  // It's a local call

  if ((foregroundUserId == callingUser) || (systemUiUid == callingUid) ||
      (SYSTEM_UID == callingUid))