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

Commit d569a8b1 authored by Atneya Nair's avatar Atneya Nair Committed by Android (Google) Code Review
Browse files

Merge "Add AIDL interfaces for fake STHAL" into udc-dev

parents b8b16486 52bf345a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.content.Context;
import android.media.AudioFormat;
import android.media.permission.Identity;
import android.media.soundtrigger.Status;
import android.media.soundtrigger_middleware.ISoundTriggerInjection;
import android.media.soundtrigger_middleware.ISoundTriggerMiddlewareService;
import android.media.soundtrigger_middleware.SoundTriggerModuleDescriptor;
import android.os.Build;
@@ -77,9 +78,11 @@ public class SoundTrigger {
    }

    /**
     * Model architecture associated with a fake STHAL which can be injected.
     * Used for testing purposes.
     * @hide
     */
    public static final String FAKE_HAL_ARCH = "injection";
    public static final String FAKE_HAL_ARCH = ISoundTriggerInjection.FAKE_HAL_ARCH;

    /**
     * Status code used when the operation succeeded
+1 −4
Original line number Diff line number Diff line
@@ -29,10 +29,7 @@ aidl_interface {
        },
    },
    srcs: [
        "aidl/android/media/soundtrigger_middleware/ISoundTriggerCallback.aidl",
        "aidl/android/media/soundtrigger_middleware/ISoundTriggerMiddlewareService.aidl",
        "aidl/android/media/soundtrigger_middleware/ISoundTriggerModule.aidl",
        "aidl/android/media/soundtrigger_middleware/SoundTriggerModuleDescriptor.aidl",
        "aidl/android/media/soundtrigger_middleware/*.aidl",
    ],
    imports: [
        "android.media.audio.common.types-V2",
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.media.soundtrigger_middleware;

/**
 * Opaque callback for acknowledging oneway events.
 * Since there is no return channel for oneway events,
 * passing this interface in a oneway method allows the service to call
 * back to the client to indicate the event was registered.
 * This essentially functions like a <code> Future<void> </code> without
 * an error channel.
 * {@hide}
 */
oneway interface IAcknowledgeEvent {
    /**
     * Acknowledge that the event has been received.
     */
    void eventReceived();

}
+43 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.media.soundtrigger_middleware;

import android.media.soundtrigger_middleware.IAcknowledgeEvent;

/**
 * Interface for injecting global events to the fake STHAL.
 * {@hide}
 */
oneway interface IInjectGlobalEvent {

    /**
     * Request a fake STHAL restart.
     * This invalidates the {@link IInjectGlobalEvent}.
     */
    void triggerRestart();

    /**
     * Triggers global resource contention into the fake STHAL. Loads/startRecognition
     * will fail with RESOURCE_CONTENTION.
     * @param isContended - true to enable resource contention. false to disable resource contention
     *                      and resume normal functionality.
     * @param callback - Call {@link IAcknowledgeEvent#eventReceived()} on this interface once
     * the contention status is successfully set.
     */
    void setResourceContention(boolean isContended, IAcknowledgeEvent callback);

}
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.media.soundtrigger_middleware;

/**
 * Interface for injecting model events into the fake ST HAL.
 *
 * {@hide}
 */
oneway interface IInjectModelEvent {
    /**
     * Trigger a preemptive model unload for the model session associated with
     * this object.
     * This invalidates the {@link IInjectModelEvent} session.
     */
    void triggerUnloadModel();

}
Loading