OSDN Git Service

Avoid BinderProxy duplicate native registration
authorHans Boehm <hboehm@google.com>
Fri, 16 Feb 2018 00:12:51 +0000 (16:12 -0800)
committerHans Boehm <hboehm@google.com>
Fri, 16 Feb 2018 18:22:12 +0000 (10:22 -0800)
commit03477cb9b707fb2c32f1ba8abdcee2ee43d72bb0
treee127a168ca82c57ccc40721559359f11b4055d81
parent2792c7f6a2477e0e0a4fbf829ed3973654383a9c
Avoid BinderProxy duplicate native registration

In case of an OOME, we would recycle the nativeData we just allocated,
even if the BinderProxy.getInstance() call got far enough to register
the allocation for automatic freeing. This could cause a duplicate
deallocation.

This changes the code to be much more careful about handling native
deallocation correctly in the exception case.

Bug: 72707270

Test: Build and boot master.
Change-Id: I2cffdd1d59af95f089714893e819c2d02302a6d4
core/java/android/os/Binder.java
core/jni/android_util_Binder.cpp