Profile activation logs
This commit is contained in:
@@ -544,38 +544,64 @@ public class Profile implements Comparable<Profile>
|
|||||||
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
|
||||||
if(changeSoundMode)
|
if(changeSoundMode)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting sound mode to " + String.valueOf(soundMode), 4);
|
||||||
Actions.setSound(context, soundMode);
|
Actions.setSound(context, soundMode);
|
||||||
|
}
|
||||||
|
|
||||||
if(changeDndMode)
|
if(changeDndMode)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting DND mode to " + String.valueOf(dndMode), 4);
|
||||||
Actions.setDoNotDisturb(context, dndMode);
|
Actions.setDoNotDisturb(context, dndMode);
|
||||||
|
}
|
||||||
|
|
||||||
if(changeVolumeMusicVideoGameMedia)
|
if(changeVolumeMusicVideoGameMedia)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting media volume to " + String.valueOf(volumeMusic), 4);
|
||||||
am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND);
|
am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND);
|
||||||
|
}
|
||||||
|
|
||||||
if(changeVolumeNotifications)
|
if(changeVolumeNotifications)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting notification volume to " + String.valueOf(volumeNotifications), 4);
|
||||||
am.setStreamVolume(AudioManager.STREAM_NOTIFICATION, volumeNotifications, AudioManager.FLAG_PLAY_SOUND);
|
am.setStreamVolume(AudioManager.STREAM_NOTIFICATION, volumeNotifications, AudioManager.FLAG_PLAY_SOUND);
|
||||||
|
}
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= 34)
|
if(Build.VERSION.SDK_INT >= 34)
|
||||||
{
|
{
|
||||||
if (changeVolumeRingtones)
|
if (changeVolumeRingtones)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting ring volume to " + String.valueOf(volumeRingtones), 4);
|
||||||
am.setStreamVolume(AudioManager.STREAM_RING, volumeRingtones, AudioManager.FLAG_PLAY_SOUND);
|
am.setStreamVolume(AudioManager.STREAM_RING, volumeRingtones, AudioManager.FLAG_PLAY_SOUND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(changeVolumeAlarms)
|
if(changeVolumeAlarms)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting alarm volume to " + String.valueOf(volumeAlarms), 4);
|
||||||
am.setStreamVolume(AudioManager.STREAM_ALARM, volumeAlarms, AudioManager.FLAG_PLAY_SOUND);
|
am.setStreamVolume(AudioManager.STREAM_ALARM, volumeAlarms, AudioManager.FLAG_PLAY_SOUND);
|
||||||
|
}
|
||||||
|
|
||||||
if(changeIncomingCallsRingtone)
|
if(changeIncomingCallsRingtone)
|
||||||
|
{
|
||||||
if (incomingCallsRingtone != null)
|
if (incomingCallsRingtone != null)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting ringtone " + incomingCallsRingtone, 4);
|
||||||
applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
|
applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(changeVibrateWhenRinging)
|
if(changeVibrateWhenRinging)
|
||||||
{
|
{
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
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);
|
android.provider.Settings.System.putInt(context.getContentResolver(), "vibrate_when_ringing", vibrateWhenRinging?1:0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting vibrate when ringing to " + String.valueOf(vibrateWhenRinging), 4);
|
||||||
|
|
||||||
if (vibrateWhenRinging)
|
if (vibrateWhenRinging)
|
||||||
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
|
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
|
||||||
else
|
else
|
||||||
@@ -584,16 +610,24 @@ public class Profile implements Comparable<Profile>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(changeNotificationRingtone)
|
if(changeNotificationRingtone)
|
||||||
|
{
|
||||||
if (notificationRingtone != null)
|
if (notificationRingtone != null)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting notification ringtone to " + String.valueOf(notificationRingtone), 4);
|
||||||
applyRingTone(notificationRingtone, RingtoneManager.TYPE_NOTIFICATION, context);
|
applyRingTone(notificationRingtone, RingtoneManager.TYPE_NOTIFICATION, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(changeScreenLockUnlockSound)
|
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);
|
android.provider.Settings.System.putInt(context.getContentResolver(), "lockscreen_sounds_enabled" , screenLockUnlockSound ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(changeAudibleSelection)
|
if(changeAudibleSelection)
|
||||||
{
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting audible selection to " + String.valueOf(audibleSelection ? 1 : 0), 4);
|
||||||
|
|
||||||
if(audibleSelection)
|
if(audibleSelection)
|
||||||
android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.SOUND_EFFECTS_ENABLED, 1); // enable
|
android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.SOUND_EFFECTS_ENABLED, 1); // enable
|
||||||
else
|
else
|
||||||
@@ -602,6 +636,8 @@ public class Profile implements Comparable<Profile>
|
|||||||
|
|
||||||
if(changeHapticFeedback)
|
if(changeHapticFeedback)
|
||||||
{
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Profile", "Setting haptic feedback to " + String.valueOf(hapticFeedback ? 1 : 0), 4);
|
||||||
|
|
||||||
if(hapticFeedback)
|
if(hapticFeedback)
|
||||||
android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED, 1); // enable
|
android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED, 1); // enable
|
||||||
else
|
else
|
||||||
@@ -614,7 +650,8 @@ public class Profile implements Comparable<Profile>
|
|||||||
}
|
}
|
||||||
finally
|
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<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.profileActive);
|
List<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.profileActive);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user