Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 566d81d8 authored by chaviw's avatar chaviw
Browse files

Add getter to retrieve interval between requests.

Added a getter instead of getting the interval between requests data
from the xml file. This was in response to API council feedback

Test: DisplayHashManagerTest
Fixes: 184890915
Change-Id: I8f903cada26b6fc4cd8c12a5c97089705bc821e3
parent ef6d7c02
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -317,7 +317,6 @@ package android {
  public static final class R.attr {
    field public static final int allowClearUserDataOnFailedRestore = 16844288; // 0x1010600
    field public static final int durationBetweenRequestsMillis;
    field public static final int hotwordDetectionService;
    field public static final int isVrOnly = 16844152; // 0x1010578
    field public static final int minExtensionVersion = 16844305; // 0x1010611
@@ -9888,9 +9887,9 @@ package android.service.displayhash {
    method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method public abstract void onGenerateDisplayHash(@NonNull byte[], @NonNull android.hardware.HardwareBuffer, @NonNull android.graphics.Rect, @NonNull String, @NonNull android.view.displayhash.DisplayHashResultCallback);
    method @NonNull public abstract java.util.Map<java.lang.String,android.service.displayhash.DisplayHashParams> onGetDisplayHashAlgorithms();
    method public abstract int onGetIntervalBetweenRequestsMillis();
    method @Nullable public abstract android.view.displayhash.VerifiedDisplayHash onVerifyDisplayHash(@NonNull byte[], @NonNull android.view.displayhash.DisplayHash);
    field public static final String SERVICE_INTERFACE = "android.service.displayhash.DisplayHashingService";
    field public static final String SERVICE_META_DATA = "android.displayhash.display_hashing_service";
  }
}
+25 −9
Original line number Diff line number Diff line
@@ -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));
        }
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -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);
}
+0 −7
Original line number Diff line number Diff line
@@ -9568,11 +9568,4 @@
    <attr name="iconfactoryBadgeSize" format="dimension"/>
    <!-- Perceptual luminance of a color, in accessibility friendly color space. From 0 to 100. -->
    <attr name="lStar" format="float"/>
    <declare-styleable name="DisplayHashingService">
        <!-- The interval required between display hash requests. Requests made faster than this
             delay will be throttled."
             @hide @SystemApi -->
        <attr name="durationBetweenRequestsMillis" format="integer" />
    </declare-styleable>
</resources>
+0 −2
Original line number Diff line number Diff line
@@ -3095,8 +3095,6 @@
    <!-- @hide @SystemApi -->
    <public name="playHomeTransitionSound" />
    <public name="lStar" />
    <!-- @hide @SystemApi -->
    <public name="durationBetweenRequestsMillis" />
    <public name="showInInputMethodPicker" />
    <public name="effectColor" />
    <!-- @hide @TestApi -->
Loading