mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Merge pull request #8537 from atorralba/atorralba/unsafe_android_access_improvs
Java: Improvements to UnsafeAndroidAccess
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
import java
|
||||
|
||||
/** The class `android.webkit.WebView`. */
|
||||
class TypeWebView extends Class {
|
||||
TypeWebView() { this.hasQualifiedName("android.webkit", "WebView") }
|
||||
}
|
||||
|
||||
/** The class `android.webkit.WebViewClient`. */
|
||||
class TypeWebViewClient extends Class {
|
||||
TypeWebViewClient() { this.hasQualifiedName("android.webkit", "WebViewClient") }
|
||||
}
|
||||
|
||||
/** The class `android.webkit.WebSettings`. */
|
||||
class TypeWebSettings extends Class {
|
||||
TypeWebSettings() { this.hasQualifiedName("android.webkit", "WebSettings") }
|
||||
}
|
||||
|
||||
/** The method `getSettings` of the class `android.webkit.WebView`. */
|
||||
class WebViewGetSettingsMethod extends Method {
|
||||
WebViewGetSettingsMethod() {
|
||||
this.hasName("getSettings") and
|
||||
@@ -19,6 +23,7 @@ class WebViewGetSettingsMethod extends Method {
|
||||
}
|
||||
}
|
||||
|
||||
/** The method `loadUrl` or `postUrl` of the class `android.webkit.WebView`. */
|
||||
class WebViewLoadUrlMethod extends Method {
|
||||
WebViewLoadUrlMethod() {
|
||||
this.getDeclaringType() instanceof TypeWebView and
|
||||
@@ -26,9 +31,46 @@ class WebViewLoadUrlMethod extends Method {
|
||||
}
|
||||
}
|
||||
|
||||
/** The method `getUrl` or `getOriginalUrl` of the class `android.webkit.WebView`. */
|
||||
class WebViewGetUrlMethod extends Method {
|
||||
WebViewGetUrlMethod() {
|
||||
this.getDeclaringType() instanceof TypeWebView and
|
||||
(this.getName() = "getUrl" or this.getName() = "getOriginalUrl")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method allowing any-local-file and cross-origin access in the class `android.webkit.WebSettings`.
|
||||
*/
|
||||
class CrossOriginAccessMethod extends Method {
|
||||
CrossOriginAccessMethod() {
|
||||
this.getDeclaringType() instanceof TypeWebSettings and
|
||||
this.hasName(["setAllowUniversalAccessFromFileURLs", "setAllowFileAccessFromFileURLs"])
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The method `setJavaScriptEnabled` of the class `android.webkit.WebSettings`.
|
||||
*/
|
||||
class AllowJavaScriptMethod extends Method {
|
||||
AllowJavaScriptMethod() {
|
||||
this.getDeclaringType() instanceof TypeWebSettings and
|
||||
this.hasName("setJavaScriptEnabled")
|
||||
}
|
||||
}
|
||||
|
||||
/** The method `setWebViewClient` of the class `android.webkit.WebView`. */
|
||||
class WebViewSetWebViewClientMethod extends Method {
|
||||
WebViewSetWebViewClientMethod() {
|
||||
this.getDeclaringType() instanceof TypeWebView and
|
||||
this.hasName("setWebViewClient")
|
||||
}
|
||||
}
|
||||
|
||||
/** The method `shouldOverrideUrlLoading` of the class `android.webkit.WebViewClient`. */
|
||||
class ShouldOverrideUrlLoading extends Method {
|
||||
ShouldOverrideUrlLoading() {
|
||||
this.getDeclaringType().getASupertype*() instanceof TypeWebViewClient and
|
||||
this.hasName("shouldOverrideUrlLoading")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
*/
|
||||
|
||||
import java
|
||||
private import semmle.code.java.frameworks.android.WebView
|
||||
private import semmle.code.java.dataflow.DataFlow
|
||||
private import semmle.code.java.dataflow.ExternalFlow
|
||||
private import semmle.code.java.frameworks.android.WebView
|
||||
|
||||
/**
|
||||
* A sink that represents a method that fetches a web resource in Android.
|
||||
@@ -26,11 +25,9 @@ abstract class UrlResourceSink extends DataFlow::Node {
|
||||
*/
|
||||
private class CrossOriginUrlResourceSink extends JavaScriptEnabledUrlResourceSink {
|
||||
CrossOriginUrlResourceSink() {
|
||||
exists(Variable settings, MethodAccess ma |
|
||||
webViewLoadUrl(this.asExpr(), settings) and
|
||||
ma.getMethod() instanceof CrossOriginAccessMethod and
|
||||
ma.getArgument(0).(BooleanLiteral).getBooleanValue() = true and
|
||||
ma.getQualifier() = settings.getAnAccess()
|
||||
exists(WebViewRef webview |
|
||||
webViewLoadUrl(this.asExpr(), webview) and
|
||||
isAllowFileAccessEnabled(webview)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -44,57 +41,96 @@ private class CrossOriginUrlResourceSink extends JavaScriptEnabledUrlResourceSin
|
||||
*/
|
||||
private class JavaScriptEnabledUrlResourceSink extends UrlResourceSink {
|
||||
JavaScriptEnabledUrlResourceSink() {
|
||||
exists(Variable settings |
|
||||
webViewLoadUrl(this.asExpr(), settings) and
|
||||
isJSEnabled(settings)
|
||||
exists(WebViewRef webview |
|
||||
webViewLoadUrl(this.asExpr(), webview) and
|
||||
isJSEnabled(webview)
|
||||
)
|
||||
}
|
||||
|
||||
override string getSinkType() { result = "user input vulnerable to XSS attacks" }
|
||||
}
|
||||
|
||||
private class WebViewRef extends Element {
|
||||
WebViewRef() {
|
||||
this.(RefType).getASourceSupertype*() instanceof TypeWebView or
|
||||
this.(Variable).getType().(RefType).getASourceSupertype*() instanceof TypeWebView
|
||||
}
|
||||
|
||||
/** Gets an access to this WebView as a data flow node. */
|
||||
DataFlow::Node getAnAccess() {
|
||||
exists(DataFlow::InstanceAccessNode t | t.getType() = this and result = t |
|
||||
t.isOwnInstanceAccess() or t.getInstanceAccess().isEnclosingInstanceAccess(this)
|
||||
)
|
||||
or
|
||||
result = DataFlow::exprNode(this.(Variable).getAnAccess())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if a `WebViewLoadUrlMethod` method is called with the given `urlArg` on a
|
||||
* WebView with settings stored in `settings`.
|
||||
* Holds if a `WebViewLoadUrlMethod` is called on an access of `webview`
|
||||
* with `urlArg` as its first argument.
|
||||
*/
|
||||
private predicate webViewLoadUrl(Expr urlArg, Variable settings) {
|
||||
exists(MethodAccess loadUrl, Variable webview, MethodAccess getSettings |
|
||||
private predicate webViewLoadUrl(Argument urlArg, WebViewRef webview) {
|
||||
exists(MethodAccess loadUrl |
|
||||
loadUrl.getArgument(0) = urlArg and
|
||||
loadUrl.getMethod() instanceof WebViewLoadUrlMethod and
|
||||
loadUrl.getQualifier() = webview.getAnAccess() and
|
||||
getSettings.getMethod() instanceof WebViewGetSettingsMethod and
|
||||
webview.getAnAccess() = getSettings.getQualifier() and
|
||||
settings.getAnAssignedValue() = getSettings
|
||||
loadUrl.getMethod() instanceof WebViewLoadUrlMethod
|
||||
|
|
||||
webview.getAnAccess() = DataFlow::getInstanceArgument(loadUrl)
|
||||
or
|
||||
// `webview` is received as a parameter of an event method in a custom `WebViewClient`,
|
||||
// so we need to find `WebViews` that use that specific `WebViewClient`.
|
||||
exists(WebViewClientEventMethod eventMethod, MethodAccess setWebClient |
|
||||
setWebClient.getMethod() instanceof WebViewSetWebViewClientMethod and
|
||||
setWebClient.getArgument(0).getType() = eventMethod.getDeclaringType() and
|
||||
loadUrl.getQualifier() = eventMethod.getWebViewParameter().getAnAccess()
|
||||
|
|
||||
webview.getAnAccess() = DataFlow::getInstanceArgument(setWebClient)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A method allowing any-local-file and cross-origin access in the WebSettings class.
|
||||
* Holds if `webview`'s option `setJavascriptEnabled`
|
||||
* has been set to `true` via a `WebSettings` object obtained from it.
|
||||
*/
|
||||
private class CrossOriginAccessMethod extends Method {
|
||||
CrossOriginAccessMethod() {
|
||||
this.getDeclaringType() instanceof TypeWebSettings and
|
||||
this.hasName(["setAllowUniversalAccessFromFileURLs", "setAllowFileAccessFromFileURLs"])
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The `setJavaScriptEnabled` method for the webview.
|
||||
*/
|
||||
private class AllowJavaScriptMethod extends Method {
|
||||
AllowJavaScriptMethod() {
|
||||
this.getDeclaringType() instanceof TypeWebSettings and
|
||||
this.hasName("setJavaScriptEnabled")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if a call to `v.setJavaScriptEnabled(true)` exists.
|
||||
*/
|
||||
private predicate isJSEnabled(Variable v) {
|
||||
exists(MethodAccess jsa |
|
||||
v.getAnAccess() = jsa.getQualifier() and
|
||||
jsa.getMethod() instanceof AllowJavaScriptMethod and
|
||||
jsa.getArgument(0).(BooleanLiteral).getBooleanValue() = true
|
||||
private predicate isJSEnabled(WebViewRef webview) {
|
||||
exists(MethodAccess allowJs, MethodAccess settings |
|
||||
allowJs.getMethod() instanceof AllowJavaScriptMethod and
|
||||
allowJs.getArgument(0).(CompileTimeConstantExpr).getBooleanValue() = true and
|
||||
settings.getMethod() instanceof WebViewGetSettingsMethod and
|
||||
DataFlow::localExprFlow(settings, allowJs.getQualifier()) and
|
||||
DataFlow::localFlow(webview.getAnAccess(), DataFlow::getInstanceArgument(settings))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `webview`'s options `setAllowUniversalAccessFromFileURLs` or
|
||||
* `setAllowFileAccessFromFileURLs` have been set to `true` via a `WebSettings` object
|
||||
* obtained from it.
|
||||
*/
|
||||
private predicate isAllowFileAccessEnabled(WebViewRef webview) {
|
||||
exists(MethodAccess allowFileAccess, MethodAccess settings |
|
||||
allowFileAccess.getMethod() instanceof CrossOriginAccessMethod and
|
||||
allowFileAccess.getArgument(0).(CompileTimeConstantExpr).getBooleanValue() = true and
|
||||
settings.getMethod() instanceof WebViewGetSettingsMethod and
|
||||
DataFlow::localExprFlow(settings, allowFileAccess.getQualifier()) and
|
||||
DataFlow::localFlow(webview.getAnAccess(), DataFlow::getInstanceArgument(settings))
|
||||
)
|
||||
}
|
||||
|
||||
/** A method of the class `WebViewClient` that handles an event. */
|
||||
private class WebViewClientEventMethod extends Method {
|
||||
WebViewClientEventMethod() {
|
||||
this.getDeclaringType().getASupertype*() instanceof TypeWebViewClient and
|
||||
this.hasName([
|
||||
"shouldOverrideUrlLoading", "shouldInterceptRequest", "onPageStarted", "onPageFinished",
|
||||
"onLoadResource", "onPageCommitVisible", "onTooManyRedirects"
|
||||
])
|
||||
}
|
||||
|
||||
/** Gets a `WebView` parameter of this method. */
|
||||
Parameter getWebViewParameter() {
|
||||
result = this.getAParameter() and
|
||||
result.getType() instanceof TypeWebView
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* The logic to detect `WebView`s with JavaScript (and optionally file access) enabled in the query `java/android/unsafe-android-webview-fetch` has been improved.
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// Generated automatically from android.app.RemoteAction for testing purposes
|
||||
|
||||
package android.app;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class RemoteAction implements Parcelable
|
||||
{
|
||||
protected RemoteAction() {}
|
||||
public CharSequence getContentDescription(){ return null; }
|
||||
public CharSequence getTitle(){ return null; }
|
||||
public Icon getIcon(){ return null; }
|
||||
public PendingIntent getActionIntent(){ return null; }
|
||||
public RemoteAction clone(){ return null; }
|
||||
public RemoteAction(Icon p0, CharSequence p1, CharSequence p2, PendingIntent p3){}
|
||||
public boolean equals(Object p0){ return false; }
|
||||
public boolean isEnabled(){ return false; }
|
||||
public boolean shouldShowIcon(){ return false; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int hashCode(){ return 0; }
|
||||
public static Parcelable.Creator<RemoteAction> CREATOR = null;
|
||||
public void dump(String p0, PrintWriter p1){}
|
||||
public void setEnabled(boolean p0){}
|
||||
public void setShouldShowIcon(boolean p0){}
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.ConversationAction for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.app.RemoteAction;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class ConversationAction implements Parcelable
|
||||
{
|
||||
protected ConversationAction() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public CharSequence getTextReply(){ return null; }
|
||||
public RemoteAction getAction(){ return null; }
|
||||
public String getType(){ return null; }
|
||||
public float getConfidenceScore(){ return 0; }
|
||||
public int describeContents(){ return 0; }
|
||||
public static Parcelable.Creator<ConversationAction> CREATOR = null;
|
||||
public static String TYPE_CALL_PHONE = null;
|
||||
public static String TYPE_CREATE_REMINDER = null;
|
||||
public static String TYPE_OPEN_URL = null;
|
||||
public static String TYPE_SEND_EMAIL = null;
|
||||
public static String TYPE_SEND_SMS = null;
|
||||
public static String TYPE_SHARE_LOCATION = null;
|
||||
public static String TYPE_TEXT_REPLY = null;
|
||||
public static String TYPE_TRACK_FLIGHT = null;
|
||||
public static String TYPE_VIEW_CALENDAR = null;
|
||||
public static String TYPE_VIEW_MAP = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.ConversationActions for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.app.Person;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.textclassifier.ConversationAction;
|
||||
import android.view.textclassifier.TextClassifier;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class ConversationActions implements Parcelable
|
||||
{
|
||||
protected ConversationActions() {}
|
||||
public ConversationActions(List<ConversationAction> p0, String p1){}
|
||||
public List<ConversationAction> getConversationActions(){ return null; }
|
||||
public String getId(){ return null; }
|
||||
public int describeContents(){ return 0; }
|
||||
public static Parcelable.Creator<ConversationActions> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
static public class Message implements Parcelable
|
||||
{
|
||||
protected Message() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public CharSequence getText(){ return null; }
|
||||
public Person getAuthor(){ return null; }
|
||||
public ZonedDateTime getReferenceTime(){ return null; }
|
||||
public int describeContents(){ return 0; }
|
||||
public static Parcelable.Creator<ConversationActions.Message> CREATOR = null;
|
||||
public static Person PERSON_USER_OTHERS = null;
|
||||
public static Person PERSON_USER_SELF = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
static public class Request implements Parcelable
|
||||
{
|
||||
protected Request() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public List<ConversationActions.Message> getConversation(){ return null; }
|
||||
public List<String> getHints(){ return null; }
|
||||
public String getCallingPackageName(){ return null; }
|
||||
public TextClassifier.EntityConfig getTypeConfig(){ return null; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int getMaxSuggestions(){ return 0; }
|
||||
public static Parcelable.Creator<ConversationActions.Request> CREATOR = null;
|
||||
public static String HINT_FOR_IN_APP = null;
|
||||
public static String HINT_FOR_NOTIFICATION = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.SelectionEvent for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.textclassifier.TextClassification;
|
||||
import android.view.textclassifier.TextClassificationSessionId;
|
||||
import android.view.textclassifier.TextSelection;
|
||||
|
||||
public class SelectionEvent implements Parcelable
|
||||
{
|
||||
public String getEntityType(){ return null; }
|
||||
public String getPackageName(){ return null; }
|
||||
public String getResultId(){ return null; }
|
||||
public String getWidgetType(){ return null; }
|
||||
public String getWidgetVersion(){ return null; }
|
||||
public String toString(){ return null; }
|
||||
public TextClassificationSessionId getSessionId(){ return null; }
|
||||
public boolean equals(Object p0){ return false; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int getEnd(){ return 0; }
|
||||
public int getEventIndex(){ return 0; }
|
||||
public int getEventType(){ return 0; }
|
||||
public int getInvocationMethod(){ return 0; }
|
||||
public int getSmartEnd(){ return 0; }
|
||||
public int getSmartStart(){ return 0; }
|
||||
public int getStart(){ return 0; }
|
||||
public int hashCode(){ return 0; }
|
||||
public long getDurationSincePreviousEvent(){ return 0; }
|
||||
public long getDurationSinceSessionStart(){ return 0; }
|
||||
public long getEventTime(){ return 0; }
|
||||
public static Parcelable.Creator<SelectionEvent> CREATOR = null;
|
||||
public static SelectionEvent createSelectionActionEvent(int p0, int p1, int p2){ return null; }
|
||||
public static SelectionEvent createSelectionActionEvent(int p0, int p1, int p2, TextClassification p3){ return null; }
|
||||
public static SelectionEvent createSelectionModifiedEvent(int p0, int p1){ return null; }
|
||||
public static SelectionEvent createSelectionModifiedEvent(int p0, int p1, TextClassification p2){ return null; }
|
||||
public static SelectionEvent createSelectionModifiedEvent(int p0, int p1, TextSelection p2){ return null; }
|
||||
public static SelectionEvent createSelectionStartedEvent(int p0, int p1){ return null; }
|
||||
public static boolean isTerminal(int p0){ return false; }
|
||||
public static int ACTION_ABANDON = 0;
|
||||
public static int ACTION_COPY = 0;
|
||||
public static int ACTION_CUT = 0;
|
||||
public static int ACTION_DRAG = 0;
|
||||
public static int ACTION_OTHER = 0;
|
||||
public static int ACTION_OVERTYPE = 0;
|
||||
public static int ACTION_PASTE = 0;
|
||||
public static int ACTION_RESET = 0;
|
||||
public static int ACTION_SELECT_ALL = 0;
|
||||
public static int ACTION_SHARE = 0;
|
||||
public static int ACTION_SMART_SHARE = 0;
|
||||
public static int EVENT_AUTO_SELECTION = 0;
|
||||
public static int EVENT_SELECTION_MODIFIED = 0;
|
||||
public static int EVENT_SELECTION_STARTED = 0;
|
||||
public static int EVENT_SMART_SELECTION_MULTI = 0;
|
||||
public static int EVENT_SMART_SELECTION_SINGLE = 0;
|
||||
public static int INVOCATION_LINK = 0;
|
||||
public static int INVOCATION_MANUAL = 0;
|
||||
public static int INVOCATION_UNKNOWN = 0;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.TextClassification for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.app.RemoteAction;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.LocaleList;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.View;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class TextClassification implements Parcelable
|
||||
{
|
||||
protected TextClassification() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public CharSequence getLabel(){ return null; }
|
||||
public Drawable getIcon(){ return null; }
|
||||
public Intent getIntent(){ return null; }
|
||||
public List<RemoteAction> getActions(){ return null; }
|
||||
public String getEntity(int p0){ return null; }
|
||||
public String getId(){ return null; }
|
||||
public String getText(){ return null; }
|
||||
public String toString(){ return null; }
|
||||
public View.OnClickListener getOnClickListener(){ return null; }
|
||||
public float getConfidenceScore(String p0){ return 0; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int getEntityCount(){ return 0; }
|
||||
public static Parcelable.Creator<TextClassification> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
static public class Request implements Parcelable
|
||||
{
|
||||
protected Request() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public CharSequence getText(){ return null; }
|
||||
public LocaleList getDefaultLocales(){ return null; }
|
||||
public String getCallingPackageName(){ return null; }
|
||||
public ZonedDateTime getReferenceTime(){ return null; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int getEndIndex(){ return 0; }
|
||||
public int getStartIndex(){ return 0; }
|
||||
public static Parcelable.Creator<TextClassification.Request> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.TextClassificationContext for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class TextClassificationContext implements Parcelable
|
||||
{
|
||||
protected TextClassificationContext() {}
|
||||
public String getPackageName(){ return null; }
|
||||
public String getWidgetType(){ return null; }
|
||||
public String getWidgetVersion(){ return null; }
|
||||
public String toString(){ return null; }
|
||||
public int describeContents(){ return 0; }
|
||||
public static Parcelable.Creator<TextClassificationContext> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.TextClassificationSessionId for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class TextClassificationSessionId implements Parcelable
|
||||
{
|
||||
public String getValue(){ return null; }
|
||||
public String toString(){ return null; }
|
||||
public boolean equals(Object p0){ return false; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int hashCode(){ return 0; }
|
||||
public static Parcelable.Creator<TextClassificationSessionId> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.TextClassifier for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.os.LocaleList;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.textclassifier.ConversationActions;
|
||||
import android.view.textclassifier.SelectionEvent;
|
||||
import android.view.textclassifier.TextClassification;
|
||||
import android.view.textclassifier.TextClassifierEvent;
|
||||
import android.view.textclassifier.TextLanguage;
|
||||
import android.view.textclassifier.TextLinks;
|
||||
import android.view.textclassifier.TextSelection;
|
||||
import java.util.Collection;
|
||||
|
||||
public interface TextClassifier
|
||||
{
|
||||
default ConversationActions suggestConversationActions(ConversationActions.Request p0){ return null; }
|
||||
default TextClassification classifyText(CharSequence p0, int p1, int p2, LocaleList p3){ return null; }
|
||||
default TextClassification classifyText(TextClassification.Request p0){ return null; }
|
||||
default TextLanguage detectLanguage(TextLanguage.Request p0){ return null; }
|
||||
default TextLinks generateLinks(TextLinks.Request p0){ return null; }
|
||||
default TextSelection suggestSelection(CharSequence p0, int p1, int p2, LocaleList p3){ return null; }
|
||||
default TextSelection suggestSelection(TextSelection.Request p0){ return null; }
|
||||
default boolean isDestroyed(){ return false; }
|
||||
default int getMaxGenerateLinksTextLength(){ return 0; }
|
||||
default void destroy(){}
|
||||
default void onSelectionEvent(SelectionEvent p0){}
|
||||
default void onTextClassifierEvent(TextClassifierEvent p0){}
|
||||
static String EXTRA_FROM_TEXT_CLASSIFIER = null;
|
||||
static String HINT_TEXT_IS_EDITABLE = null;
|
||||
static String HINT_TEXT_IS_NOT_EDITABLE = null;
|
||||
static String TYPE_ADDRESS = null;
|
||||
static String TYPE_DATE = null;
|
||||
static String TYPE_DATE_TIME = null;
|
||||
static String TYPE_EMAIL = null;
|
||||
static String TYPE_FLIGHT_NUMBER = null;
|
||||
static String TYPE_OTHER = null;
|
||||
static String TYPE_PHONE = null;
|
||||
static String TYPE_UNKNOWN = null;
|
||||
static String TYPE_URL = null;
|
||||
static String WIDGET_TYPE_CLIPBOARD = null;
|
||||
static String WIDGET_TYPE_CUSTOM_EDITTEXT = null;
|
||||
static String WIDGET_TYPE_CUSTOM_TEXTVIEW = null;
|
||||
static String WIDGET_TYPE_CUSTOM_UNSELECTABLE_TEXTVIEW = null;
|
||||
static String WIDGET_TYPE_EDITTEXT = null;
|
||||
static String WIDGET_TYPE_EDIT_WEBVIEW = null;
|
||||
static String WIDGET_TYPE_NOTIFICATION = null;
|
||||
static String WIDGET_TYPE_TEXTVIEW = null;
|
||||
static String WIDGET_TYPE_UNKNOWN = null;
|
||||
static String WIDGET_TYPE_UNSELECTABLE_TEXTVIEW = null;
|
||||
static String WIDGET_TYPE_WEBVIEW = null;
|
||||
static TextClassifier NO_OP = null;
|
||||
static public class EntityConfig implements Parcelable
|
||||
{
|
||||
protected EntityConfig() {}
|
||||
public Collection<String> getHints(){ return null; }
|
||||
public Collection<String> resolveEntityListModifications(Collection<String> p0){ return null; }
|
||||
public boolean shouldIncludeTypesFromTextClassifier(){ return false; }
|
||||
public int describeContents(){ return 0; }
|
||||
public static Parcelable.Creator<TextClassifier.EntityConfig> CREATOR = null;
|
||||
public static TextClassifier.EntityConfig create(Collection<String> p0, Collection<String> p1, Collection<String> p2){ return null; }
|
||||
public static TextClassifier.EntityConfig createWithExplicitEntityList(Collection<String> p0){ return null; }
|
||||
public static TextClassifier.EntityConfig createWithHints(Collection<String> p0){ return null; }
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.TextClassifierEvent for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.icu.util.ULocale;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.textclassifier.TextClassificationContext;
|
||||
|
||||
abstract public class TextClassifierEvent implements Parcelable
|
||||
{
|
||||
protected TextClassifierEvent() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public String getModelName(){ return null; }
|
||||
public String getResultId(){ return null; }
|
||||
public String toString(){ return null; }
|
||||
public String[] getEntityTypes(){ return null; }
|
||||
public TextClassificationContext getEventContext(){ return null; }
|
||||
public ULocale getLocale(){ return null; }
|
||||
public float[] getScores(){ return null; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int getEventCategory(){ return 0; }
|
||||
public int getEventIndex(){ return 0; }
|
||||
public int getEventType(){ return 0; }
|
||||
public int[] getActionIndices(){ return null; }
|
||||
public static Parcelable.Creator<TextClassifierEvent> CREATOR = null;
|
||||
public static int CATEGORY_CONVERSATION_ACTIONS = 0;
|
||||
public static int CATEGORY_LANGUAGE_DETECTION = 0;
|
||||
public static int CATEGORY_LINKIFY = 0;
|
||||
public static int CATEGORY_SELECTION = 0;
|
||||
public static int TYPE_ACTIONS_GENERATED = 0;
|
||||
public static int TYPE_ACTIONS_SHOWN = 0;
|
||||
public static int TYPE_AUTO_SELECTION = 0;
|
||||
public static int TYPE_COPY_ACTION = 0;
|
||||
public static int TYPE_CUT_ACTION = 0;
|
||||
public static int TYPE_LINKS_GENERATED = 0;
|
||||
public static int TYPE_LINK_CLICKED = 0;
|
||||
public static int TYPE_MANUAL_REPLY = 0;
|
||||
public static int TYPE_OTHER_ACTION = 0;
|
||||
public static int TYPE_OVERTYPE = 0;
|
||||
public static int TYPE_PASTE_ACTION = 0;
|
||||
public static int TYPE_SELECTION_DESTROYED = 0;
|
||||
public static int TYPE_SELECTION_DRAG = 0;
|
||||
public static int TYPE_SELECTION_MODIFIED = 0;
|
||||
public static int TYPE_SELECTION_RESET = 0;
|
||||
public static int TYPE_SELECTION_STARTED = 0;
|
||||
public static int TYPE_SELECT_ALL = 0;
|
||||
public static int TYPE_SHARE_ACTION = 0;
|
||||
public static int TYPE_SMART_ACTION = 0;
|
||||
public static int TYPE_SMART_SELECTION_MULTI = 0;
|
||||
public static int TYPE_SMART_SELECTION_SINGLE = 0;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.TextLanguage for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.icu.util.ULocale;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class TextLanguage implements Parcelable
|
||||
{
|
||||
protected TextLanguage() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public String getId(){ return null; }
|
||||
public String toString(){ return null; }
|
||||
public ULocale getLocale(int p0){ return null; }
|
||||
public float getConfidenceScore(ULocale p0){ return 0; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int getLocaleHypothesisCount(){ return 0; }
|
||||
public static Parcelable.Creator<TextLanguage> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
static public class Request implements Parcelable
|
||||
{
|
||||
protected Request() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public CharSequence getText(){ return null; }
|
||||
public String getCallingPackageName(){ return null; }
|
||||
public int describeContents(){ return 0; }
|
||||
public static Parcelable.Creator<TextLanguage.Request> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// Generated automatically from android.view.textclassifier.TextSelection for testing purposes
|
||||
|
||||
package android.view.textclassifier;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.LocaleList;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.textclassifier.TextClassification;
|
||||
|
||||
public class TextSelection implements Parcelable
|
||||
{
|
||||
protected TextSelection() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public String getEntity(int p0){ return null; }
|
||||
public String getId(){ return null; }
|
||||
public String toString(){ return null; }
|
||||
public TextClassification getTextClassification(){ return null; }
|
||||
public float getConfidenceScore(String p0){ return 0; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int getEntityCount(){ return 0; }
|
||||
public int getSelectionEndIndex(){ return 0; }
|
||||
public int getSelectionStartIndex(){ return 0; }
|
||||
public static Parcelable.Creator<TextSelection> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
static public class Request implements Parcelable
|
||||
{
|
||||
protected Request() {}
|
||||
public Bundle getExtras(){ return null; }
|
||||
public CharSequence getText(){ return null; }
|
||||
public LocaleList getDefaultLocales(){ return null; }
|
||||
public String getCallingPackageName(){ return null; }
|
||||
public boolean shouldIncludeTextClassification(){ return false; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int getEndIndex(){ return 0; }
|
||||
public int getStartIndex(){ return 0; }
|
||||
public static Parcelable.Creator<TextSelection.Request> CREATOR = null;
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user