First, the scene of the problem
1. Sensorservice line is impersonating in processing Compass Sensor The process of the event, check the Buffer the validity of the pointer, and will be passed on later to the AKM gets the data used in the function interface
2. Sensorservice the process in which the thread is responsible for cross-process communication Binder Thread in Sensorservice thread Check Buffer after the pointer is not actually used,
Roger that.Disable Compass sensorthe request, fromLogcan be seen inCompass Sensorwas firstDisable,Disableat the same time will FreeaboveSensorservicechecked and in useBufferpointer, empty at the same timeBufferPointers
3. immediately Sensorservice thread continues execution AKM gets the function interface of the data and uses the Disable Empty The Buffer pointer, and then produces an exception
Second, the specific log and code
Disable Compass Sensor and Free buffer The code:
Free buffer 3ms after Sensorservice immediately because of access to null pointer exception Log :
Pass the buffer pointer and use the code:
Use the buffer pointer to generate an exception for the place log:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Another scenario analysis for Systemserver restart caused by Sensorservice crash under android5.0l