FORUMS
Remove All Ads from XDA
Video Review Win A Trip

[MOD][APP]Exchange Security Disabled - JB, ICS AOSP, Sense 3.6, 4.0 & 4.5 -WITH HOWTO

1,093 posts
Thanks Meter: 3,078
 
By shantur, Senior Member on 27th February 2012, 08:09 PM
Post Reply Email Thread
Some of the guys using Mike's excellent ARHD 6.3.0 (now ARHD 6.5.0 ) thread like me were are having problems with Exchange mail security. If you are one of them, then this is for you.

I have modified the Mail.apk to disable the Exchange Device Administrator completely. It is working for my Exchange Server (i dont know what version is used by my office )

No more passwords, device encryptions, sd encryptions and hidding of Unknown sources (in case of other administrators it will still hide )

Requirements :

1. HTC Sense 3.6 ( Tested on ARHD 6.5.0 ) or ICS AOSP or HTC Sense 4.0 ( Tested on Virtuous S4X ) Thanks EDD!E
2. Rooted Phone
3. Android SDK ( adb.exe )

** YOUR CURRENT EXCHANGE / MAIL ACCOUNTS WILL BE DELETED **
** BACKUP YOUR CURRENT ROM INCASE OF PROBLEMS **

To use it,
Manual Method - HTC Sense ROM
1. Download the attached Mail-<Rom Version>-<Mod Version>.apk for your Rom to folder.
2. On Phone : Goto Settings > Account & Sync. Select All Mail accounts and Select Remove Account.
3. On Phone : Goto Settings > Apps > All > Mail.
4. Do a Force Stop and Clear Data (Important Step)
5. Make sure your phone is in debug mode.
6. On PC : Goto Start > Run. Type cmd and enter
7. Enter <path to adb>\adb remount
8. Enter <path to adb>\adb push <path of downloaded apk> /system/app/Mail.apk
9. Add your exchange account.
10. No More Exchange Device Administrator Dialog.
11. Be happy and hit Thanks


Automatic Script Method (Windows) - HTC Sense

1. Download and extract attached MailPatch-Script.zip
2. Download APK for your Rom and Copy it to MailPatch folder which was extracted in Step 1.
3. Rename Mail-<Rom Version>-<Mod Version>.apk to Mail.apk or Mail+nonprime.apk for Sense JB
4. Connect Phone with USB Debug Enabled ( Settings > Develop Option > USB Debugging )
5. Double Click updatemail.bat
6. Add your exchange account on phone
7. No More Exchange Device Administrator dialog.
Be happy and hit Thanks

Incase of any problem, post the contents of log.txt generated in the same folder.

Manual Method - JB AOSP ROM (CM10)

1. Download the attached Exchange2_AOSP_JB.apk.
2. Make sure you have Root access to ADB in Settings > Developer Options > Root access > Apps and ADB
3. Delete your exchange account if any
4. In command prompt do following

Code:
adb root
adb remount
adb shell rm -f /system/app/Exchange2.apk
adb push Exchange2_AOSP_JB.apk /system/app/Exchange2.apk
5. Add your exchange account, it might ask you to enable the device admin if not enabled already, just enable it.
It should not ask you for device passwords or encryption.


Manual Method - ICS AOSP ROM

1. Download the attached com.android.exchange.apk.
2. Remove your exchange email account from your phone. Using email app.
3. Confirm no exchange account is there in Settings.
4. In command prompt do following

Code:
adb remount
adb uninstall com.android.exchange
adb shell rm /system/app/com.android.exchange.apk
adb push com.android.exchange /system/app/
5. Add your exchange account, it might ask you to enable the device admin if not enabled already, just enable it.
It should not ask you for device passwords or encryption.

For now it just ignores the passwords and encryption, it doesn't disable the admin completely.

You can also use ES File Explorer with Root access. If someone shares the steps I will update here...

Change Log

Code:
9.July.2013

- Added Mail+nonprime-Sense4.5-Revelation1.0.0.apk for Sense JB. 
Its a different mod than others, you will get the Exchange Device Admin prompt, enable it. It will not activate the security features.
You will need to use the new MailPatch-Script-JBSense.zip or replace manually with /system/app/Mail+nonprime.apk

21.January.2013

- Added Mail-Sense4.5-ViperS-1.6.3 for all Sense 4.5 fans

24.August.2012

- Added Exchange2_AOSP_JB.apk. Do not use script with this apk
- Added JB patch steps

17.July.2012

- Added Mail-ARHD-6.7.0-v2.apk. APK taken from ARHD 6.7.0 for Sensation

26.June.2012 Version2.0

- Added Mail-Amaze-Stock.apk. APK taken from Deodexed Stock Rom
- Added a simple How to for curious ones

18.June.2012 Version2.0

- Added Mail-Stock-EvoLTE.apk. APK taken from Deodexed Stock Rom

31.May.2012 Version2.0

- Added Mail-Sense4-OneX-Energy.apk. APK taken from OneX Energy Rom

23.Apr.2012 Version2.0

- Added Mail-Sense3.6-ARHD-6.6.3-v2.0.apk. APK taken from ARHD 6.6.3 XE

18.Apr.2012 Version2.0

- Added Mail-Sense4-orDroid-2.1.1.apk

05.Apr.2012 Version2.0

- Added Mail-Sense3.6-ARHD-6.6-v2.0.apk. APK taken from ARHD 6.6

28.Mar.2012 Version2.0

- Added Android 4.0 ICS AOSP Mod

26.Mar.2012 Version2.0

- Updated Mail-Sense4.0 apk. This should fix Sense 4.0 issues.

04.Mar.2012 Version2.0

- Added Mail-Sense3.6-ARHD-6.5.0-v2.0.apk for ARHD 6.5.0
- Updated Script to v2.0 for Automatic Deletion of accounts.

02.Mar.2012 Version2.0

- New mod disables the Exchange Device Administrator completely. 
** THIS WILL DISABLE THE REMOTE WIPE CAPABILITY TOO **
- No more hiding of "Unknown Sources" in Security Settings.
- From Version 2.0 Mail Patch script and APK are separated.
- Updated Steps according to new Version
- Discontinued ARHD 6.3.0 version

02.Mar.2012 Version1.1

- Updated Mail.apk from ARHD 6.4.0. 
I would recommend to use this one for 6.4.0. Apk is different from 6.3.0 and 
This mod ignores all restrictions not just password and sd encryption.

- Remove all .apk attachments. APK is available in Patch only.
How to mod your own

Many people are asking me how to mod their own apks and I am not able to keep up modding all the apks myself. So, I am trying to explain steps to modify the apk. Following this method you will be able to Mod any Sense 3.5, 3.6 or 4.0 apk. ( It is Sense version not Android OS version)
I will not be teaching you the basics of apk modification and will try to be as explainatory as possible.

Requirements
  1. APK Multitools : I use this tool for decompiling / recompiling apks.
  2. Text Editor with File Searching capability : I use Notepad++
  3. Modified apktool.jar for some new ics version apks.
  4. Knowledge of smali
  5. Patience... in bigger amounts

Steps
  1. Use APK Multitool to decompile apk : Sources only
  2. Goto the projects folder where the apk is decompiled and in side this folder you will find a smali folder.
  3. In this folder using Notepad++ search for "isAdminActive" ( without quotes )
  4. It should give you 6-7 results in 3 files. Like

    Code:
        invoke-virtual {v5, v0}, Landroid/app/admin/DevicePolicyManager;->isAdminActive(Landroid/content/ComponentName;)Z
    
        move-result v5
  5. Now we need to add a line after "move-result v5" line, so the complete becomes

    Code:
        invoke-virtual {v5, v0}, Landroid/app/admin/DevicePolicyManager;->isAdminActive(Landroid/content/ComponentName;)Z
    
        move-result v5
    
        const/4 v5, 0x1
  6. The variable name in const line ( ie v5 ) should be same as the one in move-result line.
  7. Add this const line to all the search results. This makes Mail.apk think that DeviceAdmin is active even if it is inactive.
  8. Now search for "processProvisionData", you will get some results in SyncManager.smali
  9. Out of these results few are method declaration starting with ".method" and some are constants starting with "const-string". The remaining ones are method calls which have "SyncManager;->processProvisionData25" and "SyncManager;->processProvisionData121". Select the first "SyncManager;->processProvisionData" in the search results.
  10. These are the methods that parse the security data sent from server, we need to skip them. If you scroll up a bit you will see that there are few conditions like "if-eqz v13, :cond_a". This means if condition is fulfilled goto the tag ":cond_a"

    You have to find the condition which leads to a tag skipping both SyncManager;->processProvisionData25 and SyncManager;->processProvisionData121.
  11. In my case it is "if-eqz v13, :cond_b". Once identified, add a line after this line "goto :cond_b". This makes Mail.apk to jump the provisioning data in any condition.
  12. Save all your files
  13. Compile using APK multitool
  14. When asked for system apk answer yes
  15. Sign and try the signed-Mail.apk (or other with signed- pre-appended to file name )
Enjoy..
The Following 71 Users Say Thank You to shantur For This Useful Post: [ View ] Gift shantur Ad-Free
 
 
28th February 2012, 01:08 AM |#2  
baste07's Avatar
Senior Member
Flag Manila
Thanks Meter: 280
 
More
thanks! working on my sensation XE ARHD 6.3.0

---------- Post added at 08:08 AM ---------- Previous post was at 07:53 AM ----------

oh and btw the path should be /system/app/Mail.apk and not \system\app\Mail.apk
The Following 3 Users Say Thank You to baste07 For This Useful Post: [ View ] Gift baste07 Ad-Free
28th February 2012, 10:39 AM |#3  
omar302's Avatar
Senior Member
Flag Doha
Thanks Meter: 520
 
More
Does this by any chance, also sort out the bug where upon a restart the send/receive setting are reset?
28th February 2012, 11:06 AM |#4  
EDD!E's Avatar
Senior Member
Thanks Meter: 14
 
More
Was it based on ROM framework or it was an independent APK ?

I will try to do the same mod into S4X ...
28th February 2012, 11:11 AM |#5  
OP Senior Member
Thanks Meter: 3,078
 
Donate to Me
More
Quote:
Originally Posted by baste07

thanks! working on my sensation XE ARHD 6.3.0

---------- Post added at 08:08 AM ---------- Previous post was at 07:53 AM ----------

oh and btw the path should be /system/app/Mail.apk and not \system\app\Mail.apk

Thanks... OP edited.

Quote:
Originally Posted by omar302

Does this by any chance, also sort out the bug where upon a restart the send/receive setting are reset?

I just modified the exchange security thing. I dont think this is solved.
The Following 3 Users Say Thank You to shantur For This Useful Post: [ View ] Gift shantur Ad-Free
28th February 2012, 11:12 AM |#6  
OP Senior Member
Thanks Meter: 3,078
 
Donate to Me
More
Quote:
Originally Posted by EDD!E

Was it based on ROM framework or it was an independent APK ?

I will try to do the same mod into S4X ...

The original APK is taken from AHRD 6.3.0 (HTC Sense 3.6 Rom). It is based on HTC framework.
The Following 2 Users Say Thank You to shantur For This Useful Post: [ View ] Gift shantur Ad-Free
28th February 2012, 11:22 AM |#7  
EDD!E's Avatar
Senior Member
Thanks Meter: 14
 
More
That will not be easy to do it in S4X ...
28th February 2012, 01:12 PM |#8  
OP Senior Member
Thanks Meter: 3,078
 
Donate to Me
More
Quote:
Originally Posted by EDD!E

That will not be easy to do it in S4X ...

I have posted the changes that I made. You can try in S4X, i hope these should work.
The Following 2 Users Say Thank You to shantur For This Useful Post: [ View ] Gift shantur Ad-Free
28th February 2012, 01:42 PM |#9  
EDD!E's Avatar
Senior Member
Thanks Meter: 14
 
More
Let me extract sense 4.0 mail.apk to compare.

Sent from my HTC Sensation XE
28th February 2012, 04:17 PM |#10  
OP Senior Member
Thanks Meter: 3,078
 
Donate to Me
More
Did it work for you?
The Following 2 Users Say Thank You to shantur For This Useful Post: [ View ] Gift shantur Ad-Free
29th February 2012, 10:37 AM |#11  
EDD!E's Avatar
Senior Member
Thanks Meter: 14
 
More
No go ... sense 4 framework is different.

---------- Post added at 05:37 PM ---------- Previous post was at 05:35 PM ----------

BTW, another way to mod the file is via ES File Explorer with root access. Copy & overwrite & change the permission.
Post Reply Subscribe to Thread

Tags
exchange device admin mail security, one xl mail

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

Advanced Search
Display Modes