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

Search This thread

shantur

Senior Member
Dec 6, 2010
1,095
3,076
[MOD][APP]Exchange Security Disabled - JB, ICS AOSP, Sense 3.6, 4.0 & 4.5 -WITH HOWTO

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:
[B]9.July.2013[/B]

- 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

[B]21.January.2013[/B]

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

[B]24.August.2012[/B]

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

[B]17.July.2012[/B]

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

[B]26.June.2012 Version2.0[/B]

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

[B]18.June.2012 Version2.0[/B]

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

[B]31.May.2012 Version2.0[/B]

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

[B]23.Apr.2012 Version2.0[/B]

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

[B]18.Apr.2012 Version2.0[/B]

- Added Mail-Sense4-orDroid-2.1.1.apk

[B]05.Apr.2012 Version2.0[/B]

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

[B]28.Mar.2012 Version2.0[/B]

- Added Android 4.0 ICS AOSP Mod

[B]26.Mar.2012 Version2.0[/B]

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

[B]04.Mar.2012 Version2.0[/B]

- 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.

[B]02.Mar.2012 Version2.0[/B]

- 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

[B]02.Mar.2012 Version1.1[/B]

- 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..
 

Attachments

  • Mail-Sense3.6-ARHD-6.4.0-v2.0.apk
    2.5 MB · Views: 289
  • Mail-Sense3.6-ARHD-6.5.0-v2.0.apk
    2.5 MB · Views: 519
  • MailPatch-Script-v2.0.zip
    283.3 KB · Views: 912
  • Mail-Rezound-Sense3.6-CleanRom_3.6-v2.0.apk
    2.6 MB · Views: 908
  • Mail-Sense4.0-Fixed-v2.0.apk
    3.2 MB · Views: 934
  • com.android.exchange.apk
    572.7 KB · Views: 996
  • Mail-Sense3.6-ARHD-6.6.0-v2.0.apk
    2.5 MB · Views: 233
  • Mail-Sense4-orDroid-2.1.1.apk
    2.9 MB · Views: 388
  • Mail-Sense3.6-ARHD-6.6.3-v2.0.apk
    2.5 MB · Views: 401
  • Mail-Sense4-OneX-Energy.apk
    4.8 MB · Views: 367
  • Mail-Stock-EvoLTE.apk
    3.4 MB · Views: 133
  • Mail-Amaze-Stock.apk
    2.6 MB · Views: 93
  • Mail-ARHD-6.7.0-v2.apk
    2.6 MB · Views: 318
  • Exchange2_AOSP_JB.apk
    827.4 KB · Views: 995
  • Mail-Sense4.5-ViperS-1.6.3.apk
    2.6 MB · Views: 274
  • Mail+nonprime-Sense4.5-Revelation1.0.0.apk
    2.7 MB · Views: 150
  • MailPatch-Script-JBSense.zip
    293.3 KB · Views: 146
Last edited:

baste07

Senior Member
Jun 22, 2009
4,454
275
Manila
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
 

EDD!E

Senior Member
Jul 22, 2007
326
14
Was it based on ROM framework or it was an independent APK ?

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

shantur

Senior Member
Dec 6, 2010
1,095
3,076
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.

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.
 

EDD!E

Senior Member
Jul 22, 2007
326
14
Let me extract sense 4.0 mail.apk to compare.

Sent from my HTC Sensation XE
 

EDD!E

Senior Member
Jul 22, 2007
326
14
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.
 

shantur

Senior Member
Dec 6, 2010
1,095
3,076
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.

I have never used ES File Explorer so didn't do that.
Can you give me Sense 4 Mail.apk? I will try to mod it.
 
  • Like
Reactions: AmberLynn

shantur

Senior Member
Dec 6, 2010
1,095
3,076
Try this if it works.
Do backup your current Mail.apk and replace the attached file with your Mail.apk and follow the steps in post 1.

If it works I will add this apk to opening post.

*** MOVED ATTACHMENT IN FIRST POST ***
 
Last edited:
  • Like
Reactions: AmberLynn

EDD!E

Senior Member
Jul 22, 2007
326
14
EXCELLENT !!!! it works on Virtuous S4X B.3.

Now syncing my exchange mail without the encryption & pin ... :)

But the "Install from unknown source" remain disable after activate the policy.
 
  • Like
Reactions: shantur

EDD!E

Senior Member
Jul 22, 2007
326
14
BTW, beside adb push in the APK, alternate way will be root file access & direct insert into the ROM before flashing the new ROM.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 71
    [MOD][APP]Exchange Security Disabled - JB, ICS AOSP, Sense 3.6, 4.0 & 4.5 -WITH HOWTO

    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:
    [B]9.July.2013[/B]
    
    - 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
    
    [B]21.January.2013[/B]
    
    - Added Mail-Sense4.5-ViperS-1.6.3 for all Sense 4.5 fans
    
    [B]24.August.2012[/B]
    
    - Added Exchange2_AOSP_JB.apk. Do not use script with this apk
    - Added JB patch steps
    
    [B]17.July.2012[/B]
    
    - Added Mail-ARHD-6.7.0-v2.apk. APK taken from ARHD 6.7.0 for Sensation
    
    [B]26.June.2012 Version2.0[/B]
    
    - Added Mail-Amaze-Stock.apk. APK taken from Deodexed Stock Rom
    - Added a simple How to for curious ones
    
    [B]18.June.2012 Version2.0[/B]
    
    - Added Mail-Stock-EvoLTE.apk. APK taken from Deodexed Stock Rom
    
    [B]31.May.2012 Version2.0[/B]
    
    - Added Mail-Sense4-OneX-Energy.apk. APK taken from OneX Energy Rom
    
    [B]23.Apr.2012 Version2.0[/B]
    
    - Added Mail-Sense3.6-ARHD-6.6.3-v2.0.apk. APK taken from ARHD 6.6.3 XE
    
    [B]18.Apr.2012 Version2.0[/B]
    
    - Added Mail-Sense4-orDroid-2.1.1.apk
    
    [B]05.Apr.2012 Version2.0[/B]
    
    - Added Mail-Sense3.6-ARHD-6.6-v2.0.apk. APK taken from ARHD 6.6
    
    [B]28.Mar.2012 Version2.0[/B]
    
    - Added Android 4.0 ICS AOSP Mod
    
    [B]26.Mar.2012 Version2.0[/B]
    
    - Updated Mail-Sense4.0 apk. This should fix Sense 4.0 issues.
    
    [B]04.Mar.2012 Version2.0[/B]
    
    - 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.
    
    [B]02.Mar.2012 Version2.0[/B]
    
    - 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
    
    [B]02.Mar.2012 Version1.1[/B]
    
    - 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..
    8
    Any chance someone can help get the SENSE 5 Mail.apk fixed?


    Nevermind, I did it!!! :)

    Attached is the Mail.apk from HTC One (Sense 5) patched for no exchange lockscreen/required pin.
    6
    Modded apk for HTC One X+ (JB, Sense 4+)

    All,

    Thanks for the great info.

    I've been Windows Mobile (HD, HD2) for a few years, and have finally made the Jump to Android (been waiting for TomTom on Android). So I'm a bit of a noob, but the instructions here were enough to get me on the learning curve and here's the result...

    I'm pleased to provide a working Mail-nonprime.apk for HTC One X + (International). This phone is running JB and Sense 4+. If you have one of these on the stock ROM, this should work to remove the Exchange policy for you (works for me anyway).

    There were a few extra steps I had to take above the tutorial on page 1. As a noob it took me a lot of reading and trial and error to get to this, so I'll put it all here in the hope of helping others working on a JB/Sense 4+ or similar config:
    1. It's Mail-nonprime.apk (Not Mail.apk) you need to patch.
    2. This, (like many stock ROMs apparently) is an odexed ROM, ie. there are both Mail-nonprime.apk and Mail-nonprime.odex files. Trying to decompile just the apk won't work, as it only has resources in, the code is in the odex file.
      So the next step is to to de-odex:
      • Get a recent version of xUltimate (2.4.2 worked for me)
      • With it (main.exe), grab all the frameworks off the device (might be safe to skip this step - not sure if they are needed to de-odex the apps or not)
      • In the folder "origi_app" under the xUltimate, place the Mail-nonprime.apk and Mail.nonprime.odex
      • Tell xUltimate to deodex the apps - this will leave you one Mail-nonprime.apk in the done-app folder
    3. The frameworks from the APK multitool site were not suitable for me, so I grabbed:
      com.htc.resources.apk and framework-res.apk from /system/framework on my device (adbfileexplorer is your friend here)
      and imported these into APK multitool (put in "other" folder, then run setup and tell it to setup frameworks)
    4. The deoxed apk from above now contained the code, but no resources so I:
      • Decompiled (Source only) the original Mail-nonprime.apk with APKMultiTool - this gets a folder with the binary resources etc.
      • Decompiled (Source only) the de-oxed Mail-nonprime.apk with APKMultiTool - rename it to something different so you end up with 2 projects in the output.
      • Copy all the files from the second (deoxed decompile) project to the first Mail-nonprime.apk project folder, don't overwrite files that are already there.
      • It's important to do the renaming this way around, as when you come to compile again, you want it looking for the signature on the original Main-nonprime.apk - not the de-oxed one (which didn't have a signature).
    5. Make the changes to the smali as described on the first post. EXCEPT:
      • In ProvisionUtil.smali, there is a "DevicePolicyManager;->isAdminActive" in a method called "enforcePolicyToAdmin". For this method, insert
        const/4 v2, 0x0​
        after the move-result line (note the ending 0x0 rather than 0x1 used elsewhere). Without this is will try to enforce the policy and fail due to no admin, resulting in an error trying to add a mail account.
      • The second instructions in the OP for the "goto" blocks were not very clear to me - I had to decompile other stock and patched apks from this thread to understand that I had to add a new goto point, not use an existing one. This means:
        • Find the method downloadPolicy in SyncManager.smali.
        • Check through the method for an unused number for goto_X (X being the number) - goto_4 worked for me.
        • Find "processProvisionData25" in the method
        • Look above for "if-eqz v13, :cond_b" (not "if-eqz v13, :cond_a which was closer but didn't work).
        • Put "goto :goto_4" just below it (without the quotes).
        • Search down the method for "processProvisionData121"
        • Look below for ":cond_b"
        • Put ":goto_4" just below it (without the quotes).
    6. Save the files, use APKMultiTool to do a system compile, check the log to ensure there are no errors then pop the file on your device.
    7. When copying the new Mail-nonprime.apk to my phone, move Mail-nonprime.odex out of /system/apps to avoid issues.
    8. Didn't even have to restart - added a new mail account and it worked great!

    Hope this helps someone.

    Regards,
    Graham
    3
    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
    3
    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.

    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.