Issue description
In one of my apps I am seeing quite odd behaviour: when my app is running in foreground (is top-most one), then I can see its activities in system's Recents. But as soon as I put it into background, the same activity (i.e. AccountsActivity
) that was listed moments ago is no longer present in Recents. Related portion of my Manifest file:
<application
android:name=".WebnetApplication"
android:allowBackup="false"
android:allowClearUserData="true"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".StartActivity"
android:alwaysRetainTaskState="true"
android:excludeFromRecents="true"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoDisplay" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AccountsActivity"
android:excludeFromRecents="false"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize" />
...
Findings
Since this is the only app of mine that misbehaves that way, I checked all styles, and my WebnetActivity
and WebnetApplication
to ensure I do not call anything that could influence Recents. There's nothing like this.
Then I started to strip down Manifest file to see if something would change. And as expected, the culprit lurks there, still it's no really clear for me why. At start, AccountsActivity
entry in Manifest had no android:excludeFromRecents
entry at all - this resulted in AccountsActivity
being not visible in Recents at all. When I added android:excludeFromRecents="true"
then the activity becomes visible in Recents, but only when it was in front. When I moved to back, then it disappeared from Recents. When I remove android:excludeFromRecents="true"
from StartActivity
declaration, then AccountsActivity
become visible in Recents regardless app is in front or in background and I can remove android:excludeFromRecents
from its entry completely without any problems as well.
Question
At the moment I am bending my head trying to understand why it all behaves that way - is it normal (and I do not know something) or it is perhaps rather bug in framework? Anyone faced similar issue and can share experience, ideas or explanation?
android:launchMode="singleTask"
- only removedexcludeFromRecents
fromStartActivity
and all works. That's why I am in WTF mode now. – OctavieAccountsActivity
? From what I can see, that'sStartActivity
->AccountsActivity
. No? – Bembaandroid:excludeFromRecents="true"
of the parent activity can be causing that behaviour. Can you post the intent you are using to launchAccountsActivity
? – BembastartActivity()
– Octavie