FORUMS

HTC Delivering Ads Straight to Sense Home

HTC’s 2015 has been a year marked by a desperate search for revenue.The HTC One M9 … more

Galaxy S6 & Edge get €100 Price Cut—New Models Incoming

Samsung has dropped the price of both the Galaxy S6 and S6 Edge by … more

How To Port Fully Featured Sony Xperia Z4 Camera

Xperia Z4’s hardware may not impress, but its software is definitely … more

Experimental TWRP Available For Moto G 2015

XDA Senior Member squid2 has posted experimental builds of TWRP for the Moto G … more

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

186 posts
Thanks Meter: 408
 
By rustamabd, Senior Member on 9th June 2011, 09:10 PM
Post Reply Subscribe to Thread Email Thread
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, 1925 views)
File Type: zip email-policy-patch-4.3.zip - [Click for QR Code] (1.29 MB, 3691 views)
Last edited by rustamabd; 23rd March 2014 at 12:19 PM. Reason: 4.3 release
The Following 300 Users Say Thank You to rustamabd For This Useful Post: [ View ]
 
 
10th June 2011, 08:03 AM |#2  
Junior Member
Thanks Meter: 3
 
More
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: 408
 
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, 591 views)
Last edited by rustamabd; 23rd March 2014 at 12:20 PM. Reason: release 4.3
The Following 15 Users Say Thank You to rustamabd For This Useful Post: [ View ]
12th June 2011, 07:46 PM |#4  
Junior Member
Thanks Meter: 3
 
More
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
 
More
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
 
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: 686
 
Donate to Me
More
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: 408
 
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 5 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
 
More
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
 
More
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 ]
21st June 2011, 02:26 PM |#11  
Member
Thanks Meter: 1
 
More
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?

Thanks!

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

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes