Post Reply

[MOD][XPOSED] ActivityForceNewTask

OP GermainZ

13th February 2014, 03:12 AM   |  #1  
GermainZ's Avatar
OP Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 6,741
 
5,690 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Introduction:
Apps can launch other apps' activities inside their task. This makes it impossible to switch back and forth between the two. This module sets the FLAG_ACTIVITY_NEW_TASK flag when starting a new activity, which 'fixes' that.
Originally requested by jacknicholson here.

Screenshots explanation:


Requirements:
Filtering:
  • A quick toggle is available in the settings. Just check "Disable module" and the changes will take effect immediately. No need to restart.
  • You can use the blacklist or the whitelist to filter activities. If the blacklist is selected, all activities except those excluded will launch in a new task. If you use the whitelist, only matching activities will launch in a new task instead. The preferred way to add entries is through the log.
The activity components are output to the logcat. You can filter it for "activityforcenewtask componentString:" to see them. A line is logged for every started activity (you probably don't want to keep the log constantly turned on.)
A log viewer is also present in the app. You can press a log entry to directly add it to the currently active list. I'd advise you to only enable the log when needed.

Source code:
https://github.com/GermainZ/ActivityForceNewTask

Download:
http://repo.xposed.info/module/com.g...tyforcenewtask

Changelog:
Quote:

2.1:

  • The blacklist/whitelist settings are now only reloaded when necessary. Shouldn't make a big difference unless you have huge lists.
  • 4.4.3 fix: get the context using a different method (fixes logging on 4.4.3).
  • Added Portuguese (Br) translation by meatboy371.
2.0.3:
  • Only use context for logging;
  • Try to get the context in an alternate manner if the first one fails;
  • Bug fix: current package wasn't being detected properly;
  • Only start activities in a new task when the caller does not expect a result (different, more general implementation.)
2.0.2:
  • Reverted back to hooking ActivityRecord's constructor. Should solve the issue where some activities' launches weren't being detected.
  • Updated Slovak translation.
2.0:
  • Ignore activities that are launched by their own apps;
  • Added filtering options back. You can choose between the whitelist and the blacklist, but the no filtering option has been removed;
  • Added help dialogs for the whitelist/blacklist/log;
  • Bug fix: duplicate log entries when returning to the app with the log viewer open.
  • Other minor changes: use icons for action bar items, reorder preferences.
1.9:
  • Removed none/blacklist filtering options. The whitelist is always used now (renamed to "Enabled Components") which means that you must configure the module, as it won't do anything by default.
  • Reverted back to hooking Activity.startActivity(Intent, Bundle). Other methods used to start an Activity require the usage of FLAG_ACTIVITY_NEW_TASK, so it doesn't actually make sense to hook anything else. Also removed the alternate way to get a context as it shouldn't be needed anymore.
  • Check if FLAG_ACTIVITY_NEW_TASK is already set, and do nothing if that's the case (the activity won't be logged either.)
  • Updated Slovak translations (by ja-som.)
1.8.1:
  • Fix some crashes at startup;
  • Add FLAG_ACTIVITY_NEW_TASK flag instead of overwriting it. This fixes issues with XHalo and some apps showing in recents when they shouldn't;
  • Updated translations.
1.7:
  • Different hook, the previous one didn't catch all new activities.
1.6.1:
  • Removed unnecessary logging.
1.6:
  • Added whitelist.
1.5:
  • Added option to enable/disable the blacklist (and log.) The blacklist requires a few extra calls which are unnecessary if you don't use it, so I'd advise you don't enable it unless you need it.
  • Cleanup/better performance for the log viewer.
1.4:
  • The mod will now only modify intents that should be modified. This should fix all breakage without needing the blacklist. \o/
  • Log viewer improvements: tapping on an item now removes it from the list after adding it to the blacklist, and a toast is shown to indicate if it's been added to the blacklist.
1.3:
  • Use flat text file for storing the logs instead of SharedPreferences. This is much better for performance, especially if the log gets long.
1.2:
  • The blacklist is now for activities.
  • You can enable/disable logging from within the app.
  • Added log viewer to the app. You can tap a log entry to directly add it to the blacklist.
  • Fixes.
1.1:
  • Fixes for the two icons appearing in the launcher.
  • Disable text correction when adding a blacklist item.
1.0:
  • Initial release.

Thanks:
  • rovo89 and Tungstwenty for the Xposed Framework;
  • egingell for helping out with what to blacklist;
  • defim for advice on which intents to modify;
  • Ja_som for Slovak translation;
  • Sanguinus112 for German translation;
  • All testers.
Attached Thumbnails
Click image for larger version

Name:	Screen.png
Views:	84595
Size:	81.7 KB
ID:	2576251  
Last edited by GermainZ; 12th June 2014 at 02:06 PM.
The Following 106 Users Say Thank You to GermainZ For This Useful Post: [ View ]
13th February 2014, 03:30 AM   |  #2  
Thomas_BA's Avatar
Senior Member
Flag Buenos Aires
Thanks Meter: 188
 
876 posts
Join Date:Joined: Dec 2009
More
Great idea, testing during the next days. So far only a cosmetic bug. After the installation of the module two icons appear in the launcher. Restart also did not change that.

Posting from the moon with Moto X and Tapatalk.
13th February 2014, 03:35 AM   |  #3  
GermainZ's Avatar
OP Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 6,741
 
5,690 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Update:
Quote:

1.1:

  • Fixes for the two icons appearing in the launcher.
  • Disable text correction when adding a blacklist item.

Quote:
Originally Posted by Thomas_BA

Great idea, testing during the next days. So far only a cosmetic bug. After the installation of the module two icons appear in the launcher. Restart also did not change that.

Oops, fixed.
13th February 2014, 03:44 AM   |  #4  
egingell's Avatar
Senior Member
Thanks Meter: 1,430
 
3,628 posts
Join Date:Joined: Apr 2012
Donate to Me
More
Quote:
Originally Posted by GermainZ

Thanks:

  • rovo89 for the Xposed Framework;
  • egingell for helping out with *what* to blacklist.

Thank you for trying to help me with my problem. I was looking at your SettingsHelper class and I think I need to start thinking of the Xposed side and Android side as separate apps and code it as such. But I'm too tired and achy to test right now.

Sent from: SGS2 - JB 4.1.2 GB27 / SGS4 - JB 4.2.2 MF9
The Following User Says Thank You to egingell For This Useful Post: [ View ]
13th February 2014, 04:38 AM   |  #5  
polobunny's Avatar
Senior Member
Flag Montreal
Thanks Meter: 2,461
 
6,135 posts
Join Date:Joined: Oct 2011
More
@GermainZ
To add to blacklist
Code:
com.android.internal.app.ResolverActivity
http://grepcode.com/file/repository....rActivity.java

If you want to be able to upload a picture through Tapatalk. I imagine there's a billion other uses to it. Might break module functionality in some cases? *shrugs*


NOT VALID ANYMORE
Last edited by polobunny; 13th February 2014 at 03:30 PM.
The Following User Says Thank You to polobunny For This Useful Post: [ View ]
13th February 2014, 04:42 AM   |  #6  
defim's Avatar
Senior Member
Thanks Meter: 874
 
1,667 posts
Join Date:Joined: Feb 2012
@GermainZ
Great idea. Would be nice if you clould find a way to detect apps which don't work and the blacklist could be removed
13th February 2014, 05:10 AM   |  #7  
polobunny's Avatar
Senior Member
Flag Montreal
Thanks Meter: 2,461
 
6,135 posts
Join Date:Joined: Oct 2011
More
Quote:
Originally Posted by defim

@GermainZ
Great idea. Would be nice if you clould find a way to detect apps which don't work and the blacklist could be removed

I'm not really sure how that could be achieved. @_@

The blacklist is good enough, but I feel like there's only going to be a handful of entries shared by specific people since people are morbidly afraid of logcat and I'm sure even more of filtering it.

Doesn't matter much in the end, I'm a happy user. Niche product for niche people?
13th February 2014, 05:24 AM   |  #8  
egingell's Avatar
Senior Member
Thanks Meter: 1,430
 
3,628 posts
Join Date:Joined: Apr 2012
Donate to Me
More
Quote:
Originally Posted by polobunny

I'm not really sure how that could be achieved. @_@

The blacklist is good enough, but I feel like there's only going to be a handful of entries shared by specific people since people are morbidly afraid of logcat and I'm sure even more of filtering it.

Doesn't matter much in the end, I'm a happy user. Niche product for niche people?

I can never get its built-in filter to work. I always have to resort to piping it through grep.

Sent from: SGS2 - JB 4.1.2 GB27 / SGS4 - JB 4.2.2 MF9
13th February 2014, 05:32 AM   |  #9  
polobunny's Avatar
Senior Member
Flag Montreal
Thanks Meter: 2,461
 
6,135 posts
Join Date:Joined: Oct 2011
More
Quote:
Originally Posted by egingell

I can never get its built-in filter to work. I always have to resort to piping it through grep.

Sent from: SGS2 - JB 4.1.2 GB27 / SGS4 - JB 4.2.2 MF9

Not sure where the issue lies, but that's usually what I use
ie:
adb logcat Xposed:V *:S

Show everything Xposed, hides everything else for instance. You can go fancy and do other things but if you're just looking to extract something real quick that will do.
13th February 2014, 05:58 AM   |  #10  
starbase64's Avatar
Senior Member
Flag Lennestadt
Thanks Meter: 571
 
3,030 posts
Join Date:Joined: Apr 2007
Donate to Me
More
Hi,

great idea, thanks.

regards

starbase64

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Xposed Framework Modules by ThreadRank