Start an app by long-pressing home button always restarts the app instead of bring it to foreground
<p>My app has two activities, ActivityA and ActivityB. They are specified in AndroidManifest below:</p>

<pre><code>&lt;activity android:name=".ActivityA" android:label="@string/app_name" android:screenOrientation="landscape" 
    android:configChanges="orientation|keyboardHidden|screenSize"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
&lt;/activity&gt;
&lt;activity android:name=".ActivityB" 
    android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden|screenSize" 
    android:windowSoftInputMode="stateAlwaysHidden"/&gt;
</code></pre>

<p>The scenario of the problem is below. </p>

<ol>
<li>I start the app and ActivityA shows. </li>
<li>From ActivityA, I start ActivityB and close ActivityA. Now the task stack only contains ActivityB. </li>
<li>I press Home button, then the phone goes to home screen.</li>
<li>I long-press Home button, and pick up my app from the history.</li>
<li>After step 4, ActivityA starts and shows, and the task stack contains ActivityA at top and ActivityB at the bottom.</li>
</ol>

<p>I am very confused at step 5. What I expected is that, the app will be brought to foreground with its existing task stack, i.e. with only ActivityB in the task stack. Why does Android start ActivityA at step 5?</p>

<p>BTW, the client logs contains the message below at Step 5:</p>

<p>10-26 21:29:04.070 V/HtcAppUsageStats(  275): (launch app, package): (MyApp, com.example.myapp)</p>

<p>10-26 21:29:04.070 I/ActivityManager(  275): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x34500000 cmp=com.example.myapp/.ActivityA bnds=[0,566][540,662] (has extras) } from pid 275</p>

<p>Thanks for any suggestions!</p>
