Sympton:
When application crash in a special timing and system server's InputMethodManager is binding, deadlock may occur.
Root Cause:
Thread(1): When using InputMethodManager in system server, it will lock mH(handler) of InputMethodManager,
and sometimes it will call to InputMethodManagerService::showCurrentInputLocked and will call bindService at some condition,
then it will also lock ActivityManagerService.
Thread(2): When an application crashed, it will lock ActivityManager when showing crash dialog, inside the dialog,
it will call setEnabled of Button and lock mH of InputMethodManager.setEnable of TextView will lock IMM's handler.
So the deadlock happened as the flow: (2) lock AMS -> (1)lock mH -> (2)wait mH -> (1) wait AMS
Solution:
Reduce nested lock of error dialog: post message to let (2) lock mH after release AMS lock.
Change-Id: Id85c29406236db3b5fca9655fde1fcaf0afd1337
We should call ResourceTable::getLocales directly,
and not AssetManager::getLocales. The latter will convert
"tl" to "fil" so we'll end up thinking we have resources
for "fil" when we don't really have any.
bug: 15873165
Change-Id: I9753e4608aaecede328a40ee1f3ee6b016d0dedc
Root Cause:
Use removeTask with flag ActivityManager.REMOVE_TASK_KILL_PROCESS will set waitingToKill = "remove task"
to the target process when its setSchedGroup is not BG_NONINTERACTIVE.
Later the target process may be killed when applying oom-adj due to setSchedGroup has changed to BG_NONINTERACTIVE.
If the process is needed to restart, the process record will be resued.
Then the restarted process may be killed again because its waitingToKill is not null.
Solution:
Clean waitingToKill when process is dead.
Change-Id: I5ffb5388127f4221da4c700d3f1c224f7ca6e7b2
This was broken by commit b27c137087ee92674 which
removed a badly phrased check. Prior to that commit,
there was a check that excluded locales whose toString()
length was not 5.
This change reinstates that check in a less roundabout
way, by excluding BCP-47 tags that don't have a country
subtag.
bug: 16038949
Change-Id: Ic24b1df87b2e2ce47d9ae04c7759088721f27b4f
AudioTrack and AudioRecord JNI should not cast
jshortArray to jbyteArray. This appeared to work with Dalvik
but causes data corruption with ART.
(cherry picked from commit 9d02848e902d04417df616354db3a18c03e639b7)
Change-Id: Ie36624d3ea06042373c64edced4b5e30b7b1ee86
Symptom: Unable to kill by Am again and will be skipped updating its oom adj.
Root Cause:
A restarted process will reuse original process record.
The flag killedByAm will keep previous state.
Solution:
Reset the flag killedByAm to false when the process is started.
Note: Found another similiar patch If95137d91939cc44882ad2813131bcde0edd0c1b
Change-Id: I59a86648ca8d0aed4c489d92751af120aae5ef90