yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Themes and Apps] shuweee:
Was wondering if someone might know how to multi-select to delete after search.
[Galaxy S II Themes and Apps] davioxx:
wifi adb

Hello I think im not the only one but do you think we could do this process via wireless adb?

Thanks!
[Galaxy S II Themes and Apps] Metalazzo:
Works like a charm...

Thank you so much ;)
[Galaxy S II Themes and Apps] johnuopini:
Managed to do this by myself using the "manual mode", as a reference this is my cleanup + patch script, i use it while in recovery after updating CM9 but it should work even when system is up (i use "su -" because latest CM releases have no root on ADB by default)

#!/bin/bash
PATCHDIR="email-policy-patch-3.0/lib/"
TEMPDIR="temp"

# Mount /system
adb shell su -c 'mount -o remount,rw /system'

# Cleanup unused system apps
adb shell su -c 'rm /system/app/*.BAK'
adb shell su -c 'rm /system/app/CMWallpapers.apk'
adb shell su -c 'rm /system/app/ChromeBookmarksSyncAdapter.apk'
adb shell su -c 'rm /system/app/GenieWidget.apk'
adb shell su -c 'rm /system/app/HoloSpiralWallpaper.apk'
adb shell su -c 'rm /system/app/Talk.apk'
adb shell su -c 'rm /system/app/ThemeManager.apk'
adb shell su -c 'rm /system/app/ThemeChooser.apk'
adb shell su -c 'rm /system/app/VoiceDialer.apk'
adb shell su -c 'rm /system/app/Trebuchet.apk'

# Copy out email apks
mkdir $TEMPDIR
adb pull /system/app/Email.apk $TEMPDIR/Email.apk
adb pull /system/app/Email.odex $TEMPDIR/Email.odex 2> /dev/null
adb pull /system/app/Exchange.apk $TEMPDIR/Exchange.apk
adb pull /system/app/Exchange.odex $TEMPDIR/Exchange.odex 2> /dev/null
adb pull /system/framework/ $TEMPDIR/framework/

# Call patch script
java -jar $PATCHDIR/email-policy-patch.jar patch-manual $TEMPDIR 15 Email.apk Exchange.apk

# Push files back into the device
adb push $TEMPDIR/Email.apk /system/app/Email.apk
adb push $TEMPDIR/Email.odex /system/app/Email.odex 2> /dev/null
adb push $TEMPDIR/Exchange.apk /system/app/Exchange.apk
adb push $TEMPDIR/Exchange.odex /system/app/Exchange.odex 2> /dev/null

# Clean up
rm -r $TEMPDIR
[Galaxy S II Themes and Apps] laithe:
Best Fix Yet

rustamabd, you are the man. I cannot express how happy I am that you did this. I've been spending all my time looking for new email apps to fix this problem, and here you come along and take the stock app (which I think is the better one anyway) and fix my issue.

This is fantastic, and works perfectly on my Galaxy Nexus 4.0.4. I'm letting everyone I know who has been wanting to get rid of the lock screen know about this thread.

Donations are on their way. If anyone deserves it, you do. :D
[Galaxy S II Themes and Apps] thewhitetower:
Help please?

Hi all, I'm new to android with a SG3...would this work on that phone?

Also, given that I'm areal noob - can someone please post a quick step by step on getting this mod on the phone? I don't really want to root - is there a waya round this?

Apologies for posting something that has probably been asked a million times but searching is proving real confusing as a link follow to another link follows to another link and it's all too confusing!!!

Thanks in advance
[Galaxy S II Themes and Apps] k_chakri:
Worked for me

New to XDA, and after days of trails today I finally got this email pin removed from my ICS 4.0.3.

In my case the process got completed with the following message:

Unable to update Email.apk. Please update Email.apk manually. The patched version is at /sdcard/Email.patched.apk

Unable to update Exchange.apk. Please update Exchange.apk manually. The patched version is at /sdcard/Exchange.patched.apk.

Then I manually copied them back to the /system/app and it worked.

Thank you very much.

Regards

Kalyan
[Galaxy S II Themes and Apps] thewhitetower:
so is it as simple as running the cmd command prompt or do I Ali's have to remove the existing secemail.apk?

Also, can this be run on a Mac? Or should I switch to Win7? ....ps...I just rooted my SG3!
[Galaxy S II Themes and Apps] dewey1973:
johnuopini, I cut an pasted your code into a new .sh script, made it executable, and ran it and these are the results I got:

rm failed for /system/app/*.BAK, No such file or directory
3501 KB/s (1529720 bytes in 0.426s)
2377 KB/s (571930 bytes in 0.234s)
pull: building file list...
pull: /system/framework/com.google.widevine.software.drm.jar -> temp/framework/com.google.widevine.software.drm.jar
pull: /system/framework/com.google.android.media.effects.jar -> temp/framework/com.google.android.media.effects.jar
pull: /system/framework/com.google.android.maps.jar -> temp/framework/com.google.android.maps.jar
pull: /system/framework/wimax_service.jar -> temp/framework/wimax_service.jar
pull: /system/framework/svc.jar -> temp/framework/svc.jar
pull: /system/framework/services.jar -> temp/framework/services.jar
pull: /system/framework/pm.jar -> temp/framework/pm.jar
pull: /system/framework/monkey.jar -> temp/framework/monkey.jar
pull: /system/framework/javax.obex.jar -> temp/framework/javax.obex.jar
pull: /system/framework/input.jar -> temp/framework/input.jar
pull: /system/framework/ime.jar -> temp/framework/ime.jar
pull: /system/framework/framework.jar -> temp/framework/framework.jar
pull: /system/framework/framework-res.apk -> temp/framework/framework-res.apk
pull: /system/framework/filterfw.jar -> temp/framework/filterfw.jar
pull: /system/framework/ext.jar -> temp/framework/ext.jar
pull: /system/framework/core.jar -> temp/framework/core.jar
pull: /system/framework/core-junit.jar -> temp/framework/core-junit.jar
pull: /system/framework/com.android.location.provider.jar -> temp/framework/com.android.location.provider.jar
pull: /system/framework/com.android.future.usb.accessory.jar -> temp/framework/com.android.future.usb.accessory.jar
pull: /system/framework/bu.jar -> temp/framework/bu.jar
pull: /system/framework/bouncycastle.jar -> temp/framework/bouncycastle.jar
pull: /system/framework/bmgr.jar -> temp/framework/bmgr.jar
pull: /system/framework/apache-xml.jar -> temp/framework/apache-xml.jar
pull: /system/framework/android.test.runner.jar -> temp/framework/android.test.runner.jar
pull: /system/framework/android.policy.jar -> temp/framework/android.policy.jar
pull: /system/framework/am.jar -> temp/framework/am.jar
26 files pulled. 0 files skipped.
2137 KB/s (13955126 bytes in 6.375s)
Error: Unable to access jarfile email-policy-patch-3.0/lib//email-policy-patch.jar
failed to copy 'temp/Email.apk' to '/system/app/Email.apk': Permission denied
failed to copy 'temp/Exchange.apk' to '/system/app/Exchange.apk': Permission denied

Any thoughts on what I need to change to get it to work for me?
[Galaxy S II Themes and Apps] grennis:
Great job. Just wanted to point out that although the OP states that Blur based phones are not supported, you can still of course make it work.

Simply remove the motorola junk from /system/app (Hux*, MoxierEasEngine*) and then download any CM9 build and move Email.apk and Exchange.apk to your /system/app. Then run the patch.

Works like a champ.
[Galaxy S II Themes and Apps] Mr.Shaky:
No joy on Galaxy Nexus 4.04

It looks like the script recompiled the ExchangeGoogle.apk then failed at "updating device." There's a file "ExchangeGoogle.patched.apk" in the root of /sdcard, but the ExchangeGoogle.apk file in system/apps has today's date on it and is a little larger than the ExchangeGoogle.apk.BAK file that's also there.

I rebooted and tried setting up an account but only got two choices: POP and IMAP.

<Edit - got it to work>

I removed the patched files from /system/apps and removed the .BAK from the original files, then rebooted the phone, deleted the 'work' folder from my pc and re-ran the patch. It worked this time.

Thanks!
[Galaxy S II Themes and Apps] banesi:
uploading to phone fails mostly because in latest CM releases you have to specificaly enable root for adb in rom's advanced settings
[Galaxy S II Themes and Apps] johnuopini:
Sorry, fixed, please BEFORE running it:

- be sure to have email-policy-patch-3.0 on the same folder

- point data/bootanimation-fakepcboot.zip to your boot anim if you have one (if not remove that code)

- be sure to be in recovery and have CM9 installed first

- ignore "rm" errors, you might not have some of those files (because maybe you install GApps once and then run the script after CM9 update only)

#!/bin/bash
#
# Before running this:
# - Install latest CM rom
# - Wipe cache
#
# Email patch taken from:
# http://xdaforums.com/showthread.php?t=1117452

# Settings
PATCHDIR="email-policy-patch-3.0/lib/"
TEMPDIR="temp"
BOOTANIM="data/bootanimation-fakepcboot.zip"
set -x

# Mount /system
adb shell 'mount /system'

# Cleanup unused system apps
adb shell 'rm /system/app/*.BAK'
adb shell 'rm /system/app/Calculator.apk'
adb shell 'rm /system/app/CMWallpapers.apk'
adb shell 'rm /system/app/ChromeBookmarksSyncAdapter.apk'
adb shell 'rm /system/app/DSPManager.apk'
adb shell 'rm /system/app/GenieWidget.apk'
adb shell 'rm /system/app/LatinIME.apk'
adb shell 'rm /system/app/NoiseField.apk'
adb shell 'rm /system/app/HoloSpiralWallpaper.apk'
adb shell 'rm /system/app/MagicSmokeWallpapers.apk'
adb shell 'rm /system/app/PhaseBeam.apk'
adb shell 'rm /system/app/PicoTts.apk'
adb shell 'rm /system/app/RomManager.apk'
adb shell 'rm /system/app/Talk.apk'
adb shell 'rm /system/app/Term.apk'
adb shell 'rm /system/app/VoiceDialer.apk'
adb shell 'rm /system/app/Trebuchet.apk'

# Copy out email apks
mkdir $TEMPDIR
adb pull /system/app/Email.apk $TEMPDIR/Email.apk
adb pull /system/app/Email.odex $TEMPDIR/Email.odex 2> /dev/null
adb pull /system/app/Exchange.apk $TEMPDIR/Exchange.apk
adb pull /system/app/Exchange.odex $TEMPDIR/Exchange.odex 2> /dev/null
adb pull /system/framework/ $TEMPDIR/framework/

# Call patch script
java -jar $PATCHDIR/email-policy-patch.jar patch-manual $TEMPDIR 15 Email.apk Exchange.apk

# Push files back into the device
adb push $TEMPDIR/Email.apk /system/app/Email.apk
adb push $TEMPDIR/Email.odex /system/app/Email.odex 2> /dev/null
adb push $TEMPDIR/Exchange.apk /system/app/Exchange.apk
adb push $TEMPDIR/Exchange.odex /system/app/Exchange.odex 2> /dev/null

# Clean up
rm -r $TEMPDIR

# Add boot animation
adb shell 'rm /system/media/bootanimation.zip'
adb shell 'rm /data/local/bootanimation.zip' 2> /dev/null
adb push $BOOTANIM /system/media/bootanimation.zip

# Done with system
adb shell sync
adb shell 'umount /system'

# Reboot
[Galaxy S II Themes and Apps] imsuperjp:
worked on my galaxy s iii...Thanks!!
[Galaxy S II Themes and Apps] stu5797:
My company's blocked exchange email on android so getting email on the stock app is not an option. Will this mod allow the work exchange email to work?
[Galaxy S II Themes and Apps] rustyx3:
No, the patch as it is now will not change the fact that exchange is blocked.
[Galaxy S II Themes and Apps] pentafive:
Worked on Jelly Bean! You just have to tell it the name of the app.

Waiting for USB connection...
Checking device...
Model: Galaxy Nexus, build JRN84D, android 4.1 (API Level 15)
/system mounted on /dev/block/platform/omap/omap_hsmmc.0/by-name/system, mode ro

checking root access. root uid: 0, secure: yes, busybox: yes
Pulling app(s) ...
Can't find Exchange app. Enter the name of your exchange apk or press <Enter> to
continue: Exchange2Google.apk
Pulling libs ...
Decompiling EmailGoogle.odex ...
Applying patch ...
Patching method isActive(Lcom/android/emailcommon/provider/Policy;)Z
Patching method isActiveAdmin()Z
Patching method getInactiveReasons(Lcom/android/emailcommon/provider/Policy;)I
Recompiling ...
Building EmailGoogle.apk ...
Decompiling Exchange2Google.odex ...
Applying patch ...
Patching method hasSupportablePolicySet()Z
Recompiling ...
Building Exchange2Google.apk ...
Updating device ...
Rebooting device ...
Done.

NOTES! PLEASE READ!

* All shortcuts to the Email app will disappear and will need to be re-created.
The Email app will appear on the last page of the application drawer.

* Delete any leftover Exchange device administrators!
(Settings -> Location and security -> Device administrators).

Press any key to continue . . .
[Galaxy S II Themes and Apps] nakadm:
Please please please, add Jelly Bean support!

Flashed it on GN, patch seems to have worked:

Patches OK, Phone reboots, setup account, starts email sync, then, Force Close...

So close!

Update: Saw Pentafive Post above, was running 2.2 version of Patch...Tried again with 3.0

Works great!
[Galaxy S II Themes and Apps] Sboulema:
Working great on a Samsung Galaxy S Plus!
[Galaxy S II Themes and Apps] haroonie:
Unfortunately failed upon running against Jelly Bean 4.1 :( ... its been rocksolid every other device / update i've tried it with though!
[Galaxy S II Themes and Apps] haroonie:
Whoops missed these when I posted, works great by specifying Exchange2Google.apk on Jelly Bean

Cleaning up ...

Waiting for USB connection...

Checking device...

Model: Galaxy Nexus, build JRN84D, android 4.1 (API Level 15)

/system mounted on /dev/block/platform/omap/omap_hsmmc.0/by-name/system, mode rw

checking root access. root uid: 0, secure: yes, busybox: yes

Pulling app(s) ...

Can't find Exchange app. Enter the name of your exchange apk or press <Enter> to

continue: Exchange2Google.apk

Pulling libs ...

Decompiling EmailGoogle.apk ...

Applying patch ...

Patching method isActive(Lcom/android/emailcommon/provider/Policy;)Z

Patching method isActiveAdmin()Z

Patching method getInactiveReasons(Lcom/android/emailcommon/provider/Policy;)I

Recompiling ...

Building EmailGoogle.apk ...

Decompiling Exchange2Google.apk ...

Applying patch ...

Patching method hasSupportablePolicySet()Z

Recompiling ...

Building Exchange2Google.apk ...

Updating device ...

Rebooting device ...

Done.
[Galaxy S II Themes and Apps] mels0n:
I am getting spam'd "Update Security" notifications. This is on a Sprint S3, is there a setting that can be disabled to prevent this?

The sync of exchange halts until I manually press "Ok" on the notification at which point everything works perfectly again.

Edit to add: Returning to prehacked version of files the notification is no longer present and everything works as normal.
[Galaxy S II Themes and Apps] CaspaTheGhost:
Haven't had to use this for a while as AOKP settings allow you to use the slide unlock prior to pin unlock but giving JB a go and worked perfectly as mentioned above.

Sent from my Galaxy Nexus
[Galaxy S II Themes and Apps] maumaus:
Is it in any way possible to let this script work local? So the exchange and email apk in a folder and then patch them?

Everytime I wanna flash a new rom or update... I have to recplace the email and exchange apk...

But if an update have updated the email and exchange apk... I have to do it all again and have to sync my email all over...

When I flash the update rom with de email en exchange already hacked... the email is still present and doesnt have to sync all over...

Thanks!
[Galaxy S II Themes and Apps] Kaiken:
My Jelly Bean rom seems to hang in "Waiting for Sync" forever.

---------- Post added at 06:10 AM ---------- Previous post was at 06:01 AM ----------

It eventually worked it's way through
[Galaxy S II Themes and Apps] brk3:
Would someone on a Jellybean rom be kind enough to post a copy of their EmailGoogle.apk for those of us who don't have access to a Windows machine to run the patch?
[Galaxy S II Themes and Apps] Nasty64:
Which policies?

Hi rustamabd, Great app. Thanks! Another +1 for it working fine on Jelly Bean.

Can you describe which of the Exchange policies you're eliminating/modifying? Or is it all of them?

For instance, I wouldn't mind having the remote wipe feature still enabled, so IT could wipe the phone if I lose it and call them.

Thanks!
[Galaxy S II Themes and Apps] rustyx3:
All the policies are eliminated. Since the device administrator is simply not installed, it's not possible to keep one policy and not the other.

If you want remote wipe, you need to arrange it yourself via other means (Samsung has a built-in remote wipe, plus there are some apps that can do that).
[Galaxy S II Themes and Apps] dbrown2:
I have a Galaxy Nexus on Jellybean and don't mind providing the EmailGoogle.apk file, but two questions.

1. Do you still want the one from Galaxy Nexus on JB?

2. Where and how do I get the apk file?
[Galaxy S II Themes and Apps] rustyx3:
For Mac/Linux/Unix there is a shell script that applies the patch to a given Email apk. See apply-patch-nix.sh.
[Galaxy S II Themes and Apps] pentafive:
Attached..
[Galaxy S II Themes and Apps] purian23:
Hi Rustamabd, do you plan on making a JB compatible version? You're patch is by far the best and easiest method out there to bypass. Thank you!!!!!
[Galaxy S II Themes and Apps] danwanna:
Could someone create a flashable zip with the Jelly Bean versions of the files please? I've been trying for a couple days with no luck. I'd like to flash it immediately after installing a new ROM to prevent the need re-setup my email.

Thanks in advance!
[Galaxy S II Themes and Apps] purian23:
Here you are, this are ready to go and pre-patched!

Thx :)
[Galaxy S II Themes and Apps] rustyx3:
A new version 3.1 is already available, it contains JB support (mainly only the apk name difference). :D
[Galaxy S II Themes and Apps] johoja:
Hey,

Im getting this error and FC's with JB, and sync stops working after a few hours:

E/AndroidRuntime( 1478): java.lang.SecurityException: No active admin ComponentInfo{com.google.android.email/com.android.email.SecurityPolicy$PolicyAdmin}

E/AndroidRuntime( 1478):	at android.os.Parcel.readException(Parcel.java:1425)

E/AndroidRuntime( 1478):	at android.os.Parcel.readException(Parcel.java:1379)

E/AndroidRuntime( 1478):	at com.android.emailcommon.service.IPolicyService$Stub$Proxy.setAccountPolicy(IPolicyService.java:169)

E/AndroidRuntime( 1478):	at com.android.emailcommon.service.PolicyServiceProxy$2.run(PolicyServiceProxy.java:74)

E/AndroidRuntime( 1478):	at com.android.emailcommon.service.ServiceProxy$ProxyRunnable.run(ServiceProxy.java:102)

E/AndroidRuntime( 1478):	at java.lang.Thread.run(Thread.java:856)

I/ActivityManager( 344): Process com.google.android.exchange (pid 1478) has died.
[Galaxy S II Themes and Apps] Johnnykorn:
Its Alive!

I realize this was initially designed for the Galaxy phones but after reading through the thread I figured I would give it shot and tried it on my phone which is a Motorola Bionic. I'm current running a ICS leak version of 6.7.230.

Model: DROID BIONIC, build 6.7.2-223_DBN_M4-7, android 4.0.4 (API Level 15)
/system mounted on /dev/block/system, mode ro
checking root access. root uid: 0, secure: yes, busybox: yes
Pulling app(s) ...
Can't find Email app. Enter the name of your email apk or press <Enter> to exit:
MotoEmail.apk
Can't find Exchange app. Enter the name of your exchange apk or press <Enter> to
continue:
Pulling libs ...
Decompiling MotoEmail.apk ...
Applying patch ...
Patching method isActive(Lcom/motorola/emailcommon/provider/Policy;)Z
Patching method isActiveAdmin()Z
Patching method isSupported(Lcom/motorola/emailcommon/provider/Policy;)Z
Patching method getInactiveReasons(Lcom/motorola/emailcommon/provider/Policy;)I
Recompiling ...
Building MotoEmail.apk ...
Updating device ...
Unable to upload patched MotoEmail.apk. Please update /system/app/MotoEmail.apk
manually.

*** Device update failed.

Press any key to continue . . .

I did have to manually move the file over but currently its working as expected. I wanted to say thanks for your work on this and to let others know it may work for them. Not sure why it had a problem copying the file back over but a small price to pay to have it working. :good:
[Galaxy S II Themes and Apps] Red94:
DeviceID

Hi,

Is it possible to fake deviceid reported by EAS ? To change it to WPhone... :-) using an optional config file that input the value to replace.

Here is the exchange fields that show a user is using an android phone.

Nom de l'appareil : GT-I9100

Modèle de l'appareil : GT-I9100

Type de périphérique : SAMSUNGGTI9100

ID de l'appareil : SAMSUNGxxxxxxxxEMEIxxxxxxxxx

Système d'exploitation de l'appareil : Android

Agent utilisateur : SAMSUNG-GT-I9100/100.40003

So if it can be done, i will be very happy, if you have no time, i thank you for the existing patch :angel:! It's only a whish.

Best regards.
[Galaxy S II Themes and Apps] jahfry:
Script worked beautifully. Thanks. Captivate running AOKP m6. Saved me from having to go in and manually hack it like I did for stock 2.3. Donated :)
[Galaxy S II Themes and Apps] abacon15:
Alright! I got it work on my mac! With JB! For those of you needing help on what to do, here's whats up.

Open terminal and do this.

cd (patch folder, mine was /Users/abacon/Downloads/email-policy-patch-3.1)

sh (patch shell script, mine was /Users/abacon/Downloads/email-policy-patch-3.1/apply-patch-nix.sh)

That will give you some instruction. Create the new directory and pull those files like it says.

Then:

java -jar $PATCHDIR(just drag policy-patch folder here)/email-policy-patch.jar patch-manual
$TEMPDIR (work directory, should be in your patch policy folder, drag and drop again)
15 (if on 4.0.0+, the correct number is in the shell script you ran earlier)
Email.apk (name of Email.apk, mine happened to be EmailGoogle.apk)
Exchange.apk (name of Exchange.apk, mine was Exchange2Google.apk)

Obviously anything in parentheses () isn't in there, but is my little note to help you. And for the second set of code everything will be on one line, not broken up like I have it. Hit enter only when you finish typing/getting the whole command in. After it does it's thing put the apk's back into system/app, I had to rename the old ones to get it. If you have any questions shoot me a PM, this is about as clear as mud. :p

Edit: oh and on mine I had to change the permissions for the Exchange apk because it kept FC'ing. Also, anybody who wants to add to this is more than welcome!
[Galaxy S II Themes and Apps] T-Loop:
This is sick! :) I was so upset when I set up my companies Exchange and it forced me to use PIN-code. That was not cool. This worked so beautifully, I can't believe how XDA community comes to the rescue everytime! Awesome mate, thank you.
[Galaxy S II Themes and Apps] legulli88:
Hello,

i've a little problem using this fix.

I'll try to patch it with the script for windows, but i get following error:

I'm using the Stock eMail Software, the System is rooted, Stock FW SGIII.

Can anyone help me pls? :crying:
[Galaxy S II Themes and Apps] rustyx3:
Why would you need this?

And what would be the desired field values?
[Galaxy S II Themes and Apps] skyflyt:
Problem with JB

I had this working perfectly on my xoom running ICS. now with JB it goes through the script fine and even reboots my xoom and tells me success, but when the xoom comes back up there is no email app in the app drawer. i looked all over even tried to just go into the add accounts in settings and it just isnt there. i was able to get it back by using your restore from backup script(thank you for that!). Any ideas on how to get this working? i can post a logcat too if you think that would help narrow it down. Thanks again for your work!
[Galaxy S II Themes and Apps] maumaus:
bump...

Is it possible to localy patch the 2 apk's in a folder on pc?

Thanks!
[Galaxy S II Themes and Apps] deim:
As far as I understand patch is not replacing email apps, but UPDATING versions of mail apps installed at the moment. At least console log says that:

I just applied patch to the most recent JB 4.1.1 version of ROM released only yesterday.
[Galaxy S II Themes and Apps] rustyx3:
Sure, just write a patch-manual.cmd file with a contents like this:

@java -jar lib/email-policy-patch.jar patch-manual %*