You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-8Lines changed: 17 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
1
# Activity State Changes Tasker Project
2
2
3
-
`Activity State Changes Tasker Project` for android provides a way to detect android app activity state changes like activity changes in the same app or between different ones or if an activity enters or exits the fullscreen mode. This majorly relies on logcat entries detected using the Tasker `Logcat Entry` Profile and requires Tasker to be granted `android.permission.READ_LOGS`.
3
+
`Activity State Changes Tasker Project` for android provides a way to detect android app activity state changes like activity changes in the same app or between different ones or if an activity enters or exits the fullscreen mode using the [Tasker App]. This majorly relies on logcat entries detected using the Tasker `Logcat Entry` Profile and requires Tasker to be granted `android.permission.READ_LOGS`.
4
4
##
5
5
6
6
7
7
### Contents
8
8
-[Project Details](#Project-Details)
9
9
-[How Project Works](#How-Project-Works)
10
10
-[Activity States And Transitions](#Activity-States-And-Transitions)
11
+
-[Compatibility](#Compatibility)
11
12
-[Dependencies](#Dependencies)
12
13
-[Downloads](#Downloads)
13
14
-[Install Instructions For Tasker In Android](#Install-Instructions-For-Tasker-In-Android)
@@ -156,15 +157,21 @@ If previous_activity!=current_activity:
156
157
##
157
158
158
159
160
+
### Compatibility
161
+
162
+
- Android using [Tasker App].
163
+
##
164
+
165
+
159
166
### Dependencies
160
167
161
-
- No specific dependencies other than requires Tasker to be granted `android.permission.READ_LOGS`. Either grant it over adb manually using `pm grant net.dinglisch.android.taskerm android.permission.READ_LOGS` command or use the script in [tasker_package_utils](https://github.com/Taskomater/tasker_package_utils) project which has a few more features.
168
+
- No specific dependencies other than requires Tasker to be granted `android.permission.READ_LOGS`. Either grant it over adb manually using `pm grant net.dinglisch.android.taskerm android.permission.READ_LOGS` command or use the script in [tasker_package_utils](https://github.com/Taskomater/tasker_package_utils) project which has a few more features. Root users are automatically granted permissions by Tasker if required.
162
169
##
163
170
164
171
165
172
### Downloads
166
173
167
-
Download `Activity State Changes Tasker Project` latest release from [here](https://github.com/Taskomater/Activity-State-Changes-Tasker-Project/releases).
@@ -177,17 +184,17 @@ Download `Activity State Changes Tasker Project` latest release from [here](http
177
184
178
185
### Usage
179
186
180
-
1. Enable the `ActivityTrigger Activity Start Monitor`, `ActivityManager Activity Config Change Monitor`, `Activity State Change Controller Command Monitor` and `Reset Activity State Change Variables On Monitor Start` Profiles if not already action. You may optionally enable the `Custom Activity Start Monitor` Profile instead of the `ActivityTrigger Activity Start Monitor` Profile if you found Activity resume logcat entries for your device. Do not enable both profiles together.
187
+
1. Enable the `ActivityTrigger Activity Start Monitor`, `ActivityManager Activity Config Change Monitor`, `Activity State Change Controller Command Monitor` and `Reset Activity State Change Variables On Monitor Start` Profiles if not already enabled. You may optionally enable the `Custom Activity Start Monitor` Profile instead of the `ActivityTrigger Activity Start Monitor` Profile if you found Activity resume logcat entries for your device. Do not enable both profiles together.
181
188
182
189
2. Optionally enable the use of non-root modes if you are a root user by disabling the `%use_root_mode` Variable Set action in the `Activity State Change Relay` and `Activity State Change Controller` Tasks or change their values from `1`.
183
190
184
191
3. Enable the `%lc_text` Flash action of the `Activity State Change Relay` Task, the `%enable_debugging` Variable Set action of the `Activity State Change Controller` Task and optionally the `%action\n%%activity_transition` action of the `project_name Activity State Change Responder` Tasks. This should normally give you enough info on what is being run. The Flash actions will of course not be synchronized with what is being run.
185
192
186
-
4. Change the `Wait` action time in the `Activity State Change Relay` Task for the `ActivityTrigger Activity Start Monitor` Profile conditional statement if you are using non-root mode.
193
+
4. Change the `Wait` action time in the `Activity State Change Relay` Task for the `ActivityTrigger Activity Start Monitor` Profile conditional statement if you are using non-root mode. Also use the `App Usage Stats` mode for `Tasker Settings` -> `Monitor` -> `App Check Method` for possibly better results.
187
194
188
195
5. If the fullscreen mode is not always being detected correctly, try to change the `Wait` action time in the `Wait For User To Hide Status Bar By Tapping Screen*` section of the `Activity State Change Controller` Task. Do not forget to tap the screen once to hide the status bar as soon as you enter a fullscreen activity for which you want to detect fullscreen mode. You may optionally not tap it to prevent the respective `project_name Activity State Change Responder` Task from running the fullscreen actions you defined.
189
196
190
-
6. Create `project_name Activity State Change Responder` Tasks for each app you want to handle activity transitions for. The tasks may respond appropriately to activity transitions but must not perform long running operations since `Activity State Change Controller` Task will not finish until the called tasks are finished to maintain order and any queued tasks for it task will also be in waiting. Any long running operations that do not require ordered execution can be run inside the called tasks in additional tasks with `%priority - 1` so that the called tasks can return before the additional tasks finish.
197
+
6. Create `project_name Activity State Change Responder` Tasks for each app you want to handle activity transitions for. The tasks may respond appropriately to activity transitions but must not perform long running operations since `Activity State Change Controller` Task will not finish until the called tasks are finished to maintain order and any queued tasks for it will also be in waiting. Any long running operations that do not require ordered execution can be run inside the called tasks in additional tasks with `%priority - 1` so that the called tasks can return before the additional tasks finish.
191
198
192
199
7. If the default `ActivityTrigger Activity Start Monitor` Profile with the `ActivityTrigger activityPauseTrigger` filter is never triggered, then find matching entries for `ActivityTrigger activityResumeTrigger` or other related pause/resume activity entries for your device in the logcat and update the profile. You may optionally find activity resume entries in your logcat that also contain the package and activity name and update the `Custom Activity Start Monitor` Profile with them. In this case you also need to update the `Variable Search Replace` action in the `Custom Activity Start Monitor` Profile conditional actions in the `Activity State Change Relay` Task to extract the package name and activity name from the logcat entries and set them to `%current_package_and_activity` in the format `package_name/activity_name`.
193
200
@@ -204,7 +211,7 @@ There are a few ways to find device specific logcat entries for various things.
204
211
- If you have root access, then run `logcat | grep -E 'activity|trigger|resume|start|stop|config change|systemuivisibility|statusbar'` in a root shell in termux and then switch to multi-window and then switch between activities to see logcat changes in real time. You can pass any string in a regex to `grep` to filter entries you want to monitor.
205
212
- If you do not have root access, you may run the logcat command above over adb. If you are using windows, then `grep` command will not be available, install `cygwin` if required.
206
213
207
-
To find activity resume entries, adding part of the package or activity name to the filter regex can be helful to narrow down important logcat entries. For LG G5 7.0, the activity resuming entries match the following format:
214
+
To find activity resume entries, adding part of the package or activity name to the filter regex can be helpful to narrow down important logcat entries. For LG G5 7.0, the activity resuming entries match the following format:
- You may increase the priority of `Logcat Entry` Profiles to a number higher than the default `5` to make them run as soon as they are trigerred to store the value of the current package and activity if other lower priority tasks are running in Tasker. But note that using `Wait` actions will prevent other tasks from executing until the profile entry tasks are complete and may create sluggish behaviour.
240
247
241
-
- The dumpsys commands are by default run in `Run Shell` actions with the root toggle enabled. Opening a root shell takes a tiny bit longer than normal non-root shells. If Tasker is installed as a system privileged app and is granted `android.permission.DUMP`, then root shell is not required and the root toggle may be disabled to slightly increase performance. You may use the script in [Tasker Package Utils](https://github.com/Taskomater/tasker_package_utils) project to automatically install tasker as a system privileged app.
248
+
- The dumpsys commands are by default run in `Run Shell` actions with the root toggle enabled. Opening a root shell takes a tiny bit longer than normal non-root shells. If Tasker is installed as a system privileged app and is granted `android.permission.DUMP`, then root shell is not required and the root toggle may be disabled to slightly increase performance. You may use the script in [Tasker Package Utils](https://github.com/Taskomater/tasker_package_utils) project to automatically install Tasker as a system privileged app.
242
249
##
243
250
244
251
@@ -259,3 +266,5 @@ Check [CHANGELOG.md](CHANGELOG.md) file for the **Changelog**.
Copy file name to clipboardExpand all lines: projects/Activity_State_Changes.prj.md
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Export Info:
4
4
**Tasker Version:**`5.9.1`
5
-
**Timestamp:**`2020-01-12 05.23.07`
5
+
**Timestamp:**`2020-01-13 05.28.11`
6
6
7
7
8
8
@@ -110,7 +110,18 @@ This task does not take any parameters or return anything.
110
110
```
111
111
A task is called by the "Activity State Change Controller Command Monitor" Profile when the %ActivityStateChangeControllerCommand variable is set.
112
112
113
-
This task first checks if the current_package_and_activity passed is a valid package and activity name in the format "package_name/activity_name". If it is then it checks if the current activity is in fullscreen mode with status bars hidden either by using the dumpsys command's "mTopIsFullscreen" value if root mode is enabled or from the last "*StatusBar: setSystemUiVisibility" logcat entry's "newVal" bit flags. Then it sets the current_activity_state depending on activity_state_change and fullscreen mode. Then it checks if the a "package_name Activity State Change Responder" Task exists in the Tasker config for the current_package_and_activity or previous_package_and_activity. If either of those exists, then it calculates the previous_activity_task_activity_transition_par and current_activity_task_activity_transition_par depending on activity transitions in the transitions table. Then it calls the "previous_package Activity State Change Responder" Task if it exists with the previous_activity as %par1 and previous_activity_task_activity_transition_par as %par2. Then it calls the "current_package Activity State Change Responder" Task if it exists with the current_activity as %par1 and current_activity_task_activity_transition_par as %par2. Those tasks may respond appropriately to activity transitions but must not perform long running operations since this task will not finish until the called tasks are finished to maintain order and any queued tasks for this task will also be in waiting. Any long running operations that do not require ordered execution can be run inside the called tasks in additional tasks with "%priority - 1" so that the called tasks can return before the additional tasks finish.
113
+
This task first checks if the current_package_and_activity passed is a valid package and activity name in the format "package_name/activity_name".
114
+
115
+
Then it checks if the current activity is in fullscreen mode with status bars hidden either by using the dumpsys command's "mTopIsFullscreen" value if root mode is enabled or from the last "*StatusBar: setSystemUiVisibility" logcat entry's "newVal" bit flags. If no entries are found in the logcat for "setSystemUiVisibility", then it is automatically assumed that activity is in non fullscreeen mode.
116
+
Then it sets the current_activity_state depending on activity_state_change and fullscreen mode.
117
+
118
+
Then it checks if the a "package_name Activity State Change Responder" Task exists in the Tasker config for the current_package_and_activity or previous_package_and_activity. If either of those exists, then it calculates the previous_activity_task_activity_transition_par and current_activity_task_activity_transition_par depending on activity transitions in the transitions table.
119
+
120
+
Then it calls the "previous_package Activity State Change Responder" Task if it exists with the previous_activity as %par1 and previous_activity_task_activity_transition_par as %par2.
121
+
122
+
Then it calls the "current_package Activity State Change Responder" Task if it exists with the current_activity as %par1 and current_activity_task_activity_transition_par as %par2.
123
+
124
+
"*Responder" tasks may respond appropriately to activity transitions but must not perform long running operations since this task will not finish until the called tasks are finished to maintain order and any queued tasks for this task will also be in waiting. Any long running operations that do not require ordered execution can be run inside the called tasks in additional tasks with "%priority - 1" so that the called tasks can return before the additional tasks finish.
114
125
115
126
Check Activity State Changes Project docs to get more info on how this task is called and what it does.
Copy file name to clipboardExpand all lines: projects/Activity_State_Changes.prj.xml
+15-4Lines changed: 15 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ The text that corresponds to the matched logcat entry</_array_net.dinglisch.a
42
42
<Profilesr="prof855"ve="2">
43
43
<cdate>1578295763395</cdate>
44
44
<clp>true</clp>
45
-
<edate>1578787826285</edate>
45
+
<edate>1578875237200</edate>
46
46
<flags>8</flags>
47
47
<id>855</id>
48
48
<mid0>839</mid0>
@@ -85,7 +85,7 @@ The text that corresponds to the matched logcat entry</_array_net.dinglisch.a
85
85
<Profilesr="prof863"ve="2">
86
86
<cdate>1578401192742</cdate>
87
87
<clp>true</clp>
88
-
<edate>1578787826880</edate>
88
+
<edate>1578875237904</edate>
89
89
<flags>8</flags>
90
90
<id>863</id>
91
91
<limit>true</limit>
@@ -1044,7 +1044,7 @@ This task does not return anything.</label>
1044
1044
</Task>
1045
1045
<Tasksr="task858">
1046
1046
<cdate>1576882993943</cdate>
1047
-
<edate>1578526650699</edate>
1047
+
<edate>1578853830354</edate>
1048
1048
<id>858</id>
1049
1049
<nme>Activity State Change Controller</nme>
1050
1050
<pri>6</pri>
@@ -1053,7 +1053,18 @@ This task does not return anything.</label>
1053
1053
<code>300</code>
1054
1054
<label>A task is called by the "Activity State Change Controller Command Monitor" Profile when the %ActivityStateChangeControllerCommand variable is set.
1055
1055
1056
-
This task first checks if the current_package_and_activity passed is a valid package and activity name in the format "package_name/activity_name". If it is then it checks if the current activity is in fullscreen mode with status bars hidden either by using the dumpsys command's "mTopIsFullscreen" value if root mode is enabled or from the last "*StatusBar: setSystemUiVisibility" logcat entry's "newVal" bit flags. Then it sets the current_activity_state depending on activity_state_change and fullscreen mode. Then it checks if the a "package_name Activity State Change Responder" Task exists in the Tasker config for the current_package_and_activity or previous_package_and_activity. If either of those exists, then it calculates the previous_activity_task_activity_transition_par and current_activity_task_activity_transition_par depending on activity transitions in the transitions table. Then it calls the "previous_package Activity State Change Responder" Task if it exists with the previous_activity as %par1 and previous_activity_task_activity_transition_par as %par2. Then it calls the "current_package Activity State Change Responder" Task if it exists with the current_activity as %par1 and current_activity_task_activity_transition_par as %par2. Those tasks may respond appropriately to activity transitions but must not perform long running operations since this task will not finish until the called tasks are finished to maintain order and any queued tasks for this task will also be in waiting. Any long running operations that do not require ordered execution can be run inside the called tasks in additional tasks with "%priority - 1" so that the called tasks can return before the additional tasks finish.
1056
+
This task first checks if the current_package_and_activity passed is a valid package and activity name in the format "package_name/activity_name".
1057
+
1058
+
Then it checks if the current activity is in fullscreen mode with status bars hidden either by using the dumpsys command's "mTopIsFullscreen" value if root mode is enabled or from the last "*StatusBar: setSystemUiVisibility" logcat entry's "newVal" bit flags. If no entries are found in the logcat for "setSystemUiVisibility", then it is automatically assumed that activity is in non fullscreeen mode.
1059
+
Then it sets the current_activity_state depending on activity_state_change and fullscreen mode.
1060
+
1061
+
Then it checks if the a "package_name Activity State Change Responder" Task exists in the Tasker config for the current_package_and_activity or previous_package_and_activity. If either of those exists, then it calculates the previous_activity_task_activity_transition_par and current_activity_task_activity_transition_par depending on activity transitions in the transitions table.
1062
+
1063
+
Then it calls the "previous_package Activity State Change Responder" Task if it exists with the previous_activity as %par1 and previous_activity_task_activity_transition_par as %par2.
1064
+
1065
+
Then it calls the "current_package Activity State Change Responder" Task if it exists with the current_activity as %par1 and current_activity_task_activity_transition_par as %par2.
1066
+
1067
+
"*Responder" tasks may respond appropriately to activity transitions but must not perform long running operations since this task will not finish until the called tasks are finished to maintain order and any queued tasks for this task will also be in waiting. Any long running operations that do not require ordered execution can be run inside the called tasks in additional tasks with "%priority - 1" so that the called tasks can return before the additional tasks finish.
1057
1068
1058
1069
Check Activity State Changes Project docs to get more info on how this task is called and what it does.
0 commit comments