yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Themes and Apps] mexke:
Works perfect on Samsung i9505 (Galaxy S4)

My work decided to get a new security policy for Exchange, which forced me to put a password on my i9505 to unlock it and I hate it!

With your patch (or hack) I managed to get rid of the password and use my phone like before. Thank you very much!

:laugh::good::D:victory:
[Galaxy S II Themes and Apps] daniello8:
Hmm .. Samsung S4 Mini ...

Cleaning up ...

Downloading adb...

Waiting for USB connection...

Checking device...

Model: GT-I9195, build JDQ39.I9195XXUBML4, android 4.2.2 (API Level 16)

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

*** Warning: cannot set root (is device rooted?). uid=2000

Pulling app(s) ...

Pulling libs ...

Decompiling SecEmail_J.odex ...

Error occured while loading boot class path files. Aborting.

java.lang.IllegalArgumentException: bad utf-8 byte 8d at offset 005f0195

at org.jf.util.Utf8Utils.throwBadUtf8(Utf8Utils.java:283)

at org.jf.util.Utf8Utils.utf8BytesWithUtf16LengthToString(Utf8Utils.java:259)

at org.jf.dexlib2.dexbacked.BaseDexReader.readString(BaseDexReader.java:515)

at org.jf.dexlib2.dexbacked.DexBackedDexFile.getString(DexBackedDexFile.java:216)

at org.jf.dexlib2.dexbacked.DexBackedDexFile.getType(DexBackedDexFile.java:231)

at org.jf.dexlib2.dexbacked.DexBackedClassDef.getType(DexBackedClassDef.java:95)

at org.jf.dexlib2.analysis.ClassPath.<init>(ClassPath.java:97)

at org.jf.dexlib2.analysis.ClassPath.fromClassPath(ClassPath.java:164)

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

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

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:922)

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

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

Drücken Sie eine beliebige Taste . . .

Neither offline nor online works. Phone is rooted. Added init.rc and env to work path .. but that didn't help with either method.

Anyone?
[Galaxy S II Themes and Apps] dragonash:
Did anyone ever get this to work on a stock rooted Note 2 (with latest JB?)
[Galaxy S II Themes and Apps] KSKHH:
The mail application on S3 Android 4.3 worked, but the calendar is not syncing.

Any idea?

Fixed: There is calendar application file was missing. Now it is solved.
[Galaxy S II Themes and Apps] rmedure:
4.4 KitKat?

Does anybody know if this works on Droid Maxx with 4.4?
[Galaxy S II Themes and Apps] daniello8:
I cannot find a fix for this .. seems to be a UTF encoding problem somewhere .. strange.

Wanam Xposed works partially but once the pin code is enabled you can't return since it doesn't prevent an admin from being installed.

If anyone is willing to give it a go please pm me and I will gladly provide the two files.
[Galaxy S II Themes and Apps] rustyx3:
I see you have a German OS. Do you have German characters in the work path?
[Galaxy S II Themes and Apps] daniello8:
No .. just an underscore. And the same setup works on my i9505.

I found some information on the error (which I don't understand well): http://goo.gl/GY9wq4 but might give you an idea.

Any chance you will look further into this? If my app files could be the culprit I will glady provide them.
[Galaxy S II Themes and Apps] Chip90:
Thanks! Had this working on an AOKP 4.2.2 ROM. Finally updated to CM11 Snapshot.

For anyone having issues, between both my PC and MAC, my phone was not being recognized by adb even after enabling it under Settings. The issue was the "allow access to PC" prompt wasn't showing up. After rebooting the phone, the prompt came up and I was able to patch the files!
[Galaxy S II Themes and Apps] rustyx3:
Well, at the moment I can only suggest to try another ROM version.. You don't have to flash it, just extract the necessary files and see if the patch works.
[Galaxy S II Themes and Apps] starbucks2010:
Guys,

If this helps ... I patched my 4.3 FoxHound email with v4.2 patch and after that I setup my exchange email but it was always asking to apply the certificate. Then, I installed an exposed module (Exchange Bypass for Xposed v1.5 not Exchange Bypass v1.5.5.5 - be careful) and all was ok.

Just test for yourself.
[Galaxy S II Themes and Apps] laithe:
Success on KitKat 4.4!

Well I decided to stop being lazy and actually took an hour to look into this. In KitKat (on the Moto X and Droid Maxx family) the email apps have been moved to /system/priv-app/ instead of just /system/app/. I suspect this is common for all 4.4+ devices and not just mine because of what Google seems to be doing here with app permissions.

Anyway, to get the app to work simply copy your email/exchange and odex files to the /system/app folder. (For me, this means copying MotoEmail.apk and MotoEmail.odex from priv-app to app). You should probably also make backups just in case, I always do. Then simply run the email policy patch as normal, pointing it to your email/echange APKs as you normally would. After it finished it will have updated and deleted the .odex files. Now just move them from /system/app/ back into /system/priv-app/ and replace/delete the old ones if you left them there.

Viola! KitKat email policy patched magic! rustamabd I'm going to have to donate to you again, because this patch is gorgeous and you keep it updated. Works with so many devices and keeps my custom Moto email apk which I love. AND you haven't even updated it for Kit Kat and it works with not much effort at all on my part. You are golden!

--------------------------------------------------------------------------------------------------------------------------------------------------------

I just got KitKat up and running on my Droid Maxx and no luck. It can't find the MotoEmail.apk anymore.

I'm going to play around with it some more and see if I can get it working. It looks like MotoEmail got moved from /system/app to /system/priv-app. I'll let you know how it goes. Hopefully if I don't figure it out someone else on here will soon! There are a lot of seriously smart people on xda.
[Galaxy S II Themes and Apps] daniello8:
I second that: 0U6775412H056503K
[Galaxy S II Themes and Apps] doctork:
digest error?

Dear rustamb,

Thanks für your great email-patcher. Works flawlessly on my 8160 (xcover2) with the stock rom.

Nevertheless, when trying out the cm10.2 from flxo, I'm encountering Problems.

The patch itself runs, without problems.

When trying to "apply" them (put to /system/app, reboot) the apps are just not there. When trying to install manually, the log throws a lot of lines but 1 red one:

E/PackageParser( 3788):
Package com.android.email has no certificates at entry classes.dex; ignoring!

I found out that each apk has its signature, tested with "jarsign -verify Email.apk". The original seems ok, the patched one doesnt:

jarsigner -verify Email.apk
jar verified.

Warning:
This jar contains entries whose certificate chain is not validated.

Re-run with the -verbose and -certs options for more details.

and the bad one:

jarsigner -verify Email.patched.apk
jarsigner: java.lang.SecurityException: SHA1 digest error for classes.dex

After googling around, I found out that there was signing issues while switching from jdk6 to jdk7, I tried out jdk6, no success....

So Im typing the 4 digit pin code again...... You got any idea whats going on?

Thanks in Advance

Clemens
[Galaxy S II Themes and Apps] monemhamid:
brilliant...works on htc one gpe edition without moving any apps

thanks
[Galaxy S II Themes and Apps] Biff0rz:
Is there a way to apply this patch to the apk and then place it on the phone? The reason I ask is that my USB no longer connects to my pc but I can still use it for power...quite annoying when modding.

I have a gs3 att if it matters

Thanks!
[Galaxy S II Themes and Apps] bricenott:
Is it working on sgs4 4.3?
[Galaxy S II Themes and Apps] moshepupkin:
Does not work on my 4.3 (stock Samsung S3), says "Can't find Email app".
[Galaxy S II Themes and Apps] dmachin:
It seems not to work in my Samsung Galaxy Tab 3 (P5220).

Don't know if I'm doing something wrong...

The patch finished without errors but the policy is still being applied:

Cleaning up ...
Waiting for USB connection...
Checking device...
Model: GT-P5220, build JDQ39.P5220XXUAMJ8, android 4.2.2 (API Level 16)
/system mounted on /dev/block/mmcblk0p8, mode ro
checking root access. root uid: 0, secure: yes, busybox: no
Pulling app(s) ...
Can't find Email app. Enter the name of your Email apk or press <Enter> to exit:
SecMail_Tablet.apk
Pulling libs ...
Decompiling SecExchange.odex ...
Applying patch ...
Patching com/android/exchange/adapter/ProvisionParser.hasSupportablePolicySet()Z

Recompiling ...
Building SecExchange.patched.apk ...
Updating device ...
Rebooting device ...
Done.
[Galaxy S II Themes and Apps] dmachin:
Let me answer myself: SecEmail_Tablet.apk was the correct apk (not SecMail_Tablet.apk)... Now working great...
[Galaxy S II Themes and Apps] josephpatrick:
how does the security option remain active even if the secemail and secexchange.apk files are deleted?
[Galaxy S II Themes and Apps] mpegripper:
are you on just 4.4 or 4.4.2? does your email sync properly after this patch? i have to use mailwise right now b/c of the 4.4 email bug
[Galaxy S II Themes and Apps] laithe:
My Droid Maxx is still on 4.4. I don't think the 4.4.2 patch has been pushed to any of the Droid phones yet. (Though I believe the Moto X does have it now)

Email does still sync properly. I have it set to push so I actually get the email on my phone before it comes into my outlook on my computer. Same with the calendar showing up just fine.

So I never actually had email set up WITHOUT this patch. So I've never seen the email bug. I don't know if Droid Maxx is exempt from this bug (if you have a different device) or if this patch actually fixes the bug because of the security bypass.

Someone with more experience with KitKat may be able to answer. The Maxx is my only 4.4 phone right now!
[Galaxy S II Themes and Apps] rockcipher:
this is working for me great on cm 4.4.2, m4. Thanks!
[Galaxy S II Themes and Apps] fastguy:
Does not work on Ubuntu 13.10 32bit

Hi,

I can't get it work automatically on Ubuntu 32bit. HEre's the debug.log

./apply-patch.sh

Cleaning up ...

Waiting for USB connection...

*** No device connected. Please connect your device and try again.

email-policy-patch-4.2$ platform-tools/adb shell

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

shell@hlte:/ $

cat debug.log

Cleaning up ...

> adb kill-server

< returned: 0

> adb version

Android Debug Bridge version 1.0.31

< returned: 0

Waiting for USB connection...

> platform-tools/adb wait-for-device

Cannot run program "platform-tools/adb" (in directory "work"): error=2, No such file or directory

> platform-tools/adb kill-server

Cannot run program "platform-tools/adb" (in directory "work"): error=2, No such file or directory

adb (installed in system already) and the adb that comes with the patch in platform-tools both run perfectly fine.

What's the issue?
[Galaxy S II Themes and Apps] fab_r_a:
Worked for S4 i9502

Thanks rustamabd!

It's working very well for Samsung S4 (model i9502) with SVA S4 4.5 based ROM ZNUEMK3 (android 4.3).

I used "email-policy-patch-4.2.zip".

The only adjustable needed was the windows 8.1 path to java.

Thanks you!
[Galaxy S II Themes and Apps] rustyx3:
This happens on some ROMs, I couldn't find the root cause yet. It may have to do with file permissions, file placement or java runtime (e.g. ART VM is not supported atm).

This is normal as obviously it is impossible to re-sign the patched apk without knowing Samsung's private key. That's why the patch requires root and replaces the file in place, bypassing the installation process. You can't "install" a patched apk, that is exactly what apk signing is made to prevent.
[Galaxy S II Themes and Apps] rustyx3:
There were a couple of bugs related to the adb path. Please try patch version 4.3, it should work better.
[Galaxy S II Themes and Apps] kart_man_21:
With latest Xperia Z1 Romaur 7, I cannot patch Exchange2.apk.

Model: C6903, build RomAur v7.0, android 4.4.2 (API Level 15)

/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) ...

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

SemcEmail.apk

Pulling libs ...

Decompiling SemcEmail.apk ...

Applying patch ...

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

Recompiling ...

Building SemcEmail.patched.apk ...

Decompiling Exchange2.apk ...

java.lang.reflect.InvocationTargetException

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:922)

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

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

Caused by: org.jf.util.ExceptionWithContext: work\Exchange2.apk is not an apk, d

ex file or odex file.

at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:111)

at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:54)

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

... 7 more

Debug log written to debug.log

in debug.log

Applying patch ...

Recompiling ...

Running org.jf.smali.main : -a15 -o work/classes.dex work/out-SemcEmail.apk/

Building SemcEmail.patched.apk ...

Exchange2.apk extra libs: com.sonymobile.smime.jar, com.sonyericsson.idd.jar, co

m.google.protobuf-2.3.0.jar, com.sonymobile.provider.tasks_1.jar

Decompiling Exchange2.apk ...

Running org.jf.baksmali.main : -d work -c core.jar:conscrypt.jar:okhttp.jar:core

-junit.jar:bouncycastle.jar:ext.jar:framework.jar:framework2.jar:telephony-commo

n.jar:voip-common.jar:mms-common.jar:android.policy.jar:services.jar:apache-xml.

jar:webviewchromium.jar:telephony-msim.jar:qcmediaplayer.jar:WfdCommon.jar:oem-s

ervices.jar:org.codeaurora.Performance.jar:qcom.fmradio.jar:com.sonyericsson.uxp

.jar:com.sonymobile.smime.jar:com.sonyericsson.idd.jar:com.google.protobuf-2.3.0

.jar -I -x -a15 -o work/out-Exchange2.apk/ work/Exchange2.apk

> work\platform-tools\adb kill-server

< returned: 0
[Galaxy S II Themes and Apps] luisjoseb:
ART Compatible

It's possible to make this hack compatible with ART?

I used the e-mail build from source such http://xdaforums.com/showthread.php?t=1749921 and works fine, but I perfer hack de stock app included with the KOT49H build in my nexus 4.

It works fine in DALVIK but don't works with ART, it's possible to make compatible?

What differences exist between the stock app vs the build from source.

Thanks for your help.
[Galaxy S II Themes and Apps] hypetaxx:
Me too!

95G78425UA061311M
[Galaxy S II Themes and Apps] david_zzz:
Thanks for sharing. This is useful email app for me.
[Galaxy S II Themes and Apps] TripFlex:
4.3 patch worked fine for me on Galaxy Note 3, but i'm running the PacMan ROM.

You can download the Google version of Email and Exchange from my site and try to use that one. It will still ask to activate as device administrator, but should not require you to update to PIN, etc:

http://smyl.es/downloads/download-info/android-4-4-kitkat-email-and-exchange-apk-exchange-policy-requirements-bypassed/
[Galaxy S II Themes and Apps] sordna:
I tried this hack in the past, but recently I discovered an AWESOME email app for exchange/activesync called Nine.

https://play.google.com/store/apps/details?id=com.ninefolders.hd3

It allows to set the security model to the app (instead of device) so you don't need any security policies on the phone itself, and it works without rooting or hacks.

It's also a gazillion times better than touchdown or the stock email app for that matter.
[Galaxy S II Themes and Apps] rustyx3:
Very nice but it's US$9.99.
[Galaxy S II Themes and Apps] sordna:
yep, but the 2 week free trial is long enough to evaluate it... no registration or anything like that needed.

Thread view, category labels, high priority ! emails, syncs stock contacts and calendar. Nine is pretty much perfect.

I got tired of modifying system apk's and OTA updates failing because of that. Not worth my time. So I happily bought this after the trial :)

I did try Touchdown a year or two ago and did not buy it.
[Galaxy S II Themes and Apps] TripFlex:
Yeah after seeing this post I installed nine and it is AMAZING! Thank you for posting on here or I would have never known about it, by far the best app I've ever used for exchange email. Only thing I wish it would allow to use IMAP for other emails because the UI is so nice

Thanks again man!
[Galaxy S II Themes and Apps] Chip90:
Is there a free alternative to Nine?
[Galaxy S II Themes and Apps] Roidred:
I have thanked the person who directed to nine app. Well what feature you want in other free app that is not available in nine app ?
[Galaxy S II Themes and Apps] Chip90:
Mainly the ability to use a swipe unlock rather than a mandated pin unlock. But no worries- I came upon this thread and tried that patch out. Worked out great!

http://xdaforums.com/showthread.php?t=1749921
[Galaxy S II Themes and Apps] jsauder2:
CloudMagic doesn't require any kind of password. Available in the play store.

Sent from my Nexus 4
[Galaxy S II Themes and Apps] fastguy:
There is also mail wise beta. It has an option to bypass the exchange locks. Read it's FAQ on its website. Does not yet work on tablets properly.
[Galaxy S II Themes and Apps] os2baba:
Thanks for the heads up on it. Mail Wise is great! Until I installed it (with the bypass mentioned it their FAQ), I was using the stock email client on the LG G2 using the Xposed module "Keyguard disabler" (http://xdaforums.com/xposed/modules/xposed-completekeyguarddisabler-t2609932) which worked like a charm. But the stock LG email client is awful! Mail Wise is so much nicer, all though still not complete.

I couldn't use Cloud Magic because of the lack of Exchange calendar support which was a deal breaker. Plus it didn't allow saving of drafts. Which I use fairly frequently. Add to that the fact that my office emails would have been in some one else's cloud. I don't think my company would have approved of that. Not setting the pin is one thing, exposing your email elsewhere is a step too far.
[Galaxy S II Themes and Apps] Lolento:
Hi rustamabd,

I am having trouble running this patch on my Xperia Z2. It looks like the apks are located in system/priv-app rather than system/app.

Can you update the script?

Thanks!
[Galaxy S II Themes and Apps] fastguy:
Cloud Magic is no Go for me as it exposes my corporate mails to their server which can't be trusted.
[Galaxy S II Themes and Apps] Lolento:
Used 4.3 on my stock rooted xperia Z2.

Everything seem to be working except for the install from Unknown Sources policy.
[Galaxy S II Themes and Apps] aakaash:
Thanks, it works in my S4 with stock rom 4.4.3
[Galaxy S II Themes and Apps] KSKHH:
This patch though work on latest Ported Note II KK Stock rom for S3, however I can not change the mail signature, it is giving FC.

@ OP can this patch be updated for KK Rom
[Galaxy S II Themes and Apps] reinert012:
gettings tons of FCs on nexus 5 4.4.3 stock.

Would love any advice!
[Galaxy S II Themes and Apps] reinert012:
FIXED- just reflashed ROM
[Galaxy S II Themes and Apps] dasa4u:
Hi ... I am new to this forum .. I am using S5 kitkat 4.4 and my company has setup the mail using good app. The privacy policies have disabled options for phone lock ..

Looking at the thread am not sure what exactly to do to hack this... any help is much appreciated ... I am ametuer in this area...
[Galaxy S II Themes and Apps] zanoli99:
I used this on galaxy tab 4.4 and worked perfect however it is for stock email app and don't think it will work on others.
[Galaxy S II Themes and Apps] jimhaddon:
Is it possible to change the device provisioning to make exchange think it is not android?
[Galaxy S II Themes and Apps] agentdr8:
An Xposed module could do that. I wrote one for TouchDown, but I'm sure one could be done for the native Activesync client. Might have some luck requesting this in the module request thread.
[Galaxy S II Themes and Apps] jimhaddon:
Done.

I've d compiled the native app before to mod it, but not sure where the provisioning is.
[Galaxy S II Themes and Apps] mygti02:
Im trying to do this on my T-Mobile One M8 but it keeps failing because it cant find the email.apk and echange.apk. What are they named on this phone? any ideas?
[Galaxy S II Themes and Apps] agentdr8:
Mail.apk in /system/priv-app is most likely HTC's version of Email.apk. And it's possible that the Exchange.apk is named /system/priv-app/AndroidHtcSync.apk

Chances of this mod working on those 2 packages is probably slim.
[Galaxy S II Themes and Apps] mygti02:
That sucks :( What would you suggest I do? Would it be possible for me to install the stock Android Email and exchange.apk's on my One?
[Galaxy S II Themes and Apps] agentdr8:
That probably won't work either. You can either go AOSP (CM, etc) and modify the native Email/Exchange apks, write/find an Xposed module for the HTC version of those apps, or maybe use a 3rd-party app like Touchdown.

I believe this thread is specific to Touchwiz-based Email/Exchange apks.
[Galaxy S II Themes and Apps] Captain_Throwback:
You're in the wrong thread. Search for the thread with patched Email app for the One.

---------- Post added at 04:16 PM ---------- Previous post was at 04:06 PM ----------

EDIT: http://xdaforums.com/showthread.php?p=51509034
[Galaxy S II Themes and Apps] swrajjoshi:
please ignore, it was an email config issue
[Galaxy S II Themes and Apps] mmalka:
* deleted. Issue resolved.
[Galaxy S II Themes and Apps] fdyfdy:
Issue when /system almost full

I am using this tool on a CM11 on Moto Defy+, but as my /system partition is almost full (4.5M left), the push of patched apk is not done properly: the Exchange2.apk is corrupted.

Could it be possible to force removal of the original apk in /system before pushing the patched one to /system ?

Thanks for your work
[Galaxy S II Themes and Apps] fastguy:
Why don't you just install manually?
[Galaxy S II Themes and Apps] fdyfdy:
Because there are lots of manual steps to performed each time I update my ROM
[Galaxy S II Themes and Apps] fastguy:
Ok so you don't want to add another. If you are a bit knowledgeable, go to backup scripts directory in /system, find the backup script for gapps and add exchange and email apk path to this file.

This way, you can update your rom (assuming cyanogenmod or some aosp which you would update often), your email app will be backed up and then restored. So you need to only do this manual copying once.

You can see from time to time, in few months for example, if there's a patch of update to the email app then you can disable the backup, do rom upgrade and then reapply the patch.
[Galaxy S II Themes and Apps] madvj:
Does anyone know if this work on Verizon S5?