diff options
| author | Chavi Weingarten <chaviw@google.com> | 2021-05-18 15:02:06 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-05-18 15:02:06 +0000 |
| commit | 6ebcfff707afa3547b190aba527223c366197e68 (patch) | |
| tree | 6f4a231f67b8e74bc63d4c3cbc94c58ad38e28d9 /core/java | |
| parent | 225ffc92e1e95fa1395d86621a80fec79ab12d68 (diff) | |
| parent | 566d81d8021c4cfdd19db7b93c643a86e6a15ee2 (diff) | |
Merge "Add getter to retrieve interval between requests." into sc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/service/displayhash/DisplayHashingService.java | 34 | ||||
| -rw-r--r-- | core/java/android/service/displayhash/IDisplayHashingService.aidl | 9 |
2 files changed, 34 insertions, 9 deletions
diff --git a/core/java/android/service/displayhash/DisplayHashingService.java b/core/java/android/service/displayhash/DisplayHashingService.java index e8bb485780d0..f22d40ea4d5e 100644 --- a/core/java/android/service/displayhash/DisplayHashingService.java +++ b/core/java/android/service/displayhash/DisplayHashingService.java @@ -51,15 +51,9 @@ public abstract class DisplayHashingService extends Service { public static final String EXTRA_VERIFIED_DISPLAY_HASH = "android.service.displayhash.extra.VERIFIED_DISPLAY_HASH"; - /** - * Name under which a DisplayHashingService component publishes information - * about itself. This meta-data must reference an XML resource containing a - * {@link com.android.internal.R.styleable#DisplayHashingService} tag. - * - * @hide - */ - @SystemApi - public static final String SERVICE_META_DATA = "android.displayhash.display_hashing_service"; + /** @hide **/ + public static final String EXTRA_INTERVAL_BETWEEN_REQUESTS = + "android.service.displayhash.extra.INTERVAL_BETWEEN_REQUESTS"; /** * The {@link Intent} action that must be declared as handled by a service in its manifest @@ -149,6 +143,21 @@ public abstract class DisplayHashingService extends Service { callback.sendResult(data); } + /** + * Call to get the interval required between display hash requests. Requests made faster than + * this will be throttled. + * + * @return the interval value required between requests. + */ + public abstract int onGetIntervalBetweenRequestsMillis(); + + private void getDurationBetweenRequestsMillis(RemoteCallback callback) { + int durationBetweenRequestMillis = onGetIntervalBetweenRequestsMillis(); + Bundle data = new Bundle(); + data.putInt(EXTRA_INTERVAL_BETWEEN_REQUESTS, durationBetweenRequestMillis); + callback.sendResult(data); + } + private final class DisplayHashingServiceWrapper extends IDisplayHashingService.Stub { @Override public void generateDisplayHash(byte[] salt, HardwareBuffer buffer, Rect bounds, @@ -187,5 +196,12 @@ public abstract class DisplayHashingService extends Service { mHandler.sendMessage(obtainMessage(DisplayHashingService::getDisplayHashAlgorithms, DisplayHashingService.this, callback)); } + + @Override + public void getIntervalBetweenRequestsMillis(RemoteCallback callback) { + mHandler.sendMessage( + obtainMessage(DisplayHashingService::getDurationBetweenRequestsMillis, + DisplayHashingService.this, callback)); + } } } diff --git a/core/java/android/service/displayhash/IDisplayHashingService.aidl b/core/java/android/service/displayhash/IDisplayHashingService.aidl index 56e1e0aa9009..066cd51f4dbf 100644 --- a/core/java/android/service/displayhash/IDisplayHashingService.aidl +++ b/core/java/android/service/displayhash/IDisplayHashingService.aidl @@ -58,4 +58,13 @@ oneway interface IDisplayHashingService { * @param callback The callback invoked to send back the map of algorithms to DisplayHashParams. */ void getDisplayHashAlgorithms(in RemoteCallback callback); + + /** + * Call to get the interval required between display hash requests. Requests made faster than + * this will be throttled. The result will be sent in the callback as an int with the key + * {@link #EXTRA_INTERVAL_BETWEEN_REQUESTS}. + * + * @param callback The callback invoked to send back the interval duration. + */ + void getIntervalBetweenRequestsMillis(in RemoteCallback callback); } |
