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

Commit e08c6273 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

base: Add simulate device connection Java APIs

Expose the setSimulateDeviceConnections to Java Layer. It can be
helpful during the testing.

Test: make and check logs
Bug: 401100433
Flag: EXEMPT TestApi

(cherry picked from https://android-review.googlesource.com/q/commit:6dd9828373ebeb58a467a11f40107117abd6aecd)
Change-Id: I15eb872da75a68c06a343f22aee52bfad2fc43a7
parent 7d8b73c1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3376,6 +3376,11 @@ static jboolean android_media_AudioSystem_isBluetoothVariableLatencyEnabled(JNIE
    return enabled;
}

static int android_media_AudioSystem_setSimulateDeviceConnections(JNIEnv *env, jobject thiz,
                                                                  jboolean enabled) {
    return check_AudioSystem_Command(AudioSystem::setSimulateDeviceConnections(enabled));
}

class JavaSystemPropertyListener {
  public:
    JavaSystemPropertyListener(JNIEnv* env, jobject javaCallback, std::string sysPropName) :
@@ -3642,6 +3647,7 @@ static const JNINativeMethod gMethods[] = {
                               android_media_AudioSystem_listenForSystemPropertyChange),
        MAKE_JNI_NATIVE_METHOD("triggerSystemPropertyUpdate", "(J)V",
                               android_media_AudioSystem_triggerSystemPropertyUpdate),
        MAKE_AUDIO_SYSTEM_METHOD(setSimulateDeviceConnections),
};

static const JNINativeMethod gEventHandlerMethods[] =
+6 −0
Original line number Diff line number Diff line
@@ -2754,4 +2754,10 @@ public class AudioSystem
     */
    public static native int unregisterAudioVolumeGroupCallback(
            INativeAudioVolumeGroupCallback callback);

    /**
     * Enable or disable device connection simulation at the HAL level.
     * @hide
     */
    public static native int setSimulateDeviceConnections(boolean enabled);
}