Merge "Dispose InputChannel when dispose InputEventReceiver"
This commit is contained in:
committed by
Android (Google) Code Review
commit
f80171ef5c
@@ -196,7 +196,6 @@ public abstract class WallpaperService extends Service {
|
||||
final WindowManager.LayoutParams mLayout
|
||||
= new WindowManager.LayoutParams();
|
||||
IWindowSession mSession;
|
||||
InputChannel mInputChannel;
|
||||
|
||||
final Object mLock = new Object();
|
||||
boolean mOffsetMessageEnqueued;
|
||||
@@ -819,11 +818,11 @@ public abstract class WallpaperService extends Service {
|
||||
mLayout.setTitle(WallpaperService.this.getClass().getName());
|
||||
mLayout.windowAnimations =
|
||||
com.android.internal.R.style.Animation_Wallpaper;
|
||||
mInputChannel = new InputChannel();
|
||||
InputChannel inputChannel = new InputChannel();
|
||||
|
||||
if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE,
|
||||
mDisplay.getDisplayId(), mWinFrame, mContentInsets, mStableInsets,
|
||||
mOutsets, mDisplayCutout, mInputChannel,
|
||||
mOutsets, mDisplayCutout, inputChannel,
|
||||
mInsetsState) < 0) {
|
||||
Log.w(TAG, "Failed to add window while updating wallpaper surface.");
|
||||
return;
|
||||
@@ -831,7 +830,7 @@ public abstract class WallpaperService extends Service {
|
||||
mCreated = true;
|
||||
|
||||
mInputEventReceiver = new WallpaperInputEventReceiver(
|
||||
mInputChannel, Looper.myLooper());
|
||||
inputChannel, Looper.myLooper());
|
||||
}
|
||||
|
||||
mSurfaceHolder.mSurfaceLock.lock();
|
||||
@@ -1267,13 +1266,6 @@ public abstract class WallpaperService extends Service {
|
||||
}
|
||||
mSurfaceHolder.mSurface.release();
|
||||
mCreated = false;
|
||||
|
||||
// Dispose the input channel after removing the window so the Window Manager
|
||||
// doesn't interpret the input channel being closed as an abnormal termination.
|
||||
if (mInputChannel != null) {
|
||||
mInputChannel.dispose();
|
||||
mInputChannel = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,11 @@ public abstract class InputEventReceiver {
|
||||
nativeDispose(mReceiverPtr);
|
||||
mReceiverPtr = 0;
|
||||
}
|
||||
mInputChannel = null;
|
||||
|
||||
if (mInputChannel != null) {
|
||||
mInputChannel.dispose();
|
||||
mInputChannel = null;
|
||||
}
|
||||
mMessageQueue = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -399,7 +399,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
@UnsupportedAppUsage
|
||||
final View.AttachInfo mAttachInfo;
|
||||
InputChannel mInputChannel;
|
||||
InputQueue.Callback mInputQueueCallback;
|
||||
InputQueue mInputQueue;
|
||||
@UnsupportedAppUsage
|
||||
@@ -882,9 +881,10 @@ public final class ViewRootImpl implements ViewParent,
|
||||
// manager, to make sure we do the relayout before receiving
|
||||
// any other events from the system.
|
||||
requestLayout();
|
||||
InputChannel inputChannel = null;
|
||||
if ((mWindowAttributes.inputFeatures
|
||||
& WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL) == 0) {
|
||||
mInputChannel = new InputChannel();
|
||||
inputChannel = new InputChannel();
|
||||
}
|
||||
mForceDecorViewVisibility = (mWindowAttributes.privateFlags
|
||||
& PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY) != 0;
|
||||
@@ -895,14 +895,14 @@ public final class ViewRootImpl implements ViewParent,
|
||||
res = mWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes,
|
||||
getHostVisibility(), mDisplay.getDisplayId(), mTmpFrame,
|
||||
mAttachInfo.mContentInsets, mAttachInfo.mStableInsets,
|
||||
mAttachInfo.mOutsets, mAttachInfo.mDisplayCutout, mInputChannel,
|
||||
mAttachInfo.mOutsets, mAttachInfo.mDisplayCutout, inputChannel,
|
||||
mTempInsets);
|
||||
setFrame(mTmpFrame);
|
||||
} catch (RemoteException e) {
|
||||
mAdded = false;
|
||||
mView = null;
|
||||
mAttachInfo.mRootView = null;
|
||||
mInputChannel = null;
|
||||
inputChannel = null;
|
||||
mFallbackEventHandler.setView(null);
|
||||
unscheduleTraversals();
|
||||
setAccessibilityFocus(null, null);
|
||||
@@ -978,12 +978,12 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mInputQueueCallback =
|
||||
((RootViewSurfaceTaker)view).willYouTakeTheInputQueue();
|
||||
}
|
||||
if (mInputChannel != null) {
|
||||
if (inputChannel != null) {
|
||||
if (mInputQueueCallback != null) {
|
||||
mInputQueue = new InputQueue();
|
||||
mInputQueueCallback.onInputQueueCreated(mInputQueue);
|
||||
}
|
||||
mInputEventReceiver = new WindowInputEventReceiver(mInputChannel,
|
||||
mInputEventReceiver = new WindowInputEventReceiver(inputChannel,
|
||||
Looper.myLooper());
|
||||
}
|
||||
|
||||
@@ -4375,13 +4375,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
|
||||
// Dispose the input channel after removing the window so the Window Manager
|
||||
// doesn't interpret the input channel being closed as an abnormal termination.
|
||||
if (mInputChannel != null) {
|
||||
mInputChannel.dispose();
|
||||
mInputChannel = null;
|
||||
}
|
||||
|
||||
mDisplayManager.unregisterDisplayListener(mDisplayListener);
|
||||
|
||||
unscheduleTraversals();
|
||||
|
||||
Reference in New Issue
Block a user