Fixed WifiManager checks to allow methods to be called by device owner.

WifiManager allows some APIs to be called by the device owner app,
but it's curently also checking that the caller is the foreground
user.

On systems running on headless system user mode, the device owner is
set in the system user, which will never be in the foreground.

Test: m -j com.android.wifi && adb install -r --staged --enable-rollback $ANDROID_PRODUCT_OUT/system/apex/com.android.wifi.apex && adb reboot
Test: atest com.android.server.wifi.util.WifiPermissionsUtilTest#testIsDeviceOwnerByUid,testIsDeviceOwnerByPackageName # affected methods
Test: atest WifiConfigManagerTest WifiPermissionsUtilTest # extra validation
Test: create a WiFi configuration on CtsVerifier on automotive

Bug: 177554984
Bug: 180024338

Change-Id: Ic0ffcc8294cd6adc14110305dbd4dab2872c4ac5
4 files changed