setUidsAllowedOnRestrictedNetworks: Modify UID enforcement to check app id

Binder's calling UID seems to return the full UID on occasion which fails when commpared to Process.SYSTEM_UID. Return the app id instead.

Issue: calyxos#823
Change-Id: Ieb84d389b4f160370be2c890db4705d920aba4ee
Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
diff --git a/framework/src/android/net/ConnectivitySettingsManager.java b/framework/src/android/net/ConnectivitySettingsManager.java
index 822e67d..32f8319 100644
--- a/framework/src/android/net/ConnectivitySettingsManager.java
+++ b/framework/src/android/net/ConnectivitySettingsManager.java
@@ -1050,7 +1050,7 @@
     }
 
     private static boolean isCallingFromSystem() {
-        final int uid = Binder.getCallingUid();
+        final int uid = UserHandle.getAppId(Binder.getCallingUid());
         final int pid = Binder.getCallingPid();
         if (uid == Process.SYSTEM_UID && pid == Process.myPid()) {
             return true;