tunitowen/DevDrawer

Use home/launcher style intent behaviour when opening an app from the widget

jgilfelt opened this issue · 2 comments

Firstly - this is cool app and it has been a real time saver for me during app development. Thanks!

One issue I have with it is that every time an app is launched from the drawer widget, it uses FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TOP to (sort of) reset the task state each time. This makes it difficult to test how a user will actually resume an app if its already running in a backgrounded task. It can also lead to duplicate instances of the root activity in the history stack if I did not completely back out of an earlier task.

I'd prefer if it used FLAG_ACTIVITY_NEW_TASK with FLAG_ACTIVITY_RESET_TASK_IF_NEEDED instead, which are the flags the stock launcher app uses when an icon on the home screen is pressed. This would mean any existing task with the same affinity would come back to the foreground in its previous state, otherwise a new task would be launched as before.

With this you could test real-world launch behaviour without having to also manually add an icon to the home screen or search for the app in the apps drawer.

I understand what you're trying to do with FLAG_ACTIVITY_CLEAR_TOP, so maybe this new behaviour could be an option that can be enabled in the settings?

I've made and tested the changes in a local fork so I'm happy to submit a pull request if you're interested.

Hi Jeff

Glad you like the app. I'm an fan of your work! :)

I agree with you. No need for a pull request, I'll add a preference for this.. I was trying to emulate the launcher behaviour and for some reason never thought of looking at the source.

I need to update for a small bug so hopefully I'll get this updates today.

Tony

Added preference in 1.5. Default is now AOSP Launcher launching intents