Post Reply

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

9th June 2011, 09:10 PM   |  #1  
OP Senior Member
Thanks Meter: 399
 
186 posts
Join Date:Joined: Apr 2009
Donate to Me
More
This patch was originally created for Samsung Galaxy S II (GB and ICS) and Galaxy S III (ICS and JB), 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 v6 or 7)
  3. Get USB drivers (for Samsung, install Kies or just the drivers). Most likely you already have this because of step 1.
  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 apply-patch.sh

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.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 email-policy-patch-4.2.zip - [Click for QR Code] (1.29 MB, 1389 views)
File Type: zip email-policy-patch-4.3.zip - [Click for QR Code] (1.29 MB, 1511 views)
Last edited by rustamabd; 23rd March 2014 at 12:19 PM. Reason: 4.3 release
The Following 294 Users Say Thank You to rustamabd For This Useful Post: [ View ]
10th June 2011, 08:03 AM   |  #2  
Junior Member
Thanks Meter: 3
 
11 posts
Join Date:Joined: Dec 2008
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, 09:25 AM   |  #3  
OP Senior Member
Thanks Meter: 399
 
186 posts
Join Date:Joined: Apr 2009
Donate to Me
More
For those who are interested in the source code of this patch, here it is.
Attached Files
File Type: zip email-policy-patch-4.3-src.zip - [Click for QR Code] (135.9 KB, 208 views)
Last edited by rustamabd; 23rd March 2014 at 12:20 PM. Reason: release 4.3
The Following 13 Users Say Thank You to rustamabd For This Useful Post: [ View ]
12th June 2011, 07:46 PM   |  #4  
Junior Member
Thanks Meter: 3
 
11 posts
Join Date:Joined: Dec 2008
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, 12:01 PM   |  #5  
Junior Member
Thanks Meter: 3
 
10 posts
Join Date:Joined: Jul 2003
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, 12:48 PM   |  #6  
Senior Member
Flag Haarlem
Thanks Meter: 59
 
585 posts
Join Date:Joined: Nov 2009
More
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

Edit1:
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 12:56 PM.
The Following User Says Thank You to BackfireNL For This Useful Post: [ View ]
16th June 2011, 02:30 PM   |  #7  
Fr4gg0r's Avatar
Recognized Developer
Flag Bremen
Thanks Meter: 679
 
671 posts
Join Date:Joined: Aug 2010
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, 10:22 AM   |  #8  
OP Senior Member
Thanks Meter: 399
 
186 posts
Join Date:Joined: Apr 2009
Donate to Me
More
Quote:
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 4 Users Say Thank You to rustamabd For This Useful Post: [ View ]
19th June 2011, 08:32 AM   |  #9  
salamt's Avatar
Senior Member
Thanks Meter: 8
 
130 posts
Join Date:Joined: Nov 2008
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, 09:58 PM   |  #10  
Senior Member
Thanks Meter: 15
 
115 posts
Join Date:Joined: May 2011
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)?

Frank

The Following User Says Thank You to fscherz For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Galaxy S II Themes and Apps by ThreadRank