summaryrefslogtreecommitdiff
path: root/cmds
diff options
context:
space:
mode:
authorPaul Lawrence <paullawrence@google.com>2024-02-28 20:10:39 +0000
committerPaul Lawrence <paullawrence@google.com>2024-02-28 23:20:42 +0000
commit86b8d5e51a81e370f84a7f61764f4348edd394f7 (patch)
tree7e86581d145a1c9d4f7c4d491bdd53b844d2239c /cmds
parent3bd28b5829f1d463b31550ebc500ec0d8874b68d (diff)
downloadbase-86b8d5e51a81e370f84a7f61764f4348edd394f7.tar.gz
Prevent error message on svc power reboot
With the changes to sys.powerctl this variable is no longer set on a power event - the power action is simply carried out. (This is to avoid possible DoS of these power functions.) However, this means that this property can no longer be read to see if a power event is happening. Since there is no longer a way of telling if a remote exception is real or not, best not to print out an error. Note that this bug occurs on some devices, not all. I was able to reproduce it reliably on a Pixel 7a, but not on a Pixel 7 or Cuttlefish. Bug: 318323013 Test: adb shell svc power reboot Change-Id: Icbc1ec1b7882140d4d742b056ea2adaafae67ee9
Diffstat (limited to 'cmds')
-rw-r--r--cmds/svc/src/com/android/commands/svc/PowerCommand.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/cmds/svc/src/com/android/commands/svc/PowerCommand.java b/cmds/svc/src/com/android/commands/svc/PowerCommand.java
index a7560b23c6bd..12b79f4c42f8 100644
--- a/cmds/svc/src/com/android/commands/svc/PowerCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/PowerCommand.java
@@ -23,8 +23,6 @@ import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.os.SystemProperties;
-import android.sysprop.InitProperties;
public class PowerCommand extends Svc.Command {
private static final int FORCE_SUSPEND_DELAY_DEFAULT_MILLIS = 0;
@@ -142,12 +140,10 @@ public class PowerCommand extends Svc.Command {
// Check if remote exception is benign during shutdown. Pm can be killed
// before system server during shutdown, so remote exception can be ignored
// if it is already in shutdown flow.
+ // sys.powerctl is no longer set to avoid a possible DOS attack (see
+ // bionic/libc/bionic/system_property_set.cpp) so we have no real way of knowing if a
+ // remote exception is real or simply because pm is killed (b/318323013)
+ // So we simply do not display anything.
private void maybeLogRemoteException(String msg) {
- String powerProp = SystemProperties.get("sys.powerctl");
- // Also check if userspace reboot is ongoing, since in case of userspace reboot value of the
- // sys.powerctl property will be reset.
- if (powerProp.isEmpty() && !InitProperties.userspace_reboot_in_progress().orElse(false)) {
- System.err.println(msg);
- }
}
}