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

Commit 0fb2788d authored by Louis Chang's avatar Louis Chang Committed by Android Build Coastguard Worker
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
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:fca9c788b3364017b021544ec9594b43c93c9d29)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b04474764693d7ad05c64925a271c94574c6cb11)
Merged-In: Ida3648fb8a4c7e4801b024622f7e5f1110184a0d
Change-Id: Ida3648fb8a4c7e4801b024622f7e5f1110184a0d
parent fd66d834
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -246,21 +246,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);