[HACK] Removing keyguard and other security policy restrictions from Email apk

188 posts
Thanks Meter: 410
By rustamabd, Senior Member on 9th June 2011, 10:10 PM
Post Reply Subscribe to Thread Email Thread
This patch was originally created for Samsung Galaxy S II and Galaxy S III, but it might work for other devices* running Android 2.3 or 4.x because it patches the Email application that you have on your phone. This is not a pre-patched Email.apk.

* Motorola Blur (Droid), LG G2 and HTC Sense - based ROMs are not supported!

What does it do?

It will make the Email app ignore Exchange-pushed policy on your device, including things like mandatory pin lock (a.k.a. keyguard), minimum password length, encryption, etc.

How to apply this patch?
  1. Root your phone. Your phone must be rooted. It is impossible to apply this patch without root access. You need root to proceed.
  2. Get Java (Java SE JRE v7 or later)
  3. Get USB ADB drivers (for Samsung, install Samsung USB Drivers). Most likely you already have this because of step 1.
    Note - ADB via Wi-Fi is also supported. In that case no USB drivers are needed.
  4. Enable USB debugging on the phone (Settings->Applications->Development->USB debugging)
    * For CM9 users, also go to Settings > Developer Options > Root access, and select ADB.
  5. Download and unzip attached patch
  6. Run apply-patch.cmd or

Note 1: Although the Email app will prompt you for device admin access, it won't actually enforce any policy on your device. Let the app install the device admin!

Note 2: any shortcuts to the Email app as well as any Exchange accounts will disappear and will need to be re-created.

Note 3: The patch will reboot your phone, this is needed for the changes to take effect.

Note 4: If you already installed another Email application and it doesn't work, first restore your original Email application before applying this patch.

A Special Note to those experiencing performance issues! This is not an issue of my patch. This is an issue in the Email app itself. Sometimes calendar sync can't finish properly, causing battery drain. It often happens after you just added a new exchange account. A reboot usually solves this issue. Again, this is not my issue!

Change Log

4.5 - More fixes for Android 4.3 and 4.4
4.4 - Minor release with fixes for KitKat 4.4
4.3 - Bugfix release (adb path errors)
4.2 - Bugfix release (IOException)
4.1 - Bugfix release (connection timeout bug fix)
4.0 - Improved ADB support for Mac and Linux (beta)
3.4 - JB 4.3 support (improved boot class path detection)
3.3 - JB 4.2 support (updated adb)
3.2 - Improved Jelly Bean support
3.1 - Added Jelly Bean support (alpha, do not use), minor optimization and cleanup
3.0 - Added Galaxy S III support
2.4 - Bugfix release
2.3 - Will now patch both Email.apk and Exchange.apk, added patch for ProvisionP****r.hasSupportablePolicy(), courtesy of boost252525
2.2 - added ICS isSupported() patch
2.1 - added support for EmailGoogle.apk
2.0 - New patch method based on patching SecurityPolicy's isActive() and isActiveAdmin()
1.1 - Fixed a bug with /system remounting
1.0 - Initial revision based on patching SecurityPolicy.PolicySet <init>

Did the patch work for you? Donations are welcome!
Attached Files
File Type: zip - [Click for QR Code] (1.42 MB, 138 views)
File Type: zip - [Click for QR Code] (1.43 MB, 8 views)
Last edited by rustamabd; 8th February 2016 at 05:41 PM. Reason: 4.5 release
The Following 301 Users Say Thank You to rustamabd For This Useful Post: [ View ]
10th June 2011, 09:03 AM |#2  
Junior Member
Thanks Meter: 3
Already patch Email.apk
Your "How to install this patch "is a little to difficult for me.

Is it possible for you to supply an already patched Email.apk ?

In advance thanks
The Following User Says Thank You to doudouhightech For This Useful Post: [ View ]
10th June 2011, 10:25 AM |#3  
OP Senior Member
Thanks Meter: 410
Donate to Me
For those who are interested in the source code of this patch, here it is.
Last edited by rustamabd; 27th December 2015 at 03:06 PM. Reason: moved to github
The Following 15 Users Say Thank You to rustamabd For This Useful Post: [ View ]
12th June 2011, 08:46 PM |#4  
Junior Member
Thanks Meter: 3
Thanks you
I use the Email.apk with the how to you supply, and All work like a charm.

I want to thanks you very much.
The Following 2 Users Say Thank You to doudouhightech For This Useful Post: [ View ]
16th June 2011, 01:01 PM |#5  
Junior Member
Thanks Meter: 6
Thank You
Thanks so much for your effort. just want to get one thing clear, since you provided the patched Email.apk can i just install it directly, or do i need to be in recovery mode for example. because in your note you mentioned not to install!

Thanks again
The Following User Says Thank You to has128 For This Useful Post: [ View ]
16th June 2011, 01:48 PM |#6  
Senior Member
Flag Haarlem
Thanks Meter: 59
Root explorer will also work! no ADB required!

1) Put Email.apk on your sdcard
2) Go to /system/app and press mount rw
3) remove Email.apk and Email.odex
4) move Email.apk from /sdcard/ to /system/app/

Then you need to setup your email again!
I had to clear the data also in applications -> email

your Email.apk is weird. When i reboot i get the notification that i need to set extra security. But when i press it nothing happends.

And after the email.apk the phone doesn't feel as smooth.. weird

Edit: removed Email.apk (modified) and wen't back to stock! phone is smooth again and works fine
Last edited by BackfireNL; 16th June 2011 at 01:56 PM.
The Following User Says Thank You to BackfireNL For This Useful Post: [ View ]
16th June 2011, 03:30 PM |#7  
Fr4gg0r's Avatar
Recognized Developer
Flag Bremen
Thanks Meter: 686
Donate to Me
May I ask why u use const/16 ?
const/4 goes from -8 to 8 (2^4) and should be preferred for small constants I think
17th June 2011, 11:22 AM |#8  
OP Senior Member
Thanks Meter: 410
Donate to Me
Originally Posted by Fr4gg0r

May I ask why u use const/16 ?
const/4 goes from -8 to 8 (2^4) and should be preferred for small constants I think

const/4 has also a limited range of destination register numbers, and with the p-format in smali the mapping of p-registers to actual v-registers depends on the number of v-registers. It may happen that in the future more v-register are added, and an existing p-register does not fit in const/4 anymore. Using const/16 is thus more or less future proof.
The Following 5 Users Say Thank You to rustamabd For This Useful Post: [ View ]
19th June 2011, 09:32 AM |#9  
salamt's Avatar
Senior Member
Thanks Meter: 8
This is awesome, it woks great

I am on KF1 and it works flawless push with no lag or so

I wonder what happened when we deleted the Email.odex and didn't replace it? we only replace the Email.apk
19th June 2011, 10:58 PM |#10  
Senior Member
Thanks Meter: 15
At first to all, I used tool "FroyoMailUnlocker" to generate my new mail.apk and it worked fine for SGSII on 2.2.3 and also on GT7100 on Honeycomb 3.0.1.

Only problem is that after flashing new OS it need to be installed again.

Does anybody what settings should/can be saved to have an easier restore of the mailbox setup (for my exchange and hotmail accounts)?

The Following User Says Thank You to fscherz For This Useful Post: [ View ]
21st June 2011, 03:26 PM |#11  
Thanks Meter: 1
This looks very interesting, but please help me figure out if it will solve my problem:

I have complete security enforced by my work Exchange account.
I need to sync email and calendar with that account.
I want to be able to set a timeout delay to the PIN lock engagement (now it is on immediately as the screen goes black), and it would be nice to use swipe unlock instead of PIN/password.

Will this hack do the trick for me? If so, even with calendar sync?


/Edit: I use the standard email app and calendar om my SGS2
Last edited by CrackaBoi; 21st June 2011 at 03:58 PM.

Read More
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes