Refactoring and some fixes around TextClassifierService
This change is mainly to address the comment "TextClassifierService.onDetectLanguage receives a callback but immediately calls callback.onSuccess before method returns, that is unexpected behavior. Method should either have a return value or post callback. Same for onSuggestConversationActions" from API council. 1. Like other services that allows developers to extend, APIs in TextClassifierService are now delivered in the main thread. 2. The default implementation of onDetectLanguage and onSuggestConversationActions now run local textclassifier in a worker thread. So it won't block the main thread and make sure the callback is called after the function returns. 3. Refactor the code so that fewer boilerplate codes around the callback. We are now using ITextClassifierCallback to replace all the existing I*Callback. This allows us to write template code easily. BUG: 120841922 Test: Enable system textclassifier tests and run atest TextClassifierTest.java Test: Manual. Try out smart selection and related features. Change-Id: I33b2cc80f968fb8b5d5007a153b6e50041e57ce6
Loading
Please register or sign in to comment