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

Commit 212da992 authored by sandeepbandaru's avatar sandeepbandaru
Browse files

Adding method to update processing state of isolated process via the

non-isolated counterpart. It creates a proxy to invoke the
updateProcessingState method via system-server callback.

Context: go/isolated-aicore

Test:make
Bug:316589195
API-Coverage-Bug: 323147058
Change-Id: I3f5fa63f48d3e026a1d25172042fbe585d8cb448
parent 24d6b6a9
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -12963,9 +12963,22 @@ package android.service.ondeviceintelligence {
    method public abstract void onGetReadOnlyFeatureFileDescriptorMap(@NonNull android.app.ondeviceintelligence.Feature, @NonNull java.util.function.Consumer<java.util.Map<java.lang.String,android.os.ParcelFileDescriptor>>);
    method public abstract void onGetReadOnlyFeatureFileDescriptorMap(@NonNull android.app.ondeviceintelligence.Feature, @NonNull java.util.function.Consumer<java.util.Map<java.lang.String,android.os.ParcelFileDescriptor>>);
    method public abstract void onGetVersion(@NonNull java.util.function.LongConsumer);
    method public abstract void onGetVersion(@NonNull java.util.function.LongConsumer);
    method public abstract void onListFeatures(@NonNull android.os.OutcomeReceiver<java.util.List<android.app.ondeviceintelligence.Feature>,android.app.ondeviceintelligence.OnDeviceIntelligenceManager.OnDeviceIntelligenceManagerException>);
    method public abstract void onListFeatures(@NonNull android.os.OutcomeReceiver<java.util.List<android.app.ondeviceintelligence.Feature>,android.app.ondeviceintelligence.OnDeviceIntelligenceManager.OnDeviceIntelligenceManagerException>);
    method public final void updateProcessingState(@NonNull android.os.Bundle, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.PersistableBundle,android.service.ondeviceintelligence.OnDeviceIntelligenceService.OnDeviceUpdateProcessingException>);
    field public static final String SERVICE_INTERFACE = "android.service.ondeviceintelligence.OnDeviceIntelligenceService";
    field public static final String SERVICE_INTERFACE = "android.service.ondeviceintelligence.OnDeviceIntelligenceService";
  }
  }
  public static class OnDeviceIntelligenceService.OnDeviceIntelligenceServiceException extends java.lang.Exception {
    ctor public OnDeviceIntelligenceService.OnDeviceIntelligenceServiceException(int);
    ctor public OnDeviceIntelligenceService.OnDeviceIntelligenceServiceException(int, @NonNull String);
    method public int getErrorCode();
  }
  public static class OnDeviceIntelligenceService.OnDeviceUpdateProcessingException extends android.service.ondeviceintelligence.OnDeviceIntelligenceService.OnDeviceIntelligenceServiceException {
    ctor public OnDeviceIntelligenceService.OnDeviceUpdateProcessingException(int);
    ctor public OnDeviceIntelligenceService.OnDeviceUpdateProcessingException(int, @NonNull String);
    field public static final int PROCESSING_UPDATE_STATUS_CONNECTION_FAILED = 1; // 0x1
  }
  @FlaggedApi("android.app.ondeviceintelligence.flags.enable_on_device_intelligence") public abstract class OnDeviceTrustedInferenceService extends android.app.Service {
  @FlaggedApi("android.app.ondeviceintelligence.flags.enable_on_device_intelligence") public abstract class OnDeviceTrustedInferenceService extends android.app.Service {
    ctor public OnDeviceTrustedInferenceService();
    ctor public OnDeviceTrustedInferenceService();
    method public final void fetchFeatureFileInputStreamMap(@NonNull android.app.ondeviceintelligence.Feature, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.Map<java.lang.String,java.io.FileInputStream>>);
    method public final void fetchFeatureFileInputStreamMap(@NonNull android.app.ondeviceintelligence.Feature, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.Map<java.lang.String,java.io.FileInputStream>>);
@@ -12973,6 +12986,7 @@ package android.service.ondeviceintelligence {
    method @NonNull public abstract void onCountTokens(@NonNull android.app.ondeviceintelligence.Feature, @NonNull android.app.ondeviceintelligence.Content, @Nullable android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver<java.lang.Long,android.app.ondeviceintelligence.OnDeviceIntelligenceManager.OnDeviceIntelligenceManagerProcessingException>);
    method @NonNull public abstract void onCountTokens(@NonNull android.app.ondeviceintelligence.Feature, @NonNull android.app.ondeviceintelligence.Content, @Nullable android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver<java.lang.Long,android.app.ondeviceintelligence.OnDeviceIntelligenceManager.OnDeviceIntelligenceManagerProcessingException>);
    method @NonNull public abstract void onProcessRequest(@NonNull android.app.ondeviceintelligence.Feature, @NonNull android.app.ondeviceintelligence.Content, int, @Nullable android.os.CancellationSignal, @Nullable android.app.ondeviceintelligence.ProcessingSignal, @NonNull android.os.OutcomeReceiver<android.app.ondeviceintelligence.Content,android.app.ondeviceintelligence.OnDeviceIntelligenceManager.OnDeviceIntelligenceManagerProcessingException>);
    method @NonNull public abstract void onProcessRequest(@NonNull android.app.ondeviceintelligence.Feature, @NonNull android.app.ondeviceintelligence.Content, int, @Nullable android.os.CancellationSignal, @Nullable android.app.ondeviceintelligence.ProcessingSignal, @NonNull android.os.OutcomeReceiver<android.app.ondeviceintelligence.Content,android.app.ondeviceintelligence.OnDeviceIntelligenceManager.OnDeviceIntelligenceManagerProcessingException>);
    method @NonNull public abstract void onProcessRequestStreaming(@NonNull android.app.ondeviceintelligence.Feature, @NonNull android.app.ondeviceintelligence.Content, int, @Nullable android.os.CancellationSignal, @Nullable android.app.ondeviceintelligence.ProcessingSignal, @NonNull android.app.ondeviceintelligence.StreamingResponseReceiver<android.app.ondeviceintelligence.Content,android.app.ondeviceintelligence.Content,android.app.ondeviceintelligence.OnDeviceIntelligenceManager.OnDeviceIntelligenceManagerProcessingException>);
    method @NonNull public abstract void onProcessRequestStreaming(@NonNull android.app.ondeviceintelligence.Feature, @NonNull android.app.ondeviceintelligence.Content, int, @Nullable android.os.CancellationSignal, @Nullable android.app.ondeviceintelligence.ProcessingSignal, @NonNull android.app.ondeviceintelligence.StreamingResponseReceiver<android.app.ondeviceintelligence.Content,android.app.ondeviceintelligence.Content,android.app.ondeviceintelligence.OnDeviceIntelligenceManager.OnDeviceIntelligenceManagerProcessingException>);
    method public abstract void onUpdateProcessingState(@NonNull android.os.Bundle, @NonNull android.os.OutcomeReceiver<android.os.PersistableBundle,android.service.ondeviceintelligence.OnDeviceIntelligenceService.OnDeviceUpdateProcessingException>);
    method public final java.io.FileInputStream openFileInput(@NonNull String) throws java.io.FileNotFoundException;
    method public final java.io.FileInputStream openFileInput(@NonNull String) throws java.io.FileNotFoundException;
    method public final void openFileInputAsync(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.io.FileInputStream>) throws java.io.FileNotFoundException;
    method public final void openFileInputAsync(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.io.FileInputStream>) throws java.io.FileNotFoundException;
    field public static final String SERVICE_INTERFACE = "android.service.ondeviceintelligence.OnDeviceTrustedInferenceService";
    field public static final String SERVICE_INTERFACE = "android.service.ondeviceintelligence.OnDeviceTrustedInferenceService";
+2 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ import android.app.ondeviceintelligence.IFeatureCallback;
import android.app.ondeviceintelligence.IListFeaturesCallback;
import android.app.ondeviceintelligence.IListFeaturesCallback;
import android.app.ondeviceintelligence.IFeatureDetailsCallback;
import android.app.ondeviceintelligence.IFeatureDetailsCallback;
import com.android.internal.infra.AndroidFuture;
import com.android.internal.infra.AndroidFuture;
import android.service.ondeviceintelligence.IRemoteProcessingService;




/**
/**
@@ -41,4 +42,5 @@ oneway interface IOnDeviceIntelligenceService {
    void getReadOnlyFileDescriptor(in String fileName, in AndroidFuture<ParcelFileDescriptor> future);
    void getReadOnlyFileDescriptor(in String fileName, in AndroidFuture<ParcelFileDescriptor> future);
    void getReadOnlyFeatureFileDescriptorMap(in Feature feature, in RemoteCallback remoteCallback);
    void getReadOnlyFeatureFileDescriptorMap(in Feature feature, in RemoteCallback remoteCallback);
    void requestFeatureDownload(in Feature feature, in ICancellationSignal cancellationSignal, in IDownloadCallback downloadCallback);
    void requestFeatureDownload(in Feature feature, in ICancellationSignal cancellationSignal, in IDownloadCallback downloadCallback);
    void registerRemoteServices(in IRemoteProcessingService remoteProcessingService);
}
}
 No newline at end of file
+5 −1
Original line number Original line Diff line number Diff line
@@ -23,8 +23,10 @@ import android.app.ondeviceintelligence.IProcessingSignal;
import android.app.ondeviceintelligence.Content;
import android.app.ondeviceintelligence.Content;
import android.app.ondeviceintelligence.Feature;
import android.app.ondeviceintelligence.Feature;
import android.os.ICancellationSignal;
import android.os.ICancellationSignal;
import android.os.PersistableBundle;
import android.os.Bundle;
import android.service.ondeviceintelligence.IRemoteStorageService;
import android.service.ondeviceintelligence.IRemoteStorageService;

import android.service.ondeviceintelligence.IProcessingUpdateStatusCallback;


/**
/**
 * Interface for a concrete implementation to provide on device trusted inference.
 * Interface for a concrete implementation to provide on device trusted inference.
@@ -41,4 +43,6 @@ oneway interface IOnDeviceTrustedInferenceService {
    void processRequestStreaming(in Feature feature, in Content request, in int requestType,
    void processRequestStreaming(in Feature feature, in Content request, in int requestType,
                                in ICancellationSignal cancellationSignal, in IProcessingSignal processingSignal,
                                in ICancellationSignal cancellationSignal, in IProcessingSignal processingSignal,
                                in IStreamingResponseCallback callback);
                                in IStreamingResponseCallback callback);
    void updateProcessingState(in Bundle processingState,
                                     in IProcessingUpdateStatusCallback callback);
}
}
 No newline at end of file
+14 −0
Original line number Original line Diff line number Diff line
package android.service.ondeviceintelligence;

import android.os.PersistableBundle;

/**
  * Interface for receiving status from a updateProcessingState call from on-device intelligence
  * service.
  *
  * @hide
  */
interface IProcessingUpdateStatusCallback {
    void onSuccess(in PersistableBundle statusParams) = 1;
    void onFailure(int errorCode, in String errorMessage) = 2;
}
+31 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 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.ondeviceintelligence;

import android.os.Bundle;
import android.service.ondeviceintelligence.IProcessingUpdateStatusCallback;


/**
 * Interface for a concrete implementation to provide methods to update state of a remote service.
 *
 * @hide
 */
oneway interface IRemoteProcessingService {
    void updateProcessingState(in Bundle processingState,
                                 in IProcessingUpdateStatusCallback callback);
}
Loading