Merge "TextClassificationManager API updates." into oc-dev

am: dada7c0e71

Change-Id: Idcd8fd7413b4fd187b3ffa893250b33754f0e962
This commit is contained in:
Abodunrinwa Toki
2017-03-30 19:32:10 +00:00
committed by android-build-merger
8 changed files with 56 additions and 11 deletions

View File

@@ -48080,7 +48080,8 @@ package android.view.textclassifier {
public final class TextClassificationManager {
method public java.util.List<android.view.textclassifier.TextLanguage> detectLanguages(java.lang.CharSequence);
method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
method public android.view.textclassifier.TextClassifier getTextClassifier();
method public void setTextClassifier(android.view.textclassifier.TextClassifier);
}
public final class TextClassificationResult {

View File

@@ -380,6 +380,14 @@ package android.view {
}
package android.view.textclassifier {
public final class TextClassificationManager {
method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
}
}
package android.webkit {
public class WebViewClient {

View File

@@ -51539,7 +51539,8 @@ package android.view.textclassifier {
public final class TextClassificationManager {
method public java.util.List<android.view.textclassifier.TextLanguage> detectLanguages(java.lang.CharSequence);
method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
method public android.view.textclassifier.TextClassifier getTextClassifier();
method public void setTextClassifier(android.view.textclassifier.TextClassifier);
}
public final class TextClassificationResult {

View File

@@ -374,6 +374,14 @@ package android.view {
}
package android.view.textclassifier {
public final class TextClassificationManager {
method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
}
}
package android.webkit {
public class WebViewClient {

View File

@@ -48463,7 +48463,8 @@ package android.view.textclassifier {
public final class TextClassificationManager {
method public java.util.List<android.view.textclassifier.TextLanguage> detectLanguages(java.lang.CharSequence);
method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
method public android.view.textclassifier.TextClassifier getTextClassifier();
method public void setTextClassifier(android.view.textclassifier.TextClassifier);
}
public final class TextClassificationResult {

View File

@@ -380,6 +380,14 @@ package android.view {
}
package android.view.textclassifier {
public final class TextClassificationManager {
method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
}
}
package android.webkit {
public class WebViewClient {

View File

@@ -17,6 +17,7 @@
package android.view.textclassifier;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@@ -45,7 +46,7 @@ public final class TextClassificationManager {
private final Context mContext;
private ParcelFileDescriptor mLangIdFd;
private TextClassifier mDefault;
private TextClassifier mTextClassifier;
private LangId mLangId;
/** @hide */
@@ -53,15 +54,32 @@ public final class TextClassificationManager {
mContext = Preconditions.checkNotNull(context);
}
/**
* Returns the default text classifier.
*/
// TODO: Remove.
/** @removed */
public TextClassifier getDefaultTextClassifier() {
return getTextClassifier();
}
/**
* Returns the text classifier.
*/
public TextClassifier getTextClassifier() {
synchronized (mTextClassifierLock) {
if (mDefault == null) {
mDefault = new TextClassifierImpl(mContext);
if (mTextClassifier == null) {
mTextClassifier = new TextClassifierImpl(mContext);
}
return mDefault;
return mTextClassifier;
}
}
/**
* Sets the text classifier.
* Set to null to use the system default text classifier.
* Set to {@link TextClassifier#NO_OP} to disable text classifier features.
*/
public void setTextClassifier(@Nullable TextClassifier textClassifier) {
synchronized (mTextClassifierLock) {
mTextClassifier = textClassifier;
}
}

View File

@@ -10765,7 +10765,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
TextClassificationManager tcm =
mContext.getSystemService(TextClassificationManager.class);
if (tcm != null) {
mTextClassifier = tcm.getDefaultTextClassifier();
mTextClassifier = tcm.getTextClassifier();
} else {
mTextClassifier = TextClassifier.NO_OP;
}