bigsinger / AndroidIdChanger

Xposed Module for Changing Android Device Info
http://repo.xposed.info/module/com.bigsing.changer
548 stars 152 forks source link

Nougat support #14

Closed lars18th closed 7 years ago

lars18th commented 7 years ago

Hi,

I confirm that it doesn't work with Android 7.0. I see a lot (haundred) of errors in the Xposed's log.

If you agree I can assist for adding Nougat support (with testing, not conding).

The first part of the log:

10-16 09:51:12.923 E/Xposed  ( 1732): de.robv.android.xposed.XposedHelpers$ClassNotFoundError: java.lang.ClassNotFoundException: com.android.internal.telephony.PhoneSubInfo
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.XposedHelpers.findClass(XposedHelpers.java:69)
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:258)
10-16 09:51:12.923 E/Xposed  ( 1732):   at com.bigsing.changer.b.b.a(SourceFile:34)
10-16 09:51:12.923 E/Xposed  ( 1732):   at com.bigsing.changer.MainHook.handleLoadPackage(SourceFile:63)
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:34)
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:61)
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:106)
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.XposedInit$5.afterHookedMethod(XposedInit.java:202)
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:353)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.LoadedApk.<init>(<Xposed>)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1988)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1943)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1915)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:1839)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.ContextImpl.createPackageContext(ContextImpl.java:1827)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:778)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.ActivityThread.installProvider(ActivityThread.java:5825)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.ActivityThread.installContentProviders(ActivityThread.java:5444)
10-16 09:51:12.923 E/Xposed  ( 1732):   at android.app.ActivityThread.installSystemProviders(ActivityThread.java:6037)
10-16 09:51:12.923 E/Xposed  ( 1732):   at com.android.server.am.ActivityManagerService.installSystemProviders(ActivityManagerService.java:11610)
10-16 09:51:12.923 E/Xposed  ( 1732):   at com.android.server.SystemServer.startOtherServices(SystemServer.java:591)
10-16 09:51:12.923 E/Xposed  ( 1732):   at com.android.server.SystemServer.run(SystemServer.java:330)
10-16 09:51:12.923 E/Xposed  ( 1732):   at com.android.server.SystemServer.main(SystemServer.java:215)
10-16 09:51:12.923 E/Xposed  ( 1732):   at java.lang.reflect.Method.invoke(Native Method)
10-16 09:51:12.923 E/Xposed  ( 1732):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
10-16 09:51:12.923 E/Xposed  ( 1732):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:103)
10-16 09:51:12.923 E/Xposed  ( 1732): Caused by: java.lang.ClassNotFoundException: com.android.internal.telephony.PhoneSubInfo
10-16 09:51:12.923 E/Xposed  ( 1732):   at java.lang.Class.classForName(Native Method)
10-16 09:51:12.923 E/Xposed  ( 1732):   at java.lang.Class.forName(Class.java:400)
10-16 09:51:12.923 E/Xposed  ( 1732):   at external.org.apache.commons.lang3.ClassUtils.getClass(ClassUtils.java:823)
10-16 09:51:12.923 E/Xposed  ( 1732):   at de.robv.android.xposed.XposedHelpers.findClass(XposedHelpers.java:67)
10-16 09:51:12.923 E/Xposed  ( 1732):   ... 26 more

This is the first error. However, all errors refers to "java.lang.ClassNotFoundException: com.android.internal.telephony.PhoneSubInfo"

I feel in Nougat this class has another name.

bigsinger commented 7 years ago

class "com.android.internal.telephony.PhoneSubInfo "not exist in Android N, upgrade the tool to 1.8 please

lars18th commented 7 years ago

Hi,

Perhaps this info can be useful for adding support for Android 6.x & 7.x

I hope it helps!

lars18th commented 7 years ago

Hi,

class "com.android.internal.telephony.PhoneSubInfo "not exist in Android N, upgrade the tool to 1.8 please

Upgraded. Now the error is on "com.android.internal.telephony.PhoneProxy" See this part of the log:

10-16 10:36:42.734 E/Xposed  ( 1697): de.robv.android.xposed.XposedHelpers$ClassNotFoundError: java.lang.ClassNotFoundException: com.android.internal.telephony.PhoneProxy
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.XposedHelpers.findClass(XposedHelpers.java:69)
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:258)
10-16 10:36:42.734 E/Xposed  ( 1697):   at com.bigsing.changer.b.b.a(SourceFile:40)
10-16 10:36:42.734 E/Xposed  ( 1697):   at com.bigsing.changer.MainHook.handleLoadPackage(SourceFile:63)
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:34)
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:61)
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:106)
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.XposedInit$5.afterHookedMethod(XposedInit.java:202)
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:353)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.LoadedApk.<init>(<Xposed>)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1988)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1943)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1915)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:1839)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.ContextImpl.createPackageContext(ContextImpl.java:1827)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:778)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.ActivityThread.installProvider(ActivityThread.java:5825)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.ActivityThread.installContentProviders(ActivityThread.java:5444)
10-16 10:36:42.734 E/Xposed  ( 1697):   at android.app.ActivityThread.installSystemProviders(ActivityThread.java:6037)
10-16 10:36:42.734 E/Xposed  ( 1697):   at com.android.server.am.ActivityManagerService.installSystemProviders(ActivityManagerService.java:11610)
10-16 10:36:42.734 E/Xposed  ( 1697):   at com.android.server.SystemServer.startOtherServices(SystemServer.java:591)
10-16 10:36:42.734 E/Xposed  ( 1697):   at com.android.server.SystemServer.run(SystemServer.java:330)
10-16 10:36:42.734 E/Xposed  ( 1697):   at com.android.server.SystemServer.main(SystemServer.java:215)
10-16 10:36:42.734 E/Xposed  ( 1697):   at java.lang.reflect.Method.invoke(Native Method)
10-16 10:36:42.734 E/Xposed  ( 1697):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
10-16 10:36:42.734 E/Xposed  ( 1697):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:103)
10-16 10:36:42.734 E/Xposed  ( 1697): Caused by: java.lang.ClassNotFoundException: com.android.internal.telephony.PhoneProxy
10-16 10:36:42.734 E/Xposed  ( 1697):   at java.lang.Class.classForName(Native Method)
10-16 10:36:42.734 E/Xposed  ( 1697):   at java.lang.Class.forName(Class.java:400)
10-16 10:36:42.734 E/Xposed  ( 1697):   at external.org.apache.commons.lang3.ClassUtils.getClass(ClassUtils.java:823)
10-16 10:36:42.734 E/Xposed  ( 1697):   at de.robv.android.xposed.XposedHelpers.findClass(XposedHelpers.java:67)
10-16 10:36:42.734 E/Xposed  ( 1697):   ... 26 more

I hope this helps! ;)

bigsinger commented 7 years ago

i am confused by:

SDK < 22 com.android.internal.telephony.PhoneSubInfo.getDeviceId com.android.internal.telephony.gsm.GSMPhone.getDeviceId android.telephony.TelephonyManager.getDeviceId SDK = 22 com.android.internal.telephony.PhoneSubInfo.getDeviceId com.android.internal.telephony.PhoneProxy.getDeviceId android.telephony.TelephonyManager.getDeviceId SDK = 23 android.telephony.TelephonyManager.getDeviceId android.telephony.TelephonyManager.getImei SDK >= 24 android.telephony.TelephonyManager.getDeviceId android.telephony.TelephonyManager.getImei com.android.internal.telephony.GsmCdmaPhone.getDeviceId com.android.internal.telephony.GsmCdmaPhone.getImei

can you email me? pushebp@163.com

lars18th commented 7 years ago

Hi,

I get this from another project. This is a list of members related to IMEI info in different Android versions. As I assume you would use some of these, then I put the available list for different SDK versions.

This doesn't helps?

lars18th commented 7 years ago

Hi @noobfish,

I'M using AOSP Android Nougat,the APP works !Thank you developer !

Which device/model are you using? In my it doesn't works! (the Apps runs, but not changes the values).

bigsinger commented 7 years ago

upgrade and try again

lars18th commented 7 years ago

Hi @bigsinger ,

Last version after upgrade generates a bootloop in my device. Any idea?

bigsinger commented 7 years ago

What's bootloop?

noobfish commented 7 years ago

@lars18th Hello there. I'M using Xiaomi Redmi Note 4G(dior) with Mokee 7.1.2

lars18th commented 7 years ago

Hi @bigsinger ,

What's bootloop?

If I enable the module (last version) the boot never completes. The bootanimation starts and after some time the device reboots... and this is repeated forever. The only solution is disable Xposed and disable your module. Then when I restart without you module all goes fine.

This is only true with the last version. Can you implement any internal full log for your App? The Xposed current log with only your module active not shows any probem. Please, add an option for increase the log level.

I hope you can fix soon the compatibility with SDK 24 (Android 7.1 is SDK 25).

lars18th commented 7 years ago

Note: Last version (the one that creates the bootloop) is v1.9.

bigsinger commented 7 years ago

can you give me your email address? I'll send you the testing version.

lars18th commented 7 years ago

can you give me your email address? I'll send you the testing version.

Send me to this ' ' (remove spaces).

lars18th commented 7 years ago

Hi,

If anyone likes to check Xposed on Nougat, this is my recommendation:

With this you will have Magisk+Xposed running in Android 7.0 & 7.1

lars18th commented 7 years ago

Hi @bigsinger ,

Regarding errors like

    10-17 16:32:27.265 239-239/? E/Xposed: Unable to stat fd 4 : Permission denied
    10-17 16:32:27.265 239-239/? E/Xposed: Unable to stat fd 5 : Permission denied

See this: https://github.com/rovo89/Xposed/issues/203 I feel the problem is related to log writes to files. Check with v88 of Xposed Framework, and if doesn't work, then try to disable logs.

In any case, please can you enable (in you App) the option for "full debug" mode? It's sufficient to increase the log verbosity and continue using the same Xposed log method.

Thank you for this good module!

bigsinger commented 7 years ago

then try to disable logs.

@lars18th you mean do not use "XposedBridge.log"?

bigsinger commented 7 years ago

See this: rovo89/Xposed#203

@lars18th sorry, i can not understand how to resovle it

lars18th commented 7 years ago

Hi @bigsinger ,

@lars18th you mean do not use "XposedBridge.log"?

If this is the reason of your error, then yes.

I suggest to try this:

Please, send me a testing version with full log for trying to found where is the problem.

bigsinger commented 7 years ago

yes, of course, i change my code as:

public class XposedLog { public static void log(String msg){ if (false) { XposedBridge.log(msg); } } } i replace "XposedBridge.log" as "XposedLog.log", it means this will never log anything.

then i recompile my app, and reboot my nexus9. unfortunately the problem still exists : 10-17 18:15:10.330 6517-6517/? E/Xposed: Unable to stat fd 4 : Permission denied 10-17 18:15:10.330 6517-6517/? E/Xposed: Unable to stat fd 6 : Permission denied

lars18th commented 7 years ago

Hi @bigsinger ,

This is part of the log when running the "testing" version with verbose log:

10-17 13:19:27.809 I/Xposed  ( 8062): Loading modules from /data/app/com.bigsing.changer-1/base.apk
10-17 13:19:27.825 I/Xposed  ( 8062):   Loading class com.bigsing.changer.MainHook
10-17 13:19:28.801 I/Xposed  ( 8425): [handleLoadPackage] android
10-17 13:19:36.833 I/Xposed  ( 8425): [handleLoadPackage] com.android.providers.settings
10-17 13:19:36.840 I/Xposed  ( 8425): [handleLoadPackage] com.motorola.android.providers.settings
10-17 13:19:36.842 I/Xposed  ( 8425): hookPackages: null
10-17 13:19:36.842 I/Xposed  ( 8425): target got! com.motorola.android.providers.settings
10-17 13:19:36.857 I/Xposed  ( 8425): HookerPhone.hook : 1
10-17 13:19:36.857 I/Xposed  ( 8425): HookerPhone.hook : 2
10-17 13:19:36.865 I/Xposed  ( 8425): HookerPhone.hook : 3
10-17 13:19:36.867 I/Xposed  ( 8425): HookerPhone.hook : 4
10-17 13:19:36.870 I/Xposed  ( 8425): HookerPhone.hook : 5
10-17 13:19:36.873 I/Xposed  ( 8425): HookerPhone.hook : 6
10-17 13:19:36.876 I/Xposed  ( 8425): HookerPhone.hook : 7
10-17 13:19:36.880 I/Xposed  ( 8425): HookerPhone.hook : 8
10-17 13:19:36.882 I/Xposed  ( 8425): HookerPhone.hook : 9
10-17 13:19:36.885 I/Xposed  ( 8425): HookerPhone.hook : 10
10-17 13:19:36.886 I/Xposed  ( 8425): HookerPhone.hook : 11
10-17 13:19:36.889 I/Xposed  ( 8425): HookerPhone.hook : 12
10-17 13:19:36.891 I/Xposed  ( 8425): HookerPhone.hook : 13
10-17 13:19:36.895 I/Xposed  ( 8425): HookerPhone.hook : 14
10-17 13:19:36.895 I/Xposed  ( 8425): HookerPhone.hook : 15
10-17 13:19:36.895 I/Xposed  ( 8425): HookerPhone.hook : 16
10-17 13:19:36.896 I/Xposed  ( 8425): HookerPhone.hook : 17
10-17 13:19:36.896 I/Xposed  ( 8425): HookerPhone.hook : 18
10-17 13:19:36.896 I/Xposed  ( 8425): HookerPhone.hook : 19
10-17 13:19:40.886 I/Xposed  ( 8579): [handleLoadPackage] com.google.android.inputmethod.latin
10-17 13:19:40.887 I/Xposed  ( 8579): hookPackages: null
10-17 13:19:40.887 I/Xposed  ( 8579): target got! com.google.android.inputmethod.latin
10-17 13:19:40.903 I/Xposed  ( 8579): HookerPhone.hook : 1
10-17 13:19:40.903 I/Xposed  ( 8579): HookerPhone.hook : 2
10-17 13:19:40.910 I/Xposed  ( 8579): HookerPhone.hook : 3
10-17 13:19:40.912 I/Xposed  ( 8579): HookerPhone.hook : 4
10-17 13:19:40.914 I/Xposed  ( 8579): HookerPhone.hook : 5
10-17 13:19:40.918 I/Xposed  ( 8579): HookerPhone.hook : 6
10-17 13:19:40.921 I/Xposed  ( 8579): HookerPhone.hook : 7
10-17 13:19:40.924 I/Xposed  ( 8605): [handleLoadPackage] com.android.systemui
10-17 13:19:40.924 I/Xposed  ( 8579): HookerPhone.hook : 8
10-17 13:19:40.926 I/Xposed  ( 8579): HookerPhone.hook : 9
10-17 13:19:40.926 I/Xposed  ( 8605): hookPackages: null
10-17 13:19:40.926 I/Xposed  ( 8605): target got! com.android.systemui
10-17 13:19:40.927 I/Xposed  ( 8579): HookerPhone.hook : 10
10-17 13:19:40.929 I/Xposed  ( 8579): HookerPhone.hook : 11
10-17 13:19:40.930 I/Xposed  ( 8579): HookerPhone.hook : 12
10-17 13:19:40.932 I/Xposed  ( 8579): HookerPhone.hook : 13
10-17 13:19:40.935 I/Xposed  ( 8579): HookerPhone.hook : 14
10-17 13:19:40.935 I/Xposed  ( 8579): HookerPhone.hook : 15
10-17 13:19:40.935 I/Xposed  ( 8579): HookerPhone.hook : 16
10-17 13:19:40.936 I/Xposed  ( 8579): HookerPhone.hook : 17
10-17 13:19:40.936 I/Xposed  ( 8579): HookerPhone.hook : 18
10-17 13:19:40.936 I/Xposed  ( 8579): HookerPhone.hook : 19
10-17 13:19:40.943 I/Xposed  ( 8605): HookerPhone.hook : 1
10-17 13:19:40.943 I/Xposed  ( 8605): HookerPhone.hook : 2
10-17 13:19:40.952 I/Xposed  ( 8605): HookerPhone.hook : 3
10-17 13:19:40.954 I/Xposed  ( 8605): HookerPhone.hook : 4
10-17 13:19:40.956 I/Xposed  ( 8605): HookerPhone.hook : 5
10-17 13:19:40.959 I/Xposed  ( 8605): HookerPhone.hook : 6
10-17 13:19:40.962 I/Xposed  ( 8605): HookerPhone.hook : 7
10-17 13:19:40.965 I/Xposed  ( 8605): HookerPhone.hook : 8
10-17 13:19:40.967 I/Xposed  ( 8605): HookerPhone.hook : 9
10-17 13:19:40.968 I/Xposed  ( 8605): HookerPhone.hook : 10
10-17 13:19:40.969 I/Xposed  ( 8605): HookerPhone.hook : 11
10-17 13:19:40.971 I/Xposed  ( 8605): HookerPhone.hook : 12
10-17 13:19:40.972 I/Xposed  ( 8605): HookerPhone.hook : 13
10-17 13:19:40.975 I/Xposed  ( 8605): HookerPhone.hook : 14
10-17 13:19:40.975 I/Xposed  ( 8605): HookerPhone.hook : 15
10-17 13:19:40.975 I/Xposed  ( 8605): HookerPhone.hook : 16
10-17 13:19:40.976 I/Xposed  ( 8605): HookerPhone.hook : 17
10-17 13:19:40.976 I/Xposed  ( 8605): HookerPhone.hook : 18
10-17 13:19:40.976 I/Xposed  ( 8605): HookerPhone.hook : 19
10-17 13:19:41.705 E/Xposed  ( 8579): java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
10-17 13:19:41.705 E/Xposed  ( 8579):   at com.b.b$7.afterHookedMethod(SourceFile:150)
10-17 13:19:41.705 E/Xposed  ( 8579):   at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:353)
10-17 13:19:41.705 E/Xposed  ( 8579):   at android.app.ActivityManager.getRunningAppProcesses(<Xposed>)
10-17 13:19:41.705 E/Xposed  ( 8579):   at etn.a(PG:10)
10-17 13:19:41.705 E/Xposed  ( 8579):   at pc.a(PG:3936)
10-17 13:19:41.705 E/Xposed  ( 8579):   at eov.a(PG:69)
10-17 13:19:41.705 E/Xposed  ( 8579):   at eov$b.uncaughtException(PG:21)
10-17 13:19:41.705 E/Xposed  ( 8579):   at eqh.uncaughtException(PG:28)
10-17 13:19:41.705 E/Xposed  ( 8579):   at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
10-17 13:19:41.705 E/Xposed  ( 8579):   at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)

This indicates that you try to iterate over a null object. I feel you can fix it! ;-)

bigsinger commented 7 years ago

can you show some errors contain my package name "com.bigsing.changer", it seems not my source.

10-17 13:19:41.705 E/Xposed ( 8579): java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference 10-17 13:19:41.705 E/Xposed ( 8579): at com.b.b$7.afterHookedMethod(SourceFile:150)

in my app i use xposed:

compile 'de.robv.android.xposed:api:82:sources' provided 'de.robv.android.xposed:api:82'

should i use the 88 version?

lars18th commented 7 years ago

Hi @bigsinger ,

can you show some errors contain my package name "com.bigsing.changer", it seems not my source.

Sorry! This is all! Only removed the header... after the last line the system reboots. And I not see any other LOG file generated by your package inside "/data/data/com.bigsing.changer/ " or even "/data/user_de/0/com.bigsing.changer/ ".

However, I found that if I select only a small set of Apps in the list of "Specific App" then I can boot without troubles. But, then in the list of Apps, the changed values seems to be "null". I'm testing the values with "CPU-X" and "DevCheck".

Suggestions:

lars18th commented 7 years ago

Hi @bigsinger ,

Regarding the trouble with "values equal to null". This is not really true!

Then, I suspect that it works, but not for all Apps. You need to add more verbose debug for resolve the crash and null values. But some Apps work. Please, try with these tools in house!

lars18th commented 7 years ago

Hi @bigsinger ,

More info about these Apps: after rebooting a different behaviour is found: Aida64 & CPU-X present "null" values; and CPU-Z & DevCheck crashed.

So. I feel some part of the code fails with Nougat 7.0 (SDK 24).

Futhermore, I do this check: Clear the Xposed LOG, open CPU-Z (it crashes) and re-open the Xposed log. Here it is:

10-17 14:48:38.487 I/Xposed  (12314): [handleLoadPackage] com.cpuid.cpu_z
10-17 14:48:38.489 I/Xposed  (12314): hookPackages: com.abs.cpu_z_advance com.cpuid.cpu_z com.finalwire.aida64 flar2.devcheck
10-17 14:48:38.490 I/Xposed  (12314): target got! com.cpuid.cpu_z
10-17 14:48:38.508 I/Xposed  (12314): HookerPhone.hook : 1
10-17 14:48:38.508 I/Xposed  (12314): HookerPhone.hook : 2
10-17 14:48:38.514 I/Xposed  (12314): HookerPhone.hook : 3
10-17 14:48:38.515 I/Xposed  (12314): HookerPhone.hook : 4
10-17 14:48:38.517 I/Xposed  (12314): HookerPhone.hook : 5
10-17 14:48:38.520 I/Xposed  (12314): HookerPhone.hook : 6
10-17 14:48:38.524 I/Xposed  (12314): HookerPhone.hook : 7
10-17 14:48:38.526 I/Xposed  (12314): HookerPhone.hook : 8
10-17 14:48:38.528 I/Xposed  (12314): HookerPhone.hook : 9
10-17 14:48:38.529 I/Xposed  (12314): HookerPhone.hook : 10
10-17 14:48:38.530 I/Xposed  (12314): HookerPhone.hook : 11
10-17 14:48:38.531 I/Xposed  (12314): HookerPhone.hook : 12
10-17 14:48:38.533 I/Xposed  (12314): HookerPhone.hook : 13
10-17 14:48:38.537 I/Xposed  (12314): HookerPhone.hook : 14
10-17 14:48:38.538 I/Xposed  (12314): HookerPhone.hook : 15
10-17 14:48:38.538 I/Xposed  (12314): HookerPhone.hook : 16
10-17 14:48:38.538 I/Xposed  (12314): HookerPhone.hook : 17
10-17 14:48:38.538 I/Xposed  (12314): HookerPhone.hook : 18
10-17 14:48:38.538 I/Xposed  (12314): HookerPhone.hook : 19
10-17 14:48:38.762 I/Xposed  (12314): [handleLoadPackage] com.google.android.gms
10-17 14:48:38.763 I/Xposed  (12314): hookPackages: com.abs.cpu_z_advance com.cpuid.cpu_z com.finalwire.aida64 flar2.devcheck
10-17 14:48:39.057 I/Xposed  (12314): [handleLoadPackage] com.android.chrome
10-17 14:48:39.058 I/Xposed  (12314): hookPackages: com.abs.cpu_z_advance com.cpuid.cpu_z com.finalwire.aida64 flar2.devcheck
10-17 14:49:45.039 I/Xposed  ( 2410): Hide task: de.robv.android.xposed.installer/de.robv.android.xposed.installer.WelcomeActivity-hjmodi

That's all!

I feel the problem is the hook of the running Apps. Perhaps your code isn't compatible with SDK 24.

bigsinger commented 7 years ago

what can i do for :

I feel the problem is the hook of the running Apps. Perhaps your code isn't compatible with SDK 24.

the log contains:

HookerPhone.hook : 19

means hook's already done success.

cause xposed can't work on my N9, i can't test this in my house.

Please, try with these tools in house!

i have not resovle the problem:

10-17 16:32:27.265 239-239/? E/Xposed: Unable to stat fd 4 : Permission denied 10-17 16:32:27.265 239-239/? E/Xposed: Unable to stat fd 5 : Permission denied

bigsinger commented 7 years ago

the value "hookPackages" is null on first installing, if hookPackages is null, i'll hook all apps, maybe i should hook nothing when no app specified.

you metioned sorting app by name will be implemented next version.

lars18th commented 7 years ago

Hi @bigsinger ,

the value "hookPackages" is null on first installing, if hookPackages is null, i'll hook all apps, maybe i should hook nothing when no app specified.

No. Hook nothing it's equal to disable the module. If you hook all apps, the problems seems to be with the method you use to hook all. Please, check all process references. Perhaps some of them are null in the RunningAppProcessInfo list. Or use another way for hook all.

you metioned sorting app by name will be implemented next version.

Great! I hope to see this version soon (even if not all new functions are included).

lars18th commented 7 years ago

Hi @bigsinger ,

HookerPhone.hook : 19

means hook's already done success.

Yes, and this is only true when I select only a list of Apps. The bootloop is caused when the list is empty and you try to hook all Apps. So, my first suggestion is: disable the hook of all running processes until you fix this trouble. When the list is empty you need to not hook anything. This will resolve the startup with Nougat.

The second problem is the empty values in hooked Apps. Please, can you add more verbose debug when a hooked value is readed? Perhaps this be simple to resolve it.

cause xposed can't work on my N9, i can't test this in my house.

i have not resovle the problem: 10-17 16:32:27.265 239-239/? E/Xposed: Unable to stat fd 4 : Permission denied 10-17 16:32:27.265 239-239/? E/Xposed: Unable to stat fd 5 : Permission denied

Ok. I'll try to help you! You can access to XDA, or it's blocked for you?

bigsinger commented 7 years ago

Great minds think alike. When the hook list is empty i hook nothing to resolve the startup problem with N, and show a toast to remind user to specify hooked app. I upgrade a new verion(1.11), you can have a try.

XDA is blocked for me somtimes, so, it's hardly to find some useful thing, 3q 4 your help.

lars18th commented 7 years ago

Hi @bigsinger ,

I'm testing v1.11 now... One question (as the new version has reseted the config): in "shared_prefs" are "phone.xml" and "phoneinfo.xml". Which one saves the content of the "modified" values?

XDA is blocked for me somtimes

Ok. I'll search for Magisk+Xposed support for Nexus 9.

bigsinger commented 7 years ago

phoneinfo is the modified

lars18th commented 7 years ago

phoneinfo is the modified

Thank you! I'm editing the file manually now. ;-)

Please, can you add these two changes?

1) Support for the "fingerprint" value (ro.build.fingerprint). It's in the "phone.xml", but not present in "phoneinfo.xml".

2) If one value not exists in the "phoneinfo" or it's empty, then not hook it. The idea is only call to "findAndHookMethod" is something needs to change (Xposed slows down the device!).

You agree?

lars18th commented 7 years ago

Hi,

With v1.11 the same behaviour continues when the list of selected Apps has some values: Aida64 & CPU-X present "null" values; and CPU-Z & DevCheck crashed.

And when the selected Apps is empty: now the bootloop is fixed! ;)

In order to fix the problem with the empty values, can you share the sources? Perhaps I can see where is the problem.

bigsinger commented 7 years ago

i'v send the code to u, u can modify these(fingerprint and null values). I need to work now..

lars18th commented 7 years ago

Hi @bigsinger ,

i'v send the code to u

Thank you! I'm reviewing it.

lars18th commented 7 years ago

Hi @bigsinger ,

After review the code, some “suggestions” if you like to implement them:

That’s all my comments! I hope it helps.

bigsinger commented 7 years ago

u r realy nuibility

let me resolve these one by one

lars18th commented 7 years ago

Hi @bigsinger ,

u r realy nuibility

:smile:

Regarding the "empty" values (the most relevant part), I feel the problem can be the reading of preferences in Nougat.

Please, do some of these changes to check it:

  1. Log the value hooked. If the value is "" in the log, the the problem is the load of preferences.
  2. At starting of the execution Print the values to modify. This will check if they are valid or not.
  3. Also I recommend to not hook empty values (as this overheads!).

Regards!

lars18th commented 7 years ago

Hi,

For improve the check of "empty" values, I suggest to change the code in this sense...

Instead of

XposedHelpers.setStaticObjectField(Build.class, "DISPLAY", PhoneInfoUtils.getValue("display"));

Use like this:

XposedHelpers.setStaticObjectField(Build.class, "DISPLAY", StringUtils.isBlank(PhoneInfoUtils.getValue("display")) ? "0" : PhoneInfoUtils.getValue("display") );

This will use "0" (or any other value) if the value is empty.

bigsinger commented 7 years ago

PhoneInfoUtils.getValue function will never return null, the implemention:

public static String getValue(String key) {
    String value = null;
    try {
        if (mHashMap == null) {
            getPhoneInfo();
        }
        value = mHashMap.get(key);
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (value == null) {
        value = "";
    }
    return value;
}
lars18th commented 7 years ago

So, the problem can be when returning "".

For assure it, please add to the code something like this:

XposedLog.logd("HookerPhone.hook : 18" + " PRODUCT= " + PhoneInfoUtils.getValue("product") + " HOST= " + PhoneInfoUtils.getValue("host") );

More or less. That's print all values in the log when hooking them. You agree?

bigsinger commented 7 years ago

agree,send u.

lars18th commented 7 years ago

agree,send u.

Tested! But, this version never reach the "HookerPhone.hook : 18" in my device! See this log (with some parts removed):

10-19 18:50:27.674 I/Xposed  ( 2860): HookerPhone.hook : 1
10-19 18:50:27.674 I/Xposed  ( 2860): HookerPhone.hook : 2
10-19 18:50:27.689 I/Xposed  ( 2860): HookerPhone.hook : 3
10-19 18:50:27.692 I/Xposed  ( 2860): HookerPhone.hook : 4
10-19 18:50:27.696 I/Xposed  ( 2860): HookerPhone.hook : 5
10-19 18:50:27.716 I/Xposed  ( 2860): HookerPhone.hook : 6
10-19 18:50:27.724 I/Xposed  ( 2860): HookerPhone.hook : 7
10-19 18:50:27.733 I/Xposed  ( 2860): HookerPhone.hook : 8
10-19 18:50:27.736 I/Xposed  ( 2860): HookerPhone.hook : 9
10-19 18:50:27.742 I/Xposed  ( 2860): HookerPhone.hook : 10
10-19 18:50:27.745 I/Xposed  ( 2860): HookerPhone.hook : 11
10-19 18:50:27.748 I/Xposed  ( 2860): HookerPhone.hook : 12
10-19 18:50:27.751 I/Xposed  ( 2860): HookerPhone.hook : 13
10-19 18:50:27.755 I/Xposed  ( 2860): HookerPhone.hook : 14
10-19 18:50:27.760 E/Xposed  ( 2860): java.lang.NoSuchFieldError: android.os.Build$VERSION#Incremental
10-19 18:50:27.760 E/Xposed  ( 2860):   at de.robv.android.xposed.XposedHelpers.findField(XposedHelpers.java:114)
10-19 18:50:27.760 E/Xposed  ( 2860):   at de.robv.android.xposed.XposedHelpers.setStaticObjectField(XposedHelpers.java:1016)
10-19 18:50:27.760 E/Xposed  ( 2860):   at com.bigsing.changer.b.b.a(SourceFile:269)
10-19 18:50:27.760 E/Xposed  ( 2860):   at com.bigsing.changer.MainHook.handleLoadPackage(SourceFile:68)
10-19 18:50:27.760 E/Xposed  ( 2860):   at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:34)
10-19 18:50:27.760 E/Xposed  ( 2860):   at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:61)
10-19 18:50:27.760 E/Xposed  ( 2860):   at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:106)
10-19 18:50:27.760 E/Xposed  ( 2860):   at de.robv.android.xposed.XposedInit$2.beforeHookedMethod(XposedInit.java:123)
10-19 18:50:27.760 E/Xposed  ( 2860):   at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:319)
10-19 18:50:27.760 E/Xposed  ( 2860):   at android.app.ActivityThread.handleBindApplication(<Xposed>)
10-19 18:50:27.760 E/Xposed  ( 2860):   at android.app.ActivityThread.-wrap2(ActivityThread.java)
10-19 18:50:27.760 E/Xposed  ( 2860):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
10-19 18:50:27.760 E/Xposed  ( 2860):   at android.os.Handler.dispatchMessage(Handler.java:102)
10-19 18:50:27.760 E/Xposed  ( 2860):   at android.os.Looper.loop(Looper.java:154)
10-19 18:50:27.760 E/Xposed  ( 2860):   at android.app.ActivityThread.main(ActivityThread.java:6123)
10-19 18:50:27.760 E/Xposed  ( 2860):   at java.lang.reflect.Method.invoke(Native Method)
10-19 18:50:27.760 E/Xposed  ( 2860):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
10-19 18:50:27.760 E/Xposed  ( 2860):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
10-19 18:50:27.760 E/Xposed  ( 2860):   at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:103)
10-19 18:50:28.253 I/Xposed  ( 2983): [handleLoadPackage] com.teslacoilsw.launcherclientproxy
10-19 18:50:28.291 I/Xposed  ( 2983): hookPackages: com.abs.cpu_z_advance com.cpuid.cpu_z com.finalwire.aida64 flar2.devcheck
10-19 18:50:28.455 I/Xposed  ( 3025): [handleLoadPackage] com.google.android.gms
10-19 18:50:28.472 I/Xposed  ( 2860): onHook 5 before
10-19 18:50:28.472 I/Xposed  ( 2860): onHook 5 after
10-19 18:50:28.495 I/Xposed  ( 3025): hookPackages: com.abs.cpu_z_advance com.cpuid.cpu_z com.finalwire.aida64 flar2.devcheck
10-19 18:50:28.524 I/Xposed  ( 2860): onHook 18 before
10-19 18:50:28.524 I/Xposed  ( 2860): onHook 18 after
10-19 18:50:28.531 I/Xposed  ( 3070): [handleLoadPackage] com.android.providers.contacts
10-19 18:50:28.535 I/Xposed  ( 3070): hookPackages: com.abs.cpu_z_advance com.cpuid.cpu_z com.finalwire.aida64 flar2.devcheck
10-19 18:50:28.606 I/Xposed  ( 3091): [handleLoadPackage] com.google.android.partnersetup
10-19 18:50:28.645 I/Xposed  ( 3091): hookPackages: com.abs.cpu_z_advance com.cpuid.cpu_z com.finalwire.aida64 flar2.devcheck
10-19 18:50:28.732 I/Xposed  ( 3070): [handleLoadPackage] com.android.providers.blockednumber
10-19 18:50:28.740 I/Xposed  ( 3070): hookPackages: com.abs.cpu_z_advance com.cpuid.cpu_z com.finalwire.aida64 flar2.devcheck
10-19 18:50:28.781 I/Xposed  ( 2860): onHook 14 before
10-19 18:50:28.781 I/Xposed  ( 2860): onHook 14 after

So, I suggest:

  1. Add the log of all PhoneInfoUtils in yours "HookerPhone.hook :"
  2. Remove (or fix) the "Incremental" value (in the future you can protect all reading values with one try { } block)
  3. Change the order of hooks: First do from 14 to 19, then 4 to 13, and at end 1 to 3. This will be more "safe".

you agree?

bigsinger commented 7 years ago

send u

lars18th commented 7 years ago

Hi @bigsinger ,

I confirm that the values are empty from the configuration. See this on log:

10-20 08:40:31.928 I/Xposed  ( 6588): HookerPhone.hook : 18 PRODUCT=  HOST= 

So, results are:

  1. Hooks works in Nougat (as the value is in fact replaced by "", so the only error is the value).
  2. In Nougat is a trouble reading the preferences values.
  3. A bug exist with the preferences. This is in my "phoneinfo.xml": ` new original

    ` where "new" in my replaced value and "original" (changed here) is the stock value. Then in the UI I can't change the value as it's all the time grayed. Please review the code!

Regards!

bigsinger commented 7 years ago

send u

    XposedLog.logd("HookerPhone.hook : 18" + " PRODUCT= " + PhoneInfoUtils.getValue("Product") + " HOST= " + PhoneInfoUtils.getValue("Host") );
    XposedHelpers.setStaticObjectField(Build.class, "PRODUCT", PhoneInfoUtils.getValue("Product"));
    XposedHelpers.setStaticObjectField(Build.class, "HOST", PhoneInfoUtils.getValue("Host"));
lars18th commented 7 years ago

Hi @bigsinger ,

Inside the mothod “HookerPhone.hook(XC_LoadPackage.LoadPackageParam param)” I suggest to code like this:

{
XposedLog.logd("AIC: HookerPhone.hook() : starting");
...

    // DISPLAY
    if (HARDCODED) {
       hookValue = "hooked-display";
    } else {
       hookValue = PhoneInfoUtils.getValue("display");
    }
    if (StringUtils.isBlank(hookValue)) {
        if (DEBUG) XposedLog.logd("AIC: HookerPhone.hook() : no hook DISPLAY, it's  null");
    } else {
       try {
        XposedHelpers.setStaticObjectField(Build.class, "DISPLAY", hookValue);
       } catch (Exception e) {
        XposedLog.logd("AIC: HookerPhone.hook() : error hooking DISPLAY ");
       }
    }

    // HOST
    if (HARDCODED) {
       hookValue = "hooked-host";
    } else {
       hookValue = PhoneInfoUtils.getValue("host");
    }
    if (StringUtils.isBlank(hookValue)) {
        if (DEBUG) XposedLog.logd("AIC: HookerPhone.hook() : no hook HOST, it's  null");
    } else {
       try {
        XposedHelpers.setStaticObjectField(Build.class, "HOST", hookValue);
       } catch (Exception e) {
        XposedLog.logd("AIC: HookerPhone.hook() : error hooking HOST");
       }
    }

...

    // IMEI
    if (HARDCODED) {
       hookValue = "1234567890123456";
    } else {
       hookValue = PhoneInfoUtils.getValue("imei");
    }
    if (StringUtils.isBlank(hookValue)) {
        if (DEBUG) XposedLog.logd("AIC: HookerPhone.hook() : no hook IMEI, it's  null");
    } else {
       try {
           if (Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {          // SDK < 22
              ...
           } else if (Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {  // SDK = 22
              ...
           } else if (Build.VERSION.SDK_INT >= 23) {                                           // SDK >=23
              ...
           }
       } catch (Exception e) {
          XposedLog.logd("AIC: HookerPhone.hook() : error hooking IMEI");
       }
    }

...

}

Where:

“AIC: “ it’s the name of the Module for distinguishing from other modules in the log. “HookerPhone.hook()” is the name of the method to log. “DEBUG” is one bool var in your App for enable verbose debug. “HARDCODED” is one bool var in your App for use hand-coded values.

It's a simple Copy&Paste&Modify conding. I hope you get it!

bigsinger commented 7 years ago

yes it's great! i got that, 3q u very much.

lars18th commented 7 years ago

Hi @bigsinger ,

send u XposedLog.logd("HookerPhone.hook : 18" + " PRODUCT= " + PhoneInfoUtils.getValue("Product") + " HOST= " + PhoneInfoUtils.getValue("Host") ); XposedHelpers.setStaticObjectField(Build.class, "PRODUCT", PhoneInfoUtils.getValue("Product")); XposedHelpers.setStaticObjectField(Build.class, "HOST", PhoneInfoUtils.getValue("Host"));

I don't see any difference:

10-20 09:40:22.842 I/Xposed  ( 6381): HookerPhone.hook : 18 PRODUCT=  HOST= 

And, please remember to add the code for FINGERPRINT (current code is): XposedHelpers.setStaticObjectField(Build.class, "FINGERPRINT", "")

I suggest, that for the next (beta) version you also update the src file in the repository (for review it!). Thank you!