Prevent race condition
There is a chance that the service record loses its ability to start background activities (BAL) between the evaluation of the if condition and computing the token used to update the process record. This results in system server crashing for a failed precondition (expecting BAL allowed, but actually forbidden by the passed in privileges). With the change there is almost no penalty in calculating the token every time (it might actually be faster as we can now skip evaluating the logic a second time) and it is guaranteed to be consistent. Since the logic is otherwise not changes there is no risk in doing this change. Test: atest BackgroundActivityLaunchTest Bug: 285979934 Change-Id: Ia480ef68dfaf34dccea6f24cf34ced15e1434cc3
Loading
Please register or sign in to comment