Relax permission checks in sound trigger middleware

This is a temporary measure to address a bug preventing Now Playing
from working.

Bug: 150750187
Test: Manual
Change-Id: I55f1224ab7301e5cfaff510705d8c7bf21ecfad3
This commit is contained in:
Ytai Ben-Tsvi
2020-03-04 17:42:53 -08:00
parent 5688bc3e4c
commit 194969aa5f

View File

@@ -249,21 +249,8 @@ public class SoundTriggerMiddlewareValidation implements ISoundTriggerMiddleware
* @param permission The permission to check.
*/
void enforcePermission(String permission) {
final int status = PermissionChecker.checkCallingOrSelfPermissionForPreflight(mContext,
permission);
switch (status) {
case PermissionChecker.PERMISSION_GRANTED:
return;
case PermissionChecker.PERMISSION_HARD_DENIED:
throw new SecurityException(
String.format("Caller must have the %s permission.", permission));
case PermissionChecker.PERMISSION_SOFT_DENIED:
throw new ServiceSpecificException(Status.TEMPORARY_PERMISSION_DENIED,
String.format("Caller must have the %s permission.", permission));
default:
throw new InternalServerError(
new RuntimeException("Unexpected perimission check result."));
}
mContext.enforceCallingOrSelfPermission(permission,
String.format("Caller must have the %s permission.", permission));
}
@Override