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

Commit cbed111b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Relax permission checks in sound trigger middleware" into rvc-dev

parents 97f4e229 194969aa
Loading
Loading
Loading
Loading
+2 −15
Original line number Diff line number Diff line
@@ -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(
        mContext.enforceCallingOrSelfPermission(permission,
                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