Add NeedsSu for RunShellCommand to check whether it needs SU

Currently, the as_root=True option causes run shell command to fail if "su" is
not available (e.g. because on a user build), even when accessing resources
which are not protected anyway.

This leads to clients writing complex "is my resource protected" functions
to determine the correct value to use for as_root.

With this CL, as_root=True will only fail if (1) one is trying to access
a protected resource and (2) we don't have privileged access to the device
either through root or su.

So clients can safely use always as_root=True in order to access a resource
which _may_ be protected.

BUG=430708

Review URL: https://codereview.chromium.org/700983006

Cr-Commit-Position: refs/heads/master@{#303063}
2 files changed