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

Commit 913ce89b authored by Hansong Zhang's avatar Hansong Zhang
Browse files

HIDD: Fix the logic in unregisterApp()

unregisterApp() does nothing when no app is registered

Test: SL4A
Bug: 72168126
Change-Id: I6a541fee6cbd8fdabfddd0b1c56f90c8dfdecafd
parent 9af35bb7
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -508,15 +508,7 @@ public class HidDeviceService extends ProfileService {
        }

        int callingUid = Binder.getCallingUid();

        if (callingUid == mUserUid || callingUid < Process.FIRST_APPLICATION_UID) {
            mUserUid = 0;
            return mHidDeviceNativeInterface.unregisterApp();
        }
        if (DBG) {
            Log.d(TAG, "unregisterAppUid(): caller UID doesn't match user UID");
        }
        return false;
        return unregisterAppUid(callingUid);
    }

    private synchronized boolean unregisterAppUid(int uid) {
@@ -524,10 +516,13 @@ public class HidDeviceService extends ProfileService {
            Log.d(TAG, "unregisterAppUid(): uid=" + uid);
        }

        if (uid == mUserUid) {
        if (mUserUid != 0 && (uid == mUserUid || uid < Process.FIRST_APPLICATION_UID)) {
            mUserUid = 0;
            return mHidDeviceNativeInterface.unregisterApp();
        }
        if (DBG) {
            Log.d(TAG, "unregisterAppUid(): caller UID doesn't match user UID");
        }
        return false;
    }