Skip to content

Commit 7bf246e

Browse files
Updated README.md
1 parent 2489092 commit 7bf246e

File tree

5 files changed

+88
-56
lines changed

5 files changed

+88
-56
lines changed

CHANGELOG.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,37 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
**Version Number Format:** `major.minor.patch`
6+
**Release Date Format:** `yyyy-mm-dd`
7+
8+
**Types of Changes:**
9+
- **Added** for new features.
10+
- **Changed** for changes in existing functionality.
11+
- **Deprecated** for soon-to-be removed features.
12+
- **Removed** for now removed features.
13+
- **Fixed** for any bug fixes.
14+
- **Security** in case of vulnerabilities.
15+
##
16+
17+
518
## [Unreleased]
19+
620
`-`
721

8-
## [0.2.0] - 2020-01-10
22+
23+
## [0.2.0] - 2020-01-12
924

1025
### Added
1126
- Added `Display State` State is `On` to `*Activity Start Monitor` and `*Config Change Monitor` Profiles to save battery when display is off.
1227
- Added task to get project version.
1328

14-
## [0.1.0] - 2020-01-09
15-
`-`
16-
##
17-
1829

30+
## [0.1.0] - 2020-01-09
1931

20-
### Types of Changes
21-
- **Added** for new features.
22-
- **Changed** for changes in existing functionality.
23-
- **Deprecated** for soon-to-be removed features.
24-
- **Removed** for now removed features.
25-
- **Fixed** for any bug fixes.
26-
- **Security** in case of vulnerabilities.
32+
`-`
2733
##
2834

2935

30-
3136
[unreleased]: https://github.com/Taskomater/Activity-State-Changes-Tasker-Project/compare/v0.2.0...HEAD
3237
[0.2.0]: https://github.com/Taskomater/Activity-State-Changes-Tasker-Project/compare/v0.1.0...v0.2.0
3338
[0.1.0]: https://github.com/Taskomater/Activity-State-Changes-Tasker-Project/releases/tag/v0.1.0

FAQs_And_FUQs.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Frequently Asked Questions(FAQs)
2+
3+
`-`
4+
##
5+
6+
7+
### Frequently Unasked Questions(FUQs)
8+
9+
`-`
10+
##
11+

README.md

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
##
55

66

7-
### Contents:
7+
### Contents
88
- [Project Details](#Project-Details)
99
- [How Project Works](#How-Project-Works)
1010
- [Activity States And Transitions](#Activity-States-And-Transitions)
@@ -16,12 +16,14 @@
1616
- [Current Features](#Current-Features)
1717
- [Planned Features](#Planned-Features)
1818
- [Issues](#Issues)
19-
- [Worthy of Note](#Worthy-of-Note)
19+
- [Worthy Of Note](#Worthy-Of-Note)
20+
- [FAQs And FUQs](#FAQs-And-FUQs)
2021
- [Changelog](#Changelog)
22+
- [Contributions](#Contributions)
2123
##
2224

2325

24-
### Project Details:
26+
### Project Details
2527

2628
Each android app has a package name which is a unique name that allows android to differentiate between different apps even if they have the same name. For example, the package name for Tasker is `net.dinglisch.android.taskerm`. Each app can contain different activities inside it which are basically views or screens. For example Tasker has the homescreen activity, the settings activity, task edit activity and so on.
2729
Activities can be of the following types:
@@ -55,7 +57,7 @@ The `ActivityManager: Displayed` will not be logged for activities which are ret
5557
The `ActivityTrigger: ActivityTrigger activityPauseTrigger` can be used to reliable detect all activity transitions but since the entry itself does not contain the package and activity name, other ways need to be used to detect what activity is currently in focus. But this creates lots of problems because if the `Logcat Entry` Profile entry task takes too long to process an entry, then by the time the turn comes for queued tasks, the package and/or activity might have already changed for which those Logcat entries were generated for, resulting in false activity transitions being calculated.
5658

5759
Currently two ways are used to detect which activity is currently in focus:
58-
- For non-root users the `GetCurrentAppAndActivity` function of the `Tasker Function` action is used, but the value returned by it is sometimes that of a previous activity since Tasker does not receive/calculate the new value fast enough and a wait action is required of `0.5-1s` before running it. The exact time of the `Wait` action at runtime will vary depending on other same priority tasks running in tasker or the device load itself and may even vary for different devices, and so activity transitions may not always be accurate.
60+
- For non-root users the `GetCurrentAppAndActivity` function of the `Tasker Function` action is used, but the value returned by it is sometimes that of a previous activity since Tasker does not receive/calculate the new value fast enough and a wait action is required of `0.5-1s` before running it. The exact time of the `Wait` action at runtime will vary depending on other same priority tasks running in tasker or the device load itself and may even vary for different devices, and so activity transitions may not always be accurate. The `Tasker Settings` -> `Monitor` -> `App Check Method` if set to `App Usage Stats` may give better results than `Accessibility`.
5961
- For root users, the `mFocusedActivity` value is extracted from the `dumpsys activity activities` command. This ideally should work for almost every device if not all. This is relatively more reliable for getting the current package and activity value accurately since its updated fast enough and a `Wait` action is not required. The full command to extract `GetCurrentAppAndActivity` value is `dumpsys activity activities | grep mFocusedActivity | sed -E 's/.*ActivityRecord\{[^ ]+ [^ ]+ ([^ ]+) [^ ]+\}.*/\1/'`.
6062

6163
But with both these methods false activity transitions will still occur in cases when the entry task is slow or queued because of higher priority tasks running in tasker and packages and/or activities have already changed. It is best to find device specific Logcat entries for all activity resumes which also contain the package and activity name in the format `package_name/activity_name`. These should normally exist in all devices but will vary depending on device manufacturer and android version. Check the [Finding Device Specific Logcat Entries](###Finding-Device-Specific-Logcat-Entries) section for more info on how to find them.
@@ -73,7 +75,7 @@ The details for fullscreen and immersive modes can be found [here](https://devel
7375

7476
Once it is found if the activity is fullscreen or not, then the current activity state is calculated. After this, if the current or previous activity's package name responder tasks are found in the tasker config, then activity transitions are calculated from previous and current activity states and passed to the respective tasks.
7577

76-
### How Project Works:
78+
### How Project Works
7779

7880

7981
**Logcat Entry Profiles**:
@@ -154,26 +156,26 @@ If previous_activity!=current_activity:
154156
##
155157

156158

157-
### Dependencies:
159+
### Dependencies
158160

159-
- 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.
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.
160162
##
161163

162164

163-
### Downloads:
165+
### Downloads
164166

165167
Download `Activity State Changes Tasker Project` latest release from [here](https://github.com/Taskomater/Activity-State-Changes-Tasker-Project/releases).
166168
##
167169

168170

169-
### Install Instructions For Tasker In Android:
171+
### Install Instructions For Tasker In Android
170172

171-
1. Import `Activity_State_Changes.prj.xml` Project file into Tasker.
173+
1. Import `projects/Activity_State_Changes.prj.xml` Project file into Tasker.
172174

173175
##
174176

175177

176-
### Usage:
178+
### Usage
177179

178180
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.
179181

@@ -209,40 +211,51 @@ LGImageQualityEnhancementService: activityResuming: package_name/activity_name
209211
##
210212

211213

212-
### Current Features:
214+
### Current Features
213215

214216
- Detect activity transitions
215217
- Detect if activities enter or leave fullscreen mode
216218
- Sample tasks for handling activity transitions of some apps
217219
##
218220

219221

220-
### Planned Features:
222+
### Planned Features
221223

222-
- Not thought of yet.
224+
- Optimizations to reduce tasks execution times.
223225
##
224226

225227

226-
### Issues:
228+
### Issues
227229

228230
- Some `package_name/activity_name` might be considered invalid. Currently the hyphen `-` character in activities is considered invalid by the `\p{javaJavaIdentifierPart}` character class of the validation regex for some unknown reason on the devs device. The regex may be changed in future.
229231

230232
##
231233

232234

233-
### Worthy of Note:
235+
### Worthy Of Note
234236

235237
- The activity name of activities defined in the `AndroidManifest.xml` of apps may start with a dot, which implies that the package name should automatically be prepended to their name. Depending on the method used to detect the current package and activity, the activity name may not be prepended with the package name and may start with a dot instead. So it is best to use `~` matches instead of `eq` conditional statements in the `project_name Activity State Change Responder` Tasks.
236238

237239
- 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.
238240

239-
- 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.
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.
240242
##
241243

242244

243-
### Changelog:
245+
### FAQs And FUQs
244246

245-
Check [CHANGELOG.md](CHANGELOG.md) file for the changelog.
247+
Check [FAQs_And_FUQs.md](FAQs_And_FUQs.md) file for the **Frequently Asked Questions(FAQs)** and **Frequently Unasked Questions(FUQs)**.
248+
##
249+
250+
### Changelog
251+
252+
Check [CHANGELOG.md](CHANGELOG.md) file for the **Changelog**.
253+
254+
##
255+
256+
257+
### Contributions
246258

259+
`-`
247260
##
248261

projects/Activity_State_Changes.prj.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Activity State Changes
22

33
## Export Info:
4-
**Tasker Version:** `5.9`
5-
**Timestamp:** `2020-01-10 15.21.37`
4+
**Tasker Version:** `5.9.1`
5+
**Timestamp:** `2020-01-12 05.23.07`
66

77

88

@@ -287,7 +287,7 @@ Otherwise it will contain an appropriate exit code.
287287
**#:** `9`
288288
**Name:** `Get Activity_State_Changes Tasker Project Version Number`
289289
**ID:** `869`
290-
**Collision Handling:** `Abort New Task`
290+
**Collision Handling:** `Run Both Together`
291291
**Keep Device Awake:** `false`
292292
**Help:**
293293
```

projects/Activity_State_Changes.prj.xml

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
<TaskerData sr="" dvi="1" tv="5.9">
1+
<TaskerData sr="" dvi="1" tv="5.9.1">
22
<Profile sr="prof841" ve="2">
33
<cdate>1576896789133</cdate>
44
<clp>true</clp>
5-
<edate>1578595589782</edate>
5+
<edate>1578787811114</edate>
66
<flags>8</flags>
77
<id>841</id>
88
<mid0>839</mid0>
99
<nme>ActivityManager Activity Config Change Monitor</nme>
10-
<Event sr="con0" ve="2">
10+
<State sr="con0" ve="2">
11+
<code>123</code>
12+
<Int sr="arg0" val="1"/>
13+
</State>
14+
<Event sr="con1" ve="2">
1115
<code>2085</code>
1216
<pri>0</pri>
1317
<Bundle sr="arg0">
@@ -21,10 +25,6 @@ The text that corresponds to the matched logcat entry&lt;/_array_net.dinglisch.a
2125
<Str sr="arg1" ve="3">ActivityManager</Str>
2226
<Str sr="arg2" ve="3">ActivityManager: Config change</Str>
2327
</Event>
24-
<State sr="con1" ve="2">
25-
<code>123</code>
26-
<Int sr="arg0" val="1"/>
27-
</State>
2828
</Profile>
2929
<Profile sr="prof847" ve="2">
3030
<cdate>1578266148686</cdate>
@@ -42,12 +42,16 @@ The text that corresponds to the matched logcat entry&lt;/_array_net.dinglisch.a
4242
<Profile sr="prof855" ve="2">
4343
<cdate>1578295763395</cdate>
4444
<clp>true</clp>
45-
<edate>1578650864528</edate>
45+
<edate>1578787826285</edate>
4646
<flags>8</flags>
4747
<id>855</id>
4848
<mid0>839</mid0>
4949
<nme>ActivityTrigger Activity Start Monitor</nme>
50-
<Event sr="con0" ve="2">
50+
<State sr="con0" ve="2">
51+
<code>123</code>
52+
<Int sr="arg0" val="1"/>
53+
</State>
54+
<Event sr="con1" ve="2">
5155
<code>2085</code>
5256
<pri>0</pri>
5357
<Bundle sr="arg0">
@@ -61,10 +65,6 @@ The text that corresponds to the matched logcat entry&lt;/_array_net.dinglisch.a
6165
<Str sr="arg1" ve="3">ActivityTrigger</Str>
6266
<Str sr="arg2" ve="3">ActivityTrigger activityPauseTrigger</Str>
6367
</Event>
64-
<State sr="con1" ve="2">
65-
<code>123</code>
66-
<Int sr="arg0" val="1"/>
67-
</State>
6868
</Profile>
6969
<Profile sr="prof859" ve="2">
7070
<cdate>1578341457397</cdate>
@@ -84,13 +84,18 @@ The text that corresponds to the matched logcat entry&lt;/_array_net.dinglisch.a
8484
</Profile>
8585
<Profile sr="prof863" ve="2">
8686
<cdate>1578401192742</cdate>
87-
<edate>1578650865867</edate>
87+
<clp>true</clp>
88+
<edate>1578787826880</edate>
8889
<flags>8</flags>
8990
<id>863</id>
9091
<limit>true</limit>
9192
<mid0>839</mid0>
9293
<nme>Custom Activity Start Monitor</nme>
93-
<Event sr="con0" ve="2">
94+
<State sr="con0" ve="2">
95+
<code>123</code>
96+
<Int sr="arg0" val="1"/>
97+
</State>
98+
<Event sr="con1" ve="2">
9499
<code>2085</code>
95100
<pri>0</pri>
96101
<Bundle sr="arg0">
@@ -104,10 +109,6 @@ The text that corresponds to the matched logcat entry&lt;/_array_net.dinglisch.a
104109
<Str sr="arg1" ve="3">LGImageQualityEnhancementService</Str>
105110
<Str sr="arg2" ve="3">activityResuming:</Str>
106111
</Event>
107-
<State sr="con1" ve="2">
108-
<code>123</code>
109-
<Int sr="arg0" val="1"/>
110-
</State>
111112
</Profile>
112113
<Project sr="proj0" ve="2">
113114
<cdate>1578339897867</cdate>
@@ -117,7 +118,7 @@ The text that corresponds to the matched logcat entry&lt;/_array_net.dinglisch.a
117118
</Project>
118119
<Task sr="task839">
119120
<cdate>1576882993943</cdate>
120-
<edate>1578651411713</edate>
121+
<edate>1578760085239</edate>
121122
<id>839</id>
122123
<nme>Activity State Change Relay</nme>
123124
<pri>6</pri>
@@ -448,6 +449,7 @@ Value Set:
448449
<edate>1578640088625</edate>
449450
<id>852</id>
450451
<nme>Reset Activity State Change Variables</nme>
452+
<pri>6</pri>
451453
<Action sr="act0" ve="7">
452454
<code>300</code>
453455
<label>A task that resets Activity States Changes Project variables.
@@ -2881,9 +2883,10 @@ Otherwise it will contain an appropriate exit code.</label>
28812883
</Task>
28822884
<Task sr="task869">
28832885
<cdate>1575359655233</cdate>
2884-
<edate>1578650105708</edate>
2886+
<edate>1578787822122</edate>
28852887
<id>869</id>
28862888
<nme>Get Activity_State_Changes Tasker Project Version Number</nme>
2889+
<rty>2</rty>
28872890
<Action sr="act0" ve="7">
28882891
<code>300</code>
28892892
<label>A task that returns Activity_State_Changes Tasker Project version number.

0 commit comments

Comments
 (0)