Bug 1039943: make gallery exit if it goes to background while scanning on a device with less than 512mb RAM device
(cherry picked from commit bddd3a639ccf6353d06ae215215c4a4ddd31cffa)
Merge pull request #22375 from davidflanagan/bug1039943-v1.4

Bug 1039943: make gallery exit if it goes to background while scanning o... r=pdahiya a=1.4+