Merge "Add IPC latency in extras." into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-11-16 01:23:24 +00:00
committed by Android (Google) Code Review

View File

@@ -23,9 +23,11 @@ import android.app.search.ISearchCallback.Stub;
import android.content.Context; import android.content.Context;
import android.content.pm.ParceledListSlice; import android.content.pm.ParceledListSlice;
import android.os.Binder; import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.SystemClock;
import android.util.Log; import android.util.Log;
import dalvik.system.CloseGuard; import dalvik.system.CloseGuard;
@@ -229,7 +231,14 @@ public final class SearchSession implements AutoCloseable{
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "CallbackWrapper.onResult result=" + result.getList()); Log.d(TAG, "CallbackWrapper.onResult result=" + result.getList());
} }
mExecutor.execute(() -> mCallback.accept(result.getList())); List<SearchTarget> list = result.getList();
if (list.size() > 0) {
Bundle bundle = list.get(0).getExtras();
if (bundle != null) {
bundle.putLong("key_ipc_start", SystemClock.elapsedRealtime());
}
}
mExecutor.execute(() -> mCallback.accept(list));
} finally { } finally {
Binder.restoreCallingIdentity(identity); Binder.restoreCallingIdentity(identity);
} }