What is the default implementation of onBackPressed() in Activity
<p>I want to know the default implementation of <code>onBackPressed()</code> in <code>Activity</code>. How to deal with the <code>Activity</code> recover in the default implementation of <code>onBackPressed()</code>?.</p>

<p>The following is the issues I suffer from. I have a test <code>Activity</code> code like this:</p>

<pre><code>public class MainActivity extends Activity {
    public static boolean test = false;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    protected void onResume() {
        super.onResume();
        Toast.makeText(this,"is "+test,Toast.LENGTH_LONG).show();
        test = !test;
    }
}
</code></pre>

<p>When I first enter the app, I get 'is false'. Then I click back button and get to the home screen. After that, when I enter the app, I get the Toast 'is true'. I think the <code>onBackPressed()</code> should kill my app when it gets back to the home screen, but It does not. This is my question.</p>

<p>If I override <code>onBackPressed()</code> like this</p>

<pre><code>@Override
public void onBackPressed() {
//  super.onBackPressed();
    finish();
    try {
        android.os.Process.killProcess(android.os.Process.myPid());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
</code></pre>

<p>I always get the Toast 'is false' after I enter the app.</p>

<p>Can anyone explain this problem and tell me what the default implementation of <code>onBackPressed()</code>? </p>

<p>I'd like to know the flow process in <code>onBackPressed()</code> in detail. I have read some of the source code on <code>onBackPressed()</code>, but I couldn't understand it well.</p>

<p>Thanks in advance.</p>