commit | bcc5b4c1ff0c5ac8299df40c2fa146c3345e2c61 | [log] [tgz] |
---|---|---|
author | Neil Fuller <[email protected]> | Thu Apr 08 09:23:28 2021 +0000 |
committer | Android (Google) Code Review <[email protected]> | Thu Apr 08 09:23:28 2021 +0000 |
tree | c223492943e31471b11d551112f7e8b443d32862 | |
parent | f87898d0360696fc3b0da3e5833f0a29a7c66043 [diff] | |
parent | 9d02a125fbc7825a7e47d97fe33e5513d5252427 [diff] |
Merge "Fix state dumping when service stopped" into sc-dev
diff --git a/services/core/java/com/android/server/timezonedetector/location/LocationTimeZoneManagerService.java b/services/core/java/com/android/server/timezonedetector/location/LocationTimeZoneManagerService.java index 12767bc..326cfe7 100644 --- a/services/core/java/com/android/server/timezonedetector/location/LocationTimeZoneManagerService.java +++ b/services/core/java/com/android/server/timezonedetector/location/LocationTimeZoneManagerService.java
@@ -429,8 +429,11 @@ }, BLOCKING_OP_WAIT_DURATION_MILLIS); } - /** Returns a snapshot of the current controller state for tests. */ - @NonNull + /** + * Returns a snapshot of the current controller state for tests. Returns {@code null} if the + * service is stopped. + */ + @Nullable LocationTimeZoneManagerServiceState getStateForTests() { enforceManageTimeZoneDetectorPermission();
diff --git a/services/core/java/com/android/server/timezonedetector/location/LocationTimeZoneManagerShellCommand.java b/services/core/java/com/android/server/timezonedetector/location/LocationTimeZoneManagerShellCommand.java index bdf4a70..40638080 100644 --- a/services/core/java/com/android/server/timezonedetector/location/LocationTimeZoneManagerShellCommand.java +++ b/services/core/java/com/android/server/timezonedetector/location/LocationTimeZoneManagerShellCommand.java
@@ -217,6 +217,11 @@ return 1; } + if (state == null) { + // Controller is stopped. + return 0; + } + DualDumpOutputStream outputStream; boolean useProto = Objects.equals(DUMP_STATE_OPTION_PROTO, getNextOption()); if (useProto) {