Skip to content

Commit f5ea12c

Browse files
committed
Fail silently if a process trys to launch an acitvity for background user
Doing this so we don't break current apps. In the future we should properly position the activity in the stack (i.e. behind all current user activity/task) and not change the positioning of stacks. Bug: 21801163 Bug: 13507605 Bug: 22929608 Change-Id: I979b6288e66f5b2ec2a6f22cb8d416e5c68109bd
1 parent 405eceb commit f5ea12c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

core/java/android/app/Instrumentation.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,9 +1810,14 @@ public static void checkStartActivityResult(int res, Object intent) {
18101810
throw new SecurityException(
18111811
"Starting under voice control not allowed for: " + intent);
18121812
case ActivityManager.START_NOT_CURRENT_USER_ACTIVITY:
1813-
throw new SecurityException(
1814-
"Not allowed to start background user activity that shouldn't be"
1815-
+ " displayed for all users.");
1813+
// Fail silently for this case so we don't break current apps.
1814+
// TODO(b/22929608): Instead of failing silently or throwing an exception,
1815+
// we should properly position the activity in the stack (i.e. behind all current
1816+
// user activity/task) and not change the positioning of stacks.
1817+
Log.e(TAG,
1818+
"Not allowed to start background user activity that shouldn't be displayed"
1819+
+ " for all users. Failing silently...");
1820+
break;
18161821
default:
18171822
throw new AndroidRuntimeException("Unknown error code "
18181823
+ res + " when starting " + intent);

0 commit comments

Comments
 (0)