Fix testNetworkSettingsPermission for headless User 0

This test fails on devices with headless user 0 when it tries to
verify apps with android:sharedUserId="android.uid.system" (and without
explicit ask for NETWORK_SETTINGS). Such apps get this permission
by default, but when running on user 1 they get UID 1001000, what doesn't
match SYSTEM_UID=1000.

By the chance of modifying this code, let's also add more verbose error
message (with UID), simplify it and reduce indentation count.

Bug: 120143468
Test: atest android.net.wifi.cts.WifiManagerTest#testNetworkSettingsPermission
Change-Id: Ifc09320cf738a518003126fad1ce31f5e38a3aff
2 files changed