packages/apps/Settings
Revisão | c7882bb34474ad9e128b1f17ff9174d583c02d4f (tree) |
---|---|
Hora | 2021-08-16 13:15:16 |
Autor | Weng Su <wengsu@goog...> |
Commiter | Android Build Coastguard Worker |
[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)
@@ -28,6 +28,7 @@ import android.net.wifi.WifiConfiguration; | ||
28 | 28 | import android.net.wifi.WifiManager; |
29 | 29 | import android.net.wifi.WifiManager.ActionListener; |
30 | 30 | import android.os.Bundle; |
31 | +import android.util.EventLog; | |
31 | 32 | import android.util.Log; |
32 | 33 | |
33 | 34 | import androidx.annotation.VisibleForTesting; |
@@ -216,6 +217,7 @@ public class WifiDialogActivity extends Activity implements WifiDialog.WifiDialo | ||
216 | 217 | final String callingPackage = getCallingPackage(); |
217 | 218 | if (callingPackage == null) { |
218 | 219 | Log.d(TAG, "Failed to get the calling package, don't return the result."); |
220 | + EventLog.writeEvent(0x534e4554, "185126813", -1 /* UID */, "no calling package"); | |
219 | 221 | return false; |
220 | 222 | } |
221 | 223 |
@@ -232,6 +234,14 @@ public class WifiDialogActivity extends Activity implements WifiDialog.WifiDialo | ||
232 | 234 | } |
233 | 235 | |
234 | 236 | Log.d(TAG, "The calling package does not have the necessary permissions for result."); |
237 | + try { | |
238 | + EventLog.writeEvent(0x534e4554, "185126813", | |
239 | + getPackageManager().getPackageUid(callingPackage, 0 /* flags */), | |
240 | + "no permission"); | |
241 | + } catch (PackageManager.NameNotFoundException e) { | |
242 | + EventLog.writeEvent(0x534e4554, "185126813", -1 /* UID */, "no permission"); | |
243 | + Log.w(TAG, "Cannot find the UID, calling package: " + callingPackage, e); | |
244 | + } | |
235 | 245 | return false; |
236 | 246 | } |
237 | 247 | } |