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

Commit fca9c788 authored by Louis Chang's avatar Louis Chang
Browse files

Fix starting the activity with incorrect pid/uid

Starts the activity in the same thread vs. in the frame callback.

Bug: 406763872
Test: am start-in-vsync
Flag: EXEMPT bugfix
Change-Id: Ida3648fb8a4c7e4801b024622f7e5f1110184a0d
parent 29c44684
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -250,21 +250,13 @@ final class ActivityManagerShellCommand extends ShellCommand {
                    return runStartActivity(pw);
                case "start-in-vsync":
                    final ProgressWaiter waiter = new ProgressWaiter(0);
                    final int[] startResult = new int[1];
                    startResult[0] = -1;
                    mInternal.mUiHandler.runWithScissors(
                            () -> Choreographer.getInstance().postFrameCallback(frameTimeNanos -> {
                                try {
                                    startResult[0] = runStartActivity(pw);
                                waiter.onFinished(0, null /* extras */);
                                } catch (Exception ex) {
                                    getErrPrintWriter().println(
                                            "Error: unable to start activity, " + ex);
                                }
                            }),
                            USER_OPERATION_TIMEOUT_MS / 2);
                    waiter.waitForFinish(USER_OPERATION_TIMEOUT_MS);
                    return startResult[0];
                    return runStartActivity(pw);
                case "startservice":
                case "start-service":
                    return runStartService(pw, false);