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

Commit 24274277 authored by atrost's avatar atrost
Browse files

Clear calling id before binder call

The permission check in app compat fails without clearing calling id.

Bug: 149662772
Test: launch com.appstem.mammoth, it crashed -> add clearcallingid -> doesn't crash
Change-Id: Ide87da8b8c13e8a10723f379bd4e4b386e5d35e4
parent 24818449
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1878,6 +1878,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
            return false;
        }

        final long token = Binder.clearCallingIdentity();
        try {
            if (permName.equals(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
                    && mPlatformCompat.isChangeEnabledByPackageName(BACKGROUND_RATIONALE_CHANGE_ID,
@@ -1886,6 +1887,8 @@ public class PermissionManagerService extends IPermissionManager.Stub {
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to check if compatibility change is enabled.", e);
        } finally {
            Binder.restoreCallingIdentity(token);
        }

        return (flags & PackageManager.FLAG_PERMISSION_USER_SET) != 0;