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)