Ringer mode changed from vibrate to normal when it shouldn't

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
Scott
Posts: 24
Joined: 12 Dec 2015 00:09

Ringer mode changed from vibrate to normal when it shouldn't

Post by Scott » 13 Jan 2016 15:50

The flow shown below behaves strangely, as far as I can tell. When my ringer mode is silent, it works as expected; the sound file is played and the ringer mode stays "silent."

But if the ringer mode is vibrate, the flow never gets past the action that sets the notification volume. After that action, it splits into two conditions that check for silent mode and vibrate mode. Both come back "false" because the ringer mode has been changed (directly or indirectly by Automagic) to normal mode. The phone remains in normal mode after that.

Why is this happening?

I created a different version of the flow, and that one works properly. Instead of checking for normal ringer mode and proceeding if it's not, I split it immediately after the trigger into two streams that check for silent and vibrate mode separately. That version works fine and the ringer mode remains in vibrate, as expected.

I don't get it.

I've edited the flow and log to remove private information; the actual flow and log have real contact information, of course.

The flow that DOES work as expected:
workingflow.png
workingflow.png (182.08 KiB) Viewed 8305 times
The flow that is not working as expected:
screwyflow.png
screwyflow.png (136.11 KiB) Viewed 8305 times
Code from the flow that is not working as expected:

Code: Select all

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<data version="1.29.0">
  <trigger type="incoming_call">
    <useDefaultName>true</useDefaultName>
    <name>Incoming Call. State: Ringing, Numbers: *(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX</name>
    <enabled>false</enabled>
    <all>false</all>
    <incomingNumbersList>*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX</incomingNumbersList>
    <handleSuppressedCallnumber>false</handleSuppressedCallnumber>
    <ringing>true</ringing>
    <offhook>false</offhook>
    <idle>false</idle>
    <missedRejected>false</missedRejected>
  </trigger>
  <condition type="call_state">
    <useDefaultName>true</useDefaultName>
    <name>Call State: Off-hook</name>
    <idle>false</idle>
    <ringing>false</ringing>
    <offhook>true</offhook>
  </condition>
  <condition type="call_state">
    <useDefaultName>true</useDefaultName>
    <name>Call State: Ringing</name>
    <idle>false</idle>
    <ringing>true</ringing>
    <offhook>false</offhook>
  </condition>
  <condition type="ringer_mode">
    <useDefaultName>true</useDefaultName>
    <name>Ringer Mode: Normal</name>
    <ringerMode>NORMAL</ringerMode>
  </condition>
  <condition type="ringer_mode">
    <useDefaultName>true</useDefaultName>
    <name>Ringer Mode: Silent</name>
    <ringerMode>SILENT</ringerMode>
  </condition>
  <condition type="ringer_mode">
    <useDefaultName>true</useDefaultName>
    <name>Ringer Mode: Vibrate</name>
    <ringerMode>VIBRATE</ringerMode>
  </condition>
  <action type="notification_screen">
    <useDefaultName>true</useDefaultName>
    <name>Notification on Screen: Overriding silent mode for incoming call from {contact_name} ({incoming_number}) (long)</name>
    <showText>true</showText>
    <text>Overriding silent mode for incoming call from {contact_name} ({incoming_number})</text>
    <widgetName></widgetName>
    <width>200</width>
    <height>250</height>
    <stretchToFillArea>false</stretchToFillArea>
    <opacity>1.0</opacity>
    <durationLong>true</durationLong>
    <customPosition>false</customPosition>
    <gravityType>TOP_LEFT</gravityType>
    <xOffset>0</xOffset>
    <yOffset>0</yOffset>
  </action>
  <action type="notification_screen">
    <useDefaultName>true</useDefaultName>
    <name>Notification on Screen: Overriding vibrate mode for incoming call from {contact_name} ({incoming_number}) (long)</name>
    <showText>true</showText>
    <text>Overriding vibrate mode for incoming call from {contact_name} ({incoming_number})</text>
    <widgetName></widgetName>
    <width>200</width>
    <height>250</height>
    <stretchToFillArea>false</stretchToFillArea>
    <opacity>1.0</opacity>
    <durationLong>true</durationLong>
    <customPosition>false</customPosition>
    <gravityType>TOP_LEFT</gravityType>
    <xOffset>0</xOffset>
    <yOffset>0</yOffset>
  </action>
  <action type="restore_audio_stream_volume">
    <useDefaultName>true</useDefaultName>
    <name>Restore Audio Volumes</name>
    <restoreVolumeAlarm>false</restoreVolumeAlarm>
    <variableVolumeAlarm>global_volume_alarm</variableVolumeAlarm>
    <restoreVolumeDTMF>false</restoreVolumeDTMF>
    <variableVolumeDTMF>global_volume_dtmf</variableVolumeDTMF>
    <restoreVolumeMusic>false</restoreVolumeMusic>
    <variableVolumeMusic>global_volume_music</variableVolumeMusic>
    <restoreVolumeNotification>true</restoreVolumeNotification>
    <variableVolumeNotification>global_volume_notification</variableVolumeNotification>
    <restoreVolumeRing>false</restoreVolumeRing>
    <variableVolumeRing>global_volume_ring</variableVolumeRing>
    <restoreVolumeSystem>false</restoreVolumeSystem>
    <variableVolumeSystem>global_volume_system</variableVolumeSystem>
    <restoreVolumeVoiceCall>false</restoreVolumeVoiceCall>
    <variableVolumeVoiceCall>global_volume_voice_call</variableVolumeVoiceCall>
    <restoreRingerMode>false</restoreRingerMode>
    <variableRingerMode>global_ringer_mode</variableRingerMode>
    <restoreInterruptionsMode>false</restoreInterruptionsMode>
    <variableInterruptionsMode>global_interruptions_mode</variableInterruptionsMode>
  </action>
  <action type="set_audio_stream_volume">
    <useDefaultName>true</useDefaultName>
    <name>Set Audio Stream Volume: Notification to level 4</name>
    <audioStreamType>NOTIFICATION</audioStreamType>
    <volumeIndex>4</volumeIndex>
    <playSound>false</playSound>
    <showUI>false</showUI>
  </action>
  <action type="sound">
    <useDefaultName>true</useDefaultName>
    <name>Sound: Callisto as Notification</name>
    <soundSourceType>BUILTIN</soundSourceType>
    <alarmName>Callisto</alarmName>
    <uri>content://media/internal/audio/media/28</uri>
    <path></path>
    <audioStreamType>NOTIFICATION</audioStreamType>
    <showStopSoundNotification>true</showStopSoundNotification>
    <waitForSoundToFinish>true</waitForSoundToFinish>
    <requestAudioFocus>true</requestAudioFocus>
    <audioFocusType>PERMANENT</audioFocusType>
  </action>
  <action type="store_audio_stream_volume">
    <useDefaultName>true</useDefaultName>
    <name>Store Audio Volumes</name>
    <storeVolumeAlarm>false</storeVolumeAlarm>
    <variableVolumeAlarm>global_volume_alarm</variableVolumeAlarm>
    <storeVolumeDTMF>false</storeVolumeDTMF>
    <variableVolumeDTMF>global_volume_dtmf</variableVolumeDTMF>
    <storeVolumeMusic>false</storeVolumeMusic>
    <variableVolumeMusic>global_volume_music</variableVolumeMusic>
    <storeVolumeNotification>true</storeVolumeNotification>
    <variableVolumeNotification>global_volume_notification</variableVolumeNotification>
    <storeVolumeRing>false</storeVolumeRing>
    <variableVolumeRing>global_volume_ring</variableVolumeRing>
    <storeVolumeSystem>false</storeVolumeSystem>
    <variableVolumeSystem>global_volume_system</variableVolumeSystem>
    <storeVolumeVoiceCall>false</storeVolumeVoiceCall>
    <variableVolumeVoiceCall>global_volume_voice_call</variableVolumeVoiceCall>
    <storeRingerMode>false</storeRingerMode>
    <variableRingerMode>global_ringer_mode</variableRingerMode>
    <storeInterruptionsMode>false</storeInterruptionsMode>
    <variableInterruptionsMode>global_interruptions_mode</variableInterruptionsMode>
  </action>
  <flow type="flow">
    <name>Ring upon incoming call from important contacts - screwy</name>
    <group>Calls</group>
    <enabled>false</enabled>
    <executionPolicy>SKIP</executionPolicy>
    <actioncontainer id="t1" x="69.99999" y="402.5">Store Audio Volumes</actioncontainer>
    <actioncontainer id="t2" x="70.000015" y="1452.5">Restore Audio Volumes</actioncontainer>
    <actioncontainer id="t3" x="70.00004" y="1102.5">Sound: Callisto as Notification</actioncontainer>
    <conditioncontainer id="t4" x="-35.000008" y="752.5">Ringer Mode: Silent</conditioncontainer>
    <actioncontainer id="t5" x="-34.999985" y="927.5">Notification on Screen: Overriding silent mode for incoming call from {contact_name} ({incoming_number}) (long)</actioncontainer>
    <actioncontainer id="t6" x="70.0" y="577.5">Set Audio Stream Volume: Notification to level 4</actioncontainer>
    <conditioncontainer id="t7" x="69.999954" y="1277.5002">Call State: Ringing</conditioncontainer>
    <conditioncontainer id="t8" x="69.99999" y="227.49997">Call State: Off-hook</conditioncontainer>
    <triggercontainer id="t9" x="70.00001" y="-122.500015">
      <trigger>Incoming Call. State: Ringing, Numbers: *(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX</trigger>
    </triggercontainer>
    <actioncontainer id="t10" x="174.99998" y="927.5">Notification on Screen: Overriding vibrate mode for incoming call from {contact_name} ({incoming_number}) (long)</actioncontainer>
    <conditioncontainer id="t11" x="175.00003" y="752.5">Ringer Mode: Vibrate</conditioncontainer>
    <conditioncontainer id="t12" x="69.999985" y="52.500004">Ringer Mode: Normal</conditioncontainer>
    <connection from="t1" to="t6" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t3" to="t7" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t4" to="t5" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t5" to="t3" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t6" to="t4" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t6" to="t11" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t7" to="t2" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t7" to="t11" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t7" to="t4" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t8" to="t1" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t9" to="t12" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t10" to="t3" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t11" to="t10" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
    <connection from="t12" to="t8" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
  </flow>
</data>
A log of the flow executing:

Code: Select all

13.01.2016 08:31:19.086 Trigger 'Incoming Call. State: Ringing, Numbers: *(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX' special characters of number '*(XXX) XXX-XXXX' have been removed, using number '*XXXXXXXXXX' to compare
13.01.2016 08:31:19.086 Trigger 'Incoming Call. State: Ringing, Numbers: *(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX' special characters of number '*(XXX) XXX-XXXX' have been removed, using number '*XXXXXXXXXX' to compare
13.01.2016 08:31:19.087 Trigger 'Incoming Call. State: Ringing, Numbers: *(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX' special characters of number '*(XXX) XXX-XXXX' have been removed, using number '*XXXXXXXXXX' to compare
13.01.2016 08:31:19.087 Trigger 'Incoming Call. State: Ringing, Numbers: *(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX' special characters of number '*(XXX) XXX-XXXX' have been removed, using number '*XXXXXXXXXX' to compare
13.01.2016 08:31:19.157 Trigger 'Incoming Call. State: Ringing, Numbers: *(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX' going to execute flows
13.01.2016 08:31:19.159 [Ring upon incoming call from important contacts - screwy] Starting to execute flow 'Ring upon incoming call from important contacts - screwy' with Context{global{global_volume_notification=0,global_flashlight_on=false},local{contact_note=,contact_email=xxxxx@gmail.com,incoming_number=XXXXXXXXXX,contact_company=,contact_name=Xxxx,triggertime=1452691879086,contact_groups=[Starred in Android, My Contacts],flow_name=Ring upon incoming call from important contacts - screwy,contact_title=,call_missed_rejected=false,trigger=Incoming Call. State: Ringing, Numbers: *(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XXX-XXXX,*(XXX) XX...,contact_nickname=,call_state=RINGING}}
13.01.2016 08:31:19.160 [Ring upon incoming call from important contacts - screwy] Start executing condition 'Ringer Mode: Normal'
13.01.2016 08:31:19.161 [Ring upon incoming call from important contacts - screwy] End executing condition 'Ringer Mode: Normal' with return value false
13.01.2016 08:31:19.195 [Ring upon incoming call from important contacts - screwy] Flow continues executing with the next step.
13.01.2016 08:31:19.195 [Ring upon incoming call from important contacts - screwy] Start executing condition 'Call State: Off-hook'
13.01.2016 08:31:19.698 [Ring upon incoming call from important contacts - screwy] End executing condition 'Call State: Off-hook' with return value false
13.01.2016 08:31:19.729 [Ring upon incoming call from important contacts - screwy] Flow continues executing with the next step.
13.01.2016 08:31:19.729 [Ring upon incoming call from important contacts - screwy] Start executing action 'Store Audio Volumes'
13.01.2016 08:31:19.730 [Ring upon incoming call from important contacts - screwy] Action 'Store Audio Volumes' Set global_volume_notification to 0
13.01.2016 08:31:19.730 [Ring upon incoming call from important contacts - screwy] End executing action 'Store Audio Volumes'
13.01.2016 08:31:19.731 [Ring upon incoming call from important contacts - screwy] Flow continues executing with the next step.
13.01.2016 08:31:19.731 [Ring upon incoming call from important contacts - screwy] Start executing action 'Set Audio Stream Volume: Notification to level 4'
13.01.2016 08:31:19.768 [Ring upon incoming call from important contacts - screwy] End executing action 'Set Audio Stream Volume: Notification to level 4'
13.01.2016 08:31:19.769 [Ring upon incoming call from important contacts - screwy] Flow continues executing with the next step.
13.01.2016 08:31:19.769 [Ring upon incoming call from important contacts - screwy] Start executing condition 'Ringer Mode: Silent'
13.01.2016 08:31:19.769 [Ring upon incoming call from important contacts - screwy] End executing condition 'Ringer Mode: Silent' with return value false
13.01.2016 08:31:19.770 [Ring upon incoming call from important contacts - screwy] Start executing condition 'Ringer Mode: Vibrate'
13.01.2016 08:31:19.772 [Ring upon incoming call from important contacts - screwy] End executing condition 'Ringer Mode: Vibrate' with return value false
13.01.2016 08:31:19.772 [Ring upon incoming call from important contacts - screwy] Flow ended.
Samsung Galaxy S9+ (unrooted and cannot/will not root), Android 9.0
Latest stable Automagic version, always

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Ringer mode changed from vibrate to normal when it shoul

Post by Martin » 13 Jan 2016 20:18

Hi,

Android probably changes the ringer mode to 'Normal' when the notification volume is changed to 4. I think your flow that checks the ringer mode before it changes the notification volume is a good workaround.
Android seems not to do this for all audio streams. Maybe I could offer an option in action Notification on Statusbar to play the sound on the alarm stream which could work in this case.

Regards,
Martin

User avatar
Scott
Posts: 24
Joined: 12 Dec 2015 00:09

Re: Ringer mode changed from vibrate to normal when it shoul

Post by Scott » 13 Jan 2016 22:15

After more testing (which I should have done before even asking), I see you're exactly right, Martin. Setting the notification stream to 4 changes the ringer mode from vibrate to normal. And the "restore audio volumes" action sets it back to vibrate mode. Thank you!
Samsung Galaxy S9+ (unrooted and cannot/will not root), Android 9.0
Latest stable Automagic version, always

Post Reply