Synchronize mPermissions to void NullPointerException.
When we run mokey test on App permissions activity of a APK for example Contacts(Settings -> Apps & notifications ->See all ** apps -> Contacts ->Permissions),if we grant and revoke some permission frequently,NullPointerException may happen. As granting runtime perimssion leads to writting new state of runtime permissions on disk via BackgroundThread. To write new state of runtime permissions, system will get the permissionData stored in mPermissions(assume that this permissionData is stored at the last location ).If we revoke this permison,permissionData will be removed from mPermissions on another thread. So in function getPermissionStatesInternal,mPermissions.valueAt(i) may return null by chance so that crash will happen. So we should synchronize mPermissions to void NullPointerException. Bug:115697209 Test: Make services.jar,push it into phone and reboot.Run monkey test on App permissions activity and no NullPointerException happens. Change-Id: I61151fa7df7a2c3830cff2eac9cc8284bd28c448
Loading
Please register or sign in to comment