Loading core/java/android/view/textclassifier/SelectionSessionLogger.java +12 −3 Original line number Diff line number Diff line Loading @@ -80,12 +80,16 @@ public final class SelectionSessionLogger { .addTaggedData(INDEX, event.getEventIndex()) .addTaggedData(WIDGET_TYPE, event.getWidgetType()) .addTaggedData(WIDGET_VERSION, event.getWidgetVersion()) .addTaggedData(MODEL_NAME, SignatureParser.getModelName(event.getResultId())) .addTaggedData(ENTITY_TYPE, event.getEntityType()) .addTaggedData(SMART_START, event.getSmartStart()) .addTaggedData(SMART_END, event.getSmartEnd()) .addTaggedData(EVENT_START, event.getStart()) .addTaggedData(EVENT_END, event.getEnd()); if (isPlatformLocalTextClassifierSmartSelection(event.getResultId())) { // Ensure result id and smart indices are only set for events with smart selection from // the platform's textclassifier. log.addTaggedData(MODEL_NAME, SignatureParser.getModelName(event.getResultId())) .addTaggedData(SMART_START, event.getSmartStart()) .addTaggedData(SMART_END, event.getSmartEnd()); } if (event.getSessionId() != null) { log.addTaggedData(SESSION_ID, event.getSessionId().flattenToString()); } Loading Loading @@ -193,6 +197,11 @@ public final class SelectionSessionLogger { } } static boolean isPlatformLocalTextClassifierSmartSelection(String signature) { return SelectionSessionLogger.CLASSIFIER_ID.equals( SelectionSessionLogger.SignatureParser.getClassifierId(signature)); } private static void debugLog(LogMaker log) { if (!Log.ENABLE_FULL_LOGGING) { return; Loading core/java/android/view/textclassifier/TextClassificationSession.java +5 −9 Original line number Diff line number Diff line Loading @@ -158,11 +158,11 @@ final class TextClassificationSession implements TextClassifier { mStartEvent = event; break; case SelectionEvent.EVENT_SMART_SELECTION_SINGLE: // fall through case SelectionEvent.EVENT_SMART_SELECTION_MULTI: case SelectionEvent.EVENT_SMART_SELECTION_MULTI: // fall through case SelectionEvent.EVENT_AUTO_SELECTION: mSmartEvent = event; break; case SelectionEvent.EVENT_SELECTION_MODIFIED: // fall through case SelectionEvent.EVENT_AUTO_SELECTION: case SelectionEvent.EVENT_SELECTION_MODIFIED: if (mPrevEvent != null && mPrevEvent.getAbsoluteStart() == event.getAbsoluteStart() && mPrevEvent.getAbsoluteEnd() == event.getAbsoluteEnd()) { Loading Loading @@ -215,7 +215,8 @@ final class TextClassificationSession implements TextClassifier { case SelectionEvent.EVENT_SMART_SELECTION_SINGLE: // fall through case SelectionEvent.EVENT_SMART_SELECTION_MULTI: // fall through case SelectionEvent.EVENT_AUTO_SELECTION: if (isPlatformLocalTextClassifierSmartSelection(event.getResultId())) { if (SelectionSessionLogger.isPlatformLocalTextClassifierSmartSelection( event.getResultId())) { if (event.getAbsoluteEnd() - event.getAbsoluteStart() > 1) { event.setEventType(SelectionEvent.EVENT_SMART_SELECTION_MULTI); } else { Loading @@ -229,10 +230,5 @@ final class TextClassificationSession implements TextClassifier { return; } } private static boolean isPlatformLocalTextClassifierSmartSelection(String signature) { return SelectionSessionLogger.CLASSIFIER_ID.equals( SelectionSessionLogger.SignatureParser.getClassifierId(signature)); } } } Loading
core/java/android/view/textclassifier/SelectionSessionLogger.java +12 −3 Original line number Diff line number Diff line Loading @@ -80,12 +80,16 @@ public final class SelectionSessionLogger { .addTaggedData(INDEX, event.getEventIndex()) .addTaggedData(WIDGET_TYPE, event.getWidgetType()) .addTaggedData(WIDGET_VERSION, event.getWidgetVersion()) .addTaggedData(MODEL_NAME, SignatureParser.getModelName(event.getResultId())) .addTaggedData(ENTITY_TYPE, event.getEntityType()) .addTaggedData(SMART_START, event.getSmartStart()) .addTaggedData(SMART_END, event.getSmartEnd()) .addTaggedData(EVENT_START, event.getStart()) .addTaggedData(EVENT_END, event.getEnd()); if (isPlatformLocalTextClassifierSmartSelection(event.getResultId())) { // Ensure result id and smart indices are only set for events with smart selection from // the platform's textclassifier. log.addTaggedData(MODEL_NAME, SignatureParser.getModelName(event.getResultId())) .addTaggedData(SMART_START, event.getSmartStart()) .addTaggedData(SMART_END, event.getSmartEnd()); } if (event.getSessionId() != null) { log.addTaggedData(SESSION_ID, event.getSessionId().flattenToString()); } Loading Loading @@ -193,6 +197,11 @@ public final class SelectionSessionLogger { } } static boolean isPlatformLocalTextClassifierSmartSelection(String signature) { return SelectionSessionLogger.CLASSIFIER_ID.equals( SelectionSessionLogger.SignatureParser.getClassifierId(signature)); } private static void debugLog(LogMaker log) { if (!Log.ENABLE_FULL_LOGGING) { return; Loading
core/java/android/view/textclassifier/TextClassificationSession.java +5 −9 Original line number Diff line number Diff line Loading @@ -158,11 +158,11 @@ final class TextClassificationSession implements TextClassifier { mStartEvent = event; break; case SelectionEvent.EVENT_SMART_SELECTION_SINGLE: // fall through case SelectionEvent.EVENT_SMART_SELECTION_MULTI: case SelectionEvent.EVENT_SMART_SELECTION_MULTI: // fall through case SelectionEvent.EVENT_AUTO_SELECTION: mSmartEvent = event; break; case SelectionEvent.EVENT_SELECTION_MODIFIED: // fall through case SelectionEvent.EVENT_AUTO_SELECTION: case SelectionEvent.EVENT_SELECTION_MODIFIED: if (mPrevEvent != null && mPrevEvent.getAbsoluteStart() == event.getAbsoluteStart() && mPrevEvent.getAbsoluteEnd() == event.getAbsoluteEnd()) { Loading Loading @@ -215,7 +215,8 @@ final class TextClassificationSession implements TextClassifier { case SelectionEvent.EVENT_SMART_SELECTION_SINGLE: // fall through case SelectionEvent.EVENT_SMART_SELECTION_MULTI: // fall through case SelectionEvent.EVENT_AUTO_SELECTION: if (isPlatformLocalTextClassifierSmartSelection(event.getResultId())) { if (SelectionSessionLogger.isPlatformLocalTextClassifierSmartSelection( event.getResultId())) { if (event.getAbsoluteEnd() - event.getAbsoluteStart() > 1) { event.setEventType(SelectionEvent.EVENT_SMART_SELECTION_MULTI); } else { Loading @@ -229,10 +230,5 @@ final class TextClassificationSession implements TextClassifier { return; } } private static boolean isPlatformLocalTextClassifierSmartSelection(String signature) { return SelectionSessionLogger.CLASSIFIER_ID.equals( SelectionSessionLogger.SignatureParser.getClassifierId(signature)); } } }