mateor / auto-patcher

smali patcher for Android code injection
MIT License
74 stars 42 forks source link

cm10.1.2: Settings$Secure.smali patching failed #138

Closed jand23 closed 11 years ago

jand23 commented 11 years ago

EDIT: This is a dup to https://github.com/mateor/auto-patcher/issues/134.

Can be solved by using this cmd line:

./auto_patcher ../../cm10.1.2/cm-10.1.2-maguro.zip openpdroid cm 20130516


First of all, great work! I have been using this regularly.

It should be a different issue than: https://github.com/mateor/auto-patcher/issues/134 FULL LOG:

ROOT= /Users/xyz/localwork/galaxynexusroot/git/auto-patcher/. TOOL= /Users/xyz/localwork/galaxynexusroot/git/auto-patcher/./patch_tools.tgz ROM= /Users/xyz/localwork/galaxynexusroot/git/auto-patcher/../../cm10.1.2/cm-10.1.2-maguro.zip ROMX= /Users/xyz/localwork/galaxynexusroot/git/auto-patcher/../../cm10.1.2/cm-10.1.2-maguro.zip

checking for updates

Updater: Auto-Patcher is already up to date

verify tools

/usr/bin/patch /usr/bin/tar /usr/bin/jar /usr/bin/java /usr/bin/cpio

verify ROM

running ./auto_patcher ../../cm10.1.2/cm-10.1.2-maguro.zip

PATH= /Users/xyz/localwork/galaxynexusroot/git/auto-patcher/./tmp20130714121209:/Users/xyz/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

unzip patch tools

unzip patch patches

probe rom type

Darwin Build Query used

VER= v2.9.925

OS= darwin11 64bit

VID= 4.2.2

PID= openpdroid

MID= cm_maguro-userdebug

RID= cm

ANDR= 4.2

BDID= 20130711

DID= maguro

BID= 20130626

Patches are openpdroid/4.2/cm/20130626

Current HEAD: e8d04cf822b3fd704f5064024bc091cadb718faf Version-up

DELETE FILES=

COPY FILES= system/media/PDroid.jpeg

JAR FILES= system/framework/framework.jar system/framework/core.jar system/framework/services.jar system/framework/telephony-common.jar

APK FILES= system/app/Mms.apk

IMG FILES=

TXT FILES=

unzip rom

create updater script

... using Clockworkmod installer ...

generated updater-script

ui_print(""); ui_print(""); ui_print("~~~~~~~~~~~~"); uiprint("* "); uiprint(" * The Auto-Patcher * _"); uiprint(" * * * * _"); uiprint(" * by mateor * _"); uiprint(" *"); ui_print("~~~~~~~~~~~~"); ui_print(""); ui_print(" Attention"); ui_print(" ****"); ui_print(""); ui_print(" There is nothing that can go wrong here"); ui_print(" that reflashing your ROM won't fix."); ui_print(""); mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "/system"); package_extract_dir("system", "/system"); set_perm_recursive(0, 0, 0755, 0644, "/system"); set_perm_recursive(0, 0, 0755, 0755, "/system/addon.d"); set_perm_recursive(0, 2000, 0755, 0755, "/system/bin"); set_perm(0, 3003, 02750, "/system/bin/netcfg"); set_perm(0, 3004, 02755, "/system/bin/ping"); set_perm(0, 2000, 06750, "/system/bin/run-as"); set_perm(1002, 1002, 0440, "/system/etc/dbus.conf"); set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks"); set_perm_recursive(0, 2000, 0755, 0755, "/system/etc/init.d"); set_perm(0, 0, 0755, "/system/etc/init.d"); set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh"); set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp"); set_perm(0, 2000, 0755, "/system/vendor"); set_perm_recursive(0, 2000, 0755, 0755, "/system/vendor/bin"); set_perm(0, 2000, 0755, "/system/vendor/etc"); set_perm(0, 2000, 0755, "/system/vendor/firmware"); set_perm(0, 2000, 0755, "/system/vendor/lib"); set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/lib/drm"); set_perm(0, 0, 0644, "/system/vendor/lib/drm/libdrmwvmplugin.so"); set_perm(0, 2000, 0755, "/system/vendor/lib/egl"); set_perm(0, 2000, 0755, "/system/vendor/lib/hw"); set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/res"); set_perm(0, 0, 0644, "/system/vendor/res/images/dock/dock.png"); set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin"); set_perm(0, 0, 06755, "/system/xbin/librank"); set_perm(0, 0, 06755, "/system/xbin/procmem"); set_perm(0, 0, 06755, "/system/xbin/procrank"); set_perm(0, 0, 06755, "/system/xbin/su"); unmount("/system"); ui_print(" ."); ui_print(" ."); ui_print(" done!");

create restore.zip

decompile system files

... decompile framework.jar ...

... extract preloaded-classes ... inflated: preloaded-classes

... decompile core.jar ...

... decompile services.jar ...

... decompile telephony-common.jar ... inflated: system/framework/framework-res.apk

... installing framework files ...

... decompile Mms.apk ... I: Baksmaling... I: Loading resource table... I: Loaded. I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: /Users/xyz/Library/apktool/framework/1.apk I: Loaded. I: Regular manifest package... I: Decoding file-resources... I: Decoding values / XMLs... I: Done. I: Copying assets and libs...

copy patch openpdroid/4.2/cm/20130626

... copying system/media/PDroid.jpeg ...

... overwriting system/media/PDroid.jpeg from openpdroid ... patches/openpdroid/4.2/cm/20130626/system/media/PDroid.jpeg -> ./system/media/PDroid.jpeg

... overwriting ContentResolver.smali ...

delete patch openpdroid/4.2/cm/20130626

jar patch openpdroid/4.2/cm/20130626

... apply framework.patch ... 1 out of 9 hunks FAILED -- saving rejects to file 'smali/android/provider/Settings$Secure.smali.rej'

... apply preloaded.patch ... !!! PATCHING FAILED FOR android/provider/Settings$Secure.smali' !!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!! error: failed android/provider/Settings$Secure.smali' in framework.jar cannot be remedied

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

mateor commented 11 years ago

Thanks, but why do you think it is different? Looks the same to me. 10.1.2 means it is a Final release, so it is based on the code from May sometime. Use the commands I gave at the bottom of the issue you referenced, if it doesn't work, let me know.

  ./auto_patcher cm-10.1.2-maguro.zip cm 20130516

I am looking at adding some sort of hard-coded hack to go around this...I don't know if this issue is going away, even if it isn't directly our fault.

jand23 commented 11 years ago

meteor, you're right. That's the same issue. "./auto_patcher ../../cm10.1.2/cm-10.1.2-maguro.zip openpdroid cm 20130516" will make it work.

I am confused when I said it's a different issue than #134 because I tried that command line earlier and it didn't work. That's probably because it's done in an older autopatcher version or I made some local changes. Now it works. I updated the issue description.

Thanks for the quick help.

denny0223 commented 11 years ago

solution ./auto_patcher cm-10.1.2-tilapia.zip openpdroid cm 20130516 not work for me.

log file:

ROOT= /home/denny/Android/auto-patcher TOOL= /home/denny/Android/auto-patcher/patch_tools.tgz ROM= /home/denny/Android/auto-patcher/cm-10.1.2-tilapia.zip ROMX= /home/denny/Android/auto-patcher/cm-10.1.2-tilapia.zip PING www.github.com (204.232.175.90) 56(84) bytes of data.

--- www.github.com ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms

PING www.google.com (202.169.173.221) 56(84) bytes of data.

--- www.google.com ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms

Check for update failed, probably because of no internet access.

verify tools

/usr/bin/patch /usr/bin/tar /usr/bin/jar /usr/bin/java /usr/bin/cpio

verify ROM

running ./auto_patcher cm-10.1.2-tilapia.zip openpdroid cm 20130516

PATH= /home/denny/Android/auto-patcher/tmp20130715180059:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/opt/adt-bundle-linux-x86_64-20130219/sdk/tools:/opt/adt-bundle-linux-x86_64-20130219/sdk/platform-tools:/xxx/node-webkit-v0.6.1-linux-x64:/xxx/depot_tools:/home/denny/node-v0.10.5-linux-x64/bin:/home/denny/.rvm/bin:/home/denny/.local/bin:/home/denny/bin:/opt/adt-bundle-linux-x86_64-20130219/sdk/tools:/opt/adt-bundle-linux-x86_64-20130219/sdk/platform-tools:/xxx/node-webkit-v0.6.1-linux-x64:/xxx/depot_tools:/home/denny/node-v0.10.5-linux-x64/bin:/home/denny/.rvm/bin

unzip patch tools

unzip patch patches

probe rom type

Standard Build Query

VER= v2.9.925

OS= linux-gnu 64bit

VID= 4.2.2

PID= openpdroid

MID= cm_tilapia-userdebug

RID= cm

ANDR= 4.2

BDID= 20130712

DID= tilapia

BID= 20130516

Patches are openpdroid/4.2/cm/20130516

Current HEAD: e8d04cf822b3fd704f5064024bc091cadb718faf Version-up

DELETE FILES=

COPY FILES= system/media/PDroid.jpeg

JAR FILES= system/framework/framework.jar system/framework/core.jar system/framework/services.jar system/framework/telephony-common.jar system/app/Mms.apk

APK FILES=

IMG FILES=

TXT FILES=

unzip rom

create updater script

... using Clockworkmod installer ...

generated updater-script

ui_print(""); ui_print(""); ui_print("~~~~~~~~~~~~"); uiprint("* "); uiprint(" * The Auto-Patcher * _"); uiprint(" * * * * _"); uiprint(" * by mateor * _"); uiprint(" *"); ui_print("~~~~~~~~~~~~"); ui_print(""); ui_print(" Attention"); ui_print(" ****"); ui_print(""); ui_print(" There is nothing that can go wrong here"); ui_print(" that reflashing your ROM won't fix."); ui_print(""); mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/APP", "/system"); package_extract_dir("system", "/system"); set_perm_recursive(0, 0, 0755, 0644, "/system"); set_perm_recursive(0, 0, 0755, 0755, "/system/addon.d"); set_perm_recursive(0, 2000, 0755, 0755, "/system/bin"); set_perm(0, 3003, 02750, "/system/bin/netcfg"); set_perm(0, 3004, 02755, "/system/bin/ping"); set_perm(0, 2000, 06750, "/system/bin/run-as"); set_perm(1002, 1002, 0440, "/system/etc/dbus.conf"); set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks"); set_perm_recursive(0, 2000, 0755, 0755, "/system/etc/init.d"); set_perm(0, 0, 0755, "/system/etc/init.d"); set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh"); set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp"); set_perm(0, 2000, 0755, "/system/vendor"); set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/etc"); set_perm(0, 0, 0644, "/system/vendor/etc/audio_effects.conf"); set_perm(0, 2000, 0755, "/system/vendor/firmware"); set_perm(0, 2000, 0755, "/system/vendor/lib"); set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/lib/drm"); set_perm(0, 0, 0644, "/system/vendor/lib/drm/libdrmwvmplugin.so"); set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/lib/hw"); set_perm(0, 0, 0644, "/system/vendor/lib/hw/power.grouper.so"); set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin"); set_perm(0, 0, 06755, "/system/xbin/librank"); set_perm(0, 0, 06755, "/system/xbin/procmem"); set_perm(0, 0, 06755, "/system/xbin/procrank"); set_perm(0, 0, 06755, "/system/xbin/su"); unmount("/system"); ui_print(" ."); ui_print(" ."); ui_print(" done!");

create restore.zip

system/app/Mms.apk : no such file or directory

decompile system files

... decompile framework.jar ...

... extract preloaded-classes ... inflated: preloaded-classes

... decompile core.jar ...

... decompile services.jar ...

... decompile telephony-common.jar ...

... decompile Mms.apk ... Can't find the file system/app/Mms.apk

copy patch openpdroid/4.2/cm/20130516

... copying system/media/PDroid.jpeg ...

... overwriting system/media/PDroid.jpeg from openpdroid ... patches/openpdroid/4.2/cm/20130516/system/media/PDroid.jpeg' ->./system/media/PDroid.jpeg'

... overwriting ContentResolver.smali ...

delete patch openpdroid/4.2/cm/20130516

jar patch openpdroid/4.2/cm/20130516

... apply framework.patch ... Reversed (or previously applied) patch detected! Skipping patch. 1 out of 1 hunk ignored -- saving rejects to file smali/android/app/WallpaperInfo.smali.rej Reversed (or previously applied) patch detected! Skipping patch. 2 out of 2 hunks ignored -- saving rejects to file smali/android/content/CursorLoader.smali.rej

... apply preloaded.patch ... GARBAGE= tmp/system/framework/framework.jar.out/smali/android/hardware/Camera.smali.orig tmp/system/framework/framework.jar.out/smali/android/telephony/ServiceState.smali.orig tmp/system/framework/framework.jar.out/smali/android/provider/Settings$Secure.smali.orig GARBAGE= tmp/system/framework/framework.jar.out/smali/android/content/CursorLoader.smali.rej tmp/system/framework/framework.jar.out/smali/android/app/WallpaperInfo.smali.rej

... apply core.patch ... GARBAGE= GARBAGE=

... apply services.patch ...

... apply services-gps_fix.patch ... GARBAGE= GARBAGE=

... apply telephony-common.patch ... GARBAGE= GARBAGE=

... apply Mms.apk.patch ...

apk patch openpdroid/4.2/cm/20130516

img patch openpdroid/4.2/cm/20130516

text patch openpdroid/4.2/cm/20130516

rebuild jar

... rebuild framework.jar ... adding: classes.dex(in = 8340848) (out= 3416966)(deflated 59%) adding: preloaded-classes(in = 96019) (out= 16111)(deflated 83%)

... rebuild core.jar ... adding: classes.dex(in = 2569088) (out= 1085923)(deflated 57%)

... rebuild services.jar ... adding: classes.dex(in = 2144912) (out= 967919)(deflated 54%)

... rebuild telephony-common.jar ... adding: classes.dex(in = 1040360) (out= 421672)(deflated 59%)

... rebuild Mms.apk ...

UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.RuntimeException: Cannot find file or directory "tmp/system/app/Mms.apk.out/smali" at org.jf.smali.main.main(main.java:180)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!! error: failed compiling Mms.apk !!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!! This error is generally due to an unknown bug in the smali binary!

without argument 20130516

log file:

ROOT= /home/denny/Android/auto-patcher TOOL= /home/denny/Android/auto-patcher/patch_tools.tgz ROM= /home/denny/Android/auto-patcher/cm-10.1.2-tilapia.zip ROMX= /home/denny/Android/auto-patcher/cm-10.1.2-tilapia.zip PING www.github.com (204.232.175.90) 56(84) bytes of data.

--- www.github.com ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms

PING www.google.com (202.169.173.221) 56(84) bytes of data.

--- www.google.com ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms

Check for update failed, probably because of no internet access.

verify tools

/usr/bin/patch /usr/bin/tar /usr/bin/jar /usr/bin/java /usr/bin/cpio

verify ROM

running ./auto_patcher cm-10.1.2-tilapia.zip openpdroid cm

PATH= /home/denny/Android/auto-patcher/tmp20130715180806:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/opt/adt-bundle-linux-x86_64-20130219/sdk/tools:/opt/adt-bundle-linux-x86_64-20130219/sdk/platform-tools:/xxx/node-webkit-v0.6.1-linux-x64:/xxx/depot_tools:/home/denny/node-v0.10.5-linux-x64/bin:/home/denny/.rvm/bin:/home/denny/.local/bin:/home/denny/bin:/opt/adt-bundle-linux-x86_64-20130219/sdk/tools:/opt/adt-bundle-linux-x86_64-20130219/sdk/platform-tools:/xxx/node-webkit-v0.6.1-linux-x64:/xxx/depot_tools:/home/denny/node-v0.10.5-linux-x64/bin:/home/denny/.rvm/bin

unzip patch tools

unzip patch patches

probe rom type

Standard Build Query

VER= v2.9.925

OS= linux-gnu 64bit

VID= 4.2.2

PID= openpdroid

MID= cm_tilapia-userdebug

RID= cm

ANDR= 4.2

BDID= 20130712

DID= tilapia

BID= 20130626

Patches are openpdroid/4.2/cm/20130626

Current HEAD: e8d04cf822b3fd704f5064024bc091cadb718faf Version-up

DELETE FILES=

COPY FILES= system/media/PDroid.jpeg

JAR FILES= system/framework/framework.jar system/framework/core.jar system/framework/services.jar system/framework/telephony-common.jar system/app/Mms.apk

APK FILES=

IMG FILES=

TXT FILES=

unzip rom

create updater script

... using Clockworkmod installer ...

generated updater-script

ui_print(""); ui_print(""); ui_print("~~~~~~~~~~~~"); uiprint("* "); uiprint(" * The Auto-Patcher * _"); uiprint(" * * * * _"); uiprint(" * by mateor * _"); uiprint(" *"); ui_print("~~~~~~~~~~~~"); ui_print(""); ui_print(" Attention"); ui_print(" ****"); ui_print(""); ui_print(" There is nothing that can go wrong here"); ui_print(" that reflashing your ROM won't fix."); ui_print(""); mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/APP", "/system"); package_extract_dir("system", "/system"); set_perm_recursive(0, 0, 0755, 0644, "/system"); set_perm_recursive(0, 0, 0755, 0755, "/system/addon.d"); set_perm_recursive(0, 2000, 0755, 0755, "/system/bin"); set_perm(0, 3003, 02750, "/system/bin/netcfg"); set_perm(0, 3004, 02755, "/system/bin/ping"); set_perm(0, 2000, 06750, "/system/bin/run-as"); set_perm(1002, 1002, 0440, "/system/etc/dbus.conf"); set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks"); set_perm_recursive(0, 2000, 0755, 0755, "/system/etc/init.d"); set_perm(0, 0, 0755, "/system/etc/init.d"); set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh"); set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp"); set_perm(0, 2000, 0755, "/system/vendor"); set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/etc"); set_perm(0, 0, 0644, "/system/vendor/etc/audio_effects.conf"); set_perm(0, 2000, 0755, "/system/vendor/firmware"); set_perm(0, 2000, 0755, "/system/vendor/lib"); set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/lib/drm"); set_perm(0, 0, 0644, "/system/vendor/lib/drm/libdrmwvmplugin.so"); set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/lib/hw"); set_perm(0, 0, 0644, "/system/vendor/lib/hw/power.grouper.so"); set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin"); set_perm(0, 0, 06755, "/system/xbin/librank"); set_perm(0, 0, 06755, "/system/xbin/procmem"); set_perm(0, 0, 06755, "/system/xbin/procrank"); set_perm(0, 0, 06755, "/system/xbin/su"); unmount("/system"); ui_print(" ."); ui_print(" ."); ui_print(" done!");

create restore.zip

system/app/Mms.apk : no such file or directory

decompile system files

... decompile framework.jar ...

... extract preloaded-classes ... inflated: preloaded-classes

... decompile core.jar ...

... decompile services.jar ...

... decompile telephony-common.jar ...

... decompile Mms.apk ... Can't find the file system/app/Mms.apk

copy patch openpdroid/4.2/cm/20130626

... copying system/media/PDroid.jpeg ...

... overwriting system/media/PDroid.jpeg from openpdroid ... patches/openpdroid/4.2/cm/20130626/system/media/PDroid.jpeg' ->./system/media/PDroid.jpeg'

... overwriting ContentResolver.smali ...

delete patch openpdroid/4.2/cm/20130626

jar patch openpdroid/4.2/cm/20130626

... apply framework.patch ... 1 out of 9 hunks FAILED -- saving rejects to file 'smali/android/provider/Settings$Secure.smali.rej'

... apply preloaded.patch ... !!! PATCHING FAILED FOR android/provider/Settings$Secure.smali' !!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!! error: failed android/provider/Settings$Secure.smali' in framework.jar cannot be remedied

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

mateor commented 11 years ago

aha...that is a new problem I introduced when I fixed the disappearing Mms.apks yesterday...in essence, this breaks patching for ROMs that don;t come with Mms.apk (wifi tablets).

I will create a solution to this today, thanks for the report,

mateor commented 11 years ago

Should be fixed...try autopatcherv2.9.26 and let me know. It should auto-update when you run it if you are connected to the internet (it doesn't look like you were, last run.)

denny0223 commented 11 years ago

Congratulations, the patching was successful.

Thanks a lot!