Loading api/system-current.txt +26 −0 Original line number Diff line number Diff line Loading @@ -10059,6 +10059,32 @@ package android.service.attention { } package android.service.attestation { public abstract class ImpressionAttestationService extends android.app.Service { ctor public ImpressionAttestationService(); method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent); method @Nullable public abstract android.service.attestation.ImpressionToken onGenerateImpressionToken(@NonNull android.hardware.HardwareBuffer, @NonNull android.graphics.Rect, @NonNull String); method public abstract int onVerifyImpressionToken(@NonNull android.service.attestation.ImpressionToken); field public static final int VERIFICATION_STATUS_APP_DECLARED = 2; // 0x2 field public static final int VERIFICATION_STATUS_OS_VERIFIED = 1; // 0x1 field public static final int VERIFICATION_STATUS_UNKNOWN = 0; // 0x0 } public final class ImpressionToken implements android.os.Parcelable { ctor public ImpressionToken(long, @NonNull android.graphics.Rect, @NonNull String, @NonNull byte[], @NonNull byte[]); method public int describeContents(); method @NonNull public android.graphics.Rect getBoundsInWindow(); method @NonNull public String getHashingAlgorithm(); method @NonNull public byte[] getHmac(); method @NonNull public byte[] getImageHash(); method public long getScreenshotTimeMillis(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.service.attestation.ImpressionToken> CREATOR; } } package android.service.autofill { public abstract class AutofillFieldClassificationService extends android.app.Service { core/api/system-current.txt +26 −0 Original line number Diff line number Diff line Loading @@ -8900,6 +8900,32 @@ package android.service.attention { } package android.service.attestation { public abstract class ImpressionAttestationService extends android.app.Service { ctor public ImpressionAttestationService(); method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent); method @Nullable public abstract android.service.attestation.ImpressionToken onGenerateImpressionToken(@NonNull android.hardware.HardwareBuffer, @NonNull android.graphics.Rect, @NonNull String); method public abstract int onVerifyImpressionToken(@NonNull android.service.attestation.ImpressionToken); field public static final int VERIFICATION_STATUS_APP_DECLARED = 2; // 0x2 field public static final int VERIFICATION_STATUS_OS_VERIFIED = 1; // 0x1 field public static final int VERIFICATION_STATUS_UNKNOWN = 0; // 0x0 } public final class ImpressionToken implements android.os.Parcelable { ctor public ImpressionToken(long, @NonNull android.graphics.Rect, @NonNull String, @NonNull byte[], @NonNull byte[]); method public int describeContents(); method @NonNull public android.graphics.Rect getBoundsInWindow(); method @NonNull public String getHashingAlgorithm(); method @NonNull public byte[] getHmac(); method @NonNull public byte[] getImageHash(); method public long getScreenshotTimeMillis(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.service.attestation.ImpressionToken> CREATOR; } } package android.service.autofill { public abstract class AutofillFieldClassificationService extends android.app.Service { core/java/android/service/attestation/IImpressionAttestationService.aidl 0 → 100644 +52 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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.attestation; import android.graphics.Rect; import android.hardware.HardwareBuffer; import android.service.attestation.ImpressionToken; import android.os.RemoteCallback; /** * Service used to handle impression attestation requests. * * @hide */ oneway interface IImpressionAttestationService { /** * Generates the impression token that can be used to validate that the system generated the * token. * * @param screenshot The token for the window where the view is shown. * @param bounds The size and position of the content being attested in the window. * @param hashAlgorithm The String for the hashing algorithm to use based on values in * {@link #SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS}. * @param Callback The callback invoked to send back the impression token. */ void generateImpressionToken(in HardwareBuffer screenshot, in Rect bounds, in String hashAlgorithm, in RemoteCallback callback); /** * Call to verify that the impressionToken passed in was generated by the system. The result * will be sent in the callback as an integer with the key {@link #EXTRA_VERIFICATION_STATUS} * and will be one of the values in {@link VerificationStatus}. * * @param impressionToken The token to verify that it was generated by the system. * @param callback The callback invoked to send back the verification status. */ void verifyImpressionToken(in ImpressionToken impressionToken, in RemoteCallback callback); } core/java/android/service/attestation/ImpressionAttestationService.java 0 → 100644 +152 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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.attestation; import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; import android.graphics.Rect; import android.hardware.HardwareBuffer; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.RemoteCallback; /** * A service that handles generating and verify ImpressionTokens. * * The service will generate an ImpressionToken based on arguments passed in. Then later that same * ImpressionToken can be verified to determine that it was created by the system. * * @hide */ @SystemApi public abstract class ImpressionAttestationService extends Service { /** @hide **/ public static final String EXTRA_IMPRESSION_TOKEN = "android.service.attestation.extra.IMPRESSION_TOKEN"; /** @hide **/ public static final String EXTRA_VERIFICATION_STATUS = "android.service.attestation.extra.VERIFICATION_STATUS"; /** @hide */ @IntDef(prefix = {"VERIFICATION_STATUS_"}, value = { VERIFICATION_STATUS_UNKNOWN, VERIFICATION_STATUS_OS_VERIFIED, VERIFICATION_STATUS_APP_DECLARED }) public @interface VerificationStatus { } public static final int VERIFICATION_STATUS_UNKNOWN = 0; public static final int VERIFICATION_STATUS_OS_VERIFIED = 1; public static final int VERIFICATION_STATUS_APP_DECLARED = 2; /** * Manifest metadata key for the resource string array containing the names of all impression * attestation algorithms provided by the service. * @hide */ public static final String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.attestation.available_algorithms"; private ImpressionAttestationServiceWrapper mWrapper; private Handler mHandler; public ImpressionAttestationService() { } @Override public void onCreate() { super.onCreate(); mWrapper = new ImpressionAttestationServiceWrapper(); mHandler = new Handler(Looper.getMainLooper(), null, true); } @NonNull @Override public final IBinder onBind(@NonNull Intent intent) { return mWrapper; } /** * Generates the impression token that can be used to validate that the system * generated the token. * * @param screenshot The screenshot buffer for the content to attest. * @param bounds The size and position of the content being attested in the window. * @param hashAlgorithm The String for the hashing algorithm to use based values in * {@link #SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS)}. * @return An impression token that can be used to validate information about the content. * Returns null when the arguments sent are invalid. */ @Nullable public abstract ImpressionToken onGenerateImpressionToken(@NonNull HardwareBuffer screenshot, @NonNull Rect bounds, @NonNull String hashAlgorithm); /** * Call to verify that the impressionToken passed in was generated by the system. * * @param impressionToken The token to verify that it was generated by the system. * @return A {@link VerificationStatus} about whether the token was generated by the system. */ public abstract @VerificationStatus int onVerifyImpressionToken( @NonNull ImpressionToken impressionToken); private void generateImpressionToken(HardwareBuffer screenshot, Rect bounds, String hashAlgorithm, RemoteCallback callback) { ImpressionToken impressionToken = onGenerateImpressionToken(screenshot, bounds, hashAlgorithm); final Bundle data = new Bundle(); data.putParcelable(EXTRA_IMPRESSION_TOKEN, impressionToken); callback.sendResult(data); } private void verifyImpressionToken(ImpressionToken impressionToken, RemoteCallback callback) { @VerificationStatus int verificationStatus = onVerifyImpressionToken(impressionToken); final Bundle data = new Bundle(); data.putInt(EXTRA_VERIFICATION_STATUS, verificationStatus); callback.sendResult(data); } private final class ImpressionAttestationServiceWrapper extends IImpressionAttestationService.Stub { @Override public void generateImpressionToken(HardwareBuffer screenshot, Rect bounds, String hashAlgorithm, RemoteCallback callback) { mHandler.sendMessage( obtainMessage(ImpressionAttestationService::generateImpressionToken, ImpressionAttestationService.this, screenshot, bounds, hashAlgorithm, callback)); } @Override public void verifyImpressionToken(ImpressionToken impressionToken, RemoteCallback callback) { mHandler.sendMessage(obtainMessage(ImpressionAttestationService::verifyImpressionToken, ImpressionAttestationService.this, impressionToken, callback)); } } } core/java/android/service/attestation/ImpressionToken.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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.attestation; parcelable ImpressionToken; No newline at end of file Loading
api/system-current.txt +26 −0 Original line number Diff line number Diff line Loading @@ -10059,6 +10059,32 @@ package android.service.attention { } package android.service.attestation { public abstract class ImpressionAttestationService extends android.app.Service { ctor public ImpressionAttestationService(); method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent); method @Nullable public abstract android.service.attestation.ImpressionToken onGenerateImpressionToken(@NonNull android.hardware.HardwareBuffer, @NonNull android.graphics.Rect, @NonNull String); method public abstract int onVerifyImpressionToken(@NonNull android.service.attestation.ImpressionToken); field public static final int VERIFICATION_STATUS_APP_DECLARED = 2; // 0x2 field public static final int VERIFICATION_STATUS_OS_VERIFIED = 1; // 0x1 field public static final int VERIFICATION_STATUS_UNKNOWN = 0; // 0x0 } public final class ImpressionToken implements android.os.Parcelable { ctor public ImpressionToken(long, @NonNull android.graphics.Rect, @NonNull String, @NonNull byte[], @NonNull byte[]); method public int describeContents(); method @NonNull public android.graphics.Rect getBoundsInWindow(); method @NonNull public String getHashingAlgorithm(); method @NonNull public byte[] getHmac(); method @NonNull public byte[] getImageHash(); method public long getScreenshotTimeMillis(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.service.attestation.ImpressionToken> CREATOR; } } package android.service.autofill { public abstract class AutofillFieldClassificationService extends android.app.Service {
core/api/system-current.txt +26 −0 Original line number Diff line number Diff line Loading @@ -8900,6 +8900,32 @@ package android.service.attention { } package android.service.attestation { public abstract class ImpressionAttestationService extends android.app.Service { ctor public ImpressionAttestationService(); method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent); method @Nullable public abstract android.service.attestation.ImpressionToken onGenerateImpressionToken(@NonNull android.hardware.HardwareBuffer, @NonNull android.graphics.Rect, @NonNull String); method public abstract int onVerifyImpressionToken(@NonNull android.service.attestation.ImpressionToken); field public static final int VERIFICATION_STATUS_APP_DECLARED = 2; // 0x2 field public static final int VERIFICATION_STATUS_OS_VERIFIED = 1; // 0x1 field public static final int VERIFICATION_STATUS_UNKNOWN = 0; // 0x0 } public final class ImpressionToken implements android.os.Parcelable { ctor public ImpressionToken(long, @NonNull android.graphics.Rect, @NonNull String, @NonNull byte[], @NonNull byte[]); method public int describeContents(); method @NonNull public android.graphics.Rect getBoundsInWindow(); method @NonNull public String getHashingAlgorithm(); method @NonNull public byte[] getHmac(); method @NonNull public byte[] getImageHash(); method public long getScreenshotTimeMillis(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.service.attestation.ImpressionToken> CREATOR; } } package android.service.autofill { public abstract class AutofillFieldClassificationService extends android.app.Service {
core/java/android/service/attestation/IImpressionAttestationService.aidl 0 → 100644 +52 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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.attestation; import android.graphics.Rect; import android.hardware.HardwareBuffer; import android.service.attestation.ImpressionToken; import android.os.RemoteCallback; /** * Service used to handle impression attestation requests. * * @hide */ oneway interface IImpressionAttestationService { /** * Generates the impression token that can be used to validate that the system generated the * token. * * @param screenshot The token for the window where the view is shown. * @param bounds The size and position of the content being attested in the window. * @param hashAlgorithm The String for the hashing algorithm to use based on values in * {@link #SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS}. * @param Callback The callback invoked to send back the impression token. */ void generateImpressionToken(in HardwareBuffer screenshot, in Rect bounds, in String hashAlgorithm, in RemoteCallback callback); /** * Call to verify that the impressionToken passed in was generated by the system. The result * will be sent in the callback as an integer with the key {@link #EXTRA_VERIFICATION_STATUS} * and will be one of the values in {@link VerificationStatus}. * * @param impressionToken The token to verify that it was generated by the system. * @param callback The callback invoked to send back the verification status. */ void verifyImpressionToken(in ImpressionToken impressionToken, in RemoteCallback callback); }
core/java/android/service/attestation/ImpressionAttestationService.java 0 → 100644 +152 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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.attestation; import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; import android.graphics.Rect; import android.hardware.HardwareBuffer; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.RemoteCallback; /** * A service that handles generating and verify ImpressionTokens. * * The service will generate an ImpressionToken based on arguments passed in. Then later that same * ImpressionToken can be verified to determine that it was created by the system. * * @hide */ @SystemApi public abstract class ImpressionAttestationService extends Service { /** @hide **/ public static final String EXTRA_IMPRESSION_TOKEN = "android.service.attestation.extra.IMPRESSION_TOKEN"; /** @hide **/ public static final String EXTRA_VERIFICATION_STATUS = "android.service.attestation.extra.VERIFICATION_STATUS"; /** @hide */ @IntDef(prefix = {"VERIFICATION_STATUS_"}, value = { VERIFICATION_STATUS_UNKNOWN, VERIFICATION_STATUS_OS_VERIFIED, VERIFICATION_STATUS_APP_DECLARED }) public @interface VerificationStatus { } public static final int VERIFICATION_STATUS_UNKNOWN = 0; public static final int VERIFICATION_STATUS_OS_VERIFIED = 1; public static final int VERIFICATION_STATUS_APP_DECLARED = 2; /** * Manifest metadata key for the resource string array containing the names of all impression * attestation algorithms provided by the service. * @hide */ public static final String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.attestation.available_algorithms"; private ImpressionAttestationServiceWrapper mWrapper; private Handler mHandler; public ImpressionAttestationService() { } @Override public void onCreate() { super.onCreate(); mWrapper = new ImpressionAttestationServiceWrapper(); mHandler = new Handler(Looper.getMainLooper(), null, true); } @NonNull @Override public final IBinder onBind(@NonNull Intent intent) { return mWrapper; } /** * Generates the impression token that can be used to validate that the system * generated the token. * * @param screenshot The screenshot buffer for the content to attest. * @param bounds The size and position of the content being attested in the window. * @param hashAlgorithm The String for the hashing algorithm to use based values in * {@link #SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS)}. * @return An impression token that can be used to validate information about the content. * Returns null when the arguments sent are invalid. */ @Nullable public abstract ImpressionToken onGenerateImpressionToken(@NonNull HardwareBuffer screenshot, @NonNull Rect bounds, @NonNull String hashAlgorithm); /** * Call to verify that the impressionToken passed in was generated by the system. * * @param impressionToken The token to verify that it was generated by the system. * @return A {@link VerificationStatus} about whether the token was generated by the system. */ public abstract @VerificationStatus int onVerifyImpressionToken( @NonNull ImpressionToken impressionToken); private void generateImpressionToken(HardwareBuffer screenshot, Rect bounds, String hashAlgorithm, RemoteCallback callback) { ImpressionToken impressionToken = onGenerateImpressionToken(screenshot, bounds, hashAlgorithm); final Bundle data = new Bundle(); data.putParcelable(EXTRA_IMPRESSION_TOKEN, impressionToken); callback.sendResult(data); } private void verifyImpressionToken(ImpressionToken impressionToken, RemoteCallback callback) { @VerificationStatus int verificationStatus = onVerifyImpressionToken(impressionToken); final Bundle data = new Bundle(); data.putInt(EXTRA_VERIFICATION_STATUS, verificationStatus); callback.sendResult(data); } private final class ImpressionAttestationServiceWrapper extends IImpressionAttestationService.Stub { @Override public void generateImpressionToken(HardwareBuffer screenshot, Rect bounds, String hashAlgorithm, RemoteCallback callback) { mHandler.sendMessage( obtainMessage(ImpressionAttestationService::generateImpressionToken, ImpressionAttestationService.this, screenshot, bounds, hashAlgorithm, callback)); } @Override public void verifyImpressionToken(ImpressionToken impressionToken, RemoteCallback callback) { mHandler.sendMessage(obtainMessage(ImpressionAttestationService::verifyImpressionToken, ImpressionAttestationService.this, impressionToken, callback)); } } }
core/java/android/service/attestation/ImpressionToken.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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.attestation; parcelable ImpressionToken; No newline at end of file