From 63264fcf9b0e0d6cd7d56a28c8e441ff91b490c1 Mon Sep 17 00:00:00 2001 From: jens Date: Sun, 14 Dec 2025 12:49:58 +0100 Subject: [PATCH] Profile activation logs --- .../java/com/jens/automation2/Profile.java | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/jens/automation2/Profile.java b/app/src/main/java/com/jens/automation2/Profile.java index c17e6ef..8260462 100644 --- a/app/src/main/java/com/jens/automation2/Profile.java +++ b/app/src/main/java/com/jens/automation2/Profile.java @@ -544,56 +544,90 @@ public class Profile implements Comparable AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE); if(changeSoundMode) - Actions.setSound(context, soundMode); + { + Miscellaneous.logEvent("i", "Profile", "Setting sound mode to " + String.valueOf(soundMode), 4); + Actions.setSound(context, soundMode); + } if(changeDndMode) - Actions.setDoNotDisturb(context, dndMode); + { + Miscellaneous.logEvent("i", "Profile", "Setting DND mode to " + String.valueOf(dndMode), 4); + Actions.setDoNotDisturb(context, dndMode); + } if(changeVolumeMusicVideoGameMedia) - am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND); + { + Miscellaneous.logEvent("i", "Profile", "Setting media volume to " + String.valueOf(volumeMusic), 4); + am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND); + } if(changeVolumeNotifications) - am.setStreamVolume(AudioManager.STREAM_NOTIFICATION, volumeNotifications, AudioManager.FLAG_PLAY_SOUND); + { + Miscellaneous.logEvent("i", "Profile", "Setting notification volume to " + String.valueOf(volumeNotifications), 4); + am.setStreamVolume(AudioManager.STREAM_NOTIFICATION, volumeNotifications, AudioManager.FLAG_PLAY_SOUND); + } if(Build.VERSION.SDK_INT >= 34) { if (changeVolumeRingtones) - am.setStreamVolume(AudioManager.STREAM_RING, volumeRingtones, AudioManager.FLAG_PLAY_SOUND); + { + Miscellaneous.logEvent("i", "Profile", "Setting ring volume to " + String.valueOf(volumeRingtones), 4); + am.setStreamVolume(AudioManager.STREAM_RING, volumeRingtones, AudioManager.FLAG_PLAY_SOUND); + } } if(changeVolumeAlarms) - am.setStreamVolume(AudioManager.STREAM_ALARM, volumeAlarms, AudioManager.FLAG_PLAY_SOUND); + { + Miscellaneous.logEvent("i", "Profile", "Setting alarm volume to " + String.valueOf(volumeAlarms), 4); + am.setStreamVolume(AudioManager.STREAM_ALARM, volumeAlarms, AudioManager.FLAG_PLAY_SOUND); + } if(changeIncomingCallsRingtone) - if(incomingCallsRingtone != null) - applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context); - + { + if (incomingCallsRingtone != null) + { + Miscellaneous.logEvent("i", "Profile", "Setting ringtone " + incomingCallsRingtone, 4); + applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context); + } + } + if(changeVibrateWhenRinging) { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Miscellaneous.logEvent("i", "Profile", "Setting vibrate when ringing to " + String.valueOf(vibrateWhenRinging?1:0), 4); android.provider.Settings.System.putInt(context.getContentResolver(), "vibrate_when_ringing", vibrateWhenRinging?1:0); } else { + Miscellaneous.logEvent("i", "Profile", "Setting vibrate when ringing to " + String.valueOf(vibrateWhenRinging), 4); + if (vibrateWhenRinging) - am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON); + am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON); else am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF); } } if(changeNotificationRingtone) - if(notificationRingtone != null) - applyRingTone(notificationRingtone, RingtoneManager.TYPE_NOTIFICATION, context); + { + if (notificationRingtone != null) + { + Miscellaneous.logEvent("i", "Profile", "Setting notification ringtone to " + String.valueOf(notificationRingtone), 4); + applyRingTone(notificationRingtone, RingtoneManager.TYPE_NOTIFICATION, context); + } + } if(changeScreenLockUnlockSound) { + Miscellaneous.logEvent("i", "Profile", "Setting lockscreen sounds enabled to " + String.valueOf(screenLockUnlockSound ? 1 : 0), 4); android.provider.Settings.System.putInt(context.getContentResolver(), "lockscreen_sounds_enabled" , screenLockUnlockSound ? 1 : 0); } if(changeAudibleSelection) { + Miscellaneous.logEvent("i", "Profile", "Setting audible selection to " + String.valueOf(audibleSelection ? 1 : 0), 4); + if(audibleSelection) android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.SOUND_EFFECTS_ENABLED, 1); // enable else @@ -602,6 +636,8 @@ public class Profile implements Comparable if(changeHapticFeedback) { + Miscellaneous.logEvent("i", "Profile", "Setting haptic feedback to " + String.valueOf(hapticFeedback ? 1 : 0), 4); + if(hapticFeedback) android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED, 1); // enable else @@ -614,7 +650,8 @@ public class Profile implements Comparable } finally { - Miscellaneous.logEvent("i", "Profile", "Checking for applicable rules after profile " + this.getName() + " has been activated.", 2); + Miscellaneous.logEvent("i", "Profile", "Profile activation complete: " + this.getName(), 3); + Miscellaneous.logEvent("i", "Profile", "Checking for applicable rules after profile " + this.getName() + " has been activated.", 3); List ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.profileActive); for(int i=0; i