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

Commit 64ea8781 authored by Sandeep Bandaru's avatar Sandeep Bandaru Committed by Android (Google) Code Review
Browse files

Merge "Adding onReady method as @TestApi to use in CTS tests" into main

parents 5a864cfb f27cde53
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3116,6 +3116,14 @@ package android.service.notification {

}

package android.service.ondeviceintelligence {

  @FlaggedApi("android.app.ondeviceintelligence.flags.enable_on_device_intelligence") public abstract class OnDeviceIntelligenceService extends android.app.Service {
    method public void onReady();
  }

}

package android.service.quickaccesswallet {

  public interface QuickAccessWalletClient extends java.io.Closeable {
+1 −0
Original line number Diff line number Diff line
@@ -47,4 +47,5 @@ oneway interface IOnDeviceIntelligenceService {
    void registerRemoteServices(in IRemoteProcessingService remoteProcessingService);
    void notifyInferenceServiceConnected();
    void notifyInferenceServiceDisconnected();
    void ready();
}
 No newline at end of file
+16 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SdkConstant;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.app.Service;
import android.app.ondeviceintelligence.DownloadCallback;
import android.app.ondeviceintelligence.Feature;
@@ -110,6 +111,11 @@ public abstract class OnDeviceIntelligenceService extends Service {
            //  thread.
            return new IOnDeviceIntelligenceService.Stub() {
                /** {@inheritDoc} */
                @Override
                public void ready() {
                    OnDeviceIntelligenceService.this.onReady();
                }

                @Override
                public void getVersion(RemoteCallback remoteCallback) {
                    Objects.requireNonNull(remoteCallback);
@@ -208,6 +214,16 @@ public abstract class OnDeviceIntelligenceService extends Service {
        return null;
    }

    /**
     * Using this signal to assertively a signal each time service binds successfully, used only in
     * tests to get a signal that service instance is ready. This is needed because we cannot rely
     * on {@link #onCreate} or {@link #onBind} to be invoke on each binding.
     *
     * @hide
     */
    @TestApi
    public void onReady() {}


    /**
     * Invoked when a new instance of the remote inference service is created.
+3 −0
Original line number Diff line number Diff line
@@ -372,6 +372,7 @@ public class OnDeviceIntelligenceManagerService extends SystemService {
                            public void onConnected(
                                    @NonNull IOnDeviceIntelligenceService service) {
                                try {
                                    service.ready();
                                    service.registerRemoteServices(
                                            getRemoteProcessingService());
                                } catch (RemoteException ex) {
@@ -538,6 +539,8 @@ public class OnDeviceIntelligenceManagerService extends SystemService {
                Manifest.permission.USE_ON_DEVICE_INTELLIGENCE, TAG);
        synchronized (mLock) {
            mTemporaryServiceNames = componentNames;
            mRemoteInferenceService.unbind();
            mRemoteOnDeviceIntelligenceService.unbind();
            mRemoteOnDeviceIntelligenceService = null;
            mRemoteInferenceService = null;
            if (mTemporaryHandler == null) {