[DO NOT MERGE] Add SafetyNet logging

- Add SafetyNet log if the calling package is no the permission for
result

Test: checked eventlog in the bugreport
Bug: 185126813

Merged-In: I1535f6f2ded2445702df0d723518b773cd094164
Change-Id: I1535f6f2ded2445702df0d723518b773cd094164
(cherry picked from commit 199528d46065ffe444e140023bd723786dbb5cdd)
(cherry picked from commit b9b493d39d609e14b8dda3bd863430fc393e4f14)
diff --git a/src/com/android/settings/wifi/WifiDialogActivity.java b/src/com/android/settings/wifi/WifiDialogActivity.java
index a212190..53c941e 100644
--- a/src/com/android/settings/wifi/WifiDialogActivity.java
+++ b/src/com/android/settings/wifi/WifiDialogActivity.java
@@ -28,6 +28,7 @@
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.ActionListener;
 import android.os.Bundle;
+import android.util.EventLog;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
@@ -216,6 +217,7 @@
         final String callingPackage = getCallingPackage();
         if (callingPackage == null) {
             Log.d(TAG, "Failed to get the calling package, don't return the result.");
+            EventLog.writeEvent(0x534e4554, "185126813", -1 /* UID */, "no calling package");
             return false;
         }
 
@@ -232,6 +234,14 @@
         }
 
         Log.d(TAG, "The calling package does not have the necessary permissions for result.");
+        try {
+            EventLog.writeEvent(0x534e4554, "185126813",
+                    getPackageManager().getPackageUid(callingPackage, 0 /* flags */),
+                    "no permission");
+        } catch (PackageManager.NameNotFoundException e) {
+            EventLog.writeEvent(0x534e4554, "185126813", -1 /* UID */, "no permission");
+            Log.w(TAG, "Cannot find the UID, calling package: " + callingPackage, e);
+        }
         return false;
     }
 }