1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| private fun isUnderTraced(): Boolean { val processStatusFilePath = java.lang.String.format(Locale.US, "/proc/%d/status", Process.myPid()) val procInfoFile = File(processStatusFilePath) try { val b = BufferedReader(FileReader(procInfoFile)) var readLine: String? while (b.readLine().also { readLine = it } != null) {
if (readLine?.contains("TracerPid")!!) { val arrays = readLine!!.split(":".toRegex()).toTypedArray() if (arrays.size == 2) { val tracerPid = arrays[1].trim { it <= ' ' }.toInt() if (tracerPid != 0) { return true } } } } b.close() } catch (e: Exception) { e.printStackTrace() } return false }
|