Update virtual display size before turning it on.
When a bubble is expanded, a virtual display turns on, an activity for the bubble is resumed, and the activity draws contents on the virtual display. The system waits until the contents is drawn, then shows the contents in the bubble. However, if size of the virtual display is changed after resuming the activity, an app transition initiated by the activity is canceled, and this sequence gets stuck. As a result, contents in the bubble is never displayed. Test: Manual. Bug: 158675422 Change-Id: I3ba0805fd09f4dee36dae6a236b5b6fc7983e06b
This commit is contained in:
@@ -33,7 +33,10 @@ import android.hardware.display.VirtualDisplay;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayInfo;
|
||||
import android.view.IWindow;
|
||||
import android.view.IWindowManager;
|
||||
import android.view.KeyEvent;
|
||||
@@ -416,6 +419,9 @@ public class ActivityView extends ViewGroup implements android.window.TaskEmbedd
|
||||
}
|
||||
|
||||
private class SurfaceCallback implements SurfaceHolder.Callback {
|
||||
private final DisplayInfo mTempDisplayInfo = new DisplayInfo();
|
||||
private final DisplayMetrics mTempMetrics = new DisplayMetrics();
|
||||
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||
if (!mTaskEmbedder.isInitialized()) {
|
||||
@@ -424,13 +430,21 @@ public class ActivityView extends ViewGroup implements android.window.TaskEmbedd
|
||||
mTmpTransaction.reparent(mTaskEmbedder.getSurfaceControl(),
|
||||
mSurfaceView.getSurfaceControl()).apply();
|
||||
}
|
||||
mTaskEmbedder.resizeTask(getWidth(), getHeight());
|
||||
mTaskEmbedder.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height) {
|
||||
mTaskEmbedder.resizeTask(width, height);
|
||||
mTaskEmbedder.notifyBoundsChanged();
|
||||
final Display display = getVirtualDisplay().getDisplay();
|
||||
if (!display.getDisplayInfo(mTempDisplayInfo)) {
|
||||
return;
|
||||
}
|
||||
mTempDisplayInfo.getAppMetrics(mTempMetrics);
|
||||
if (width != mTempMetrics.widthPixels || height != mTempMetrics.heightPixels) {
|
||||
mTaskEmbedder.resizeTask(width, height);
|
||||
mTaskEmbedder.notifyBoundsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user