Merge "Making ViewRootImpl drop input events when the Activity is in ambient mode." into cw-e-dev
am: cbef517d02
* commit 'cbef517d02f4f3680e155cc1a704ebf5c959d03f':
Making ViewRootImpl drop input events when the Activity is in ambient mode.
This commit is contained in:
@@ -174,6 +174,10 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
// so the window should no longer be active.
|
// so the window should no longer be active.
|
||||||
boolean mStopped = false;
|
boolean mStopped = false;
|
||||||
|
|
||||||
|
// Set to true if the owner of this window is in ambient mode,
|
||||||
|
// which means it won't receive input events.
|
||||||
|
boolean mIsAmbientMode = false;
|
||||||
|
|
||||||
// Set to true to stop input during an Activity Transition.
|
// Set to true to stop input during an Activity Transition.
|
||||||
boolean mPausedForTransition = false;
|
boolean mPausedForTransition = false;
|
||||||
|
|
||||||
@@ -990,6 +994,10 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIsAmbientMode(boolean ambient) {
|
||||||
|
mIsAmbientMode = ambient;
|
||||||
|
}
|
||||||
|
|
||||||
void setWindowStopped(boolean stopped) {
|
void setWindowStopped(boolean stopped) {
|
||||||
if (mStopped != stopped) {
|
if (mStopped != stopped) {
|
||||||
mStopped = stopped;
|
mStopped = stopped;
|
||||||
@@ -3704,7 +3712,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
return true;
|
return true;
|
||||||
} else if ((!mAttachInfo.mHasWindowFocus
|
} else if ((!mAttachInfo.mHasWindowFocus
|
||||||
&& !q.mEvent.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) || mStopped
|
&& !q.mEvent.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) || mStopped
|
||||||
|| (mPausedForTransition && !isBack(q.mEvent))) {
|
|| mIsAmbientMode || (mPausedForTransition && !isBack(q.mEvent))) {
|
||||||
// This is a focus event and the window doesn't currently have input focus or
|
// This is a focus event and the window doesn't currently have input focus or
|
||||||
// has stopped. This could be an event that came back from the previous stage
|
// has stopped. This could be an event that came back from the previous stage
|
||||||
// but the window has lost focus or stopped in the meantime.
|
// but the window has lost focus or stopped in the meantime.
|
||||||
@@ -5514,6 +5522,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
writer.println(mProcessInputEventsScheduled);
|
writer.println(mProcessInputEventsScheduled);
|
||||||
writer.print(innerPrefix); writer.print("mTraversalScheduled=");
|
writer.print(innerPrefix); writer.print("mTraversalScheduled=");
|
||||||
writer.print(mTraversalScheduled);
|
writer.print(mTraversalScheduled);
|
||||||
|
writer.print(innerPrefix); writer.print("mIsAmbientMode=");
|
||||||
|
writer.print(mIsAmbientMode);
|
||||||
if (mTraversalScheduled) {
|
if (mTraversalScheduled) {
|
||||||
writer.print(" (barrier="); writer.print(mTraversalBarrier); writer.println(")");
|
writer.print(" (barrier="); writer.print(mTraversalBarrier); writer.println(")");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user