Exchange mail without device adminstrator - Galaxy S II General

One of the things I miss when changing to a new stock or custom ROM is having the option of installing an exchange client which doesn't require a device administrator.
Turns out it's fairly easy to change the Email application to disregard an security requirements. Note that the info below can be found spread over several threads on XDA so I did not discover this myself.
Root the device
You will make changes in /system/app so root is required.
Get smali and baksmali
Smali and baksmali can decode and encode the classes.dex file containing the source code for the Mail application. They can be found at http://code.google.com/p/smali/
Copy Email.apk (and Email.odex if existing) from /system/app
Odex files will be there in stock ROMs or other odexed ROMs
Copy files from /system/framework
Framework files are needed for baksmali to be able to deodex the odex file.
Download java.awt.jar
Java.awt.jar can be found from http://forum.xda-developers.com/showthread.php?t=1132724
Decompile the odex file
Code:
java -jar baksmali-1.3.2.jar -x Email.odex -c :com.google.android.maps.jar:twframework.jar:java.awt.jar
Make necessary changes in out\com\android\email\SecurityPolicy.smali
Function isActive should always return 1. Easiest by changing:
Code:
const/4 v1, 0x0
to:
Code:
const/4 v1, 0x1
Recompile code into out.dex
Code:
java -jar smali-1.3.2.jar out
Deodex the apk
Put out.dex into apk as classes.dex (the apk is a zip)
Push apk to phone
Clear data for Email
Delete/backup old Email.apk and Email.odex
Put new Email.apk in /system/app
Reboot

Related

[Tool\Script] Sign, Zipalign and adb push apk's

Sign, Zip align and ADB push Apk's
What's different about this script?
*It's simple, easy to understand
*It can be used with any JDK. All that is required is replacing the PATH
This was intended to be used on HTC Skins; however, it can be used for any APK.
About
I wrote this batch file because the tools currently on XDA seem very complex or are based on JDK 7. People like myself that prefer to use JDK 6 are at a loss. This batch file assumes you already know how to sign APK's, Zipalign and ADB push Apk's. I've included some of my other threads below if you need further instructions.
Other threads a noob might need
Noobs guide to signing an APK
Noobs guide to installing and running zipalign
****All that is required to make this run, is replacing the directory paths with YOUR OWN Directory paths.
Source Code below, below that is the Multi to the .bat file.
Code:
@ECHO OFF
C:
CD\
CLS
cd c:\Program Files\Java\jdk1.6.0_26\bin (This can be replaced with whatever JDK you're using. Simply, replace the path)
jarsigner -verbose -keystore skin.keystore -signedjar C:\Users\Reynolds\ANDROID\SKINS\Rezound\Pitch_Black\dist\New-Pitchblack.apk C:\Users\Reynolds\ANDROID\SKINS\Rezound\Pitch_Black\dist\Pitchblack.apk [B]REPLACE-THESE-CAPS-W-YOUR-ALIAS[/B]
DEL C:\Users\Reynolds\ANDROID\SKINS\Rezound\Pitch_Black\dist\New-Pitchblack.apk
C:
CD\
CLS
cd C:\Users\Reynolds\ANDROID\SKINS\Rezound\Pitch_Black\dist
zipalign -fv 4 New-Pitchblack.apk Pitchblack.apk
cd c:\android-sdk-windows\platform-tools
C:
CD\
CLS
cd c:\android-sdk-windows\platform-tools [B](Your directory might be different)[/B]
adb install -r C:\Users\Reynolds\ANDROID\SKINS\Rezound\Pitch_Black\dist\Pitchblack.apk [B]( This Path can be replaced with whatever your apk is located in order to push the apk to your device[/B]
Media Fire DL Link: http://www.mediafire.com/?c3f0thcv6cmdwws

[GUIDE] NOOB/ Beginners : Batch sign and Zipalign your apps/themes

GUIDE FOR NOOBS / BEGINNERS/ THEMERS/ DEVELOPERS :
BATCH SIGN AND ZIPALIGN YOUR APPS/THEMES
This guide will show you an easy way to batch sign your apks and zipalign it for uploading to Google Play store.
Requisites
Windows OS ;
Your Signature .Keystore file
Java SDK installed
Zipalign tool (Found in tools directory of Android SDK) or download from attachment.
​
Method
1. Create a BAT file
a. Open Notepad and paste the following
---------------------------------------------------------------------------
Code:
@echo off
"[U]C:\Program Files\Java\jdk1.7.0_45\bin\jarsigner[/U]" -verbose -sigalg MD5withRSA -storepass [U]yourpassword[/U] -digestalg SHA1 -keystore [U]yoursigfile.keystore appname.apk aliasname[/U]
"[U]Your zipalign path\[/U]zipalign" -v 4 "[U]folderpath\Signedapk.apk[/U]"[U]Output folder\Zipalignedapk.apk[/U]"
echo Thanks for your time
pause
------------------------------------------------------------------------------
b. Correct the path of zipalign.exe and apk files as required.
c. Save the file in .bat format
2. Create a folder anywhere in your computer
3. Copy your .keystore file and the bat file created into this folder
4. Now Copy the apk files into the same folder.,
5. Now just run the bat file to have your signed and zipaligned APKs
For more easiness : Complete package download (find Signalign.zip in attachments)
1. Extract to C:\
2. Copy your unsigned apk files into signalign folder
3. Open the "Sign and zipalign.bat" file in notepad
4. Edit appname ; keystore filename ; keystore password ; alias name
You can add any number apks in the bat file.
5. Run the bat file
6. You have your zipaligned apps ready
reserved

[MOD] [I8200N] deodexed stock rom apps

DEODEXED APPS​
Here is the stock app and framework files from new firmware I8200NXXUAOA1 for Samsung Galaxy VE (I8200N).It have all apps so and the bloatware.After install you can delete any bloatware you want.Maybe it is safe for all versions!!!
What is Odex and Deodex ROM
What is an ODEX file?
In Android file system, applications come in packages with the extension .apk.
These application packages, or APKs contain certain .odex files whose supposed function is to save space.
These ‘odex’ files are actually collections of parts of an application that are optimized before booting.
Doing so speeds up the boot process, as it preloads part of an application.
On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.
What is an DEODEX file?
Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled into classes.dex files.
By doing that, all pieces of an application package are put together back in one place, thus eliminating the worry of a modified APK conflicting with some separate odexed parts.
So, Deodexed ROMs (or APKs) have all their application packages put back together in one place,
allowing for easy modification such as theming. Since no pieces of code are coming from any external location,
custom ROMs or APKs are always deodexed to ensure integrity.
all apps are full working and not yet any bugs
Code:
[COLOR="red"][B][U]* I can give ABSOLUTLEY no gurantee!!
All you do with your phone will be on your own.
I'm not responsible if your phone will brick or whatever...[/U][/B][/COLOR]
Code:
[B][COLOR="Red"]Rrequirements :[/COLOR][/B]
[B]Root [URL="http://forum.xda-developers.com/galaxy-s3-mini/general/s-iii-mini-ve-i8200-n-t2826565"]Hot To Root[/URL]
Adb [URL="http://forum.xda-developers.com/showthread.php?t=2588979"]How to Install[/URL]
Phone drivers[/B]
How To Install :
1. download the zip file
2. extract it
3. connect your phone
4. usb debugging on
3. paste the app and framework file into
GT-I8200N\Card folder which you find it on your computer
4 .install adb drivers
5. open cmd and type
Code:
adb shell
[COLOR="red"][I][SIZE="3"](if you are using adb shell in su for the first time,
keep phone screen on.
After entering "su" code, super user request prompt in phone.
Press allow )[/SIZE][/I][/COLOR]
su
stop
mount -o rw,remount /system/ /system/
cp /storage/extSdCard/app/* /system/app/ (wait...)
rm /system/app/*.odex (wait...)
cp /storage/extSdCard/framework/* /system/framework/ (wait...)
rm /system/framework/*.odex (wait...)
mount -o ro,remount /system/ /system/
reboot
How To check if you done
1. open cmd and type
Code:
adb shell
su
cd /system/app
or
cd /system/framework
ls
2. now you see all your system apps.if doesnt exist .odex file and you dont have any errors or bugs your ok
DOWNLOAD:
the file
credits:
@Snoop05 for adb installer
@j.posarekar70 for deodex guide
This work for the version i8200L?
Nice all ok
Test done
SAMSUNG
GALAXY S3 MINI
GT-I8200N
Willian182 said:
This work for the version i8200L?
Click to expand...
Click to collapse
try it i dont know.take a backup first.maybe you have error with nfc you can delete the apk .try it and tell me please
..................
Como lo descargo soy nuevo en esto.
Sent from my GT-I8200N using XDA Free mobile app
Thanks for this apps pack! It saves my phone. Best regards.
download link
download link is broken
Is it possible to unroot the deodexed stock rom?
I got some Apps which refuse to work if they detect a rooted phone...

Amazfit 1.2.8 source code app/priv-app (decompiled)

Last night I decided to decompile all the apps of our beloved amazfit, I started to look at the source to find some interesting information. (Like how to turn off the standby mode or as add new watchfaces with even the standby mode)
I found interesting information but I have to do many tests and I don't have too much time at the moment, I leave the link to download all sources divided by folders (Gradle project)
Amazfit 1.2.8 decompiled apps
Enjoy!
Cracklydisc said:
Last night I decided to decompile all the apps of our beloved amazfit, I started to look at the source to find some interesting information. (Like how to turn off the standby mode or as add new watchfaces with even the standby mode)
Amazfit 1.2.8 decompiled apps
Enjoy!
Click to expand...
Click to collapse
Hi @Cracklydisc, which toolchain are you using to decompile amazfit system apps? baksmali 2.2.0 fails to deodex:
Code:
java -jar ../tools/smali/baksmali/build/libs/baksmali.jar deodex HuamiWatchFaces.odex -b framework/
Exception in thread "main" org.jf.dexlib2.DexFileFactory$UnsupportedOatVersionException: Unsupported oat version: 45
Tried also https://github.com/pxb1988/dex2jar, which gives smali files, but they fail to re-compile with apktool:
Code:
apktool b HuamiWatchFaces
I: Using Apktool 2.2.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
HuamiWatchFaces/smali/android/support/v4/media/MediaMetadataCompat.smali[73,45] Error for input '@': Invalid text
HuamiWatchFaces/smali/android/support/v4/media/MediaMetadataCompat.smali[73,39] mismatched input 'vtable' expecting VTABLE_INDEX
[...]
Many thanks in advance!
drbourbon said:
Hi @Cracklydisc, which toolchain are you using to decompile amazfit system apps? baksmali 2.2.0 fails to deodex:
Code:
java -jar ../tools/smali/baksmali/build/libs/baksmali.jar deodex HuamiWatchFaces.odex -b framework/
Exception in thread "main" org.jf.dexlib2.DexFileFactory$UnsupportedOatVersionException: Unsupported oat version: 45
Tried also https://github.com/pxb1988/dex2jar, which gives smali files, but they fail to re-compile with apktool:
Code:
apktool b HuamiWatchFaces
I: Using Apktool 2.2.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
HuamiWatchFaces/smali/android/support/v4/media/MediaMetadataCompat.smali[73,45] Error for input '@': Invalid text
HuamiWatchFaces/smali/android/support/v4/media/MediaMetadataCompat.smali[73,39] mismatched input 'vtable' expecting VTABLE_INDEX
[...]
Many thanks in advance!
Click to expand...
Click to collapse
Project ref:
- https://forum.xda-developers.com/and...batch-t2980857
- https://github.com/skylot/jadx
i use this 2 software for extract the source code.
How?
0. Extract from Amazfit the directory /app /priv-app /framework
adb pull /app
adb pull /priv-app
adb pull /framework
1. Create dir System and put the 3 dir inside.
2. Rename all mips dir in arm (one dir for any apk and one dir for framework )
3. Use JoelDroidLollipopBatchDeodexer.exe, select dir System and click start process (the software changes original file!)
4. Use Jadx for decompile apk in source code
example
jadx.bat -e app/Alipay/Alipay.apk -d decompiledApp/Alipay
If you have any questions please ask
Thank you for your suggestions @Cracklydisc !
I ended up doing things manually with oat2dex, apktool and smali/baksmali.
My idea is to replace one existing system watch face from HuamiWatchfaces.apk (and HuamiWatchfaces.odex) by replacing the relevant smali files with my custom compiled smali classes (with same java package name) in it. For example:
Code:
SunriseDigitalSlptClock.smali
SunriseDigitalWatchFace$1.smali
SunriseDigitalWatchFace$Engine$1.smali
SunriseDigitalWatchFace$Engine$2.smali
SunriseDigitalWatchFace$Engine$3.smali
SunriseDigitalWatchFace$Engine$4.smali
SunriseDigitalWatchFace$Engine$5.smali
SunriseDigitalWatchFace$Engine.smali
SunriseDigitalWatchFace.smali
I am struggling with basic permission and signing issues that I am sure have already been solved by you guys, so that I ask you for basic directions.
Here's the steps I made to decompile and recompile back everything in order to test the process. This results in "HuamiWatchFaces stopped" after reboot .
adb pull /system/framework
adb pull /system/app
java -jar oat2dex.jar -a 22 odex HuamiWatchFaces.odex
java -jar baksmali.jar d odex/HuamiWatchFaces.dex -o Faces
apktool d -c HuamiWatchFaces.apk
cp -r Faces HuamiWatchFaces/smali
(here relevant smali files will be replaced with custom ones in HuamiWatchFaces/smali)
apktool b -c HuamiWatchFaces/
adb push HuamiWatchFaces.apk /system/app/HuamiWatchFaces/HuamiWatchFaces.apk
delete /system/app/HuamiWatchFaces/mips/HuamiWatchFaces.odex from adb shell (apk is now deodexed)
rm /data/dalvik-cache/mips/[email protected]@HuamiWatch*
adb reboot
drbourbon said:
Thank you for your suggestions @Cracklydisc !
I ended up doing things manually with oat2dex, apktool and smali/baksmali.
My idea is to replace one existing system watch face from HuamiWatchfaces.apk (and HuamiWatchfaces.odex) by replacing the relevant smali files with my custom compiled smali classes (with same java package name) in it. For example:
Code:
SunriseDigitalSlptClock.smali
SunriseDigitalWatchFace$1.smali
SunriseDigitalWatchFace$Engine$1.smali
SunriseDigitalWatchFace$Engine$2.smali
SunriseDigitalWatchFace$Engine$3.smali
SunriseDigitalWatchFace$Engine$4.smali
SunriseDigitalWatchFace$Engine$5.smali
SunriseDigitalWatchFace$Engine.smali
SunriseDigitalWatchFace.smali
I am struggling with basic permission and signing issues that I am sure have already been solved by you guys, so that I ask you for basic directions.
Here's the steps I made to decompile and recompile back everything in order to test the process. This results in "HuamiWatchFaces stopped" after reboot .
adb pull /system/framework
adb pull /system/app
java -jar oat2dex.jar -a 22 odex HuamiWatchFaces.odex
java -jar baksmali.jar d odex/HuamiWatchFaces.dex -o Faces
apktool d -c HuamiWatchFaces.apk
cp -r Faces HuamiWatchFaces/smali
(here relevant smali files will be replaced with custom ones in HuamiWatchFaces/smali)
apktool b -c HuamiWatchFaces/
adb push HuamiWatchFaces.apk /system/app/HuamiWatchFaces/HuamiWatchFaces.apk
delete /system/app/HuamiWatchFaces/mips/HuamiWatchFaces.odex from adb shell (apk is now deodexed)
rm /data/dalvik-cache/mips/[email protected]@HuamiWatch*
adb reboot
Click to expand...
Click to collapse
Why do you want to replace a native Watchface?
They have implemented the wfz engine and with the current dev version you can create both analog and digital Watchface and change shape to widgets.
Cracklydisc said:
Why do you want to replace a native Watchface?
They have implemented the wfz engine and with the current dev version you can create both analog and digital Watchface and change shape to widgets.
Click to expand...
Click to collapse
Good question
Even thought configurable watch faces are nice and powerful, coming from the Pebble world I'd like to open up the option to former Pebble developers to deliver radically custom watch faces like https://apps.getpebble.com/en_US/application/533966299820be90ed0000c5?hardware=chalk, https://apps.getpebble.com/en_US/application/52de476d6094ff6bf0000046?hardware=chalk or https://apps.getpebble.com/en_US/ap...5e1c8000118?hardware=chalk&section=watchfaces
Thank you for the decompiled version!!
I have a question for you, on the version you decompiled, could you please guide me to the file path/method used for the GATT profile to access the raw data from the device?
Thank you again!
Best,

[TUTORIAL] How to get the Stock Android Theme back to LineageOS

I'm not responsible for any Damage taken to your Device.
If you follow my steps, then nothing can go wrong
First things that you need
- A Device with LineageOS 14.1 that is rooted
- Newest APKTool Version: https://ibotpeaches.github.io/Apktool/
- A File Explorer that can use Root. (I use Root Explorer)
- A Text program to open and edit .xml files (I used Notepad++)
Lets Start
1. Go to your Root File Explorer and Navigate to /system/framework, scroll down and you will see the "framework-res.apk" file.
Go ahead and copy it to your Download Folder.
(Maybe you need to activate Read/Write first to copy or change files from the system folder, you can do this in Root Explorer if you click on Mount R/W at the Top)
2. Transfer the framework-res.apk from your Download folder to your PC (I used Google Drive for this)
Create a New Folder and put the "framework-res.apk" and the downloaded "apktool_2.2.2" in it.
Now Rename the "apktool_2.2.2" to "apktool"
Also create a text document and put in this Code:
Code:
@echo off
if "%PATH_BASE%" == "" set PATH_BASE=%PATH%
set PATH=%CD%;%PATH_BASE%;
java -jar -Duser.language=en "%~dp0\apktool.jar" %*
Save it as "apktool.
Now its gonna look like this
http://imgur.com/U1Pu8PM
3. Type in "cmd" in the "NavigationBar" (http://imgur.com/L46rY2r) and press Enter.
Now type in
Code:
apktool if framework-res.apk
Then type in
Code:
apktool d framework-res.apk
It should look like this: http://imgur.com/CdpMTzG
4. Now go into the "framework-res" Folder and go to res/values/colors.xml and open it.
Search for this:
Code:
<color name="primary_material_settings">@color/material_grey_900</color>
And change it into this:
Code:
<color name="primary_material_settings">@color/material_blue_grey_900</color>
Also Search for this:
Code:
<color name="primary_dark_material_settings">@color/black</color>
And change it into this:
Code:
<color name="primary_dark_material_settings">@color/material_blue_grey_950</color>
Press STRG+S to Save everything.
Close the Folder and go back to the CMD Console.
5. Open CMD again and type in:
Code:
apktool b framework-res
Just ignore warnings like this one: http://imgur.com/lwM9Kiy
Go back into the "framework-res" Folder and go into "Original".
Copy "META-INF" and "AndroidManifest" and paste/replace it into the build/res Folder.
Go Back to CMD and type in again:
Code:
apktool b framework-res
Then Go into the "framework-res" Folder and go to "dist"
In that Folder you will find a APK File named "framework-res", Copy that File and transfer it to your Dowload Folder in your Device (I used Google Drive)
6. Now go into your Root File explorer and Navigate to the Download Folder. Long-Press on the "Framework-res.apk" and Copy it to /system (!NOT INTO /System/framework just yet!)
Long-Press on it again and go to Permissions, then change the Permissions to this: http://imgur.com/IkVOQTA and Press "Ok"
Now Long-Press on it a last time and go to Move, and move it into /system/framework and Replace the Old File.
7. Reboot your Device.
BE HAPPY
You are the best!!! I was able to make LineageOS have a Pixel look!

Resources