Index: shell/android/apk/src/org/chromium/mojo/shell/ViewportActivity.java |
diff --git a/shell/android/apk/src/org/chromium/mojo/shell/ViewportActivity.java b/shell/android/apk/src/org/chromium/mojo/shell/ViewportActivity.java |
index 29b69a7b5bc785a175f5278bed0f6f03b5ea7098..b087cd0e37809becbf524e0b379924c5a7ac68df 100644 |
--- a/shell/android/apk/src/org/chromium/mojo/shell/ViewportActivity.java |
+++ b/shell/android/apk/src/org/chromium/mojo/shell/ViewportActivity.java |
@@ -19,6 +19,12 @@ import org.chromium.mojo.input.InputServiceImpl; |
* Activity for displaying on the screen from the NativeViewportService. |
*/ |
public class ViewportActivity extends Activity { |
+ private static Activity sCurrentActivity = null; |
+ |
+ public static Activity getCurrent() { |
+ return sCurrentActivity; |
+ } |
+ |
/** |
* @see Activity#onKeyDown(int, KeyEvent) |
*/ |
@@ -57,4 +63,22 @@ public class ViewportActivity extends Activity { |
super.onNewIntent(intent); |
new RuntimeException("This activity instance should only ever receive one intent."); |
} |
+ |
+ /** |
+ * @see Activity#onPause() |
+ */ |
+ @Override |
+ protected void onPause() { |
+ if (sCurrentActivity == this) sCurrentActivity = null; |
+ super.onPause(); |
+ } |
+ |
+ /** |
+ * @see Activity#onResume() |
+ */ |
+ @Override |
+ protected void onResume() { |
+ super.onResume(); |
+ sCurrentActivity = this; |
+ } |
} |