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

Commit 5a1316a7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 334f8eb4 8bad4500
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) {