Skip to content

Commit b2690f3

Browse files
ogunwaleAndroid (Google) Code Review
authored andcommitted
Merge "Fail silently if a process trys to launch an acitvity for background user" into mnc-dev
2 parents 55dbf2d + f5ea12c commit b2690f3

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)