Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5ea12c2 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

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
parent 405eceb2
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1810,9 +1810,14 @@ public class Instrumentation {
                throw new SecurityException(
                        "Starting under voice control not allowed for: " + intent);
            case ActivityManager.START_NOT_CURRENT_USER_ACTIVITY:
                throw new SecurityException(
                        "Not allowed to start background user activity that shouldn't be"
                        + " displayed for all users.");
                // Fail silently for this case so we don't break current apps.
                // TODO(b/22929608): Instead of failing silently or throwing an exception,
                // we should properly position the activity in the stack (i.e. behind all current
                // user activity/task) and not change the positioning of stacks.
                Log.e(TAG,
                        "Not allowed to start background user activity that shouldn't be displayed"
                        + " for all users. Failing silently...");
                break;
            default:
                throw new AndroidRuntimeException("Unknown error code "
                        + res + " when starting " + intent);