Add log for thread change.
am: 93dd087eb2
Change-Id: Ieb9a7cfc3a256f755b5621b397289b35c76807bb
diff --git a/src/com/android/server/telecom/callfiltering/IncomingCallFilterGraph.java b/src/com/android/server/telecom/callfiltering/IncomingCallFilterGraph.java
index 99f4e5d..b39854c 100644
--- a/src/com/android/server/telecom/callfiltering/IncomingCallFilterGraph.java
+++ b/src/com/android/server/telecom/callfiltering/IncomingCallFilterGraph.java
@@ -20,15 +20,16 @@
import android.os.Handler;
import android.os.HandlerThread;
import android.telecom.Log;
+import android.telecom.Logging.Runnable;
import com.android.server.telecom.Call;
+import com.android.server.telecom.LoggedHandlerExecutor;
import com.android.server.telecom.TelecomSystem;
import com.android.server.telecom.Timeouts;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
public class IncomingCallFilterGraph {
//TODO: Add logging for control flow.
@@ -47,7 +48,6 @@
private final HandlerThread mHandlerThread;
private final TelecomSystem.SyncRoot mLock;
private List<CallFilter> mFiltersList;
- private Executor mExecutor;
private CallFilter mDummyComplete;
private boolean mFinished;
private CallFilteringResult mCurrentResult;
@@ -88,11 +88,10 @@
mHandlerThread = new HandlerThread(TAG);
mHandlerThread.start();
mHandler = new Handler(mHandlerThread.getLooper());
- mExecutor = mHandler::post;
+ mLock = lock;
mFinished = false;
mContext = context;
mTimeoutsAdapter = timeoutsAdapter;
- mLock = lock;
mCurrentResult = DEFAULT_RESULT;
}
@@ -114,15 +113,17 @@
addEdge(dummyStart, mDummyComplete);
scheduleFilter(dummyStart);
- mHandler.postDelayed(() -> {
- synchronized(mLock) {
+ mHandler.postDelayed(new Runnable("ICFG.pF", mLock) {
+ @Override
+ public void loggedRun() {
if (!mFinished) {
- Log.i(this, "Graph timed out when perform filtering.");
+ Log.i(this, "Graph timed out when performing filtering.");
mListener.onCallFilteringComplete(mCall, mCurrentResult);
mFinished = true;
mHandlerThread.quit();
}
- }}, mTimeoutsAdapter.getCallScreeningTimeoutMillis(mContext.getContentResolver()));
+ }
+ }.prepare(), mTimeoutsAdapter.getCallScreeningTimeoutMillis(mContext.getContentResolver()));
}
private void scheduleFilter(CallFilter filter) {
@@ -143,8 +144,10 @@
CompletableFuture.completedFuture(input);
PostFilterTask postFilterTask = new PostFilterTask(filter);
- startFuture.thenComposeAsync(filter::startFilterLookup, mExecutor)
- .thenApplyAsync(postFilterTask::whenDone, mExecutor);
+ startFuture.thenComposeAsync(filter::startFilterLookup,
+ new LoggedHandlerExecutor(mHandler, "ICFG.sF", null))
+ .thenApplyAsync(postFilterTask::whenDone,
+ new LoggedHandlerExecutor(mHandler, "ICFG.sF", null));
}
public static void addEdge(CallFilter before, CallFilter after) {