Revert "Fix lock contention while swiping up"

This reverts commit 12c4ecb015.

Reason for revert: pending some comments

Change-Id: I064b76c7cedfda1bd4de17dc407dc843831ecd68
This commit is contained in:
Sunny Goyal
2018-05-09 20:10:40 +00:00
parent 12c4ecb015
commit daa47e7ccc
@@ -15,14 +15,10 @@
*/ */
package com.android.quickstep; package com.android.quickstep;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.util.UiThreadHelper;
import com.android.quickstep.util.RemoteAnimationTargetSet; import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.systemui.shared.system.BackgroundExecutor; import com.android.systemui.shared.system.BackgroundExecutor;
import com.android.systemui.shared.system.RecentsAnimationControllerCompat; import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* Wrapper around RecentsAnimationController to help with some synchronization * Wrapper around RecentsAnimationController to help with some synchronization
@@ -32,9 +28,6 @@ public class RecentsAnimationWrapper {
public RecentsAnimationControllerCompat controller; public RecentsAnimationControllerCompat controller;
public RemoteAnimationTargetSet targetSet; public RemoteAnimationTargetSet targetSet;
private final ExecutorService mExecutorService =
new LooperExecutor(UiThreadHelper.getBackgroundLooper());
private boolean mInputConsumerEnabled = false; private boolean mInputConsumerEnabled = false;
private boolean mBehindSystemBars = true; private boolean mBehindSystemBars = true;
private boolean mSplitScreenMinimized = false; private boolean mSplitScreenMinimized = false;
@@ -55,16 +48,17 @@ public class RecentsAnimationWrapper {
* on the background thread. * on the background thread.
*/ */
public void finish(boolean toHome, Runnable onFinishComplete) { public void finish(boolean toHome, Runnable onFinishComplete) {
mExecutorService.submit(() -> { BackgroundExecutor.get().submit(() -> {
TraceHelper.endSection("RecentsController", synchronized (this) {
"Finish " + controller + ", toHome=" + toHome); TraceHelper.endSection("RecentsController",
RecentsAnimationControllerCompat thisController = controller; "Finish " + controller + ", toHome=" + toHome);
controller = null; if (controller != null) {
if (thisController != null) { controller.setInputConsumerEnabled(false);
thisController.setInputConsumerEnabled(false); controller.finish(toHome);
thisController.finish(toHome); if (onFinishComplete != null) {
if (onFinishComplete != null) { onFinishComplete.run();
onFinishComplete.run(); }
controller = null;
} }
} }
}); });
@@ -73,11 +67,13 @@ public class RecentsAnimationWrapper {
public void enableInputConsumer() { public void enableInputConsumer() {
mInputConsumerEnabled = true; mInputConsumerEnabled = true;
if (mInputConsumerEnabled) { if (mInputConsumerEnabled) {
mExecutorService.submit(() -> { BackgroundExecutor.get().submit(() -> {
TraceHelper.partitionSection("RecentsController", synchronized (this) {
"Enabling consumer on " + controller); TraceHelper.partitionSection("RecentsController",
if (controller != null) { "Enabling consumer on " + controller);
controller.setInputConsumerEnabled(true); if (controller != null) {
controller.setInputConsumerEnabled(true);
}
} }
}); });
} }
@@ -88,11 +84,13 @@ public class RecentsAnimationWrapper {
return; return;
} }
mBehindSystemBars = behindSystemBars; mBehindSystemBars = behindSystemBars;
mExecutorService.submit(() -> { BackgroundExecutor.get().submit(() -> {
TraceHelper.partitionSection("RecentsController", synchronized (this) {
"Setting behind system bars on " + controller); TraceHelper.partitionSection("RecentsController",
if (controller != null) { "Setting behind system bars on " + controller);
controller.setAnimationTargetsBehindSystemBars(behindSystemBars); if (controller != null) {
controller.setAnimationTargetsBehindSystemBars(behindSystemBars);
}
} }
}); });
} }
@@ -108,20 +106,24 @@ public class RecentsAnimationWrapper {
return; return;
} }
mSplitScreenMinimized = minimized; mSplitScreenMinimized = minimized;
mExecutorService.submit(() -> { BackgroundExecutor.get().submit(() -> {
TraceHelper.partitionSection("RecentsController", synchronized (this) {
"Setting minimize dock on " + controller); TraceHelper.partitionSection("RecentsController",
if (controller != null) { "Setting minimize dock on " + controller);
controller.setSplitScreenMinimized(minimized); if (controller != null) {
controller.setSplitScreenMinimized(minimized);
}
} }
}); });
} }
public void hideCurrentInputMethod() { public void hideCurrentInputMethod() {
mExecutorService.submit(() -> { BackgroundExecutor.get().submit(() -> {
TraceHelper.partitionSection("RecentsController", "Hiding currentinput method"); synchronized (this) {
if (controller != null) { TraceHelper.partitionSection("RecentsController", "Hiding currentinput method");
controller.hideCurrentInputMethod(); if (controller != null) {
controller.hideCurrentInputMethod();
}
} }
}); });
} }