Revert "bug #6176711: guard against null GalleryActionBar." and
fix DialogPicker's NPE issue while setting wallpaper.

Change-Id: I833ebfb04907d3a1378df98db51c96b490796a00
diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
index 7d9d72b..03f522f 100644
--- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java
+++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
@@ -27,6 +27,7 @@
 import android.content.IntentFilter;
 import android.content.res.Configuration;
 import android.os.Bundle;
+import android.view.MenuItem;
 import android.view.Window;
 import android.view.WindowManager;
 
@@ -194,6 +195,17 @@
         return null;
     }
 
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        GLRoot root = getGLRoot();
+        root.lockRenderThread();
+        try {
+            return getStateManager().itemSelected(item);
+        } finally {
+            root.unlockRenderThread();
+        }
+    }
+
     // Shows status bar in portrait view, hide in landscape view
     private void toggleStatusBarByOrientation() {
         Window win = getWindow();