yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Themes and Apps] WhoDunnit:
3.1 Still available?

Right, 3.2 worked like a charm on S3 running stock rooted ROM: It asks for installation of a SecurityManager, but it doesn' give it any permissions. However, trying 3.2 on ParanoidAndroid for S3 and on CodeName Android on S2 it seems to fail since it does give the SecurtityManager a lot of permissions. Both these ROMs are CM10 based.

As mentioned in the thread earlier on, 3.1 seems to not have this issues on CM10. So, where can I download 3.1 of the patch set?

Also, can anyone tell me if the remote wipe feature is also disabled by this patch?

EDIT: great, I can answer myself. The 3.1 patch can be obtained from this url

And after applying patch 3.1 for CodeName Android (CM10) on S2 indeed an issued wipe does not wipe the device. Although several times Exchanged FC-ed on me.
[Galaxy S II Themes and Apps] apascual89:
Works on 4.2

Hi just wanted to report that 3.1 works for stock rooted 4.2 on the Nexus 7.
[Galaxy S II Themes and Apps] OlaNystrom:
I failed with v3.1 on linux. Can you send me EmailGoogle.odex (4.2 Nexus 7). I evidently missed to backup that one :(
[Galaxy S II Themes and Apps] DoomSoldier:
ok

it works on my S3 with JB
[Galaxy S II Themes and Apps] twistedsistem:
Works on my AT&T Galaxy note II!

Thanks for the great work on this!!!!
[Galaxy S II Themes and Apps] DoomSoldier:
After this Patch i have a problem.

I can't set a notification sound for my email accounts. It's gray.

Can you help me please...

Thx
[Galaxy S II Themes and Apps] QLF:
Great work, I've been using this on my GS2 for the last 6 firmware / ROM's i've had.

Sadly, with the latest JB ROm for GS2 (http://xdaforums.com/showthread.php?t=1994313&page=75), it no longer works.

Any chance to have the app updated to work with this please? Email and Exchange APk's are called "SecEmail.apk" and SecExchange.apk", and are located in /System/App

Thanks
[Galaxy S II Themes and Apps] ArtoD2:
Have you tried manual method?
[Galaxy S II Themes and Apps] mpcjanssen:
On the new SGS2 JB ROM the email apps are preloaded from /preload/symlink/system/app. The files in /system/app are simply symlinks.

---------- Post added at 02:39 PM ---------- Previous post was at 02:16 PM ----------

Ok I have tried the manual method with the apk and odex files from /preload/symlink/system/app. And after replacing those apk's and removing the odex files from /preload/symlink/system/app and the odex symlinks from /system/app, it works like a charm.
[Galaxy S II Themes and Apps] vivektyagi20:
I have backed SecEmail.apk, SecEmail.odex and SecExchange.apk to my SD Card. I am placing these files in system/app folder and then trying to Hack the email. But each time I am getting an error saying Exchange does not have .Dex file.

Moreover, I could not understand what you mentioned above. Can you please tell me which files are to be moved and which are to be replaced. It would be great if you can help me with the problem with the latest JB leak for galaxy s2. Meanwhile, I have flashed another hacked Email in CWM mode but I want Email with JB only. Kindly help.
[Galaxy S II Themes and Apps] nybom:
Great that you got it working on the leaked SGS2 4.1.2! Would you mind writing an instruction for us not so talanted users? It wuold be great!
[Galaxy S II Themes and Apps] shuweee:
I tried patching the files by renaming the files to Email.apk and Exchange.apk from the /preload/symlink/system/app and placing them in the /system/app folder and putting them back once its patched.

still no luck. can you advise how you manage to get this working please?

Thanks
[Galaxy S II Themes and Apps] vivektyagi20:
Finally got it working for Leaked JB S2

I had to flash it multiple times to actually get a work around here. Please follow the below steps:

1. First of all, backup SecEmail.apk, SecExchange.apk, SecEmail.odex from /preload/symlink/system/app and SecExchange.odex (should be more than 0 MB) from system/app to your SD Card as these files can be required anytime.

2. Enable RW mode and move SecEmail.apk, SecExchange.apk and SecEmail.odex from /preload/symlink/system/app to system/app. If asks for replacement, do it.I could not move because I had very low memory (if anyone can help me with this, I would be more than grateful :().

3. After the movement, remove the ODEX file with 0 size from system/app and keep nothing but SecEmail.apk (originally from preload/symlink/system/app), SecExchange.apk (originally from preload/symlink/system/app), SecEmail.odex (originally from preload/symlink/system/app) and SecExchange.odex (originally from system/app) in the system/app folder. Make sure none has 0 mb of size. If they do then use your SD card backup. The idea is that the Hack uses Email.ODEX and Exchange.ODEX in the process.

4. Most probably, your Email apk would have been removed from your app drawer because of its deletion. We now need to bring it back to the System (by installing it again). No, it cannot be installed just by touching. Rather, ADB and SDK are required. Install Android SDK and keep Email.apk and Exchange.apk in its folder.

5. Open CMD and go to the location of SDK (by using CD C:/...)

6. Paste the below code:

adb devices

adb push email.apk/tmp/

adb shell

$ su

# mount -o rw,remount -t yaffs2 /dev/block/system /system

# cp /tmp/email.apk /system/app/

adb devices

adb push exchange.apk/tmp/

adb shell

$ su

# mount -o rw,remount -t yaffs2 /dev/block/system /system

# cp /tmp/exchange.apk /system/app/

7. Wait for a while and restart the phone. You will now see Email.apk in the app drawer.

8. Now, we are good to go with the entire patching process (yes, it begins now...:)).

9. Run apply-patch but make sure you have more than 25 MB of free space in system/app. I had to remove ChatOn, Youtube and Gogole+ because I am usually left with no space (please someone help me with the right .PIT file). Email.apk gets removed and then is generated again.

10. Wait for the patcher to work and till the time it restarts your phone. If lucky, you will see the Email.apk on the last page.

11. All the security restrictions are now removed.

Press thanks if it helped and do help me with my .PIT file issue. I want more space in my system/app folder :laugh:
[Galaxy S II Themes and Apps] shuweee:
Thank you so much for your instructions. i a little lost starting at step 4. i do not see Email.apk nor Exchange.apk anywhere. i managed to move SecEmail, SecExchange and both odexs files to /system/app. where do i find Email.apk or Exchange.apk to push it back with ADB?

Thanks.

----

ok i think i kind of get it now..

what i did just now is placed all 4 files in the /system/app.

ran the patch which created the two new SecEmail.apk and SecExchange.apk.

so what i should do is copy those two files to my local folder and push those back with ADB?

Thanks again.
[Galaxy S II Themes and Apps] apmos:
a cwm flashable zip is possible? waiting forward for it
[Galaxy S II Themes and Apps] nybom:
+1

I would gladly donate some money for a CWM zip that patches the original Samsung secemail.apk and secexhange.apk
[Galaxy S II Themes and Apps] bilnok:
Big Thank ! Great Job !
[Galaxy S II Themes and Apps] mpcjanssen:
Yes you push those apk's back to /preload/symlink/system/app.

Don't forget to remove the .odex files in /preload/symlink/system/app and the links to them in /system/app
[Galaxy S II Themes and Apps] vivektyagi20:
I got it working by a different approach. As it is clear now that you have got 4 files in system/app. Now, the ADB code mentions EMAIL.APK and EXCHANGE.APK. To run the code, I renamed all the 4 files from SecEmail to just Email and from SecExchange to just Exchange. The idea is to have all the files present with the nomenclature followed in the ADB Code. Once you rename them, you can run the said code and will then be able to find out Email.apk in the app drawer. If so, run the patch (making sure you ahve more than 25 mb free space in system/app. If ebverything goes fine, your security restrictions shall be bypassed. Meanwhile, did any of you guys find a solution for my low system/app space? ;)
[Galaxy S II Themes and Apps] mpcjanssen:
Simple, you probably have copied the files to /system/app while before they were symlinks (symlinks take almost no space) so your space will reduce. Symlinks are to /preload which is on a different partition. With your approach I also suspect /preload still has the unpatched version. I am not sure if that matters though.
[Galaxy S II Themes and Apps] Sardo Numspa:
what i have been doing is once i ran the script and "fixed" email.apk and exchange2.apk, i copied them to my download folder or pc. then when i want to flash a new rom, i unzip the rom, replace the two apk's in the system/app folder, rezip it up and flash away. this way i dont have to flash, then move the files over, then re-add the email account.
[Galaxy S II Themes and Apps] enotionz:
I can't get this to work for my Galaxy Note 2 running JB. The patch process was fine, but I was still prompted to enable security. Anyone else tried this on the Note 2?
[Galaxy S II Themes and Apps] jim.j:
Here you go. http://db.tt/sErmkp9h

Take a backup of SecEmail, SecExchange (apk and odex files) from system/app and preload/symlink/system/app before trying this.
[Galaxy S II Themes and Apps] tommacx:
Hi jim.j this does not seem to work for me. Tried flashing through CWM6 on new 4.1.2 stock leaked rom. Any ideas? I don't trust myself to do it 'manually'.

Cheers

Tom
[Galaxy S II Themes and Apps] jim.j:
The Email app doesn't work or it still has the security policy?
[Galaxy S II Themes and Apps] tommacx:
The .zip would not flash. I used the CWM6 in Philz kernel on the new leaked 4.1.2 rom. It gives an error message at level 6

I have tried renaming the SecEmail/SecEchange to email and exchange (with Root Explorer) and then flashing and also running the Java/ABD patch with the renamed files but to no avail ( I can paste the errors when I get back from work). I have also tried both the .zip and the patch with the renamed files in their original folders and moving all to system/app

Hopefully someone has an idea of what I did wrong! With gingerbread (i skipped ICS) i managed to get hold of the hacked email.apk and just installed this so I have missed out on all the teething problems and possible solutions people came up with previously.

Hopefully we can get the .zip to work for me!

Cheers

Tom
[Galaxy S II Themes and Apps] jim.j:
I'll look for the zip once I'm back from work.

For now, delete SecEmail and SecExchange (apk and odex) from system/app and symlink from preload/symlink/system/app. Unzip the file I uploaded, you'd find system and preload folders. Take the apks from system, copy them to system/app using Root Explorer. Now, copy the apks from preload folder to preload/symlink/system/app.

Permission:

system/app - both as rw-r--r--

preload/symlink/system/app - SecExchange as rwxrwxr-x and SecEmail as rw-r--r--.
[Galaxy S II Themes and Apps] tommacx:
Outstanding. Thank you Jim.j
[Galaxy S II Themes and Apps] fchowla:
Worked perfectly for me on krarvind's Slim (4.1.2). Thanks for sharing.
[Galaxy S II Themes and Apps] lightlytoasted:
Works on Nexus 4, 4.2

Didn't work for me, Nexus 4, 4.2. It still asks to activate device administrator after patch.

I used this on my galaxy nexus 4.1 and on that version the device admin step comes earlier than it does on 4.2. It's like they delayed when to ask for device admin to get around hacks like this.

Any fix for 4.2 would be really appreciated. I already donated.

I'm so dumb, asks for device admin BUT DOESNT ASK FOR PIN!! :laugh:

Confirmed working on Nexus 4, 4.2

Thanks so much
[Galaxy S II Themes and Apps] solar666:
Email.apk not required for Android 4.1+ ??

Hi rustamabd,

actually if I do the patching manually I will find following message posted in the cmd window:

"<Email.apk> is the name of the Email.apk relative to the work-dir

(for example, Email.apk, or EmailGoogle.apk.

Not required for Android 4.1+

)"

Reading this I presume the Email.apk will not be patched during the process if using API Level = 16.

Correct or am I wrong on this?

Anyhow if I am going to use the patch now with API Level = 16 and specify the Email.apk file it will be patched:

"Decompiling

Email.apk

...

Applying patch ...

Patching com/android/emailcommon/provider/Policy.normalize()V

Recompiling ...

Building

Email.apk

...

Decompiling Exchange2.apk ...

Applying patch ...

Patching com/android/emailcommon/provider/Policy.normalize()V

Patching com/android/exchange/adapter/ProvisionParser.hasSupportablePolicySet()Z

Recompiling ...

Building Exchange2.apk ...

2 apk(s) patched.

* Updated:

Email.apk

* Updated: Exchange2.apk

Done."

Now, just for my understanding, does the Email.apk need to be patched for Jelly Bean or not?

Looking forward to your answer.

Thanks anyhow for the great patch.
[Galaxy S II Themes and Apps] JaredBanyard:
Which instructions did you follow to get this working on the Nexus 4? Did you have to do anything special?

Thanks,

Jared
[Galaxy S II Themes and Apps] bigfan2232:
On galaxy s3 I cannot locate a preload folder.
[Galaxy S II Themes and Apps] sydknee:
Well there be a new patch that works on jb Sammy roms ie. Neat?

Edit: Ok. I was daunted by the manual method, but followed Jim's instructions and easy as pie. Good work and thanks
[Galaxy S II Themes and Apps] mm512670:
file too short message

Running on Samsung GT-I9305 on 4.1.1 I get this message:

Cleaning up ...

Waiting for USB connection...

Checking device...

Model: GT-I9305, build JRO03C.I9305XXALI5, android 4.1.1 (API Level 16)

/system mounted on /dev/block/mmcblk0p13, mode rw

checking root access. root uid: 0, secure: yes, busybox: no

Pulling app(s) ...

Pulling libs ...

Decompiling SecEmail.odex ...

Error occured while loading boot class path files. Aborting.

org.jf.dexlib.Util.ExceptionWithContext: work\com.dropboxpartner.jar: file too short

at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithContext.java:54)

at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.java:190)

at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:141)

at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPathFromOdex(ClassPath.java:103)

at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:94)

at org.jf.baksmali.main.main(main.java:297)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at jpatch.emailPolicy.Run.runIsolated(Run.java:791)

at jpatch.emailPolicy.Run.applyPatch(Run.java:432)

at jpatch.emailPolicy.Run.main(Run.java:581)

Caused by: java.lang.RuntimeException: work\com.dropboxpartner.jar: file too short

at org.jf.dexlib.Util.FileUtils.readFile(FileUtils.java:103)

at org.jf.dexlib.DexFile.<init>(DexFile.java:286)

at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.java:186)

... 11 more

Error while reading boot class path entry "com.dropboxpartner.jar".

Can anyone help me with this?

thanks
[Galaxy S II Themes and Apps] Wee8Omai:
problems on patching Email*apk on 4.2 JB

..
[Galaxy S II Themes and Apps] cman6453:
+1
[Galaxy S II Themes and Apps] Ligrev:
Confirmed working on a Tab 2 7.0 (P3100) on 3.2. Although I had to name the apk for tablet.

THANKS!
[Galaxy S II Themes and Apps] dreamtheater39:
Works great on my Galaxy Note 2 running Jellybean! One quick question though -

The stock rom has a policy which restricts me from syncing my mails when I'm on roaming. Does this patch take care of that as well?
[Galaxy S II Themes and Apps] kwhit:
I just installed the patch with no problems except my whatsapp is giving me grief with initialization. Is this just a coincidence or has anyone else had issues?

Rogers Galaxy Note 2
[Galaxy S II Themes and Apps] prom311:
Anyone get this working on S3 running JB or do I have to be the first? :)
[Galaxy S II Themes and Apps] dreamtheater39:
GSIII & Galaxy Note2 are more or less the same when it comes to Email related functionality. I have it perfectly working on my GN2 running Jellybean with no issues. You could give it a go :)
[Galaxy S II Themes and Apps] umair9001:
I have it working on the S3 JB..since the start.. :) no issues..
[Galaxy S II Themes and Apps] SpdDmn268:
I've been running the patch flawlessly for over a month now - it's been AWESOME not having to enter a 6-digit alphanumeric password every. single. time.!

However, I made the mistake last night of installing the AOKP OTA update (d2 att 11/18? I think), which didn't install well for me, so I tried re-flashing my previous AOKP D2 ATT version - from a zip stored on my phone, and when that didn't install nicely, I reflashed a backup I had in TWRP.

The main thing is, the email policy patch isn't working for me anymore, as of this morning. I tried re-applying using the steps in the OP, which said the patch was already installed and aborted the installation. I did it twice, actually - before, and after, installing my office's device administration app (MaaS 360).

Would my office's mobile policy have been updated to bypass this patch, or would this be related to the OTA install I tried last night? Any help to fix this would be REALLY appreciated! I shouldn't have messed with what was working so well....! :(

Edited to add;

SGS-I747M on Telus, Android v.4.1.2

Kernel:

3.0.46-cyanogenmod-faux123-att-tmo-gc93ade0

sethyx@chaos))

Build Number:

aokp_d2att-userdebug 4.1.2 JZO54K eng. sethyx.20121022.015457 test-keys
[Galaxy S II Themes and Apps] marshalllaw:
Had this running on 4.2.

Had to restore it before OTAing to 4.2.1. Patch not working now :(
[Galaxy S II Themes and Apps] prom311:
Sweet Im going to try it out this weekend. Been using email on my old phone so I wouldn't have to deal with it
[Galaxy S II Themes and Apps] mbellot:
I applied this patch to my OG Epic 4g because our office is "upgrading" to Exchange, everything appeared to run OK without any error messages (the phone is rooted with a deodexed GB ROM).

However, being a bit paranoid I also decided to apply it to a new cheapo tablet we are giving the kids for Christmas. The tablet is rooted, but the ROM is stock ICS (odexed). I ran the patch and it appeared to work, no obvious error messages just additional info about pulling odex files and that email shortcuts would disappear (didn't have any). Tablet rebooted as expected.

Configured the exchange server and synced to be sure all was OK, then in the web interface (on my PC) went to options/phone and clicked on Wipe. Within a minute the tablet rebooted and wiped. :(

Now I'm worried the patch didn't really work for my phone.

Any thoughts?
[Galaxy S II Themes and Apps] ajislav:
I think patch removes basic nuisances, like pin, but not remote wipe. see posts 479 and 503 of this thread..
[Galaxy S II Themes and Apps] mbellot:
It looks like disabling remote wipe was removed from the patcher, I wonder why...

EDIT:

Well, after reading the entire thread I (hopefully) found a solution.

Someone else didn't like the remote wipe being enabled and posted a link to v3.1 of the patcher.

I'll be trying this on the (freshly wiped) tablet in a bit to verify a remote wipe does not work a second time.
[Galaxy S II Themes and Apps] 1ronnie:
Hi there, I have just tried to apply this patch to a Samsung Galaxy Tab 10.1 running Samsung's stock 4.0.4. The patch process seems to work and shows no errors, but after the reboot the App does not appear in the App Drawer. I ran ES Explorer, and looked in the System/App directory, both Email.apk and Exchange.apk are there, if I click on them, it reports "Parse Error - There is a problem parsing the package". If I restore the original package, the app returns to normal, but I then tried applying the patch again, and same result.

I am not a coder, so am unable to diagnose this much further myself.

BTW ... just to prove I'm not a complete noob, I have applied this on my Gnex, and it worked perfectly, so the process seems to be working all right.

Thanks

Ronnie
[Galaxy S II Themes and Apps] ajislav:
Thanks for the explanation and the tip.

I took it one step further and manually patched the Email.apk and Exchange2.apk that come with CM10, repacked the patched files into the rom zip and flashed through CWM during "normal" rom update flash..

No settings deleted, no PIN required.

Another happy user ;)
[Galaxy S II Themes and Apps] xneuromancer:
Can you describe this in more detail? I'm having problems with the script. The CMD output complains that it can't get root access even though the device is rooted. I think I'd rather just patch the APK's myself.

Is it unzipping the patched .jar, copying these files over manually into the APK somehow?

Edit - Never mind, I got the patch working. Missed an option in the Developer options config to allow Root access over ADB.
[Galaxy S II Themes and Apps] wbvczar:
Is your GN2 running stock ROM (touchwiz), or do you have a custom ROM? I used this on my Thunderbolt, but that had a custom CM7 ROM. I so want this functionality back. I have the Verizon GN2.

Thanks

---------- Post added at 01:04 PM ---------- Previous post was at 01:00 PM ----------

I saw this when using SuperSU (chainfire). It says you need to upgrade to the pro version to get that functionality. On another phone I replaced SuperSU with Superuser (ChainsDD) and was able to use this script.
[Galaxy S II Themes and Apps] gt2690b:
Jim's dropbox link is down.. anyone have that flashable zip?
[Galaxy S II Themes and Apps] wbvczar:
On my GN2, if I use Titanium backup to backup Email 4.0 and Exchange Services 4.1, can I try this patch and then restore these if it does not work?

I want to have a back out plan, or have someone confirm that it works before I try it.
[Galaxy S II Themes and Apps] Zlatko1983:
Saved me SO MUCH time.
[Galaxy S II Themes and Apps] wbvczar:
So to answer my own question, this works like a champ on my VZW Note 2 (Jelly Bean). After reading the OP again and seeing it worked on the S3, I gave it a try. I didn't even need to upgrade SuperSU.

Thanks to the dev on that great tool!
[Galaxy S II Themes and Apps] wessel99:
Does not seem to work with android 4.2.1 yet (just upgraded to 4.2.1 on my Gnex this morning)

Checking device...
Model: Galaxy Nexus, build JOP40D, android 4.2.1 (API Level 16)
/system mounted on /dev/block/platform/omap/omap_hsmmc.0/by-name/system, mode ro

checking root access. root uid: 0, secure: no, busybox: yes
Pulling app(s) ...
Pulling libs ...

*** Unable to pull framework jars.

Debug log written to debug.log
Press any key to continue . . .
[Galaxy S II Themes and Apps] Sardo Numspa:
yeah, just tried it on my xoom that i just flashed 4.2.1 on. looks like it got through most of it and just was not able to finalize. i tried rebooting manually after, but no luck.

Waiting for USB connection...
Checking device...
Model: Xoom, build cm_wingray-userdebug 4.2.1 JOP40D eng.tdr.20121204.131852.test-keys, android 4.2.1 (API Level 15)
/system mounted on /dev/block/platform/sdhci-tegra.3/by-name/system, mode ro
***Warning: cannot set root (is device rooted?). uid=2000
Pulling app(s) ...
Pulling libs ...
decompiling EmailGoogle.apk ...
Applying patch lll
Patching com/android/emailcommon/provider/Policy.normalize()V
Recompiling ...
Building EmailGoogle.apk ...
Decompiling Exchange2Google.apk ...
Applying patch ...
Patching com/android/emailcommon/provider/Policy.normalize()V
Patching com/android/exchange/adapter/ProvisionParser.hasSupportablePolicySet()Z

Recompiling ...
Building Exchange2Google.apk ...
Updating device ...

*** Unable to remount system partition for writing (are you root?).

Debug log written to debug.log
Press any key to continue . . .
[Galaxy S II Themes and Apps] prulleman:
worked like a charm on Galaxy Nexus (GSM/maguro) with AOSP based custom 4.2.1 rom :good: Thanks!

(http://xdaforums.com/showthread.php?t=1821673)
[Galaxy S II Themes and Apps] Demon Lord:
The APK made with the OSX version didn't work on CM 10.1 with 4.2.1 until I resigned them.

I went the lazy way with Auto-Sign (http://xdaforums.com/showthread.php?t=1485582) and it did the trick.