OSDN Git Service

Back button should progress through the app
authorDoris Liu <tianliu@google.com>
Fri, 7 Sep 2012 21:33:52 +0000 (14:33 -0700)
committerDoris Liu <tianliu@google.com>
Fri, 7 Sep 2012 21:33:52 +0000 (14:33 -0700)
When Gallery is launched via notification, back button should progress through the app before return to Home

Bug: 6925612
Change-Id: I9da2120c6f607f8b6d3fa57d8a70225bc66fb8ef

src/com/android/gallery3d/app/Gallery.java

index ae104eb..b35c114 100644 (file)
@@ -202,6 +202,11 @@ public final class Gallery extends AbstractGalleryActivity implements OnCancelLi
                 data.putString(PhotoPage.KEY_MEDIA_ITEM_PATH, itemPath.toString());
                 if (intent.getBooleanExtra(PhotoPage.KEY_TREAT_BACK_AS_UP, false)) {
                     data.putBoolean(PhotoPage.KEY_TREAT_BACK_AS_UP, true);
+                } else if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
+                    // when FLAG_ACTIVITY_NEW_TASK is set, (e.g. when intent is fired
+                    // from notification), back button should behave the same as up button
+                    // rather than taking users back to the home screen
+                    data.putBoolean(PhotoPage.KEY_TREAT_BACK_AS_UP, true);
                 }
 
                 // Displays the filename as title, reading the filename from the interface: