Skip to content

Commit

Permalink
#1218 fix: use calling uid instead of pid
Browse files Browse the repository at this point in the history
  • Loading branch information
sds100 committed Jun 29, 2024
1 parent 1873467 commit 771bf9d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package io.github.sds100.keymapper.api

import android.app.Service
import android.content.Intent
import android.os.Binder
import android.os.DeadObjectException
import android.os.IBinder
import android.view.KeyEvent
import io.github.sds100.keymapper.api.IKeyEventRelayService.Stub.getCallingPid
import io.github.sds100.keymapper.system.inputmethod.KeyMapperImeHelper
import timber.log.Timber
import java.util.concurrent.ConcurrentHashMap
Expand Down Expand Up @@ -88,7 +88,7 @@ class KeyEventRelayService : Service() {
override fun onBind(intent: Intent?): IBinder? = binderInterface.asBinder()

private fun getCallerPackageName(): String? {
val sourcePid = getCallingPid()
return applicationContext.packageManager.getNameForUid(sourcePid)
val sourceUid = Binder.getCallingUid()
return applicationContext.packageManager.getNameForUid(sourceUid)
}
}

0 comments on commit 771bf9d

Please sign in to comment.