Flexible Scheduling of Tasks for Self-adaptation in Mixed-critical Automotive Systems