forked from https://android.googlesource.com/platform/packages/apps/Gallery