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

Commit 66f9e72e authored by jiabin's avatar jiabin Committed by Jiabin Huang
Browse files

Add API for querying haptic playback support.

Bug: 111454766
Test: Manually test
Change-Id: Ic6a0aba877a417faf8ff0c9f2e7b0ea99e3d7fbf
parent 01fb624e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23010,6 +23010,7 @@ package android.media {
    method public deprecated boolean isBluetoothA2dpOn();
    method public boolean isBluetoothScoAvailableOffCall();
    method public boolean isBluetoothScoOn();
    method public static boolean isHapticPlaybackSupported();
    method public boolean isMicrophoneMute();
    method public boolean isMusicActive();
    method public static boolean isOffloadedPlaybackSupported(android.media.AudioFormat);
+7 −0
Original line number Diff line number Diff line
@@ -2061,6 +2061,12 @@ android_media_AudioSystem_setA11yServicesUids(JNIEnv *env, jobject thiz, jintArr
    return (jint)nativeToJavaStatus(status);
}

static jboolean
android_media_AudioSystem_isHapticPlaybackSupported(JNIEnv *env, jobject thiz)
{
    return AudioSystem::isHapticPlaybackSupported();
}

// ----------------------------------------------------------------------------

static const JNINativeMethod gMethods[] = {
@@ -2123,6 +2129,7 @@ static const JNINativeMethod gMethods[] = {
    {"setSurroundFormatEnabled", "(IZ)I", (void *)android_media_AudioSystem_setSurroundFormatEnabled},
    {"setAssistantUid", "(I)I", (void *)android_media_AudioSystem_setAssistantUid},
    {"setA11yServicesUids", "([I)I", (void *)android_media_AudioSystem_setA11yServicesUids},
    {"isHapticPlaybackSupported", "()Z", (void *)android_media_AudioSystem_isHapticPlaybackSupported},
};

static const JNINativeMethod gEventHandlerMethods[] = {
+9 −0
Original line number Diff line number Diff line
@@ -5152,6 +5152,15 @@ public class AudioManager {
        return reportedSurroundFormats;
    }

    /**
     * Return if audio haptic coupled playback is supported or not.
     *
     * @return whether audio haptic playback supported.
     */
    public static boolean isHapticPlaybackSupported() {
        return AudioSystem.isHapticPlaybackSupported();
    }


    //---------------------------------------------------------
    // Inner classes
+5 −0
Original line number Diff line number Diff line
@@ -933,6 +933,11 @@ public class AudioSystem
     */
    public static native int setA11yServicesUids(int[] uids);

    /**
     * @see AudioManager#isHapticPlaybackSupported()
     */
    public static native boolean isHapticPlaybackSupported();

    // Items shared with audio service

    /**