Clone extras Bundle when operating on it in onExtrasChanged

Currently, we do not make a copy of the extras Bundle when calling
Connection.setConnectionExtras. In rare cases, when multiple
setConnectionExtras events come in at the same time, they are posted
onto a concurrent Handler and the extras Bundle is cleared while being
copied in TelephonyConnection.updateExtras. This causes an
ArrayOutOfBoundsException and causes the Phone process to crash.

We now create a copy of the Bundle when we post it onto the concurrent
Handler to ensure that there is no simultaneous copy/clear operations
happening on the same extras Bundle.

Bug: 28957661
Change-Id: I065e78a2827c7c6e57f182d9cffee263a70647eb
1 file changed