Skip to content

Android code search (framework, system api, hidden api)

Namgyu Park edited this page Jun 8, 2021 · 5 revisions

https://cs.android.com/

예시 )

  1. 디바이스 내부 path : /system/framework-res.apk 를 분석해보면 AndroidManifest.xml 에서 com.android.internal.app.ShutdownActivity 를 사용함을 알 수 있다.
  2. 해당 Activity, Service, API 등을 https://cs.android.com/ 찾아서 확인한 뒤, App 단에서 reflection 으로 구현한다.
 //android.os.ServiceManager is hide class, we can not invoke them from SDK. So we have to use reflect to invoke these classes.
        val getService = Class.forName("android.os.ServiceManager").getMethod("getService", String::class.java)
        val binder = getService.invoke(Object(), Context.POWER_SERVICE) as IBinder

        val mService = IPowerManager.Stub.asInterface(binder)

        // reboot 시도 (PowerManager.reboot 와 동일)
//        mService.reboot(false, null, false)

        // PowerManager.SHUTDOWN_USER_REQUESTED = "userrequested"
        mService.shutdown(false, "userrequested", false)

Clone this wiki locally