Merge "[Autofill PCC]: Service interface definition"
This commit is contained in:
committed by
Android (Google) Code Review
commit
0ab6512156
@@ -39329,6 +39329,19 @@ package android.security.keystore {
|
||||
|
||||
}
|
||||
|
||||
package android.service.assist.classification {
|
||||
|
||||
public final class FieldClassification implements android.os.Parcelable {
|
||||
ctor public FieldClassification(@NonNull android.view.autofill.AutofillId, @NonNull java.util.Set<java.lang.String>);
|
||||
method public int describeContents();
|
||||
method @NonNull public android.view.autofill.AutofillId getAutofillId();
|
||||
method @NonNull public java.util.Set<java.lang.String> getHints();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.service.assist.classification.FieldClassification> CREATOR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.service.autofill {
|
||||
|
||||
public abstract class AutofillService extends android.app.Service {
|
||||
|
||||
@@ -55,6 +55,7 @@ package android {
|
||||
field public static final String BIND_DOMAIN_VERIFICATION_AGENT = "android.permission.BIND_DOMAIN_VERIFICATION_AGENT";
|
||||
field public static final String BIND_EUICC_SERVICE = "android.permission.BIND_EUICC_SERVICE";
|
||||
field public static final String BIND_EXTERNAL_STORAGE_SERVICE = "android.permission.BIND_EXTERNAL_STORAGE_SERVICE";
|
||||
field public static final String BIND_FIELD_CLASSIFICATION_SERVICE = "android.permission.BIND_FIELD_CLASSIFICATION_SERVICE";
|
||||
field public static final String BIND_GBA_SERVICE = "android.permission.BIND_GBA_SERVICE";
|
||||
field public static final String BIND_HOTWORD_DETECTION_SERVICE = "android.permission.BIND_HOTWORD_DETECTION_SERVICE";
|
||||
field public static final String BIND_IMS_SERVICE = "android.permission.BIND_IMS_SERVICE";
|
||||
@@ -11548,6 +11549,39 @@ package android.service.appprediction {
|
||||
|
||||
}
|
||||
|
||||
package android.service.assist.classification {
|
||||
|
||||
public final class FieldClassification implements android.os.Parcelable {
|
||||
ctor public FieldClassification(@NonNull android.view.autofill.AutofillId, @NonNull java.util.Set<java.lang.String>, @NonNull java.util.Set<java.lang.String>);
|
||||
method @NonNull public java.util.Set<java.lang.String> getGroupHints();
|
||||
}
|
||||
|
||||
public final class FieldClassificationRequest implements android.os.Parcelable {
|
||||
ctor public FieldClassificationRequest(@NonNull android.app.assist.AssistStructure);
|
||||
method public int describeContents();
|
||||
method @NonNull public android.app.assist.AssistStructure getAssistStructure();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.service.assist.classification.FieldClassificationRequest> CREATOR;
|
||||
}
|
||||
|
||||
public final class FieldClassificationResponse implements android.os.Parcelable {
|
||||
ctor public FieldClassificationResponse(@NonNull java.util.Set<android.service.assist.classification.FieldClassification>);
|
||||
method public int describeContents();
|
||||
method @NonNull public java.util.Set<android.service.assist.classification.FieldClassification> getClassifications();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.service.assist.classification.FieldClassificationResponse> CREATOR;
|
||||
}
|
||||
|
||||
public abstract class FieldClassificationService extends android.app.Service {
|
||||
ctor public FieldClassificationService();
|
||||
method public abstract void onClassificationRequest(@NonNull android.service.assist.classification.FieldClassificationRequest, @NonNull android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver<android.service.assist.classification.FieldClassificationResponse,java.lang.Exception>);
|
||||
method public void onConnected();
|
||||
method public void onDisconnected();
|
||||
field public static final String SERVICE_INTERFACE = "android.service.assist.classification.FieldClassificationService";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.service.attention {
|
||||
|
||||
public abstract class AttentionService extends android.app.Service {
|
||||
|
||||
3
core/java/android/service/assist/OWNERS
Normal file
3
core/java/android/service/assist/OWNERS
Normal file
@@ -0,0 +1,3 @@
|
||||
# Bug component: 351486
|
||||
|
||||
include /core/java/android/view/autofill/OWNERS
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
parcelable FieldClassification;
|
||||
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.ArraySet;
|
||||
import android.view.autofill.AutofillId;
|
||||
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Represents a classified field from the detection service.
|
||||
*/
|
||||
// TODO(b/266930067): Once @SystemApi is supported, use genSetters and genConstructor.
|
||||
@DataClass(
|
||||
genToString = true,
|
||||
genConstructor = false
|
||||
)
|
||||
public final class FieldClassification implements Parcelable {
|
||||
|
||||
/**
|
||||
* Autofill id of the detected field
|
||||
*/
|
||||
private final @NonNull AutofillId mAutofillId;
|
||||
|
||||
/**
|
||||
* Detected fields types represented as autofill hints
|
||||
*
|
||||
* A particular field can be detected as multiple types. For eg: A sign-in field may take in a
|
||||
* username, an email address or a phone number. In such cases, it should be detected as
|
||||
* "username", "emailAddress" and "phoneNumber"
|
||||
*
|
||||
* The value of these hints are contained in androidx.autofill.HintConstants
|
||||
*/
|
||||
private final @NonNull Set<String> mHints;
|
||||
|
||||
|
||||
/**
|
||||
* Group hints are the hints that may represent the group of related hints (including
|
||||
* themselves). The value of these group hints are contained in androidx.autofill.HintConstants
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "creditCardNumber" is the group hint for hints containing credit card related fields:
|
||||
* "creditCardNumber", "creditCardExpirationDate", "creditCardExpirationDay",
|
||||
* "creditCardExpirationMonth", "creditCardExpirationYear", "creditCardSecurityCode",
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "postalAddress" is the group hint for hints all postal address related fields:
|
||||
* "postalAddress", "streetAddress", "aptNumber", "dependentLocality", "extendedAddress",
|
||||
* "postalCode", "extendedPostalCode", "addressLocality", "addressRegion", "addressCountry".
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "phoneNumber" is the group hint for hints all phone number related fields: "phoneNumber",
|
||||
* "phoneNumberDevice", "phoneNational", "phoneCountryCode".
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "personName" is the group hint for hints all name related fields: "personName",
|
||||
* "personFamilyName", "personGivenName", "personMiddleName", "personMiddleInitial",
|
||||
* "personNamePrefix", "personNameSuffix" .
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "birthDateFull" is the group hint for hints containing birthday related fields:
|
||||
* "birthDateFull", "birthDateMonth", "birthDateYear",
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
private final @NonNull Set<String> mGroupHints;
|
||||
|
||||
/**
|
||||
* Autofill id of the detected field.
|
||||
*/
|
||||
public @NonNull AutofillId getAutofillId() {
|
||||
return mAutofillId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detected fields types represented as autofill hints.
|
||||
*
|
||||
* A particular field can be detected as multiple types. For eg: A sign-in field may take in a
|
||||
* username, an email address or a phone number. In such cases, it should be detected as
|
||||
* "username", "emailAddress" and "phoneNumber"
|
||||
*
|
||||
* The value of these hints are contained in androidx.autofill.HintConstants
|
||||
*/
|
||||
public @NonNull Set<String> getHints() {
|
||||
return mHints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Group hints are the hints that may represent the group of related hints (including
|
||||
* themselves). The value of these group hints are contained in androidx.autofill.HintConstants
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "creditCardNumber" is the group hint for hints containing credit card related fields:
|
||||
* "creditCardNumber", "creditCardExpirationDate", "creditCardExpirationDay",
|
||||
* "creditCardExpirationMonth", "creditCardExpirationYear", "creditCardSecurityCode",
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "postalAddress" is the group hint for hints all postal address related fields:
|
||||
* "postalAddress", "streetAddress", "aptNumber", "dependentLocality", "extendedAddress",
|
||||
* "postalCode", "extendedPostalCode", "addressLocality", "addressRegion", "addressCountry".
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "phoneNumber" is the group hint for hints all phone number related fields: "phoneNumber",
|
||||
* "phoneNumberDevice", "phoneNational", "phoneCountryCode".
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "personName" is the group hint for hints all name related fields: "personName",
|
||||
* "personFamilyName", "personGivenName", "personMiddleName", "personMiddleInitial",
|
||||
* "personNamePrefix", "personNameSuffix" .
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* "birthDateFull" is the group hint for hints containing birthday related fields:
|
||||
* "birthDateFull", "birthDateMonth", "birthDateYear",
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public @NonNull Set<String> getGroupHints() {
|
||||
return mGroupHints;
|
||||
}
|
||||
|
||||
static Set<String> unparcelHints(Parcel in) {
|
||||
List<String> hints = new java.util.ArrayList<>();
|
||||
in.readStringList(hints);
|
||||
return new ArraySet<>(hints);
|
||||
}
|
||||
|
||||
void parcelHints(Parcel dest, int flags) {
|
||||
dest.writeStringList(new ArrayList<>(mHints));
|
||||
}
|
||||
|
||||
static Set<String> unparcelGroupHints(Parcel in) {
|
||||
List<String> groupHints = new java.util.ArrayList<>();
|
||||
in.readStringList(groupHints);
|
||||
return new ArraySet<>(groupHints);
|
||||
}
|
||||
|
||||
void parcelGroupHints(Parcel dest, int flags) {
|
||||
dest.writeStringList(new ArrayList<>(mGroupHints));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new FieldClassification.
|
||||
*
|
||||
* @param autofillId
|
||||
* Autofill id of the detected field
|
||||
* @param hints
|
||||
* Detected fields types represented as autofill hints.
|
||||
* A particular field can be detected as multiple types. For eg: A sign-in field may take in
|
||||
* a username, an email address or a phone number. In such cases, it should be detected as
|
||||
* "username", "emailAddress" and "phoneNumber"
|
||||
*/
|
||||
public FieldClassification(
|
||||
@NonNull AutofillId autofillId,
|
||||
@NonNull Set<String> hints) {
|
||||
this(autofillId, hints, new ArraySet<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new FieldClassification.
|
||||
*
|
||||
* @param autofillId Autofill id of the detected field
|
||||
* @param hints Detected fields types represented as autofill hints A particular field can be
|
||||
* detected as multiple types. For eg: A sign-in field may take in a username, an email
|
||||
* address or a phone number. In such cases, it should be detected as "username",
|
||||
* "emailAddress" and "phoneNumber"
|
||||
* @param groupHints Hints that may represent the group of related hints (including themselves).
|
||||
* The value of these group hints are contained in androidx.autofill.HintConstants.
|
||||
* See {@link #getGroupHints()} for more details
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@DataClass.Generated.Member
|
||||
public FieldClassification(
|
||||
@NonNull AutofillId autofillId,
|
||||
@NonNull Set<String> hints,
|
||||
@NonNull Set<String> groupHints) {
|
||||
this.mAutofillId = autofillId;
|
||||
// com.android.internal.util.AnnotationValidations.validate(
|
||||
// NonNull.class, null, mAutofillId);
|
||||
this.mHints = hints;
|
||||
// com.android.internal.util.AnnotationValidations.validate(
|
||||
// NonNull.class, null, mHints);
|
||||
this.mGroupHints = groupHints;
|
||||
// com.android.internal.util.AnnotationValidations.validate(
|
||||
// NonNull.class, null, mGroupHints);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Code below generated by codegen v1.0.23.
|
||||
//
|
||||
// DO NOT MODIFY!
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
//
|
||||
// To regenerate run:
|
||||
// $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/assist/classification/FieldClassification.java
|
||||
//
|
||||
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
|
||||
// Settings > Editor > Code Style > Formatter Control
|
||||
//@formatter:off
|
||||
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public String toString() {
|
||||
// You can override field toString logic by defining methods like:
|
||||
// String fieldNameToString() { ... }
|
||||
|
||||
return "FieldClassification { " +
|
||||
"autofillId = " + mAutofillId + ", " +
|
||||
"hints = " + mHints + ", " +
|
||||
"groupHints = " + mGroupHints +
|
||||
" }";
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
// You can override field parcelling by defining methods like:
|
||||
// void parcelFieldName(Parcel dest, int flags) { ... }
|
||||
|
||||
dest.writeTypedObject(mAutofillId, flags);
|
||||
parcelHints(dest, flags);
|
||||
parcelGroupHints(dest, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public int describeContents() { return 0; }
|
||||
|
||||
/** @hide */
|
||||
@SuppressWarnings({"unchecked", "RedundantCast"})
|
||||
@DataClass.Generated.Member
|
||||
/* package-private */ FieldClassification(@NonNull Parcel in) {
|
||||
// You can override field unparcelling by defining methods like:
|
||||
// static FieldType unparcelFieldName(Parcel in) { ... }
|
||||
|
||||
AutofillId autofillId = (AutofillId) in.readTypedObject(AutofillId.CREATOR);
|
||||
Set<String> hints = unparcelHints(in);
|
||||
Set<String> groupHints = unparcelGroupHints(in);
|
||||
|
||||
this.mAutofillId = autofillId;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mAutofillId);
|
||||
this.mHints = hints;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mHints);
|
||||
this.mGroupHints = groupHints;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mGroupHints);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public static final @NonNull Parcelable.Creator<FieldClassification> CREATOR
|
||||
= new Parcelable.Creator<FieldClassification>() {
|
||||
@Override
|
||||
public FieldClassification[] newArray(int size) {
|
||||
return new FieldClassification[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldClassification createFromParcel(@NonNull Parcel in) {
|
||||
return new FieldClassification(in);
|
||||
}
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1675320464097L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/service/assist/classification/FieldClassification.java",
|
||||
inputSignatures = "private final @android.annotation.NonNull android.view.autofill.AutofillId mAutofillId\nprivate final @android.annotation.NonNull java.util.Set<java.lang.String> mHints\nprivate final @android.annotation.NonNull java.util.Set<java.lang.String> mGroupHints\npublic @android.annotation.NonNull android.view.autofill.AutofillId getAutofillId()\npublic @android.annotation.NonNull java.util.Set<java.lang.String> getHints()\npublic @android.annotation.SystemApi @android.annotation.NonNull java.util.Set<java.lang.String> getGroupHints()\nstatic java.util.Set<java.lang.String> unparcelHints(android.os.Parcel)\n void parcelHints(android.os.Parcel,int)\nstatic java.util.Set<java.lang.String> unparcelGroupHints(android.os.Parcel)\n void parcelGroupHints(android.os.Parcel,int)\nclass FieldClassification extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genConstructor=false)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
//@formatter:on
|
||||
// End of generated code
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) 2023, The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
parcelable FieldClassificationRequest;
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.SystemApi;
|
||||
import android.app.assist.AssistStructure;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
|
||||
/**
|
||||
* Represents a request to detect fields on an activity.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@DataClass(
|
||||
genToString = true
|
||||
)
|
||||
public final class FieldClassificationRequest implements Parcelable {
|
||||
private final @NonNull AssistStructure mAssistStructure;
|
||||
|
||||
|
||||
|
||||
// Code below generated by codegen v1.0.23.
|
||||
//
|
||||
// DO NOT MODIFY!
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
//
|
||||
// To regenerate run:
|
||||
// $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/assist/classification/FieldClassificationRequest.java
|
||||
//
|
||||
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
|
||||
// Settings > Editor > Code Style > Formatter Control
|
||||
//@formatter:off
|
||||
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public FieldClassificationRequest(
|
||||
@NonNull AssistStructure assistStructure) {
|
||||
this.mAssistStructure = assistStructure;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mAssistStructure);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull AssistStructure getAssistStructure() {
|
||||
return mAssistStructure;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public String toString() {
|
||||
// You can override field toString logic by defining methods like:
|
||||
// String fieldNameToString() { ... }
|
||||
|
||||
return "FieldClassificationRequest { " +
|
||||
"assistStructure = " + mAssistStructure +
|
||||
" }";
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
// You can override field parcelling by defining methods like:
|
||||
// void parcelFieldName(Parcel dest, int flags) { ... }
|
||||
|
||||
dest.writeTypedObject(mAssistStructure, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public int describeContents() { return 0; }
|
||||
|
||||
/** @hide */
|
||||
@SuppressWarnings({"unchecked", "RedundantCast"})
|
||||
@DataClass.Generated.Member
|
||||
/* package-private */ FieldClassificationRequest(@NonNull Parcel in) {
|
||||
// You can override field unparcelling by defining methods like:
|
||||
// static FieldType unparcelFieldName(Parcel in) { ... }
|
||||
|
||||
AssistStructure assistStructure = (AssistStructure) in.readTypedObject(AssistStructure.CREATOR);
|
||||
|
||||
this.mAssistStructure = assistStructure;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mAssistStructure);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public static final @NonNull Parcelable.Creator<FieldClassificationRequest> CREATOR
|
||||
= new Parcelable.Creator<FieldClassificationRequest>() {
|
||||
@Override
|
||||
public FieldClassificationRequest[] newArray(int size) {
|
||||
return new FieldClassificationRequest[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldClassificationRequest createFromParcel(@NonNull Parcel in) {
|
||||
return new FieldClassificationRequest(in);
|
||||
}
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1675320491692L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/service/assist/classification/FieldClassificationRequest.java",
|
||||
inputSignatures = "private final @android.annotation.NonNull android.app.assist.AssistStructure mAssistStructure\nclass FieldClassificationRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
//@formatter:on
|
||||
// End of generated code
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
parcelable FieldClassificationResponse;
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import com.android.internal.util.DataClass;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a response from detection service.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@DataClass(
|
||||
genToString = true
|
||||
)
|
||||
public final class FieldClassificationResponse implements Parcelable {
|
||||
|
||||
/**
|
||||
* List of classified fields
|
||||
*/
|
||||
private final @NonNull Set<FieldClassification> mClassifications;
|
||||
|
||||
static Set<FieldClassification> unparcelClassifications(Parcel in) {
|
||||
List<FieldClassification> detections = new java.util.ArrayList<>();
|
||||
in.readParcelableList(
|
||||
detections, FieldClassification.class.getClassLoader(), FieldClassification.class);
|
||||
return new ArraySet<>(detections);
|
||||
}
|
||||
|
||||
void parcelClassifications(Parcel dest, int flags) {
|
||||
dest.writeParcelableList(new ArrayList<>(mClassifications), flags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Code below generated by codegen v1.0.23.
|
||||
//
|
||||
// DO NOT MODIFY!
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
//
|
||||
// To regenerate run:
|
||||
// $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/assist/classification/FieldClassificationResponse.java
|
||||
//
|
||||
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
|
||||
// Settings > Editor > Code Style > Formatter Control
|
||||
//@formatter:off
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new FieldClassificationResponse.
|
||||
*
|
||||
* @param classifications
|
||||
* List of classified fields
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public FieldClassificationResponse(
|
||||
@NonNull Set<FieldClassification> classifications) {
|
||||
this.mClassifications = classifications;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mClassifications);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
/**
|
||||
* List of classified fields
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public @NonNull Set<FieldClassification> getClassifications() {
|
||||
return mClassifications;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public String toString() {
|
||||
// You can override field toString logic by defining methods like:
|
||||
// String fieldNameToString() { ... }
|
||||
|
||||
return "FieldClassificationResponse { " +
|
||||
"classifications = " + mClassifications +
|
||||
" }";
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
// You can override field parcelling by defining methods like:
|
||||
// void parcelFieldName(Parcel dest, int flags) { ... }
|
||||
|
||||
parcelClassifications(dest, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataClass.Generated.Member
|
||||
public int describeContents() { return 0; }
|
||||
|
||||
/** @hide */
|
||||
@SuppressWarnings({"unchecked", "RedundantCast"})
|
||||
@DataClass.Generated.Member
|
||||
/* package-private */ FieldClassificationResponse(@NonNull Parcel in) {
|
||||
// You can override field unparcelling by defining methods like:
|
||||
// static FieldType unparcelFieldName(Parcel in) { ... }
|
||||
|
||||
Set<FieldClassification> classifications = unparcelClassifications(in);
|
||||
|
||||
this.mClassifications = classifications;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mClassifications);
|
||||
|
||||
// onConstructed(); // You can define this method to get a callback
|
||||
}
|
||||
|
||||
@DataClass.Generated.Member
|
||||
public static final @NonNull Parcelable.Creator<FieldClassificationResponse> CREATOR
|
||||
= new Parcelable.Creator<FieldClassificationResponse>() {
|
||||
@Override
|
||||
public FieldClassificationResponse[] newArray(int size) {
|
||||
return new FieldClassificationResponse[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldClassificationResponse createFromParcel(@NonNull Parcel in) {
|
||||
return new FieldClassificationResponse(in);
|
||||
}
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1675320458276L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/service/assist/classification/FieldClassificationResponse.java",
|
||||
inputSignatures = "private final @android.annotation.NonNull java.util.Set<android.service.assist.classification.FieldClassification> mClassifications\nstatic java.util.Set<android.service.assist.classification.FieldClassification> unparcelClassifications(android.os.Parcel)\n void parcelClassifications(android.os.Parcel,int)\nclass FieldClassificationResponse extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
//@formatter:on
|
||||
// End of generated code
|
||||
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
import android.annotation.CallSuper;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.SdkConstant;
|
||||
import android.annotation.SystemApi;
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.BaseBundle;
|
||||
import android.os.Build;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.IBinder;
|
||||
import android.os.ICancellationSignal;
|
||||
import android.os.OutcomeReceiver;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* A service using {@link android.app.assist.AssistStructure} to detect fields on the screen.
|
||||
* Service may use classifiers to look at the un-stripped AssistStructure to make informed decision
|
||||
* and classify the fields.
|
||||
*
|
||||
* Currently, it's used to detect the field types for the Autofill Framework to provide relevant
|
||||
* autofill suggestions to the user.
|
||||
*
|
||||
*
|
||||
* The methods are invoked on the binder threads.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public abstract class FieldClassificationService extends Service {
|
||||
|
||||
private static final String TAG = FieldClassificationService.class.getSimpleName();
|
||||
|
||||
static boolean sDebug = Build.IS_USER ? false : true;
|
||||
static boolean sVerbose = false;
|
||||
|
||||
/**
|
||||
* The {@link Intent} that must be declared as handled by the service.
|
||||
* To be supported, the service must also require the
|
||||
* {@link android.Manifest.permission#BIND_FIELD_CLASSIFICATION_SERVICE} permission so
|
||||
* that other applications can not abuse it.
|
||||
*/
|
||||
@SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
|
||||
public static final String SERVICE_INTERFACE =
|
||||
"android.service.assist.classification.FieldClassificationService";
|
||||
|
||||
// Used for metrics / debug only
|
||||
private ComponentName mServiceComponentName;
|
||||
|
||||
private final class FieldClassificationServiceImpl
|
||||
extends IFieldClassificationService.Stub {
|
||||
|
||||
@Override
|
||||
public void onConnected(boolean debug, boolean verbose) {
|
||||
handleOnConnected(debug, verbose);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
handleOnDisconnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFieldClassificationRequest(
|
||||
FieldClassificationRequest request, IFieldClassificationCallback callback) {
|
||||
handleOnClassificationRequest(request, callback);
|
||||
}
|
||||
};
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
BaseBundle.setShouldDefuse(true);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public final IBinder onBind(Intent intent) {
|
||||
if (SERVICE_INTERFACE.equals(intent.getAction())) {
|
||||
mServiceComponentName = intent.getComponent();
|
||||
return new FieldClassificationServiceImpl().asBinder();
|
||||
}
|
||||
Log.w(TAG, "Tried to bind to wrong intent (should be " + SERVICE_INTERFACE + ": " + intent);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the Android system connects to service.
|
||||
*
|
||||
* <p>You should generally do initialization here rather than in {@link #onCreate}.
|
||||
*/
|
||||
public void onConnected() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests the service to handle field classification request.
|
||||
* @param cancellationSignal signal for observing cancellation requests. The system will use
|
||||
* this to notify you that the detection result is no longer needed and the service should
|
||||
* stop handling this detection request in order to save resources.
|
||||
* @param outcomeReceiver object used to notify the result of the request. Service <b>must</b>
|
||||
* call {@link OutcomeReceiver<>#onResult(FieldClassificationResponse)}.
|
||||
*/
|
||||
public abstract void onClassificationRequest(
|
||||
@NonNull FieldClassificationRequest request,
|
||||
@NonNull CancellationSignal cancellationSignal,
|
||||
@NonNull OutcomeReceiver<FieldClassificationResponse, Exception> outcomeReceiver);
|
||||
|
||||
/**
|
||||
* Called when the Android system disconnects from the service.
|
||||
*
|
||||
* <p> At this point this service may no longer be an active
|
||||
* {@link FieldClassificationService}.
|
||||
*/
|
||||
public void onDisconnected() {
|
||||
}
|
||||
|
||||
private void handleOnConnected(boolean debug, boolean verbose) {
|
||||
if (sDebug || debug) {
|
||||
Log.d(TAG, "handleOnConnected(): debug=" + debug + ", verbose=" + verbose);
|
||||
}
|
||||
sDebug = debug;
|
||||
sVerbose = verbose;
|
||||
onConnected();
|
||||
}
|
||||
|
||||
private void handleOnDisconnected() {
|
||||
onDisconnected();
|
||||
}
|
||||
|
||||
private void handleOnClassificationRequest(
|
||||
FieldClassificationRequest request, @NonNull IFieldClassificationCallback callback) {
|
||||
|
||||
final ICancellationSignal transport = CancellationSignal.createTransport();
|
||||
final CancellationSignal cancellationSignal = CancellationSignal.fromTransport(transport);
|
||||
onClassificationRequest(
|
||||
request,
|
||||
cancellationSignal,
|
||||
new OutcomeReceiver<FieldClassificationResponse, Exception>() {
|
||||
@Override
|
||||
public void onResult(FieldClassificationResponse result) {
|
||||
try {
|
||||
callback.onSuccess(result);
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
try {
|
||||
callback.onFailure();
|
||||
} catch (RemoteException ex) {
|
||||
ex.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.ICancellationSignal;
|
||||
|
||||
import android.service.assist.classification.FieldClassificationResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface to receive the result of an autofill request.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
interface IFieldClassificationCallback {
|
||||
|
||||
void onCancellable(in ICancellationSignal cancellation);
|
||||
|
||||
void onSuccess(in FieldClassificationResponse response);
|
||||
|
||||
void onFailure();
|
||||
|
||||
boolean isCompleted();
|
||||
|
||||
void cancel();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.service.assist.classification;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.os.IBinder;
|
||||
import android.service.assist.classification.IFieldClassificationCallback;
|
||||
import android.service.assist.classification.FieldClassificationRequest;
|
||||
import android.view.autofill.AutofillId;
|
||||
import android.view.autofill.AutofillValue;
|
||||
import android.view.inputmethod.InlineSuggestionsRequest;
|
||||
import java.util.List;
|
||||
/**
|
||||
* Interface from the system to an Autofill classification service.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
oneway interface IFieldClassificationService {
|
||||
void onConnected(boolean debug, boolean verbose);
|
||||
void onDisconnected();
|
||||
void onFieldClassificationRequest(
|
||||
in FieldClassificationRequest request, in IFieldClassificationCallback callback);
|
||||
}
|
||||
@@ -4542,6 +4542,15 @@
|
||||
<permission android:name="android.permission.BIND_AUTOFILL_SERVICE"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<!-- Must be required by a
|
||||
{@link android.service.assist.classification.FieldClassificationService},
|
||||
to ensure that only the system can bind to it.
|
||||
@SystemApi @hide This is not a third-party API (intended for OEMs and system apps).
|
||||
<p>Protection level: signature
|
||||
-->
|
||||
<permission android:name="android.permission.BIND_FIELD_CLASSIFICATION_SERVICE"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<!-- Must be required by a CredentialProviderService to ensure that only the
|
||||
system can bind to it.
|
||||
<p>Protection level: signature
|
||||
|
||||
@@ -4173,12 +4173,19 @@
|
||||
<bool name="config_quickSettingsSupported">true</bool>
|
||||
|
||||
<!-- The component name, flattened to a string, for the default autofill service
|
||||
to enabled for an user. This service must be trusted, as it can be activated
|
||||
to enabled for a user. This service must be trusted, as it can be activated
|
||||
without explicit consent of the user. If no autofill service with the
|
||||
specified name exists on the device, autofill will be disabled by default.
|
||||
-->
|
||||
<string name="config_defaultAutofillService" translatable="false"></string>
|
||||
|
||||
<!-- The component name, flattened to a string, for the default field classification service
|
||||
to enabled for a user. This service must be trusted, as it can be activated
|
||||
without explicit consent of the user. If no field classification service with the
|
||||
specified name exists on the device, field classification will be disabled by default.
|
||||
-->
|
||||
<string name="config_defaultFieldClassificationService" translatable="false"></string>
|
||||
|
||||
<!-- The package name for the OEM custom system textclassifier service.
|
||||
This service must be trusted, as it can be activated without explicit consent of the user.
|
||||
Example: "com.android.textclassifier"
|
||||
|
||||
@@ -3719,6 +3719,7 @@
|
||||
<java-symbol type="string" name="notification_channel_accessibility_magnification" />
|
||||
<java-symbol type="string" name="notification_channel_accessibility_security_policy" />
|
||||
<java-symbol type="string" name="config_defaultAutofillService" />
|
||||
<java-symbol type="string" name="config_defaultFieldClassificationService" />
|
||||
<java-symbol type="string" name="config_defaultOnDeviceSpeechRecognitionService" />
|
||||
<java-symbol type="string" name="config_defaultTextClassifierPackage" />
|
||||
<java-symbol type="string" name="config_defaultWellbeingPackage" />
|
||||
|
||||
Reference in New Issue
Block a user