Bug 1002593 - Get Gallery changes for bug 989290 and bug 1003036 into master

This PR is for getting the gallery and shared changes for bug 989290 into master. Does not include any makefile or camera changes for bug 989290.

All gallery unit tests are passing locally with these changes.