Wouldn't this require the phone to be trusted and not run unsigned software?
This does not solve the problem of the timing (but the sibling comment explained that this one has a solution)