return AudioSystem::setAllowedCapturePolicy(uid, flags);
}
+static jint
+android_media_AudioSystem_setRttEnabled(JNIEnv *env, jobject thiz, jboolean enabled)
+{
+ return (jint) check_AudioSystem_Command(AudioSystem::setRttEnabled(enabled));
+}
+
// ----------------------------------------------------------------------------
static const JNINativeMethod gMethods[] = {
{"getHwOffloadEncodingFormatsSupportedForA2DP", "(Ljava/util/ArrayList;)I",
(void*)android_media_AudioSystem_getHwOffloadEncodingFormatsSupportedForA2DP},
{"setAllowedCapturePolicy", "(II)I", (void *)android_media_AudioSystem_setAllowedCapturePolicy},
+ {"setRttEnabled", "(Z)I", (void *)android_media_AudioSystem_setRttEnabled},
};
static const JNINativeMethod gEventHandlerMethods[] = {
import android.content.pm.PackageManager;
import android.media.audiofx.AudioEffect;
import android.media.audiopolicy.AudioMix;
-import android.os.Build;
import android.util.Log;
import java.util.ArrayList;
public static native boolean getMasterMono();
/** @hide enables or disables the master mono mode. */
public static native int setMasterMono(boolean mono);
+ /** @hide enables or disables the RTT mode. */
+ public static native int setRttEnabled(boolean enabled);
/** @hide returns master balance value in range -1.f -> 1.f, where 0.f is dead center. */
@TestApi
sendEncodedSurroundMode(mContentResolver, "onAudioServerDied");
sendEnabledSurroundFormats(mContentResolver, true);
updateAssistantUId(true);
+ updateRttEanbled(mContentResolver);
}
synchronized (mAccessibilityServiceUidsLock) {
AudioSystem.setA11yServicesUids(mAccessibilityServiceUids);
}
}
+ private void updateRttEanbled(ContentResolver cr) {
+ final boolean rttEnabled = Settings.Secure.getIntForUser(cr,
+ Settings.Secure.RTT_CALLING_MODE, 0, UserHandle.USER_CURRENT) != 0;
+ AudioSystem.setRttEnabled(rttEnabled);
+ }
+
private void readPersistedSettings() {
final ContentResolver cr = mContentResolver;
sendEncodedSurroundMode(cr, "readPersistedSettings");
sendEnabledSurroundFormats(cr, true);
updateAssistantUId(true);
+ updateRttEanbled(cr);
}
mMuteAffectedStreams = System.getIntForUser(cr,
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.VOICE_INTERACTION_SERVICE), false, this);
+ mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
+ Settings.Secure.RTT_CALLING_MODE), false, this);
}
@Override
updateEncodedSurroundOutput();
sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged);
updateAssistantUId(false);
+ updateRttEanbled(mContentResolver);
}
}