Fix TextClassifier logging.

No logs were being sent via the TextClassificationManagerService to
the TextClassifierService.
Also, SelectionEvent.getSessionId() is nullable. Handle appropriately.

Bug: 79418429
Test: manual - manually tested via a debugger. Auto tests coming soon.
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Change-Id: I196885d9b03c0c11cae7686a5835d14791065e78
This commit is contained in:
Abodunrinwa Toki
2018-05-08 18:23:10 +01:00
parent 1b5e2d8b3e
commit dfd3c653ce
2 changed files with 16 additions and 2 deletions

View File

@@ -86,8 +86,10 @@ public final class SelectionSessionLogger {
.addTaggedData(SMART_START, event.getSmartStart())
.addTaggedData(SMART_END, event.getSmartEnd())
.addTaggedData(EVENT_START, event.getStart())
.addTaggedData(EVENT_END, event.getEnd())
.addTaggedData(SESSION_ID, event.getSessionId().flattenToString());
.addTaggedData(EVENT_END, event.getEnd());
if (event.getSessionId() != null) {
log.addTaggedData(SESSION_ID, event.getSessionId().flattenToString());
}
mMetricsLogger.write(log);
debugLog(log);
}

View File

@@ -129,6 +129,18 @@ public final class SystemTextClassifier implements TextClassifier {
return mFallback.generateLinks(request);
}
@Override
public void onSelectionEvent(SelectionEvent event) {
Preconditions.checkNotNull(event);
Utils.checkMainThread();
try {
mManagerService.onSelectionEvent(mSessionId, event);
} catch (RemoteException e) {
Log.e(LOG_TAG, "Error reporting selection event.", e);
}
}
/**
* @inheritDoc
*/