Reginer / aosp-android-jar

AOSP编译出的android.jar,sdk里面以前反射调用的方法,现在可以直接调用了。
MIT License
540 stars 79 forks source link

Use of services.jar #22

Closed shrthndin closed 8 months ago

shrthndin commented 9 months ago

Is it possible to gain access to a local system server using the com.android.server.* classes directly without root? In this case I'm attempting to invoke a system service object via it's abstract class such as this:

import com.android.server.LocalServices; import com.android.server.lights.LightsManager;

lm = LocalServices.getService(LightsManager.class);

I've used the older version of the android API 30 jar at https://github.com/anggrayudi/android-hidden-api which includes both framework and services and compiled with an older version of Android Studio successfully. When running the code however, the classes are not found when running. Would reflection (such as with the LSPosed library) allow for this section of the API to be accessed, or is it off limits due to permissions altogether?

Reginer commented 9 months ago

你使用的compileSdk版本是多少?以及使用的targetSdk是多少?运行的设备SDK是多少?

shrthndin commented 9 months ago

compileSDK and targetSDK are 30, the device is a Xperia I IV. Stock ROM is in use.

Reginer commented 9 months ago

compileSDK and targetSDK are 30, the device is a Xperia I IV. Stock ROM is in use.

Xperia I IV我没有听过,主要是确认设备的安卓版本。 如果是api30,那么这个LocalService你无法使用,除非你是系统级别应用。

shrthndin commented 9 months ago

Okay. Would it be possible to use my device's specific framework and services jars then decompile and repackage them in a new android.jar? My device is currently using api 33.

Reginer commented 9 months ago

Okay. Would it be possible to use my device's specific framework and services jars then decompile and repackage them in a new android.jar? My device is currently using api 33.

是可以的,只需要将想添加的类文件放入android.jar的指令路径,然后sync。 需要注意的是加入的类是可以检验过的,不然修改后的android.jar无法使用