applications – Does android keystore and “Clear data” of the “Settings” app are related?

I am working on a system app where i am storing some sensitive data in EncryptedSharedPreference.
I realise that my app is not working as expected if I do clear data of android Settings app. That is happening because my sensitive data stored in encrypted shared preference was changing.
When I observe the encrypted_myapp_pref.xml file, I observe that encrypted value of those sensitive data is not changing. but value of key material was changing (androidx_security_crypto_encrypted_prefs_key_keyset and androidx_security_crypto_encrypted_prefs_value_keyset). Hence while decrypted my sensitive data, it gave me wrong value and that was affecting on app. When I tried the same logic with priv app or user app (without using sharedUserId=”android.uid.system” it is working as expected.

So the problem is, if I am using system app with shared user id and clearing the data of settings app, on device reboot, key material of my own app changes and Encrypted shared preference will not give proper values back.