1

%caller reports incorrect context when the same named task is called by two profiles at the same time

I've discovered that %caller reports the wrong context when two different contexts with the same priority call the same named task at the same time.

You can reproduce this by creating a named task (I called mine Collision Test), with collision handling set to "Run Both Together" with the following action:

  1. Array Push: %Collision, Position: 1, Value: %caller()

Then call the task "Collision Test" in both the entry and exit tasks of two different contexts that have the same priority:

  • Collision Test 1: State -> Variable Value: %Collision_Test ~ true
  • Collision Test 2: State -> Variable Value: %Collision_Test !~ true

Now manually set the variable %Collision_Test to true. The array %Collision will return the same value for both %Collision1 and %Collision2. Both will refer to the same Context, and, at least on my device, both report as being called by an entry task, even though one of the task instances was called as an exit task.

The other confusing aspect is that the instance called as an exit task should have elevated priority, and so the two tasks shouldn't even be running together at all. The enter task should be queued after the exit task instead of the two running simultaneously (which may be the cause of this issue - the second task submitted might be overwriting the %caller variable since Tasker is alternating execution of the two actions).