My question is the same as this one, but it is old and the accepted answer uses depreciated permissions and values. I would like an updated answer that works above API 21.
I need to override a home-screen return button action under certain conditions. (App is removed from stack by user, but widget launches an activity that requires now forgotten backwards navigation, so the backpress should launch new activity intent if this is so, but can't just check if widget opens the activity because it works as intended if user doesn't close the app manually.)