yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Themes and Apps] maumaus:
Can you help me a little bit more with that?

I dont really see that line doing what i ment...

Lets say my folders structure is like this:

- email-policy-patch-3.1\

- email-policy-patch-3.1\apply-patch.cmd

- email-policy-patch-3.1\apply-patch-nix.sh

- email-policy-patch-3.1\restore-backup.cmd

- email-policy-patch-3.1\lib\

- email-policy-patch-3.1\lib\adb.exe

- email-policy-patch-3.1\lib\AdbWinApi.dll

- email-policy-patch-3.1\lib\AdbWinUsbApi.dll

- email-policy-patch-3.1\lib\email-policy-patch.jar

- email-policy-patch-3.1\lib\LICENSE.txt

If i then would add this:

- email-policy-patch-3.1\apk\

- email-policy-patch-3.1\apk\email.apk

- email-policy-patch-3.1\apk\exchange.apk

How should the *.cmd look to patch those 2 apk's to a new folder like

"- email-policy-patch-3.1\apk\patched\" or something like that...

Correct me if im wrong.. but you only patch those 2 apk's with your script right?

Like I said before.. it would be very helpfull for me when i update my rom (maybe even with an update email.apk & exchange.apk) so I dont have to resync all my mail when i patch it afterwords... now i could replace them before flashing.

Thanks alot!
[Galaxy S II Themes and Apps] psychokiller99:
Works on JellyBean

Sweet!

This worked perfectly on my Galaxy Nexus running 4.1.1

The pin feature was really annoying and almost made be go back to CM9 (in CM9 you can override the pin by having an insecure profile).

Thanks!
[Galaxy S II Themes and Apps] purian23:
The patch is working well for me on the Toro Gnex, however their is now a 3rd apk name, Exchange.apk, Exchange2Google.apk and now Exchange2.apk. Again it still works if I manually enter the name not found, but since JB hit, i'll have about 2-4 FC's on my email setup process, then it'll start working with no KNOWN issues. Has this happend to anyone else?
[Galaxy S II Themes and Apps] jakiman:
Sadly, it's not working on Galaxy Note with stock ICS 4.0.3.

I hope the support for Galaxy Note ICS is added in future. =)
[Galaxy S II Themes and Apps] mihirdshah1:
Works Great on Jelly Bean

Thank you very much !!! :good:
[Galaxy S II Themes and Apps] mundixx:
Thanks to rustamabd.

You are such a wonderful person!
[Galaxy S II Themes and Apps] rustyx3:
It seems that the version you have has less policy restrictions than the one in Galaxy S2, so if you skip the last 4 bold lines (starting with "allowDesktopSync" up until "requireStorageCardEncryption") then the mod would work for you.
[Galaxy S II Themes and Apps] ecefrm:
Total success! Thanks a lot! Since I bought the Tab I was looking for this.
[Galaxy S II Themes and Apps] trampa:
Gave it a go on a SGS but no luck (I had little expectations but tried it :))

would you know of any post that has a similar fix as this one?

I'm on 2.3.4 JVP

btw, the error I'm getting is:

# cp /sdcard/Email.apk /system/app

cp /sdcard/Email.apk /system/app

cp: write error: No space left on device
[Galaxy S II Themes and Apps] NXK:
Help on modified email.apk (Noob)!

I have a rooted SGS2 (stock ROM) and want to bypass exchange security. My email app is only 0.91 MB (?); does that mean I cannot use this modified version? The AOSP version mentioned in the OP is for older version, I guess (Froyo). I am not an expert in this field so I am looking for something that I can flash. Any help would be appreciated.
[Galaxy S II Themes and Apps] Glougloumouth:
Hi ecefrm,

I am running a Galaxy Tab 7, with Overcome Hermes (2.0.1) and wanted too to patch the native Gingerbread Mail application, but I have no Email.odex under /system/app

I thought it was a mistake and made a factory reset, no luck: that file is still not present in my device (Edit #1: the fact Overcome is deodexed is most likely the issue)

Could you share your backup copy of Email.odex (so I can do my own patching) and your modified Email.apk versions? Thanks in advance. Edit #4: no longer required.

Edit #2: I pulled the Email.apk and Email.odex files out of a clean not-deodexed ROM (001012-GB-stock-safe_v3). I can proceed with pulling out the framework, baksmali the Email.odex file, edit SecurityPolicy$PolicySet.smali (without the 4 last lines as stated in post #21, Galaxy Tab).

When I move to:java -jar smali-1.2.6.jar -o classes.dex out I get the following output:

out\com\android\email\activity\FolderMessageList.smali[0,-1] no viable alternative at input '<EOF>'

And I get no classes.dex

Edit #3: OK, pulling the Email.apk&odex files out of a clean ROM was not enough. I had to pull out the framework content out of that clean ROM, so it matches the applications. Now I have a "classes.dex" file

Being new to Android, I was now looking for guidance for the next step: "Add classes.dex to Email.apk"

Reading http://xdaforums.com/archive/index.php/t-972313.html it simply states "Using something like 7zip, open the "Email.apk" file and add your new "classes.dex" to the apk". Like anywhere in the .apk?

Edit #4: So I finally simply dropped the classes.dex at the root of the APK file using 7Zip. Then proceeded with the rest of the procedure and it simply works fine! No more annoying lock at each screen off, I could re-enable the screen pattern and couple it with "Lock with Wifi" get delayed screen lock screen.
[Galaxy S II Themes and Apps] Grem:
Thank you for this, much appreciated!
[Galaxy S II Themes and Apps] DarkDvr:
@rustamabd

Thank you so much! My work's exchange policy is rediculous - full sd encryption, etc.

This worked great.

However, one thing I noticed is that mounting system as RO (last step) can sometimes fail with "busy" error. For that, just reboot.

Also, after replacing this apk it's nessesary to reboot the phone, otherwise Email app will FC. Perhaps you want to add that to ur steps.
[Galaxy S II Themes and Apps] Maxxq:
This worked great. I used Root explorer to replace Email.apk

Thank you.
[Galaxy S II Themes and Apps] rustyx3:
My device didn't need a reboot. But anyway a note added to OP. Thanks! :)
[Galaxy S II Themes and Apps] zyxeu:
Thank you very much rustamabd.

Your apk works perfectly with the latest XXKG2 2.3.4.

I only did not like the ugly 6 char password (minimum one char, one symbol, and one number) that was enforced by the corporate activesync exchange email server security policy. I can live gladly with a 4 digit PIN especially with 2.3.4 that allows to add an extra timeout after the screen goes off.

When I have some time then I will try to do it the "hard" way you described and deactivate just the password enforcement policies allowing PIN or PATTERN.

Is it right that in this case it would be just to add the following line instead of all other overwrites?:

const/16 p2, 0x0 # "passwordMode"

Thanks.
[Galaxy S II Themes and Apps] shuweee:
I got root explorer but when i tried to delete the odex file im getting system file only message. my root explorer was granted superuser access, not sure if im missing a step. any help would be appreciated.

thanks
[Galaxy S II Themes and Apps] DarkDvr:
Strange.. worked fine and now I'm getting intermittent FCs when replying to email (doesn't happen every time).

Happens when body textbox gets the focus and keyboard is about to pop-up. Freezes and FCs.

Could be the keyboard itself... reinstalled, will try again.

EDIT1: Reinstalling the email.apk didn't help - still FCs on reply about 70% of the time.

Don't think I had this problem on stock 2.3.3 ROM with 2.3.3 email.apk.. will try 2.3.3 apk on 2.3.4 ROM.. maybe that'll work somehow =)

EDIT2: Running the 2.3.3 email.apk from OP on VillainROM (2.3.4) does run.. but same intermittend forceclose issues when replying =(

EDIT3: Issue was present in VillainROM, not present in Congition. So far, no FCs with 2.3.4 version.
[Galaxy S II Themes and Apps] Funkyfin2000:
Seems to be working well on SGS2 here! Will test!"
[Galaxy S II Themes and Apps] monkley:
just installed on 2.3.4 KG3 and getting some force closes

I'm gonna stick with it a bit to get a feel for it as the 6 characters with numbers and symbols just sucks

thanks
[Galaxy S II Themes and Apps] monkley:
I'm afraid it is force closing a lot :(

Any ideas why considering that there are reports of it working?

(KG3 2.3.4 on almost stock build - CF rooted)
[Galaxy S II Themes and Apps] CrackaBoi:
To those experiencing FCs:

Has it gotten any better, or did you see a pattern in cause of FCs?

Thanks
[Galaxy S II Themes and Apps] monkley:
seems a bit random, but it usually happens when I try to reply but not every time.

It may be unrelated, but all of a sudden I can't uninstall apps! I'm about to reflash to see if that helps with the uninstall problem.
[Galaxy S II Themes and Apps] zyxeu:
I can reproduce always the FC on KG5 stock with CF-root when I open an email from the sent folder, then click the reply icon and select e.g. forward from the menu, it FCs when clicking somewhere else in the mail.

My workaround is not opening the email, but long clicking it in the email listview and selecting e.g. to forward immedeatly, then there is no FC.

Can someone confirm that this happens just in the patched apk?
[Galaxy S II Themes and Apps] CrackaBoi:
Yeah that does not happen for me on Litening ROM 5 (2.3.4) with stock email apk.

I wanna try this but I dont need to spend more time doing trial & error testing with my phone do get it the way it should have been in the first place (mainly referring to the countless battery life experiments I've conducted to get the battery life I expected).
[Galaxy S II Themes and Apps] jameslfc5:
Out of interest, what are these restrictions please?
[Galaxy S II Themes and Apps] Red94:
Hi rustamabd,

The "why" answer:

Every new smartphone will be put in quarantine before an admin allow it to sync with Exchange. They will check if the smartphone ID is the right one (match phone EMEI)... so it's needed to fake every reporting activesync fields exchange show.

The "which" fields answer:

It must be a config file, some fields show MODEL<EMEI> like DeviceID... so it's not a fixed patch.

Without such a patch, i will shortly need to use two phones :-) In 2012, unnbelieevaablllleeeeeeeee !

Exchange command: get-activesyncdevicestatistics

http://msdn.microsoft.com/en-us/lib...deviceconfiguration_members(v=exchg.140).aspx

DeviceType :

DeviceID :

DeviceUserAgent :

DeviceModel :

DeviceIMEI :

DeviceFriendlyName :

DeviceOS :

DeviceOSLanguage :

DevicePhoneNumber :

If you need more info or need a betatester for this patch, i'm your man.

Or maybe a patch that allow email.apk to get these datas from a config file put directly on the Smartphone. It will allow to change value without a patching every time.

So... i whish you a nice week-end.
[Galaxy S II Themes and Apps] drousseau:
Hi,

What do you mean by prehacked version? You mean the original file? Doesn't that re-enable the security policies?

Thanks,
[Galaxy S II Themes and Apps] OSully:
Same here. Getting FCs every once in awhile.

I'm running bugless beast on toro... version 4.1.1 of android.
[Galaxy S II Themes and Apps] davinman:
Running the new stock ROM from Samsung for the Skyrocket S2 and wanted to patch the email files however I get the following errors

Waiting for USB connection...

Checking device...

Model: SAMSUNG-SGH-I727, build IMM76D.UCLF6, android 4.0.4 (API Level 15)

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

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

Pulling app(s) ...

Pulling libs ...

Decompiling Email.odex ...

Error occured while loading boot class path files. Aborting.

org.jf.dexlib.Util.ExceptionWithContext: Cannot locate boot class path file com.

att.vvm.sharedlib.jar

at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.jav

a:207)

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

1)

at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPathFromOdex(Cla

ssPath.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:790)

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

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

Press any key to continue . . .

Any suggestions would be appreciated.

Thanks
[Galaxy S II Themes and Apps] Johnnykorn:
Place the Email.apk, Exchange.apk and framework in the lib folder. create a new batch file and place it with the rest. paste the contents in it.

@java -jar lib/email-policy-patch.jar patch-manual lib 15 Email.apk Exchange.apk

Make sure you create back ups of the apps as it will overwrite them.
[Galaxy S II Themes and Apps] OSully:
Anyone have any ideas as to why I am getting FCs after patching?
[Galaxy S II Themes and Apps] pentafive:
You will get some right after patching. Just give it some time to "settle down" and then reboot. Should work OK after that. I get a FC here and there, but over all it works.
[Galaxy S II Themes and Apps] maumaus:
Hmm it did work...(Thanks for that!) But it also creates a classes.dex and 2 maps "out-Exchange.apk" & "out-Email.apk"...

Should that content be placed somewere? Or is it a byproduct of the patch which normally will be placed in the "work"-folder?

Like I asked orginally... are the 2 apk's the only thing that is patched? Cause im not really sure...

Thanks alot!
[Galaxy S II Themes and Apps] OSully:
Yeah, I noticed that it works okay after the initial FC during setup, but I'm getting 3-4 FCs a day and sometimes my email push stops all together.
[Galaxy S II Themes and Apps] bricenott:
Basically mine gives FC's only when opening attachments (mostly xml files from my company)
[Galaxy S II Themes and Apps] hollywoodo:
finally!

it works, and its perfect. thank you so much.
[Galaxy S II Themes and Apps] OSully:
Same here... unfortunately I get hourly emails with data feeds for work. Any chance at a fix OP? :D
[Galaxy S II Themes and Apps] rustyx3:
Did it also behave the same way before applying the patch or is the issue introduced by the patch?
[Galaxy S II Themes and Apps] OSully:
No issues before the patch. I went back to the stock apps and everything is fine.
[Galaxy S II Themes and Apps] McAwesome:
Works on my straight stock SGS3 Error Parsing on my Infuse 4g running cm9. Entopy's latest build.

2992
[Galaxy S II Themes and Apps] JedixJarf:
Works like a charm on my Maxx with an AOSP rom. Doesn't work with the stock motoblur rom.
[Galaxy S II Themes and Apps] vivektyagi20:
It keeps on loading

I am using this bypassed application on stock ICS, Galaxy S2. The only issue is that the Email erases data itself, every once in a while despite getting proper data connection and no "connection error" message. Also, once I try to reset the account again, the mails do not load and Email always remains in a 'loading' phase. Help me as otherwise, this application works like a charm.
[Galaxy S II Themes and Apps] bricenott:
Which release of software do you have? Like said before the only issue some have on sgs2 is that sometimes email app FC's. Mostly when downloading attachments.
[Galaxy S II Themes and Apps] vivektyagi20:
I am using the latest one, i.e. 3.1. Also, if i restore everything and then revert to 3.0, the same issue exists. The application FCs but more importantly, it automatically wipes all the data. To make things more precise, when i start my Email, i would need to setup Mail for Exchange all over again. Clearly, the issue is not just while downloading any attachment. Please help.
[Galaxy S II Themes and Apps] ovoix:
I have the same problem. initial setup was fine. I'm getting some FC per day and sometimes push stops. 3-4 FC is maybe a good estimation.

I have a Galaxy Nexus with offical 4.1.1. Everything aside root and your hack is stock.
[Galaxy S II Themes and Apps] RWOLUPO:
doesnt work for me ... i get fc's
[Galaxy S II Themes and Apps] OSully:
Hopefully we can get a fix. For now I'm just using 10 minute delay before locking so I'm not entering my pin every time the phone screen goes off but I'd rather no pin at all. :D
[Galaxy S II Themes and Apps] fokuslee:
Does this patch disable remote wipe as well?

thanks
[Galaxy S II Themes and Apps] squire23:
Having problems getting this working with CM10 Preview ROM. Has anyone else managed it? It keeps saying it cannot find the Exchange.apk?
[Galaxy S II Themes and Apps] @Existence@:
Thanks for this mod, was looking for this for a long time!
[Galaxy S II Themes and Apps] OSully:
Has anyone been able to find a version that won't FC with 4.1.1?

Using Cyanogenmod 10 (Galaxy Nexus CDMA/Verizon Preview).
[Galaxy S II Themes and Apps] purian23:
Not yet, it will work though. Just a couple FC upon setup.
[Galaxy S II Themes and Apps] dewey1973:
I got this error as well on CM10 for Epic 4G Touch. I didn't have time to dive into it.
[Galaxy S II Themes and Apps] phenixdragon:
Doesn't work for me on my Nexus 7. Keeps saying to connect my device, which it is with USB debugging.
[Galaxy S II Themes and Apps] rustyx3:
Apparently the patch isn't working very well for JellyBean ROMs. I'll have a look as soon as I get the time...

The good news is, Galaxy S III stock (ICS) ROMs are now officially supported, as I have an S III now :laugh:
[Galaxy S II Themes and Apps] OSully:
Thanks man, it would be much appreciated. I hate having to use a PIN :p
[Galaxy S II Themes and Apps] purian23:
Thanks dude, shot you a pm :P)
[Galaxy S II Themes and Apps] arbitarytwist:
Thanks for super work dude. Worked like a charm on 4.0.4 XWLPT.
[Galaxy S II Themes and Apps] malhor:
Until now, I never had to use this. Just patched cm9 email. Worked like a charm great work.

Sent at hyperdroid speed from a Galaxy far far away from the others
[Galaxy S II Themes and Apps] Bolick:
Hi there!

Here's another voice for Jelly Bean support.

But I'd like to ask if you have any ideas why this patch is not working correctly on JB?

I may volunteer for trying things on JB device if you don't have a target to play with.
[Galaxy S II Themes and Apps] CaspaTheGhost:
Good to hear as I may be getting one from work at some point.

Sent from my Galaxy Nexus
[Galaxy S II Themes and Apps] fastguy:
Thanks a lot for this patch, it works great on my ICS ROM.

I have one feature request, if it makes sense to add in same or another patch. I know this is about Email.apk, but the "VPN" settings in Android (ICS in my case) also enforces to enable at least the PIN lock. Due to this, using built-in VPN is not intuitive. Could the patch be extended to patch the VPN application so that it can't enforce the PIN lock?
[Galaxy S II Themes and Apps] sashaberk:
Updates to server fail

Installed the patch per instructions. All went smoothly. And it sort of works, I connected to Exchange, getting new mail.

But, any state changes on the client (reading a message, removing a message) are not pushed back to the server. For example - deleted one of the messages, closed app, several seconds later got "new email" on status bar. Opened mail - deleted message is back. Repeated several times with no luck. Also, in several minutes ate through 10% of battery - and status showed that it's Exchange that consumed the power.Will probably have to go back to PIN :(
[Galaxy S II Themes and Apps] p2im0:
Seems to be working okay for me on Jelly Bean. Some odd issues here and there where it fails to connect to the server for no obvious reason while Touchdown works without issue.

Galaxy Nexus on Jelly Belly 5.4 (Jelly Bean 4.1.1) However I had to patch Exchange2.apk instead of Exchange.apk manually for Jelly Bean.
[Galaxy S II Themes and Apps] DaDinx33:
APK file?

Hi, I was wondering where I can find the apk file? Sorry I am new at this and the files I find all end in .zip. Thanks
[Galaxy S II Themes and Apps] fastguy:
I think there's an issue with your sync as I have no such issues and works pretty good (I'm on AOKP build 40). I read that calendar sync sometimes can get stuck. Try deleting and re-creating the account.
[Galaxy S II Themes and Apps] fastguy:
Read the first post. There's no apk. This is a patch. You run it from your computer command line when your phone is connected to your computer. Your phone should be rooted.
[Galaxy S II Themes and Apps] Bolick:
Well, I was to lazy to try to dig a bit deeper. But inspired by previous message I attempted to do patching manually.

And I discovered that the only noticeable difference is in *.apk names.

And here're names for Google's Jelly Bean:

EmailGoogle.apk - Email

Exchange2Google.apk - Exchange

To be honest I saw Email application FC-ed twice right after adding of new account - not sure if it's because of changes that were done.

But in general I see sync working fine.
[Galaxy S II Themes and Apps] squire23:
So should it not be a matter of just changing the code in the bat file to these 2 different names for the files. I know nothing about coding but I know that this is literally the only thing stopping me from using the JB Preview ROM as my daily ROM.
[Galaxy S II Themes and Apps] Roland_SGN:
Works great. The only question is that there is at the ending some notification but pressing some key at the end, the windows close. I have no idea what was the last messages. Perhaps as an idea, write the output as well into a file, e.g. Output.txt and the user could at the end review it. My 2 cents for the great patch...

---------- Post added at 10:27 AM ---------- Previous post was at 10:00 AM ----------

Just another question after testing around: I am on Samsung Note, still on GB, using the default email.apk with the widget. I experience that not all mails are displayed properly in the widget. But after fumbling around, then they are, and after some more received mails, they are not updated resp. only some are displayed. Is there any connection between the patch and the weird behaviour of the widget? Cause I see no pattern when it takes all mails from my box and when not.:confused:
[Galaxy S II Themes and Apps] weslyr:
rustamabd, I have successfully used your great patch with several GB roms in the past, but i'm having mixed results when applying the patch with a JB rom (the security policies are actually circumvented, but sometimes the exchange server crashes). Ofcourse I am aware that JB support is in alpha status right now.

I'm using Evervolv JellyBeans p6 and I would love to help you make this patch compatible with this JB rom. Do you need any files or information I can provide?
[Galaxy S II Themes and Apps] rustyx3:
Sure, if you see any java exception stack traces related to Email or Exchange in logcat, please send them to me.
[Galaxy S II Themes and Apps] psychokiller99:
Re-apply patch?

I am running Jelly Bean on a Galaxy Nexus and I had installed an older version of this patch. It worked pretty well for me, I was able to get emails and calendar without having to enter a PIN constantly. It did, however, FC very frequently.

I am interested in running the 3.1 patch to see if it has fixed some of the FCs. Can I install this patch over the last one, or do I need to resinstall the JB rom from scratch?
[Galaxy S II Themes and Apps] p2im0:
Since it only modifies the Email.apk and Exchange.apk (or other variations). I'd imagine you can use the originals that were backed-up when you first ran the script. Re-run the 3.1 patch with those original files.

I'm doing this on Mac so it's more of a manual process than on Windows anyway. I do this when upgrading versions of my ROM. I just re-run the patch with the new version of APK's that come with the new ROM. Same process, just use original APK with new 3.1 patch.
[Galaxy S II Themes and Apps] OSully:
You may run into some FCs anyway if you're on a JB ROM, a few of us have had the issue.
[Galaxy S II Themes and Apps] Bolick:
So here's a screen-shot of a stack trace on Exchange service crash.

and from it I'd say that patched version faces problems :)

These lines are important markers I believe:

======================

java.lang.SecurityException: No active admin

ComponentInfo{com.google.android.email/com.android.email.SecurityPolicy$PolicyAdmin}...

======================
[Galaxy S II Themes and Apps] OSully:
Thanks for this.... I hope it leads to a fix! :)