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

Commit b30f0dda authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add hidden API to get current user of HID Device (3/3)"

parents d03bf9e0 9c3580cb
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -453,6 +453,15 @@ public class HidDeviceService extends ProfileService {

            return service.getDevicesMatchingConnectionStates(states);
        }

        @Override
        public String getUserAppName() {
            HidDeviceService service = getService();
            if (service == null) {
                return "";
            }
            return service.getUserAppName();
        }
    }

    @Override
@@ -614,6 +623,15 @@ public class HidDeviceService extends ProfileService {
                && mHidDeviceNativeInterface.reportError(error);
    }

    synchronized String getUserAppName() {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        if (mUserUid < Process.FIRST_APPLICATION_UID) {
            return "";
        }
        String appName = getPackageManager().getNameForUid(mUserUid);
        return appName != null ? appName : "";
    }

    @Override
    protected boolean start() {
        if (DBG) {