@@ -910,11 +910,45 @@ class AirPodsService : Service() {
910910 startForegroundNotification()
911911 initGestureDetector()
912912
913+ sharedPreferences = getSharedPreferences(" settings" , MODE_PRIVATE )
914+
915+ with (sharedPreferences) {
916+ val editor = edit()
917+
918+ if (! contains(" conversational_awareness_pause_music" )) editor.putBoolean(" conversational_awareness_pause_music" , false )
919+ if (! contains(" personalized_volume" )) editor.putBoolean(" personalized_volume" , false )
920+ if (! contains(" automatic_ear_detection" )) editor.putBoolean(" automatic_ear_detection" , true )
921+ if (! contains(" long_press_nc" )) editor.putBoolean(" long_press_nc" , true )
922+ if (! contains(" off_listening_mode" )) editor.putBoolean(" off_listening_mode" , false )
923+ if (! contains(" show_phone_battery_in_widget" )) editor.putBoolean(" show_phone_battery_in_widget" , true )
924+ if (! contains(" single_anc" )) editor.putBoolean(" single_anc" , true )
925+ if (! contains(" long_press_transparency" )) editor.putBoolean(" long_press_transparency" , true )
926+ if (! contains(" conversational_awareness" )) editor.putBoolean(" conversational_awareness" , true )
927+ if (! contains(" relative_conversational_awareness_volume" )) editor.putBoolean(" relative_conversational_awareness_volume" , true )
928+ if (! contains(" long_press_adaptive" )) editor.putBoolean(" long_press_adaptive" , true )
929+ if (! contains(" loud_sound_reduction" )) editor.putBoolean(" loud_sound_reduction" , true )
930+ if (! contains(" long_press_off" )) editor.putBoolean(" long_press_off" , false )
931+ if (! contains(" volume_control" )) editor.putBoolean(" volume_control" , true )
932+ if (! contains(" head_gestures" )) editor.putBoolean(" head_gestures" , true )
933+
934+ if (! contains(" adaptive_strength" )) editor.putInt(" adaptive_strength" , 51 )
935+ if (! contains(" tone_volume" )) editor.putInt(" tone_volume" , 75 )
936+ if (! contains(" conversational_awareness_volume" )) editor.putInt(" conversational_awareness_volume" , 43 )
937+
938+ if (! contains(" textColor" )) editor.putLong(" textColor" , - 1L )
939+
940+ if (! contains(" qs_click_behavior" )) editor.putString(" qs_click_behavior" , " cycle" )
941+ if (! contains(" name" )) editor.putString(" name" , " AirPods" )
942+
943+ editor.apply ()
944+ }
945+
946+ earDetectionEnabled = sharedPreferences.getBoolean(" automatic_ear_detection" , true )
947+
913948 ancModeReceiver = object : BroadcastReceiver () {
914949 override fun onReceive (context : Context ? , intent : Intent ? ) {
915950 if (intent?.action == " me.kavishdevar.librepods.SET_ANC_MODE" ) {
916951 if (intent.hasExtra(" mode" )) {
917- // If a specific mode is requested, use it
918952 val mode = intent.getIntExtra(" mode" , - 1 )
919953 if (mode in 1 .. 4 ) {
920954 setANCMode(mode)
0 commit comments