Merge "Avoid NPE when getting last shutdown reason." into oc-dev

This commit is contained in:
TreeHugger Robot
2017-05-11 15:54:12 +00:00
committed by Android (Google) Code Review

View File

@@ -4607,6 +4607,9 @@ public final class PowerManagerService extends SystemService
} catch (IOException e) {
Slog.e(TAG, "Failed to read last_reboot_reason file", e);
}
if (line == null) {
return PowerManager.SHUTDOWN_REASON_UNKNOWN;
}
switch (line) {
case REASON_SHUTDOWN:
return PowerManager.SHUTDOWN_REASON_SHUTDOWN;