Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da0cc0a3 authored by James Wei's avatar James Wei
Browse files

USB: Adjust exception message in dealing with permission check #2

Add SafetyNet logging

Bug: 180104273
Test: CtsVerifier USB Device Test
Change-Id: I88fca08da5a3b4c1693fcd5b5e90af12a43cb482
parent 2195d444
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.service.usb.UsbUidPermissionProto;
import android.service.usb.UsbUserPermissionsManagerProto;
import android.util.ArrayMap;
import android.util.AtomicFile;
import android.util.EventLog;
import android.util.Slog;
import android.util.SparseBooleanArray;
import android.util.TypedXmlPullParser;
@@ -74,6 +75,8 @@ class UsbUserPermissionManager {
    private static final String TAG = UsbUserPermissionManager.class.getSimpleName();
    private static final boolean DEBUG = false;

    private static final int SNET_EVENT_LOG_ID = 0x534e4554;

    @GuardedBy("mLock")
    /** Mapping of USB device name to list of UIDs with permissions for the device
     * Each entry lasts until device is disconnected*/
@@ -691,6 +694,7 @@ class UsbUserPermissionManager {
            if (aInfo.uid != uid) {
                Slog.w(TAG, "package " + packageName
                        + " does not match caller's uid " + uid);
                EventLog.writeEvent(SNET_EVENT_LOG_ID, "180104273", -1, "");
                throw new IllegalArgumentException("package " + packageName
                        + " not found");
            }