'Trying to build an Android Launcher - "Home" doesn't work on Pixel 5 api31

I'm trying to build a simple launcher for Android. I started with some code samples from different sources (last one is that one)

I'm doing the first steps, creating a project with an empty Activity and changing the "AndroidManifest.xml" so it looks like:

<?xml version="1.0" encoding="utf-8"?>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.FiftyLauncher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTask"
        android:clearTaskOnLaunch="true"
        android:stateNotNeeded="true"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />

        </intent-filter>
    </activity>
</application>

I see that it works on some emulators (pixel 3,4) but it doesn't work on pixel 5 api 31 . (Works = pressing the home button will show me the option to use my launcher. Doesn't work = pressing home just opens the default launcher)

Any idea what am I missing? Thank you, Saar.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source