Add a scoped lock injection tool
Bug: 271576290 The lock injection tool now handles two types of lock injection: legacy and "scoped". The legacy behavior is changed: the request method used to be called immediately after the lock is taken. The new behavior is that the request method is called immediately before the lock is taken. Legacy behavior is changed, and is as follows: 1. The request method is called immediately before the lock is taken. 2. The release method is called immediately after the lock is released. The release method is NOT holding the lock when it is called. 3. The request and release methods are static and the signature of the functions is "()V". 4. Synchronized methods and blocks are supported. Scoped behavior is new, and is as follows: 1. The request method is called immediately after the lock is taken. 2. The release method is called immediately before the lock is released. 3. Both request and release methods are instance methods of the traced object and are called on the traced object (the target of synchronized()). The signature of the methods is "()V". 4. Synchronized blocks are supported. Synchronized methods are not supported. Scoped behavior is invoked on a data type with the new --scoped switch. The format of the switch is: --scoped <target-class>,<request-method>,<release-method>,<scoped> The <scoped> argument to the --scoped switch selects legacy (false) or scoped (true) behavior. The legacy command line arguments only select legacy behavior. The Android.bp file has been updated to create test artifacts. The test procedure described in TestMain.java has been updated. In addition, the unit test for this feature has been wrapped in a script. New tests have been added for the scoped lock. Test: the following: * run the lockedregioncodeinjection unit test * build an image and verify that the java byte code is properly updated for the new lock injection * build a complete Android image and verify no regressions Change-Id: I4fbfbf8873c385005cbf67a5b02aff204d145030
Loading
Please register or sign in to comment