Merge cherrypicks of ['googleplex-android-review.googlesource.com/33833389'] into sparse-13775243-L92100030014435199.
SPARSE_CHANGE: I1ee7a09b7628a67dcb3502b29d99761bafd913b5

Change-Id: I014067ef7b430f5da7efe807125ea5d74a17856a
diff --git a/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java b/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java
index 614b0df..015073c 100644
--- a/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java
+++ b/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java
@@ -1126,6 +1126,9 @@
     public boolean isSystem(String packageName, int uid) {
         long ident = Binder.clearCallingIdentity();
         try {
+            if (SdkLevel.isAtLeastT() && Process.isSdkSandboxUid(uid)) {
+                return false;
+            }
             ApplicationInfo info = mContext.getPackageManager().getApplicationInfoAsUser(
                     packageName, 0, UserHandle.getUserHandleForUid(uid));
             return (info.flags & APP_INFO_FLAGS_SYSTEM_APP) != 0;