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

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

Merge "Use getProfileParentId() in native permission helper (2/2)" am: c1c379ba am: 5bba565a

am: 1841cfbf

Change-Id: Ia31bca07ca8a3cab28f8557e143b13bc81c30192
parents a9c77def 1841cfbf
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -47,6 +47,25 @@ class BpUserManager : public BpInterface<IUserManager> {

    return reply.readInt32();
  }

  virtual int32_t getProfileParentId(int32_t user_handle) {
    Parcel data, reply;
    data.writeInterfaceToken(IUserManager::getInterfaceDescriptor());
    data.writeInt32(user_handle);
    status_t rc = remote()->transact(GET_PROFILE_PARENT_ID, data, &reply, 0);
    if (rc != NO_ERROR) {
      ALOGE("%s: failed (%d)\n", __func__, rc);
      return -1;
    }

    int32_t exception = reply.readExceptionCode();
    if (exception != 0) {
      ALOGE("%s: got exception (%d)\n", __func__, exception);
      return -1;
    }

    return reply.readInt32();
  }
};

IMPLEMENT_META_INTERFACE(UserManager, "android.os.IUserManager");
+2 −0
Original line number Diff line number Diff line
@@ -33,9 +33,11 @@ class IUserManager : public IInterface {
  // must be kept in sync with IUserManager.aidl
  enum {
    GET_CREDENTIAL_OWNER_PROFILE = IBinder::FIRST_CALL_TRANSACTION + 0,
    GET_PROFILE_PARENT_ID,
  };

  virtual int32_t getCredentialOwnerProfile(int32_t user_id) = 0;
  virtual int32_t getProfileParentId(int32_t user_handle) = 0;

  DECLARE_META_INTERFACE(UserManager);
};
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ bool isCallerActiveUserOrManagedProfile() {
  if (um != NULL) {
    // Must use Bluetooth process identity when making call to get parent user
    int64_t ident = ipcState->clearCallingIdentity();
    parentUser = um->getCredentialOwnerProfile(callingUser);
    parentUser = um->getProfileParentId(callingUser);
    ipcState->restoreCallingIdentity(ident);
  }