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

Commit 7709a213 authored by Ytai Ben-tsvi's avatar Ytai Ben-tsvi Committed by Automerger Merge Worker
Browse files

Merge "Revert "Relax permission checks in sound trigger middleware"" into rvc-dev am: a08e8e07

Change-Id: Ibaeb2261fc900127e239dfd484e5327fbac31c42
parents 55713a6d a08e8e07
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -252,8 +252,21 @@ public class SoundTriggerMiddlewareValidation implements ISoundTriggerMiddleware
     * @param permission The permission to check.
     */
    void enforcePermission(String permission) {
        mContext.enforceCallingOrSelfPermission(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."));
        }
    }

    @Override