FORUMS

Two New Moto X and New Moto G – Specs & Details

Today’s Moto event just ended and now we have a clear look at all of … more

How Strong Is Your Connection? – XDA Xposed Tuesday

Everyone is always talking about their bars. How many bars of WiFi do they … more

OnePlus 2 Announced: Specs, Price and Details

The OnePlus 2 has just had its Virtual Reality Launch event, and at the XDA Office we all … more

A Helpful Guide to Music Streaming Services

With the launch of Apple Music, music streaming services have recently gained a lot of … more

[MOD][APP]LP/KK/JB/ICS Email APK with Exchange Security removed (Updated May 2015)

114 posts
Thanks Meter: 71
 
By ProcessorHog, Senior Member on 31st October 2012, 06:47 AM
Post Reply Subscribe to Thread Email Thread
(edited some content and added a few more instructions on May 25 2015)

I initially posted this when my employer changed their policies to require device admin access to people's phones if they wanted to access company emails or calendars. Spent a few days reading the android source code and came up with a working apk.

This app removes the annoying popup saying that you need to give it admin permissions and add a numeric password. It also does not set any additional policies other than what you already have set on your device. It does not make the email app a device admin.

The app tells the server what it wants to hear - which is they have total control over the device, but it doesn't really do anything on the phone.


DISCLAIMER: I'm not responsible if:
  • You get fired (a very real possiblilty - companies fire people for far less than "circumventing security" even though most of us know that regular folks' emails have nothing valuable to the competition.
  • If you get in other sorts of trouble for using this
  • if this melts your device down or breaks it in any fashion or your ROM gets corrupted.
USE THIS AT YOUR OWN RISK.


How to install:
Copy the files onto your phone storage and install them using a file explorer.


NOTES (read this before you install):
  • This will install easily on phones that do not have email.apk and exchange2.apk. But if you have an AOSP ROM, you may already have these in your system/app directory. In that case, you'll have to uninstall the system apps email.apk and exchange or exchange2.apk using a root explorer. I use ES explorer's "App Manager" feature and it works well for me. Once the system apps are removed, you can install the files from this post.
  • If you update your ROM later, the system apps will come back and may conflict with these apks (installed in /data by default) so you'll have to do the removal/installation again.
  • You don't need Exchange.apk AND exchange2.apk on the same phone. If you use an ICS ROM (older phones), use exchange.apk. For JB or higher, Exchange2 is the one to use. If you already have exchange2.apk on your phone, you don't need to install the one from this post.
  • I compiled this from source, so it *should* work with all devices. There are no device-specific frameworks needed for these to run as far as I know.
  • I've only removed the Exchange based security. If there are any other kind of services (POP/IMAP or something else) which has similar policy enforcement, it may not work. I haven't tested it with anything other than Exchange.


UPDATE 4 (May 25, 2015)
Patched and compiled the Lollipop email client from CM12 sources. Google remoived exchange support from the AOSP email client, so I had to turn to CM12 for the source code.

The default Exchange2.apk from a CM or AOSP lollipop build should work so I'm not uploading it here.

UPDATE 2 (May 15, 2013)
Added Email.apk compiled from 4.2.2 sources. This gives you the nice JB style expandable notifications.

Also added higher attachment size support per a user request. The default email.apk limits the size to 5MB for atachment downloads/uploads. The attached Email-JB.apk supports 100MB download/50MB upload sizes. I'm not sure if this varies by Exchange server - I spent two whole nights because I set them too high (250M) and my exchange server threw a generic error. I spent the time troubleshooting policies where it was just the attachment size all along. Cost me 8 hours of sleep

Exchange2.apk is not needed if your phone already has Exchange.apk or Exchange2.apk. For people who have HTC phones, this may come in useful. This file was pulled from this ROM - which is compiled from sources. I couldn't get Exchange2 to compile and work properly from sources, but since there is nothing to be changed in here, any working APK (from a JB/ICS ROM) would suffice.

UPDATE 3 (Jan 11, 2014)
Added Email.apk compiled from 4.4.2 sources. This gives you the new gmail-style email view based on the contact pics or the first letter of the sender's name.

It will say that the policy was changed once you successfully connect to the exchange server, but no policy will be applied. You can check the device admins list once you connect - the newly connected exchange server will not be in the device admins list on your phone.

Notes:
  1. I have not made any changes to the Exchange2_4_4_2.apk. I'm just pasting it here for convenience, for people who don't have it on their phones (certain HTC stock ROMS, or others that I don't know of).
  2. If your server has other policies which prevent you from accessing it, this probably won't show an error message before bouncing you back because I've suppressed a few of these security related dialogs.

File List
May 25, 2015
Email-5_0.apk - Compiled from CM12 sources, exchange security and popup security dialogs removed, max attachment sizes changed to 100MB download/50MB upload from 5/5.
No exchange2.apk provided for lollipop - the one already on your phone should work. If you have any problems, please get it from a CM12 or AOSP ROM.

--- Old files----
Email.APK - Compiled from ICS (4.0.1) sources.
Exchange.apk - Compiled from ICS (4.0.1) sources.

May 15, 2013:
Email-JB.apk - Compiled from 4.2.2 sources, attachment sizes increased to 100MB/50MB down/up.
Exchange2.apk - pulled from a CM10.1 port (WFTN ROM)

Jan 11, 2014
Email-4_4_2.apk - Compiled from 4.4.2 (Kit Kat) sources, still retains the increased attachment size mod.
Exchange2-4_4_2.apk - Compiled from 4.4.2 sources [this apk is not needed unless you have a phone which does not already have this]
Attached Files
File Type: apk Email.apk - [Click for QR Code] (2.52 MB, 3885 views)
File Type: apk Exchange.apk - [Click for QR Code] (632.4 KB, 2923 views)
File Type: apk Exchange2.apk - [Click for QR Code] (880.3 KB, 3091 views)
File Type: apk Email-JB.apk - [Click for QR Code] (2.95 MB, 4126 views)
File Type: apk Email_4_4_2.apk - [Click for QR Code] (4.64 MB, 2685 views)
File Type: apk Exchange2_4_4_2.apk - [Click for QR Code] (1.07 MB, 2213 views)
File Type: apk Email_5.0.apk - [Click for QR Code] (1.20 MB, 272 views)
Last edited by ProcessorHog; 25th May 2015 at 07:29 PM. Reason: Updated for lollipop.
The Following 39 Users Say Thank You to ProcessorHog For This Useful Post: [ View ]
 
 
31st October 2012, 06:03 PM |#2  
tanush's Avatar
Senior Member
Flag A.F.K.
Thanks Meter: 30
 
More
let me be the first one to say thanks !!!

worked like a charm !!

tested on HD2
1st November 2012, 05:29 AM |#3  
ProcessorHog's Avatar
OP Senior Member
Thanks Meter: 71
 
More
I'm glad it helped
29th November 2012, 07:10 AM |#4  
Junior Member
Thanks Meter: 0
 
More
Yep thanks it's working on my rooted HTC Desire Z with andromedus
2nd January 2013, 12:23 AM |#5  
Senior Member
Flag Medellin
Thanks Meter: 87
 
Donate to Me
More
Lightbulb
Quote:
Originally Posted by ProcessorHog

I'm happy to post my first actual Android dev/mod effort.

Recently my workplace introduced some draconian security policies for email syncing. I just wanted my appointments synced, so I didn't feel like encrypting my device, having zero timeout AND not even having the option of a pattern unlock (they enforce only passwords/PIN). I tried a couple of the Email.apks posted on XDA but for some reason or other, I couldn't get them to install/run. There was a GB based app which would install but when it synced, it said the device did not support some of the policies that were needed by the server. When I compared the Email app's GB source with the ICS source, I saw that there were tons more policies supported in the ICS version.

So I set upon a weekend project to modify the ICS email app, and that ended up taking 4 days part time. I learned a lot about aosp, compiling from source and all that and know that I have so much that I don't know.

Anyway, I was able to successfully modify the source code and finally managed to get the original Android Email app (which comes with AOSP) compiled running perfect, but without the ridiculous policies they wanted.

I tested it on my Evo 3D running MeanRom (4.0.3 build) and also tested it on the Android emulator of course ), and it works great. No annoying popup saying that you need to give it device admin permissions nor does it set any additional policies other than what you already have set on your device. It does not make the email app a device admin.

The app tells the server what it wants to hear - which is they have total control over my device, but it doesn't really do it on the phone. Everyone is happy


DISCLAIMER: I'm not responsible if you get fired or if you get in other sorts of trouble for using this, or if this melts your device down or breaks it in any fashion. USE THIS AT YOUR OWN RISK.


How to install:

Code:
adb install -r /path/on/your/computer/to/Email.apk
This is how I installed it. Alternatively, you can try downloading this on your phone (or copying it to the SD Card) and open it with package installer, and see if it installs.

NOTES:
  • I compiled this from source, so it *should* work with other devices as well. As far as I know, there are no device-specific frameworks/anything else needed for these to run. I used the android-4.0.1_r1 branch source code.
  • Since I was running MeanROM on my HTC (a sense-based ROM), Email.apk had some dependencies on Exchange.apk which did not exist on my device. I'm posting this as an attachment for the folks who may need it. I haven't changed any code in that project, so If you already have Exchange.apk (shows up as "Exchange Services" in your Apps) you don't need to install it.
  • I've only removed the Exchange based security. If there are any other kind of services (POP/IMAP or something else) which has similar policy enforcement, it may not work. I haven't tested it with anything other than Exchange.
  • This was compiled for the arm-v7 CPU. I'm not too sure whether this means it won't run on any other ones (but knowing that it's dalvik code and not native, it should run I guess). It ran fine on my x-86 based emulator.

  • This is an eng build (non-optimized). I couldn't find a way to get classes.dex in the APK itself on a full "user" release build. Eng is the least optimized form, userdebug is a bit better. I couldn't find a non-device-specific "lunch" option to build this with a "userdebug" variant flag. If I do figure it out, I'll post an updated APK here.
  • I'm still learning how to use eclipse and such. I haven't posted the source code here, and frankly I don't know how much of it I should post (I think I changed about 3 files and commented out a bunch of stuff). If anyone is interested in knowing, I can point out the files that I changed. If I figure out how to do a proper diff that shows all the changes, I will post the code diff here.

Update:


Replaced the apks with a "release-user" build.

Thanks for share it, I made a CWM flasheable ZIP with your files.
Attached Files
File Type: zip email-aosp-ics.zip - [Click for QR Code] (2.03 MB, 706 views)
The Following 2 Users Say Thank You to luisjoseb For This Useful Post: [ View ]
4th January 2013, 11:58 PM |#6  
carm01's Avatar
Senior Member
Flag Ohio - land of the boring
Thanks Meter: 180
 
More
Quote:
Originally Posted by ProcessorHog

I'm happy to post my first actual Android dev/mod effort.

Recently my workplace introduced some draconian security policies for email syncing. I just wanted my appointments synced, so I didn't feel like encrypting my device, having zero timeout AND not even having the option of a pattern unlock (they enforce only passwords/PIN). I tried a couple of the Email.apks posted on XDA but for some reason or other, I couldn't get them to install/run. There was a GB based app which would install but when it synced, it said the device did not support some of the policies that were needed by the server. When I compared the Email app's GB source with the ICS source, I saw that there were tons more policies supported in the ICS version.

So I set upon a weekend project to modify the ICS email app, and that ended up taking 4 days part time. I learned a lot about aosp, compiling from source and all that and know that I have so much that I don't know.

Anyway, I was able to successfully modify the source code and finally managed to get the original Android Email app (which comes with AOSP) compiled running perfect, but without the ridiculous policies they wanted.

I tested it on my Evo 3D running MeanRom (4.0.3 build) and also tested it on the Android emulator of course ), and it works great. No annoying popup saying that you need to give it device admin permissions nor does it set any additional policies other than what you already have set on your device. It does not make the email app a device admin.

The app tells the server what it wants to hear - which is they have total control over my device, but it doesn't really do it on the phone. Everyone is happy


DISCLAIMER: I'm not responsible if you get fired or if you get in other sorts of trouble for using this, or if this melts your device down or breaks it in any fashion. USE THIS AT YOUR OWN RISK.


How to install:

Code:
adb install -r /path/on/your/computer/to/Email.apk
This is how I installed it. Alternatively, you can try downloading this on your phone (or copying it to the SD Card) and open it with package installer, and see if it installs.

NOTES:
  • I compiled this from source, so it *should* work with other devices as well. As far as I know, there are no device-specific frameworks/anything else needed for these to run. I used the android-4.0.1_r1 branch source code.
  • Since I was running MeanROM on my HTC (a sense-based ROM), Email.apk had some dependencies on Exchange.apk which did not exist on my device. I'm posting this as an attachment for the folks who may need it. I haven't changed any code in that project, so If you already have Exchange.apk (shows up as "Exchange Services" in your Apps) you don't need to install it.
  • I've only removed the Exchange based security. If there are any other kind of services (POP/IMAP or something else) which has similar policy enforcement, it may not work. I haven't tested it with anything other than Exchange.
  • This was compiled for the arm-v7 CPU. I'm not too sure whether this means it won't run on any other ones (but knowing that it's dalvik code and not native, it should run I guess). It ran fine on my x-86 based emulator.

  • This is an eng build (non-optimized). I couldn't find a way to get classes.dex in the APK itself on a full "user" release build. Eng is the least optimized form, userdebug is a bit better. I couldn't find a non-device-specific "lunch" option to build this with a "userdebug" variant flag. If I do figure it out, I'll post an updated APK here.
  • I'm still learning how to use eclipse and such. I haven't posted the source code here, and frankly I don't know how much of it I should post (I think I changed about 3 files and commented out a bunch of stuff). If anyone is interested in knowing, I can point out the files that I changed. If I figure out how to do a proper diff that shows all the changes, I will post the code diff here.

Update:


Replaced the apks with a "release-user" build.

what part of the smali code was modified please?
19th February 2013, 12:20 PM |#7  
Senior Member
Thanks Meter: 14
 
More
Would this work on 4.2?
20th February 2013, 04:05 PM |#8  
Junior Member
Thanks Meter: 3
 
More
I could use some help. I'm trying to run this on SOS M ver 2.6.2 (4.0.3 build) on an Evo 3d. I was under the impression that SOS M was similar enough to Mean ROM so that it would work, but all I'm getting is an immediate crash on startup. Any suggestions?
2nd May 2013, 12:17 AM |#9  
Member
Thanks Meter: 0
 
More
So glad that someone created this! THANK YOU SO MUCH!
The new security rules are ridiculous!

I wish that app would be maintained with the current version and be put in the google play store. How can I keep up to date with the most recent version of this app?
15th May 2013, 10:05 AM |#10  
ProcessorHog's Avatar
OP Senior Member
Thanks Meter: 71
 
More
Recent update
Sorry I haven't been here much - life got too busy! If you post here and don't see a reply from me in a couple of days, feel free to send me a PM.

Quote:
Originally Posted by carm01

what part of the smali code was modified please?

No smali code was modified, the apk was compiled directly from the java source code which I modified to take out a few annoying dialog boxes and the actual policies/restrictions that the server wants to set on your device.

Quote:
Originally Posted by zdravke

Would this work on 4.2?

The ICS version worked fine on 4.2 since it's just regular java code compiled from source, but I recently also added an APK compiled from 4.2.2 sources which has the expanded notifications (the ICS version didn't have it).

Quote:
Originally Posted by pbmurdoc

I could use some help. I'm trying to run this on SOS M ver 2.6.2 (4.0.3 build) on an Evo 3d. I was under the impression that SOS M was similar enough to Mean ROM so that it would work, but all I'm getting is an immediate crash on startup. Any suggestions?

Could you try the newly updated APK? Make sure your phone has exchange2.apk or exchange.apk as well. Some phones do not have these pre-installed.

Quote:
Originally Posted by sirtom1

So glad that someone created this! THANK YOU SO MUCH!
The new security rules are ridiculous!

I wish that app would be maintained with the current version and be put in the google play store. How can I keep up to date with the most recent version of this app?

I don't think this can be put on the play store - I don't regularly maintain it (once compiled it should run without problems), and I recently updated it just because I finally got a JB ROM a few months ago and started missing the expanded notification. The next update will probably be after a long time - after the next version of android gets released.

I'm not bright enough to write something complex like the email app - there's a TON of code in it written by smart and talented people, I just dug around a little to find the policy application code and removed it. The real talented folks are the ones who actually contribute to android
Last edited by ProcessorHog; 15th May 2013 at 10:13 AM.
15th May 2013, 10:14 AM |#11  
ProcessorHog's Avatar
OP Senior Member
Thanks Meter: 71
 
More
Quote:
Originally Posted by luisjoseb

Thanks for share it, I made a CWM flasheable ZIP with your files.

Thanks for making this easy for others! If you have the time, could you make one for the 4.2.2 version of it? Someone could find that useful!

Read More
Post Reply Subscribe to Thread

Tags
email.apk, exchange, removed, security
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes