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

Commit 409fcc72 authored by yuxi1's avatar yuxi1 Committed by yuxi
Browse files

[Bugfix] Fix after performing adb shell am hang and kill this process, the...


[Bugfix] Fix after performing adb shell am hang and kill this process, the phone can not resume from hang state

After performing adb shell am hang and kill this process, the phone can not resume from hang state. The reason is that the IBinder object in runHang(PrintWriter pw) of ActivityManagerShellCommand.java is not the IBinder object of client.

Bug: 180949375
Fixes: 180949375

Test: Run adb shell am hang, and open some APPs, then the phone will hang. Then perform ctrl + c, the phone can resume from hang state.

Signed-off-by: default avataryuxi1 <yuxi1@xiaomi.com>
Change-Id: Ie1153df2e21fc267fd131994422b7c263a17372a
parent 9c92c37f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -102,6 +102,10 @@ public class ShellCallback implements Parcelable {
        }
    }

    public IBinder getShellCallbackBinder() {
        return mShellCallback.asBinder();
    }

    ShellCallback(Parcel in) {
        mLocal = false;
        mShellCallback = IShellCallback.Stub.asInterface(in.readStrongBinder());
+8 −1
Original line number Diff line number Diff line
@@ -1690,7 +1690,14 @@ final class ActivityManagerShellCommand extends ShellCommand {

        pw.println("Hanging the system...");
        pw.flush();
        mInterface.hang(new Binder(), allowRestart);
        try {
            mInterface.hang(getShellCallback().getShellCallbackBinder(), allowRestart);
        } catch (NullPointerException e) {
            pw.println("Hanging failed, since caller " + Binder.getCallingPid() +
                    " did not provide a ShellCallback!");
            pw.flush();
            return 1;
        }
        return 0;
    }