Fix #1060.
Implement custom rules
Fix #1009 finally!
This reverts commit b0412b4f.
AppManager's sub-activity should maintain dirty flags by themselves. Fix #1032.