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

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1601731

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I20ebeab1147f78b7ed2d481f00fd3d8cbb9a7879
This commit is contained in:
Makoto Onuki
2021-03-09 01:42:36 +00:00
committed by Automerger Merge Worker
2 changed files with 12 additions and 1 deletions

View File

@@ -102,6 +102,10 @@ public class ShellCallback implements Parcelable {
} }
} }
public IBinder getShellCallbackBinder() {
return mShellCallback.asBinder();
}
ShellCallback(Parcel in) { ShellCallback(Parcel in) {
mLocal = false; mLocal = false;
mShellCallback = IShellCallback.Stub.asInterface(in.readStrongBinder()); mShellCallback = IShellCallback.Stub.asInterface(in.readStrongBinder());

View File

@@ -1690,7 +1690,14 @@ final class ActivityManagerShellCommand extends ShellCommand {
pw.println("Hanging the system..."); pw.println("Hanging the system...");
pw.flush(); 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; return 0;
} }