Also, I do a test.
For the function,
void reportResized() {
try {
if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + this
+ ": " + mCompatFrame);
boolean configChanged = isConfigChanged();
if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION) && configChanged) {
Slog.i(TAG, "Sending new config to window " + this + ": "
+ mWinAnimator.mSurfaceW + "x" + mWinAnimator.mSurfaceH
+ " / " + mService.mCurConfiguration);
}
setConfiguration(mService.mCurConfiguration);
if (DEBUG_ORIENTATION && mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING)
Slog.i(TAG, "Resizing " + this + " WITH DRAW PENDING");
final Rect frame = mFrame;
final Rect overscanInsets = mLastOverscanInsets;
final Rect contentInsets = mLastContentInsets;
final Rect visibleInsets = mLastVisibleInsets;
final Rect stableInsets = mLastStableInsets;
final boolean reportDraw = mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
final Configuration newConfig = configChanged ? mConfiguration : null;
Slog.v(TAG, "reportResized(): mAttrs.type " + mAttrs.type + " mClient instanceof IWindow.Stub " + (mClient instanceof IWindow.Stub));
/*
if (mAttrs.type != WindowManager.LayoutParams.TYPE_APPLICATION_STARTING
&& mClient instanceof IWindow.Stub) {
*/
<---------------------------------------------- comment this if expression, and make it always true as below, now after a simple test, no hangs during the test. if (true) {
// To prevent deadlock simulate one-way call if win.mClient is a local object.
mService.mH.post(new Runnable() {
@Override
public void run() {
try {
Slog.i(TAG, "reportResized(): post runnable task for resized operation, always running");
mClient.resized(frame, overscanInsets, contentInsets,
visibleInsets, stableInsets, reportDraw, newConfig);
} catch (RemoteException e) {
// Not a remote call, RemoteException won't be raised.
}
}
});
} else {
Slog.i(TAG, "reportResized(): calling directly for resized operation");
mClient.resized(frame, overscanInsets, contentInsets, visibleInsets, stableInsets,
reportDraw, newConfig);
}
Slog.i(TAG, "reportResized(): after Resizing");
//TODO (multidisplay): Accessibility supported only for the default display.
if (mService.mAccessibilityController != null
&& getDisplayId() == Display.DEFAULT_DISPLAY) {
mService.mAccessibilityController.onSomeWindowResizedOrMovedLocked();
}
mOverscanInsetsChanged = false;
mContentInsetsChanged = false;
mVisibleInsetsChanged = false;
mStableInsetsChanged = false;
mWinAnimator.mSurfaceResized = false;
} catch (RemoteException e) {
mOverscanInsetsChanged = false;
mContentInsetsChanged = false;
mVisibleInsetsChanged = false;
mStableInsetsChanged = false;
mWinAnimator.mSurfaceResized = false;
mOrientationChanging = false;
mLastFreezeDuration = (int)(SystemClock.elapsedRealtime()
- mService.mDisplayFreezeTime);