Merge "Fix race condition on size compat UI" into sc-qpr1-dev am: f9c3101df3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15614097 Change-Id: Icf6c77c284a383748f8bdc0c66bb306b2937d3a3
This commit is contained in:
@@ -28,6 +28,7 @@ import android.content.res.Configuration;
|
|||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
@@ -45,7 +46,7 @@ import com.android.wm.shell.common.SyncTransactionQueue;
|
|||||||
class SizeCompatUILayout {
|
class SizeCompatUILayout {
|
||||||
private static final String TAG = "SizeCompatUILayout";
|
private static final String TAG = "SizeCompatUILayout";
|
||||||
|
|
||||||
private final SyncTransactionQueue mSyncQueue;
|
final SyncTransactionQueue mSyncQueue;
|
||||||
private final SizeCompatUIController.SizeCompatUICallback mCallback;
|
private final SizeCompatUIController.SizeCompatUICallback mCallback;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private Configuration mTaskConfig;
|
private Configuration mTaskConfig;
|
||||||
@@ -306,6 +307,10 @@ class SizeCompatUILayout {
|
|||||||
|
|
||||||
private void updateSurfacePosition(SurfaceControl leash, int positionX, int positionY) {
|
private void updateSurfacePosition(SurfaceControl leash, int positionX, int positionY) {
|
||||||
mSyncQueue.runInSync(t -> {
|
mSyncQueue.runInSync(t -> {
|
||||||
|
if (!leash.isValid()) {
|
||||||
|
Log.w(TAG, "The leash has been released.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
t.setPosition(leash, positionX, positionY);
|
t.setPosition(leash, positionX, positionY);
|
||||||
// The size compat UI should be the topmost child of the Task in case there can be more
|
// The size compat UI should be the topmost child of the Task in case there can be more
|
||||||
// than one children.
|
// than one children.
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ class SizeCompatUIWindowManager extends WindowlessWindowManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mLeash != null) {
|
if (mLeash != null) {
|
||||||
new SurfaceControl.Transaction().remove(mLeash).apply();
|
final SurfaceControl leash = mLeash;
|
||||||
|
mLayout.mSyncQueue.runInSync(t -> t.remove(leash));
|
||||||
mLeash = null;
|
mLeash = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user