Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,785,935 Members 52,396 Now Online
XDA Developers Android and Mobile Development Forum

[MOD][XPOSED] ActivityForceNewTask

Tip us?
 
GermainZ
Old
(Last edited by GermainZ; 12th June 2014 at 02:06 PM.)
#1  
GermainZ's Avatar
Forum Moderator / Recognized Developer - OP
Thanks Meter 6,217
Posts: 5,364
Join Date: Aug 2012
Default [MOD][XPOSED] ActivityForceNewTask

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:	70732
Size:	81.7 KB
ID:	2576251  
The Following 101 Users Say Thank You to GermainZ For This Useful Post: [ Click to Expand ]
 
Thomas_BA
Old
#2  
Thomas_BA's Avatar
Senior Member
Thanks Meter 175
Posts: 834
Join Date: Dec 2009
Location: Buenos Aires
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.
Moto X - XT1058
Stock 4.4.4
Root, Faux Kernel, Boot-loader unlocked, etc. blabla
 
GermainZ
Old
#3  
GermainZ's Avatar
Forum Moderator / Recognized Developer - OP
Thanks Meter 6,217
Posts: 5,364
Join Date: Aug 2012
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 View Post
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.
 
egingell
Old
#4  
egingell's Avatar
Senior Member
Thanks Meter 1,380
Posts: 3,483
Join Date: Apr 2012

 
DONATE TO ME
Quote:
Originally Posted by GermainZ View Post
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
* Phones: Samsung SGSII Epic 4G Touch; SGSIV
* ROM: Rooted Stock JB 4.1.2; Rooted Stock JB 4.2.2
* Kernel: Stock JB 4.1.2; Stock JB 4.2.2
* Enabled non-stock features: init.d, boot animations, boot splash; init.d, boot animations
* DPI: 200; 400



* UnToaster - Block Toasts by regular expressions.
* Downloads2SD - Redirect downloads.
* [TIPS][SCRIPTS][ROOT]egingell's scripts.
* My Droid Blog
* DropBox (2-18GB free).
The Following User Says Thank You to egingell For This Useful Post: [ Click to Expand ]
 
polobunny
Old
(Last edited by polobunny; 13th February 2014 at 03:30 PM.)
#5  
polobunny's Avatar
Senior Member
Thanks Meter 2,408
Posts: 5,979
Join Date: Oct 2011
Location: Montreal
@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
Please press THANKS if someone helps you!

My current configuration:
 

Device: Samsung Galaxy S3 SGH-i747M
ROM: cm-11-20140827-NIGHTLY-d2lte
Kernel: Harkness
Baseband: I747MVLDMF1
Bootloader: I747MVLDMF1
Governor: Interactive


Older device: Nexus S i9020A
The Following User Says Thank You to polobunny For This Useful Post: [ Click to Expand ]
 
defim
Old
#6  
Senior Member
Thanks Meter 768
Posts: 1,499
Join Date: 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
Motorola Defy+ aka MB526 Android 4.4.4 Cyanogen Mod
Samsung S4a aka GT-i9295 Android 4.2.2 Google Edition
My Android apps / Xposed modules: show Threads
 
polobunny
Old
#7  
polobunny's Avatar
Senior Member
Thanks Meter 2,408
Posts: 5,979
Join Date: Oct 2011
Location: Montreal
Quote:
Originally Posted by defim View Post
@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?
Please press THANKS if someone helps you!

My current configuration:
 

Device: Samsung Galaxy S3 SGH-i747M
ROM: cm-11-20140827-NIGHTLY-d2lte
Kernel: Harkness
Baseband: I747MVLDMF1
Bootloader: I747MVLDMF1
Governor: Interactive


Older device: Nexus S i9020A
 
egingell
Old
#8  
egingell's Avatar
Senior Member
Thanks Meter 1,380
Posts: 3,483
Join Date: Apr 2012

 
DONATE TO ME
Quote:
Originally Posted by polobunny View Post
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
* Phones: Samsung SGSII Epic 4G Touch; SGSIV
* ROM: Rooted Stock JB 4.1.2; Rooted Stock JB 4.2.2
* Kernel: Stock JB 4.1.2; Stock JB 4.2.2
* Enabled non-stock features: init.d, boot animations, boot splash; init.d, boot animations
* DPI: 200; 400



* UnToaster - Block Toasts by regular expressions.
* Downloads2SD - Redirect downloads.
* [TIPS][SCRIPTS][ROOT]egingell's scripts.
* My Droid Blog
* DropBox (2-18GB free).
 
polobunny
Old
#9  
polobunny's Avatar
Senior Member
Thanks Meter 2,408
Posts: 5,979
Join Date: Oct 2011
Location: Montreal
Quote:
Originally Posted by egingell View Post
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.
Please press THANKS if someone helps you!

My current configuration:
 

Device: Samsung Galaxy S3 SGH-i747M
ROM: cm-11-20140827-NIGHTLY-d2lte
Kernel: Harkness
Baseband: I747MVLDMF1
Bootloader: I747MVLDMF1
Governor: Interactive


Older device: Nexus S i9020A
 
starbase64
Old
#10  
starbase64's Avatar
Senior Member
Thanks Meter 523
Posts: 2,941
Join Date: Apr 2007
Location: Lennestadt

 
DONATE TO ME
Hi,

great idea, thanks.

regards

starbase64
Starbase64 YouTube Channel | Stabase64 Blog | Starbase64 Flickr Stream


Device: HTC One m8ul
ROM: InsertCoin
Kernel: Stock is the best
S-OFF: Yes
SuperCID: Yes
MID: 0P6B10000
PVS: 1

Device: Samsung Galaxy Tab 2 7''
ROM: CM 10.2
Kernel: stock
Recovery: TWRP
Baseband: stock

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes