yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Themes and Apps] jsauder2:
Not sure if this is what is happening, but with mine...after a rom update, it seems to work without the password (my company requires a alpha numeric 8 digit password) for the first day or so. Then it says that I need to update the security policy, so I re-run the patch to get rid of it. So it's like there is somewhat of a delay after an update.

If it's not asking for your pin, I wouldn't worry about running the patch until it starts requiring it again.
[Galaxy S II Themes and Apps] drjat:
And do you remove account first then run patch and then sync again? Or can we run the patch while there are mails/data in the app
[Galaxy S II Themes and Apps] jsauder2:
You can re-run it without removing the account. It will wipe the apps data when it runs the patch anyway.,so every time you run the patch, you'll have to setup your account again.

I've also heard that you could use titanium backup (or any other backup app) to backup the email app, the exchange app, and accounts. Then restore them after a rom update and you won't need to run the patch again. I haven't tried that yet so I can't verify how it works.
[Galaxy S II Themes and Apps] drjat:
Does that wipe calendar and contacts associated with the account as well? If it doesn't wipe them.....then would they get duplicated after sync
[Galaxy S II Themes and Apps] jsauder2:
It will wipe them as well.

Sent from my Nexus 4
[Galaxy S II Themes and Apps] rustyx3:
This delay is due to the exchange protocol: when a policy is pushed to the phone, an authorization cookie is generated by the exchange server, the client uses it in subsequent communication without having to negotiate the policy every time. The cookie has a finite lifetime, i.e. it expires after a predefined period or also as soon as something changes on the server. That's why the patch appears to work even after a new Email app is flashed, but as soon as the last authorization expires, the real policy is negotiated and the effect of the patch is then gone.
[Galaxy S II Themes and Apps] BillGoss:
What I do is have a zip file with the modified email apks that I flash when I install a new ROM. That way I don't have to set up the account again.

Sent from my GT-I9505
[Galaxy S II Themes and Apps] Army92:
It doesn't work here. My note got 2.3.6 and no version of these stated above is working. Keep getting fc. Anybody know why?
[Galaxy S II Themes and Apps] rustyx3:
I hope you didn't try putting the attached Galaxy S II .apk into a Galaxy Note? The attached files will work only on Galaxy S II.

For all other devices follow the manual process (option 1).
[Galaxy S II Themes and Apps] Army92:
I also asked in the SGN Forum, and I was redirected this thread.

(See: here or here)

When decompiling the Email.apk from the Galaxy Note you get a lot of errors and it won't extract anything. I've tried many ways. Maybe anyone got another solution?
[Galaxy S II Themes and Apps] rustyx3:
And where is Email.odex? Have you tried decompiling Email.odex?
[Galaxy S II Themes and Apps] Army92:
Haven't tried. I'll try it later, for now I have to go sleep.

See Email.odex attached.
[Galaxy S II Themes and Apps] KcDaRookie:
Sure you can, it's your work after all ^^

Though I wouldn't mind if you'd mention my nick ;)
[Galaxy S II Themes and Apps] dinoc:
Seems to work fine with 2.3.4 , Thank you !
[Galaxy S II Themes and Apps] rjhuang:
Email Client From Taiwan Version Galaxy Note KK1

Hi rustamabd,

Attached is the Email app from my Taiwan version Galaxy Note KK1, could you help try to make a modified version from it? Thank you very much! I really couldn't figure out how to do it.
[Galaxy S II Themes and Apps] ksantoshh:
Thanks a lot!
[Galaxy S II Themes and Apps] rustyx3:
Please go to the first post and follow the new instructions. Hope it will work for you (or any 2.3.x version, for that matter).
[Galaxy S II Themes and Apps] rustyx3:
The only downside to this approach is that it requires CWM recovery. Not everyone has it...

Ended up making a universal patch instead :)
[Galaxy S II Themes and Apps] zard:
Hi rustamabd,

Can I confirm that the files in post 1 will work for Galaxy Note (Asia - Singapore) without constrains on the firmware version? I'm on 2.3.5 KK1.

Thanks.
[Galaxy S II Themes and Apps] jayGGjay:
FYI, you patch did not works for me with the email.apk from the NOTE. it give me some error ("whoami suid 0 unknown" or such) and I am root.

I have apply the patch (both of them) manually (smali, Notepad++, basmali, and replace the classes.dex file) but It still DOES NOT WORKS for the email.apk from the NOTE. The apk is OK no FC or anythings but still no email in imap from my exchange server.

Jay

The only one that has been working on my NOTE is :

Email.apk-SGS2-v2.3.5.exchange-policy-patch.zip

Only some txt and boxes smaller, and no extended landscape mode like the originale Note.
[Galaxy S II Themes and Apps] rustyx3:
Made a change that should hopefully fix the whoami error.

BTW, what Android version are you running on your Note?

The patch currently supports only Android 2.x.x.
[Galaxy S II Themes and Apps] jayGGjay:
I am running 2.3.6 with rom XXKK5 and 2.6.35.14 kernel,

But the SGS II apk was working without probleme (except some txt and boxes size issue).

And tx for the change will try it now and report back if it works ;)

EDIT1: patch 1.1 seems to works OK now, let see if my exchange server is willing to serve my email via IMAP now ;)

EDIT2: no my email still does not show .... like when I patch it manually (with your method and/or the other one http://xdaforums.com/showthread.php?t=1185749 )

"

.method public isActive(Lcom/android/email/SecurityPolicy$PolicySetZ

.locals 12

.parameter "policies"

.prologue

const/4 v7, 0x0 <- just change this value to 0x1

"

I don t know what else they have change in it ....
[Galaxy S II Themes and Apps] rustyx3:
Which SGS II apk worked for you, the one that was posted in this thread or some other one? If it was the one from this thread, then the patch will most likely also work. Make sure you first restore Email.apk and Email.odex in /system/app to the original version that came with your ROM, then run the patch. If you don't have the original version anymore, you can extract it from the ROM image as described here.
[Galaxy S II Themes and Apps] jayGGjay:
Hi tx for your effort for the Note email.apk

For the SGS II email.apk, not sure which thread it was ... Find it a few weeks ago here on xda.

But I have attach it here some you and other can use it/have a look if needed.
[Galaxy S II Themes and Apps] zard:
Hi guys, is it working for Note?

How do I do manual edit of email.apk?

I'm interested in Exchange Activesync?

Appreciate if you could advice please. Thank you.
[Galaxy S II Themes and Apps] zard:
BTW, I tried version 1.1 and got an error:

*** Unable to determine system partition. This device is not supported.

Press Enter to exit ...

Screen capture and my email.apk are attached.
[Galaxy S II Themes and Apps] unorthodoxkt:
Dear all

Do you all have the stock galaxy note email.apk ?

My bad i did not back up the stock email apk.
[Galaxy S II Themes and Apps] veliahht:
help how to install e-mail does not work

help how to install e-mail does not work
[Galaxy S II Themes and Apps] TripFlex:
Just used this patch on JB 4.2.2 Goldeneye 4.0 TW (TouchWiz) and it worked perfectly! Spent all day trying to hack apart the APK for TouchWiz and ended up this was all I needed! DOH!
[Galaxy S II Themes and Apps] extremefun:
Exchange services 4.2

Does the patch still work on exchange services 4.2?

On a recent update of my S3 to OMEGA 4.2.2 , full wipe, I ran the patch and had no issue;

On setting up the email exchange account, it remains loading email messages forever. No mail messages appear.

On previous OMEGA ROM exchangeservice was v4.1, the only difference I could notice.

Deleted 4.2, installed 4.1, ran the patch, patch claimed already patched, (copied 4.1 from another patched S3).

Now mail messages arrive with exch 4.1.

Is the patch still working on exch 4.2? or what do I need to change to run it on exch 4.2
[Galaxy S II Themes and Apps] rockambole:
working here on CM10.1 (4.2.2)

any chance to have it ported to 4.3? :D
[Galaxy S II Themes and Apps] solar666:
Look at that:

http://xdaforums.com/showthread.php?p=43930450

:)
[Galaxy S II Themes and Apps] themichael:
I don't have access to a computer that I can adb. Does anyone have the patched app for the galaxy note II they can share? Running 4.1.2 touchwiz. Anyway to installed the patch without adb would be awesome too.
[Galaxy S II Themes and Apps] solar666:
In that case I would recommend you the xposed patch posted a few pages back.

Try it and feedback.

http://xdaforums.com/showthread.php?p=43280238

:sly:
[Galaxy S II Themes and Apps] cvv2:
Nexus 4

4.3, stock

rooted with SuperSU Pro v1.51

I keep getting stuck with this error:

Cleaning up ...
Waiting for USB connection...
Checking device...
Model: Nexus 4, build JWR66V, android 4.3 (API Level 16)
/system mounted on /dev/block/platform/msm_sdcc.1/by-name/system, mode ro
checking root access. root uid: 0, secure: yes, busybox: yes
Pulling app(s) ...
Pulling libs ...
Decompiling EmailGoogle.odex ...
Applying patch ...
Patching com/android/emailcommon/provider/Policy.normalize()V
Recompiling ...
Building EmailGoogle.apk ...
Decompiling Exchange2Google.odex ...
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 . . .

When I execute remount I have tried (with adb shell)

su mount -o rw,remount /system

it seems to work?

So confusing...
[Galaxy S II Themes and Apps] cvv2:
I ended up getting around this by simply copying the patched APKs over manually. Read through the code to understand what was happening, and even followed the code's backup naming standard so I can restore if needed in the future.

Much thanks to rustamabd for the source in this same thread.
[Galaxy S II Themes and Apps] rafsi:
Can you please post the modded 4.3 apks...
[Galaxy S II Themes and Apps] hamshank4eva:
weird? i'm on the same device running stock odexed factory image 4.3 obvs root and it keeps chucking this out:

I can adb shell and remount system as rw so i'm confused

EDIT

this is now resolved by moving them manually -

I pushed the modified apk files to the internal storage (/sdcard/)

mounted /system as root as rw

backed up the EmailGoogle and Exchange2Google apks and odex files then deleted the originals from /system/app

moved the modified apk files to /system/app/

rebooted the phone

put in the credentials, asked to be a device admin but no policy enforcement - cool!

looking into the remount problem it seems that only the root user gets it remounted as rw, any other user /system is still read only

galaxy nexus stock 4.3 from factory image. odexed. no mods or custom kernel. no busybox. rooted with chainfire 1.51 superSU
[Galaxy S II Themes and Apps] dbenyakar:
I used the patch on my Galaxy S4 which runs the latest build (I9500XWUBMG5). The patch worked, phone rebooted but for some reason It asks me to enter password. It even disabled my SD card. I had to decrypt it in order to use the SD card again.

I use this patch since 4.0 and had no (major) problem up until now. This also worked on every other build of SGS4 before this with no problem up until the latest build.

Any ideas why this happens?
[Galaxy S II Themes and Apps] fastguy:
this is an answer to this post:

http://xdaforums.com/showthread.php?p=43280596

why don't you just use the backup script I posted some time ago (if I remember well). that backs up your patched email and exchange apk while upgrading a new nightly CM10.1 and restores again after installation automatically, but shall work on other CM. no need to do anything else.

I only re-apply the patch if I see something changing on email or exchange apk in the nightly changelog. there were no changes since quite a few months though.

Ps I can't attach it on tapatalk now but can do it later if you can't find it in previous pages.
[Galaxy S II Themes and Apps] rust0r:
This worked on my Note 2 oddly the other night, after several patch/restores, then I had to re-install my rom due to some issues with other settings.

I can't for the life of me seem to get this to work now, it keeps telling me I need to set a pin, etc

Can someone post the APK files needed for Rootbox rom on the latest JB ?
[Galaxy S II Themes and Apps] B1663R:
4.3 update woes :(

Building EmailGoogle.apk ...

Decompiling Exchange2Google.odex ...

Applying patch ...

Recompiling ...

Building Exchange2Google.apk ...

Updating device ...

> lib/adb.exe remount

remount failed: Operation not permitted

< returned: 0

> lib/adb.exe shell mount

I have ready alot of the post here with the same issue "unable to remount system partition for writing (are you root).

I am root (least SU says so :))

Any help is appreciated this has worked so well for me through 4.2.2 and honestly i might even avoid corporate email if i cant get the pin removed.
[Galaxy S II Themes and Apps] BillGoss:
Have you set Settings/Developer options/Root access to include ADB?

Sent from my GT-I9505
[Galaxy S II Themes and Apps] B1663R:
I should clarify im on a nexus 4 stock with 4.3 and root now. I am not on CM10 and SU does show ADB having root access. Am I missing something here? thanks for your suggestion.
[Galaxy S II Themes and Apps] BillGoss:
Just a thought. Connect your phone to your PC. Run ADB and type "ADB devices". does your phone ask you to allow the PC to connect?

Just checking that phone recognizes your PC as an allowed device.

Sent from my GT-I9505
[Galaxy S II Themes and Apps] twosix:
Is Root access option available in the Developer options menu?
[Galaxy S II Themes and Apps] BillGoss:
Please note that I'm running CyanogenMod.

Sent from my GT-I9505
[Galaxy S II Themes and Apps] B1663R:
Stock 4.3 and no root access options available in developer options. In addition ADB sees my device fine and there is no request when i run adb devices on the phone to allow ADB to connect.

I have even updated all the files in patches lib folder to the newest from the SDK. (figured i would give it a shot)

Any more suggestions? :) thanks for all so far.
[Galaxy S II Themes and Apps] TheBenz:
I tried the Patch with the newest CyanognenMod(10.2) on my Galaxy SII (G) and everything worked perfectly.:):)

But I had to plug in and unplug it a few times until my SII asked me if I want to add the computer as trusted ADB device.
[Galaxy S II Themes and Apps] B1663R:
Thanks but i can communicate with my nexus 4 through ADB. Are the modified files and backups it generated usable for doing this manually since i have root and access? Just want to make sure can someone clarify the files to be moved?

Still trying :).
[Galaxy S II Themes and Apps] tutuco:
Any possibility to run this patch in a HTC one? Running JB 4.2.2 Sens 5.0?

Thanks...
[Galaxy S II Themes and Apps] B1663R:
Well i have been in/out of ADB and was looking at permissions with wugfresh's tool. I tried again and viola it worked. I am not really sure what occurred but it is working on 4.3 stock/rooted.

I have learned a lot but still wish i knew was really occurred to allow it to remount. :)
[Galaxy S II Themes and Apps] NegativeOne:
So what's the verdict for remote wipes on this?
[Galaxy S II Themes and Apps] TheBenz:
If you look into device Administrators, the Exchange Account is still there. The mod only removes the password (if I understood everything correctly).

Sorry, its German ;)
[Galaxy S II Themes and Apps] shy11:
May I know if it works with AOKP/CM10/PA Roms? e.g. Vanilla Rootbox Jelleybean
[Galaxy S II Themes and Apps] jsauder2:
Yes it does.

Sent from my Nexus 4
[Galaxy S II Themes and Apps] HopelesRomantc91:
Trying this on stock rooted 4.2.2 on GS4 with no luck, it hangs up with the CMD window saying this:

Cleaning up ...
Waiting for USB connection...
Checking device...
Model: SCH-I545, build JDQ39.I545VRUAME7, android 4.2.2 (API Level 16)
/system mounted on /dev/block/platform/msm_sdcc.1/by-name/system, mode ro
[Galaxy S II Themes and Apps] enlan:
What am I doing wrong?
[Galaxy S II Themes and Apps] marco_foschi:
no changes

I tryed to apply the patch, and it seems it worked:

BUT there's nothing different!

I still have the password in the lock screen, and I cannot remove it from the settings/account/exchange.

is there something wrong?

Thanks in advance

Marco F.

EDIT: problem solved specifying SecEmail_J.apk

:)

Thanks a lot for this amazing mod!
[Galaxy S II Themes and Apps] bricenott:
Did you de encrypted the SD? Deleted the email account? That always help to make things right. Repeat the process. Also when the command stops not doing anything, it's actually waiting for you to introduce a file name, which is secemail_j.apk for the SGS4 4.2.2 (this is for ENLAN)
[Galaxy S II Themes and Apps] arvo.bowen:
Thanks for a great tutorial and patch!

Everything seems to line up just fine except it seems the security policies were applied anyway...

Note: FRESH BRAND NEW PHONE (Samsung Galaxy S4 - T-Mobile [SGH-M919])

1) Rooted device.

2) Setup my exchange mail settings, device asked me to accept policy changes, I closed it (not agreeing).

3) Downloaded the attached file "email-policy-patch-3.3.zip"

4) Extracted it...

5) Plugged up my phone.

6) Ran apply-patch.cmd

7) Said "Can't find Email app. Enter the name of your Email apk or press <Enter> to exit:"

8) Typed in "SECEMAIL_J.APK"

9) Finished patch successfully.

10) Phone rebooted and I open the mail app accepting the security policies. Then it made me set a PIN instead of my pattern. :(

Note: I did try to delete the email account and re add it with no success..

Now I'm confused... Why do I have to use a 7 char PIN? I thought the whole point of this was to avoid the security settings.

Ideas?
[Galaxy S II Themes and Apps] marco_foschi:
Now it's working fine. I was not able to delete the post, so I modified it.

The problem was that I had to manually specify the file "SecEmail_J.apk", not Email.apk

Thanks a lot anyway!! :)

Marco F.
[Galaxy S II Themes and Apps] daniello8:
Admittedly I did not go through the whole thread so pls don't flame if this has been answered.

Will this patch leave an active administrator or not? I am asking because I use a profile switcher to activate/deactivate PIN lock depending on where I am and this won't work if there is an email administrator. Once it activates the PIN it would be removable again unless I remove the administor .. which then also removes my exchange account.

If it doesn't install an adminstrator I would give it a try with my touchwiz mail client.
[Galaxy S II Themes and Apps] bricenott:
No, it does not. :)
[Galaxy S II Themes and Apps] josurr:
i love this patch, unfortunately i cannot get it to work with my galaxy s4 for verizon (sch-i545). i am running the me7 update on the phone, but it is rooted (other apps like titaniumbackup work without any issues).

i tried specifying SecEmail_J.apk when the batch process could not find the default Email.apk file and it appeared to patch successfully.

however, after the reboot i am getting constant "acore process has stopped" messages after pressing the menu/back/home buttons or anywhere on the screen, making the phone inoperable.

i had to do a complete factory wipe to get the phone back up and running.

any tips/assistance would be greatly appreciated.

-josurr
[Galaxy S II Themes and Apps] Jinson7:
Anybody tried this with a Sense 5 ROM? I have no exchange.apk just a mail.apk
[Galaxy S II Themes and Apps] Captain_Throwback:
Read the OP.
[Galaxy S II Themes and Apps] josurr:
i was able to get my vzw gs4 working again and reapplied the root exploit, but now i cannot get the patch to run,

it always gets stuck at this point and never goes any further:

Cleaning up ...

Waiting for USB connection...

Checking device...

Model: SCH-I545, build JDQ39.I545VRUAME7, android 4.2.2 (API Level 16)

/system mounted on /dev/block/platform/msm_sdcc.1/by-name/system, mode ro

any ideas?
[Galaxy S II Themes and Apps] b0tes:
Just works!

I followed the instructions to the tee--applied this hack after a fresh install of PACrom 4.3 v3.97, but applied the hack before setting up the stock Email/Exchange app.

And I have to say, it's bittersweet that I'm only finding out about this mod, because I've been enduring my company's imposed PINcode lockscreen for the past 8 months, but I'm also grateful how simple the workaround was.

Thanks dev!
[Galaxy S II Themes and Apps] daniello8:
Anyone successful on Galaxy S4 TW ROM .. or is it a definite fail with stock client? I wanna try this but any heads-up may be helpful :)
[Galaxy S II Themes and Apps] kelmar13:
Worked fine on my T-mobile S4, just had to rename the file IIRC.
[Galaxy S II Themes and Apps] daniello8:
Thanks! Could you elaborate on renaming pls. Where was the file and what name should it have?
[Galaxy S II Themes and Apps] arvo.bowen:
Can't get it to work like you did...

I tried installing SuperSU again... Then it asked if I wanted to install it with TWRP. I said yes and it rebooted then ran the script to install SuperSU. Now it seems that apps that ask for root are getting saved as expected.

But for some reason I still get the following...

Cleaning up ...
Waiting for USB connection...
Checking device...
Model: One X, build cm_evita-userdebug 4.3 JSS15J eng.jenkins.20130821.003343 test-keys, android 4.3 (API Level 15)
/system mounted on /dev/block/mmcblk0p33, mode ro
*** Warning: cannot set root (is device rooted?). uid=2000
Pulling app(s) ...

Any ideas why it thinks my phone is not rooted?

Edited: Things that people should try who are having issues...

1) If using Cyanogenmod you should first go into "Settings" then go into "Developer options". Scroll down to "Root access" and make sure it has "ADB" in the setting. For example, "App and ADB" would work.

2) Install the "superuser" app from the play store (I used the one by ClockworkMod). Try to run it and it might say something about installing/updating the binaries. You need to do this... I had to install it manually.

- Download From: http://download.clockworkmod.com/superuser/superuser.zip

- Put the zip package on your sdcard

- Run the installed superuser app

- It should ask you to update the binaries, then reboot to recovery mode (Example: TWRP)

- Choose "Install" and install the superuser zip package.

- Boot back to OS.

Two things to remember... The script uses adb which needs root access via adb. Also the script depends on the superuser app.