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
Bug 1032045 - Fix jshint errors via function inlining