Inability to successfully terminate on Android 9 (Pie)

Appium server 1.14.0
The issue cropped up after updating mobile device testing our framework against to Android 9.
Tried again on other devices @ Android 7 & 8 and am not facing the same issue.
We are only testing against Samsung devices.

I have attached the server logs.

The basic test:
start session w/targeting our app to be tested.
androidDriver.terminateApp(“”, new AndroidTerminateApplicationOptions().withTimeout(Duration.ofMillis(10000)));
// The activate/terminate/activate was being used to ensure we started from same settings page location.

The main issue is that I see the settings app being terminated - or the instance we launched - however there seems to be a persistent background settings process that the terminateApp is still witnessing running and rightly throws an exception.

Any ideas?
appiumLog.txt (57.0 KB)

Why not set app not allow run in background? It is in app settings.

Part of our testing involves pushing the app under test into the background to manipulate say, Power Management modes for the app, location permissions, wifi, bluetooth, etc.

That would also terminate our app which would cause a state change we are trying to avoid.

i mean configure it ONLY for ''" app.

Mykola suggested the startActivity and indicating the .Settings activity terminates settings then relaunches. This is working for my use-case - though I am wondering if there might be a more appropriate message to send if in later versions of Android behavior such as terminating settings is pre-empted by the OS and not allowed to execute?