title: Navigation popUpTo and PopUpToInclusive aren't clearing the backstack
body: <p>I'm new to the Android Jetpack Navigation architecture. I'm trying it out on a new app. There's one activity and a few fragments, two of them are login screen and email login screen. I defined those fragments in my navigations XML. The flow of the app is as follows:</p>
  <p><code>Login screen</code> → <code>Email Login screen</code></p>
  <p>What I want is, after navigating to the email login screen, when I press back, the app exits. Meaning the back-stack for login screen is removed. I know login screens aren't supposed to work that way, but I'm still just figuring things out.</p>
  <p>I followed the documentation from Google's <a href="https://developer.android.com/guide/navigation/navigation-getting-started" rel="noreferrer">Get started with the Navigation component</a>. It said, using <code>app:popUpTo</code> and <code>app:popUpToInclusive=&quot;true&quot;</code> is supposed to clear the backstack, yet when I press back on email login screen, it still goes back to login instead of exiting.</p>
  <p>So, here's what I've tried.</p>
  <p>nav_main.xml</p>
  <pre><code>&lt;fragment android:id=&quot;@+id/loginFragment&quot;
            android:name=&quot;com.example.myapp.ui.main.LoginFragment&quot;
            android:label=&quot;@string/login&quot;
            tools:layout=&quot;@layout/fragment_login&quot; &gt;
      
      &lt;action
          android:id=&quot;@+id/action_login_to_emailLoginFragment&quot;
          app:destination=&quot;@id/emailLoginFragment&quot;
          app:popEnterAnim=&quot;@anim/slide_in_right&quot;
          app:popExitAnim=&quot;@anim/slide_out_right&quot;
          app:popUpTo=&quot;@+id/emailLoginFragment&quot;
          app:popUpToInclusive=&quot;true&quot;/&gt;
  
  &lt;/fragment&gt;
  
  &lt;fragment android:id=&quot;@+id/emailLoginFragment&quot;
            android:name=&quot;com.example.myapp.ui.main.EmailLoginFragment&quot;
            android:label=&quot;EmailLoginFragment&quot;
            tools:layout=&quot;@layout/fragment_login_email&quot; /&gt;
  </code></pre>
  <p>LoginFragment.kt</p>
  <pre><code>override fun onCreateView(
      inflater: LayoutInflater, container: ViewGroup?,
      savedInstanceState: Bundle?
  ): View {
      binding.emailLoginButton.setOnClickListener {
          findNavController().navigate(R.id.action_login_to_emailLoginFragment)
      }
      
      return binding.root
  }
  </code></pre>
  <p>I gave a click event to a button. In it, I used the Navigation Controller to navigate to the email login screen by giving it the action's ID. In the <code>&lt;action&gt;</code>, there are <code>app:popUpTo</code> and <code>app:popUpToInclusive=&quot;true&quot;</code>.</p>
  <p>After reading the documentation over and over, as well as reading plenty of StackOverflow questions, I found those properties are supposed to remove my login screen off the back-stack. But they don't. The button does navigate to the email login screen, but when I press back, it still goes back to login screen instead of exiting the app. What am I missing?</p>