Merge "Updated DisplayHash APIs" into sc-dev am: 8570e52d00
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14100524 Change-Id: Ia49e144989dbb341dcc2e10cc26a093520e5453f
This commit is contained in:
@@ -30927,7 +30927,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @param executor The executor that the callback should be invoked on.
|
||||
* @param callback The callback to handle the results of generating the display hash
|
||||
*/
|
||||
@Nullable
|
||||
public void generateDisplayHash(@NonNull String hashAlgorithm,
|
||||
@Nullable Rect bounds, @NonNull Executor executor,
|
||||
@NonNull DisplayHashResultCallback callback) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.view.displayhash;
|
||||
|
||||
import android.annotation.CurrentTimeMillisLong;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.SystemApi;
|
||||
import android.graphics.Rect;
|
||||
@@ -31,6 +32,7 @@ public final class DisplayHash implements Parcelable {
|
||||
/**
|
||||
* The timestamp when the hash was generated.
|
||||
*/
|
||||
@CurrentTimeMillisLong
|
||||
private final long mTimeMillis;
|
||||
|
||||
/**
|
||||
@@ -73,7 +75,7 @@ public final class DisplayHash implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public DisplayHash(long timeMillis, @NonNull Rect boundsInWindow,
|
||||
public DisplayHash(@CurrentTimeMillisLong long timeMillis, @NonNull Rect boundsInWindow,
|
||||
@NonNull String hashAlgorithm, @NonNull byte[] imageHash, @NonNull byte[] hmac) {
|
||||
mTimeMillis = timeMillis;
|
||||
mBoundsInWindow = boundsInWindow;
|
||||
@@ -92,6 +94,7 @@ public final class DisplayHash implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@CurrentTimeMillisLong
|
||||
public long getTimeMillis() {
|
||||
return mTimeMillis;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Utility class for DisplayHash requests.
|
||||
* Manages DisplayHash requests. The manager object can be retrieved by calling
|
||||
* {@code Context.getSystemService(Context.DISPLAY_HASH_SERVICE)}
|
||||
*/
|
||||
@SystemService(DISPLAY_HASH_SERVICE)
|
||||
public final class DisplayHashManager {
|
||||
@@ -75,7 +76,7 @@ public final class DisplayHashManager {
|
||||
return sSupportedHashAlgorithms;
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Failed to send request getSupportedHashingAlgorithms", e);
|
||||
return Collections.emptySet();
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +94,7 @@ public final class DisplayHashManager {
|
||||
return WindowManagerGlobal.getWindowManagerService().verifyDisplayHash(displayHash);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Failed to send request verifyImpressionToken", e);
|
||||
return null;
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.view.displayhash;
|
||||
|
||||
import android.annotation.CurrentTimeMillisLong;
|
||||
import android.annotation.NonNull;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Parcelable;
|
||||
@@ -30,6 +31,7 @@ public final class VerifiedDisplayHash implements Parcelable {
|
||||
/**
|
||||
* The timestamp when the hash was generated.
|
||||
*/
|
||||
@CurrentTimeMillisLong
|
||||
private final long mTimeMillis;
|
||||
|
||||
/**
|
||||
@@ -78,7 +80,7 @@ public final class VerifiedDisplayHash implements Parcelable {
|
||||
|
||||
|
||||
|
||||
// Code below generated by codegen v1.0.22.
|
||||
// Code below generated by codegen v1.0.23.
|
||||
//
|
||||
// DO NOT MODIFY!
|
||||
// CHECKSTYLE:OFF Generated code
|
||||
@@ -106,11 +108,13 @@ public final class VerifiedDisplayHash implements Parcelable {
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public VerifiedDisplayHash(
|
||||
long timeMillis,
|
||||
@CurrentTimeMillisLong long timeMillis,
|
||||
@NonNull Rect boundsInWindow,
|
||||
@NonNull String hashAlgorithm,
|
||||
@NonNull byte[] imageHash) {
|
||||
this.mTimeMillis = timeMillis;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
CurrentTimeMillisLong.class, null, mTimeMillis);
|
||||
this.mBoundsInWindow = boundsInWindow;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mBoundsInWindow);
|
||||
@@ -128,7 +132,7 @@ public final class VerifiedDisplayHash implements Parcelable {
|
||||
* The timestamp when the hash was generated.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
public long getTimeMillis() {
|
||||
public @CurrentTimeMillisLong long getTimeMillis() {
|
||||
return mTimeMillis;
|
||||
}
|
||||
|
||||
@@ -200,6 +204,8 @@ public final class VerifiedDisplayHash implements Parcelable {
|
||||
byte[] imageHash = in.createByteArray();
|
||||
|
||||
this.mTimeMillis = timeMillis;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
CurrentTimeMillisLong.class, null, mTimeMillis);
|
||||
this.mBoundsInWindow = boundsInWindow;
|
||||
com.android.internal.util.AnnotationValidations.validate(
|
||||
NonNull.class, null, mBoundsInWindow);
|
||||
@@ -228,10 +234,10 @@ public final class VerifiedDisplayHash implements Parcelable {
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1613168749684L,
|
||||
codegenVersion = "1.0.22",
|
||||
time = 1617747271440L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/view/displayhash/VerifiedDisplayHash.java",
|
||||
inputSignatures = "private final long mTimeMillis\nprivate final @android.annotation.NonNull android.graphics.Rect mBoundsInWindow\nprivate final @android.annotation.NonNull java.lang.String mHashAlgorithm\nprivate final @android.annotation.NonNull byte[] mImageHash\nprivate java.lang.String imageHashToString()\nprivate java.lang.String byteArrayToString(byte[])\nclass VerifiedDisplayHash extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genAidl=true)")
|
||||
inputSignatures = "private final @android.annotation.CurrentTimeMillisLong long mTimeMillis\nprivate final @android.annotation.NonNull android.graphics.Rect mBoundsInWindow\nprivate final @android.annotation.NonNull java.lang.String mHashAlgorithm\nprivate final @android.annotation.NonNull byte[] mImageHash\nprivate java.lang.String imageHashToString()\nprivate java.lang.String byteArrayToString(byte[])\nclass VerifiedDisplayHash extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genAidl=true)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user