Add dispatching overrides for foreground apps.
Apps can register to override the default dispatching
but only when they're in the foreground.
Change-Id: I8e9a9254d3f79f097fb3c8c677d806043574ba4d
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index f25c4c3..a54b305 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -632,7 +632,7 @@
/*package*/ HashMap<String,Object> mLastNonConfigurationChildInstances;
Activity mParent;
boolean mCalled;
- private boolean mResumed;
+ /*package*/ boolean mResumed;
private boolean mStopped;
boolean mFinished;
boolean mStartedActivity;
@@ -3827,9 +3827,8 @@
mLastNonConfigurationInstance = null;
- // First call onResume() -before- setting mResumed, so we don't
- // send out any status bar / menu notifications the client makes.
mCalled = false;
+ // mResumed is set by the instrumentation
mInstrumentation.callActivityOnResume(this);
if (!mCalled) {
throw new SuperNotCalledException(
@@ -3838,7 +3837,6 @@
}
// Now really resume, and install the current status bar and menu.
- mResumed = true;
mCalled = false;
onPostResume();
if (!mCalled) {
@@ -3857,6 +3855,7 @@
"Activity " + mComponent.toShortString() +
" did not call through to super.onPause()");
}
+ mResumed = false;
}
final void performUserLeaving() {
@@ -3891,10 +3890,12 @@
mStopped = true;
}
- mResumed = false;
}
- final boolean isResumed() {
+ /**
+ * @hide
+ */
+ public final boolean isResumed() {
return mResumed;
}