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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user