1

App context detects that app is not running but app was running

on some phones running Android 9/10 (Oukitel, Blackview, Cubot) I try to launch an app, when it is not running but the app is launched all the time even though it was already running, except if that app is in the foreground.

This does not happen with OnePlus 5T with Android 9.

While I found a workaround via notification checks and time limits, I prefer that this context was not reporting false results.

Can you help with a fix?

2 replies

SI

not really much in that test profile.

maybe it's a matter of permissions, but I don't know which ones.

maybe it's actually the test method that doesn't work as it should on some phones.

If did find a better workaround however. As opposed to the workaround via notification or the one via failure upon action (for autoinput), or the one via logfile age ... it works for all applications as long as they are listed with a pid in dumpsys activity.

I'm going to enhance this basic profile with some (more) entries into a custom logfile.
but such an enhanced version would probably not serve much purpose here.

Example profile xml below

<TaskerData sr="" dvi="1" tv="6.1.3-beta">
<Profile sr="prof41" ve="2">
<cdate>1681241396213</cdate>
<clp>true</clp>
<edate>1681317250362</edate>
<flags>8</flags>
<id>41</id>
<mid0>39</mid0>
<nme>DrSafety RunCheck</nme>
<Time sr="con0">
<fh>0</fh>
<fm>1</fm>
<rep>2</rep>
<repval>2</repval>
<th>23</th>
<tm>59</tm>
</Time>
</Profile>
<Task sr="task39">
<cdate>1681152680603</cdate>
<edate>1681315923823</edate>
<id>39</id>
<nme>DrSafety Conditional Launch</nme>
<pri>6</pri>
<Action sr="act0" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="9"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>39</code>
<Str sr="arg0" ve="3">%loop</Str>
<Str sr="arg1" ve="3">0 1 2 3 4</Str>
<Int sr="arg2" val="0"/>
</Action>
<Action sr="act2" ve="7">
<code>123</code>
<se>false</se>
<Str sr="arg0" ve="3">dumpsys activity | grep trendmicro | grep ProcessRecord</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="0"/>
<Str sr="arg3" ve="3">%activity</Str>
<Str sr="arg4" ve="3">%stderr</Str>
<Str sr="arg5" ve="3"/>
<Int sr="arg6" val="1"/>
<Int sr="arg7" val="0"/>
</Action>
<Action sr="act3" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%activity</lhs>
<op>13</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act4" ve="7">
<code>20</code>
<se>false</se>
<App sr="arg0">
<appClass>com.trendmicro.freetmms.gmobi.component.ui.splash.SplashActivity</appClass>
<appPkg>com.trendmicro.freetmms.gmobi</appPkg>
<label>Dr. Safety</label>
</App>
<Str sr="arg1" ve="3"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act5" ve="7">
<code>43</code>
</Action>
<Action sr="act6" ve="7">
<code>396</code>
<se>false</se>
<Bundle sr="arg0">
<Vals sr="val">
<net.dinglisch.android.tasker.RELEVANT_VARIABLES>&lt;StringArray sr=""&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;%mt_groups()
Groups
&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1&gt;%mt_match_found
Is Match
true if there was a match, false otherwise&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2&gt;%mt_match
Match
Can also be accessed as an array&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2&gt;&lt;/StringArray&gt;</net.dinglisch.android.tasker.RELEVANT_VARIABLES>
<net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>[Ljava.lang.String;</net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>
</Vals>
</Bundle>
<Int sr="arg1" val="1"/>
<Str sr="arg2" ve="3">%activity</Str>
<Str sr="arg3" ve="3"> ([0-9]+):</Str>
<Str sr="arg4" ve="3"/>
</Action>
<Action sr="act7" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">Pid of DrSafety is %mt_groups1</Str>
<Int sr="arg1" val="0"/>
<Str sr="arg10" ve="3"/>
<Int sr="arg11" val="1"/>
<Int sr="arg12" val="0"/>
<Str sr="arg13" ve="3"/>
<Int sr="arg14" val="0"/>
<Int sr="arg2" val="0"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Str sr="arg8" ve="3"/>
<Int sr="arg9" val="1"/>
</Action>
<Action sr="act8" ve="7">
<code>38</code>
</Action>
<Action sr="act9" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="19"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act10" ve="7">
<code>40</code>
</Action>
</Task>
</TaskerData>

Can you please export your profile's description (not xml) so I can take a look? Long-click the profile in Tasker->export description Thanks in advance