Background running app to bring to foreground is not working with Appium version 1.7.2 .It shows Stderr: ‘java.lang.SecurityException: Permission Denial: starting Intent


#1

Hello,
I am facing this issue after upgrade the Appium to 1.7.2. It would be really helpful if anyone could suggest a solution
Platform : Android , Language : Java
Note : This issue is not faced when running with Appium 1.7.1 and lower versions.

Test is : to minimise and maximize my test app and it should redirect to the same screen after maximize.

Below is the code i am using for it.
driver.runAppInBackground(Duration.ofSeconds(1));
driver.currentActivity();

Issue
The app retains in the background itself after the given time , also throws error as follows

[ADB] Error: Error occured while starting App. Original error: Error executing adbExec. Original error:
‘Command ‘C:\Android\sdk\platform-tools\adb.exe -P 5037 -s ce0517159b6e780333 shell am start -W -n com.ta/.RestaurantScreen’
exited with code 1’;
Stderr: ‘java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.ta/.RestaurantScreen launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } } from null (pid=6300, uid=2000)
not exported from uid 10358
at android.os.Parcel.readException(Parcel.java:1693)
at android.os.Parcel.readException(Parcel.java:1646)
at android.app.ActivityManagerProxy.startActivityAndWait(ActivityManagerNative.java:3688)
at com.android.commands.am.Am.runStart(Am.java:658)
at com.android.commands.am.Am.onRun(Am.java:392)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
at com.android.commands.am.Am.main(Am.java:125)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:316)’; Code: '1

Error: Error occured while starting App. Original error: Error executing adbExec. 
Original error: 'Command 'C\:\\Android\\sdk\\platform-tools\\adb.exe -P 5037 -s ce0517159b6e780333 shell am start -W -n com.ta/.RestaurantScreen'

exited with code 1’; Stderr: ‘java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.ta/.RestaurantScreen launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } } from null
(pid=6300, uid=2000) not exported from uid 10358
at android.os.Parcel.readException(Parcel.java:1693)
at android.os.Parcel.readException(Parcel.java:1646)
at android.app.ActivityManagerProxy.startActivityAndWait(ActivityManagerNative.java:3688)
at com.android.commands.am.Am.runStart(Am.java:658)
at com.android.commands.am.Am.onRun(Am.java:392)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
at com.android.commands.am.Am.main(Am.java:125)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:316)’; Code: ‘1’
at Object.wrappedLogger.errorAndThrow (C:\Users\QA\AppData\Roaming\npm\node_modules\appium\node_modules\appium-support\lib\logging.js:69:13)
at ADB.callee$0$0$ (C:\Users\QA\AppData\Roaming\npm\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:101:9)


#2

The same above reproduced on 1.7.2


#3

Could anyone help me to resolve this issue , any new fixes or modification do I need to do with my capabilities to work for running app in background and retrieving.
Your help is really appreciated.Thanks in Advance.


#4

I am also having the same issue on 1.7.2