Bug 1039943: make gallery exit if it goes to background while scanning on a 256mb device or smaller

Use < 512mb instead of <= 256mb as the threshold
Merge pull request #22374 from davidflanagan/bug1039943

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