PDFviewer - HTC Framework Clues - G1 Android Development

PDFviewer is probably (one of) the most requested features in the builds. So far only Haykuro's H build (from which this HTC app originated from) and Dude's build has this feature.
I have been trying to get this to work myself, but have not been able to do so, if anyone else has any clues on how to get this to work please post (if the dude himself can come show us how that would be great!).
Below are my noob attempt to get this to work.
If the APK is simply installed over, the installation works however it will force close as it references certain HTC libraries.
Copying over the files com.htc.android.pimlib.jar, com.htc.framework.jar and com.htc.resources.apk does not fix the problem.
The platform.xml with working builds have the lines:
<library name="com.android.im.plugin" file="/system/framework/com.android.im.plugin.jar" />
<library name="com.htc.android.pimlib" file="/system/framework/com.htc.android.pimlib.jar" />
Adding these lines does not solve the problem either. It appears that either I'm still missing some files or that there is some way to link the app to these files which I have not been able to recreate or both. Any enlightenment would be great.

you don't need those libraries. you need to copy over /system/app/FilePicker.apk and /system/lib/libpdfreader.so from the H build. This will allow the pdfreader to run without force crash. But unfortunate that won't work, because there are checks in pdfreader.apk or the library for HTC build. So it will pop up a dialog saying so, and if you hit ok it will uninstall pdfreader.apk. Copying the build.prop does not help. There is a thread in the apps forum with a workaround to this issue but its very inconvenient.

Related

Recompile and overwrite applications in system/app

As an experiment I am trying to rebuild some standard android applications and replace them in system/app on the G1. I have been through all the steps to get the source code and build for the dream platform and have built the various .apk files of interest (e.g. AlarmClock.apk, Browser.apk etc)
To put the files on the device I delete the old .apk and .odex files and copy my newly built .apk file on to the device. However when I try to run the application it crashes with the following message.
The application Alarm Clock (process com.android.alarmclock) has stopped unexpectedly. Please try again.
I know that replacing the applications like this is possible, because the AutoRotating Browser build works fine when copies over in this manner.
I'm using JF1.31 (RC8)
My initial reaction was that I was not signing the applications properly but having read some posts I think the default built .apk should have the right key already in it.
Another theory I have is that perhaps the applications from the head of the source tree are not compatible with the RC8 (or RC30) Android OS releases. Can anyone tell me how to get the source tree which corresponds to this baseline, I've done some reading around but cannot figure it out. I presume I need to do a repo init -u git://android.git.kernel.org/platofrm/manifest.git -b BASELINE but I can't figure out what BASELINE should be.
Many thanks in advance for any help you can give me!!!
There are some branches in android sources:
master
cupcake
release-1.0
Apps from the first two will not run on default G1, you need to reinstall a whole system. I think by default, following google docs you'll get master. So you need to download a release-1.0 sources.
I may be wrong, but that is what I'm see from my experience.
Thanks for that, I'll get the 1.0 branch downloaded and have a go with that.
Cheers for your help!
I was also trying to recompile some of the built-in apps, specifically the browser, but I can't even get it to build. I get a bunch of import errors, stating that it can't find some of the android libraries, such as android.net.http.AndroidHttpClient, android.os.AsyncTask, etc. I've got the android.jar from the SDK in my build path, and it finds some of them, such as android.webkit.URLUtil.
Can anyone shed some light on what I need to do to get it to see the missing libraries? Thanks.
UndeadCretin said:
Thanks for that, I'll get the 1.0 branch downloaded and have a go with that.
Cheers for your help!
Click to expand...
Click to collapse
There are around a dozen build breaks in release-1.0... all of them are due to missing header #includes in various .c and .h files. So, when it doesn't work, don't give up. Fix the breaks and everything will build properly.
Are you resigning the .apk files? Cuz you have to do that for them to work correctly.
Koush said:
There are around a dozen build breaks in release-1.0... all of them are due to missing header #includes in various .c and .h files. So, when it doesn't work, don't give up. Fix the breaks and everything will build properly.
Click to expand...
Click to collapse
Yep I fixed these problems but I have now hit upon the following problem:
(unknown): error 17: Field android.hardware.SensorManager.LIGHT_NO_MOON has changed value from 0.0010f to 0.001f
******************************
You have tried to change the API from what has been previously released in
an SDK. Please fix the errors listed above.
******************************
I've been in and modified SensorManager back to 0.0010f and that let me build get further but I hit the same error again later in the build.
Given that release-1.0 should be a stable branch is it normal to get all these build issues?
Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!
Just tried building the AlarmClock application and running on the G1 and it works fine. Thanks everyone for your help!
>Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!
Can you write, what did you fix?
^ Agreed, let us know which files need modifying and what needs doing, i've been trying to get my release-1.0 build root working too!
Alternatively, UndeadCretin, could you build the firmware (release-1.0) with a modified framework-res i can send you?
Ok, I managed to compile it without any editing of xml.
Just added stdlib, string, vector headers to dozen of cpp/h.
worry said:
>Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!
Can you write, what did you fix?
Click to expand...
Click to collapse
To fix the java issue, I modified frameworks/base/core/java/android/hardware/SensorManager to change the LIGHT_NO_MOON value to 0.0010f (from 0.001f) and in out/target/common/obj/PACKAGING I modified the <field name="LIGHT_NO_MOON" to have value-"0.0010f">
After this there were several other c++ files which were missing relevant includes. I'm afraid I didn't keep a note of these so cannot provide much detail but mostly they were missing one of the following
#include "stdlib.h"
#include "string.h"
#include "stdio.h"
I think one file needed the following include
#include <string>
and there were a couple of other files that needed other includes. The best way to find these is to google for the function name that isn't building and you should be able to find the appropriate include (that's how I did it).
Hope that helps a bit!
were you able to repo sync after adding the local_manifest.xml?
ximonx said:
were you able to repo sync after adding the local_manifest.xml?
Click to expand...
Click to collapse
I did try that previously but it didn't work. I don't think the relevant files for the dream build are available in the release-1.0 branch. This wasn't a problem for me since I'm only interested in building the applications which work fine with the generic build.
I would like to do the same for the mms application. Could you give me the steps or a link how to do it? I mean do I need the whole sources from android platform to do it? How can I just compile one application?
Phlogiston said:
I would like to do the same for the mms application. Could you give me the steps or a link how to do it? I mean do I need the whole sources from android platform to do it? How can I just compile one application?
Click to expand...
Click to collapse
I downloaded the whole Android source (the release-1.0 branch) and compiled the lot. It may be possible to just build the individual application but I do not know how. It is not vital to build for the dream platform if you only care about the applications since they will work fine with the generic build.
So the basic steps to start are:
Get yourself a Linux or Mac OS platform (I use Ubuntu running in VMWare on my XP box).
Follow the instructions here: http://source.android.com/download but when you come to repo init add the flag -b release-1.0
Fix various build problems
When recompiling individual apps to replace system apps is there a way of just building a single application or does the entire thing need making?
ximonx said:
When recompiling individual apps to replace system apps is there a way of just building a single application or does the entire thing need making?
Click to expand...
Click to collapse
My experience is that you have to do the whole thing if you are building from source. There is one way I know of to get around this, which is to use baksmali and smali.
Just to be clear, making the entire thing = build from source root?
ximonx said:
Just to be clear, making the entire thing = build from source root?
Click to expand...
Click to collapse
If you are asking me--yes, that's what I mean. Make sure to build for dream-open as the target (it's generic by default).

H camera & Camcorder apks?! Anyone?

So I'm running The Dude's build and I love it, the only exception is that I miss the camera and camcorder from Haykuro's build. I'm aware of TwistedUmbrella's, but I'd rather stick with what I'm running now. Has anyone been able to install these on other builds with success? If so, can you upload the apk(s)?
Thanks.
I could provide you the files, but they won't really work.
I got libs and APKs on a JF build but Camera force closes, another thread is here, were I try to get some help:
http://forum.xda-developers.com/showthread.php?t=515215
t4c said:
I could provide you the files, but they won't really work.
I got libs and APKs on a JF build but Camera force closes, another thread is here, were I try to get some help:
http://forum.xda-developers.com/showthread.php?t=515215
Click to expand...
Click to collapse
I was working on getting these files over. On native JF they won't load. If they do load, they don't work because of the missing framework. I got the framework to load, so I will pick up where you were and help. I had given up on a "build" because why make an entire build to just incorporate three apks when you can just get three apks into a build. Phone and Dialer moved but would not load the H dialer, but would load the rest. Anyway, let me read your other post...

[Q] Various android-related queries

I have managed to compile (from source) and install CM7.2 on my HTC dream, but my questions below are related to Android:
1. Is there a way to find out which packages (.apk) were installed on my system and if so, how do I do that?
2. Is there a way to find out each package dependencies (I need to figure out this as I am bent on removing the vast amount of guff installed on the phone - I won't need 90% of this stuff)?
3. Similarly to 2 above - is there a way to look at dependencies of a package not yet installed on my system (i.e. the .apk file)?
4. How do I actually remove a package for good from the system?
5. Similarly to 3 above, how do I actually install a package from within the root system - I know I can do this via adb, but is there a way to do this inside the, say, command line terminal?
6. Is there a way to alter (understand remove) certain program permissions which I could see "granted" to a particular program/package? I know there are various ways to look at these, but I wish to remove permissions I am not happy being granted to that particular program/package.
And one last a bit more advanced query: I would like to build a single package from the source tree and then install the resulting .apk file on my system.
Basically, I will try to upgrade a package with a new revision and add a few patches to the package source of my own before compiling it and building it again.
I usually build the whole lot (all packages + the rootfs image itself) with "mke bacon", but if I want to alter the source and build a single package how do I do that?
I am not very familiar with the Android make system, so I don't want to go heads-first into something and make a real mess of it.
Thanks a lot for any assistance given.
Small addition as apparently I cannot post a reply (too few posts) in this thread: http://forum.xda-developers.com/showthread.php?p=9055790#post9055790
Question to ezTerry (if he is reading this!): the advice given in that post above was absolutely splendid! I followed it religiously and it worked an absolute treat!
There is one exception though - I've LOST all of my IMEI, IMEI SV and Baseband information after applying these fixes. As soon as I installed the radio updates and then installed my newly-compiled kernel + CM7.2 (successfully!) I then checked the above fields from Settings and they were all gone!
After a while, the baseband, IMEI and IMEI SV appeared, but the IMEI and IMEI SV stuff have now different values than what I've had previously (I've had T-Mobile IMEI, now it appears that I was "assigned" O2 IMEI & IMEI SV values - very bizarre!).
Is this something I need worry about and (I don't yet have a sim card, but I plan to get one soon after I fix my phone), more importantly, how the hell do these IMEI numbers appeared on my phone - where did they came from?!
josh36 said:
Small addition as apparently I cannot post a reply (too few posts) in this thread: http://forum.xda-developers.com/showthread.php?p=9055790#post9055790
Question to ezTerry (if he is reading this!): the advice given in that post above was absolutely splendid! I followed it religiously and it worked an absolute treat!
There is one exception though - I've LOST all of my IMEI, IMEI SV and Baseband information after applying these fixes. As soon as I installed the radio updates and then installed my newly-compiled kernel + CM7.2 (successfully!) I then checked the above fields from Settings and they were all gone!
After a while, the baseband, IMEI and IMEI SV appeared, but the IMEI and IMEI SV stuff have now different values than what I've had previously (I've had T-Mobile IMEI, now it appears that I was "assigned" O2 IMEI & IMEI SV values - very bizarre!).
Is this something I need worry about and (I don't yet have a sim card, but I plan to get one soon after I fix my phone), more importantly, how the hell do these IMEI numbers appeared on my phone - where did they came from?!
Click to expand...
Click to collapse
Any takers?
@1 Check out the respective directories, i.e. for system apps /system/app
@2 Trial and Error, or someone might have made such a list for your device already
@3 No simple way, you would have to look through the decompiled code i guess
@4 Remove the apk from the folder (for example /system/app) and reboot your device, after wards you might have to clean up some extra folders, i.e. settings of that app. (you can use SD Maid from my signature for that)
@5 Some can just be installed the usual way, by opening it. Some .apk files have to be put in the system folders, afterswards reboot and the app should be "installed". To put those apps there use a rootcapable file explorer of your choice. To edit /system you will need to remount it as it is read only by default, you can do that through command line, but most good file explorers have an option for that.
@6 Yes thats possible, there was an app to do that, just not sure what it was called... It is very likely though, that those apps will not work correctly or just FC.
For the make system, if you just change a package, and build again, it will most likely just rebuild the changed files. I'm not so sure either though... damn make system can be pretty messy... and get upset real fast if you change something ;-).
Dark3n said:
@1 Check out the respective directories, i.e. for system apps /system/app
Click to expand...
Click to collapse
Yep, that indeed helped - I didn't realise that the .apk files are "intact" and do not behave in the "standard" (in Linux terms) way a "package" behaves - the app is "installed" as soon as .apk is placed in /data/app or /system/app. The PacketManager does the rest on reboot.
It also cleans up the mess "automagically" if I delete .apk file and reboot, which is nice.
Dark3n said:
@2 Trial and Error, or someone might have made such a list for your device already
Click to expand...
Click to collapse
Yeah, that's a real bugger - I can't see a way of finding the dependencies, but I haven't looked properly at "pm" (the Package Manager command line tool) - maybe I could use something there.
Dark3n said:
@6 Yes thats possible, there was an app to do that, just not sure what it was called... It is very likely though, that those apps will not work correctly or just FC.
Click to expand...
Click to collapse
A very simple example will issustrate my point - my calendar application is installed and needs some sort of GOOGLE_MAIL and access to the internet permissions, neither of which I am happy to grant, because 1) I won't be using online calendars; and 2) I won't use (google) mail.
The truth is, I deliberately did not install any google apps as I won't be using any of them - ever!
Now, every time I boot up and look at my log files with logcat I see a bunch of error messages that this application (the calendar) needs a bunch of permissions which do not exist (naturally, as I haven't installed a single google app on my phone).
So, I wish to wipe out these permissions from the calendar so that logcat is not filled with junk every time I start my phone.
As I already pointed out above, there are also some installed apps who are listed to "need" permissions I am not happy to grant - like the internet access to calendar for example (there are more apps, but I think you get the point).
Dark3n said:
For the make system, if you just change a package, and build again, it will most likely just rebuild the changed files. I'm not so sure either though... damn make system can be pretty messy... and get upset real fast if you change something ;-).
Click to expand...
Click to collapse
Yeah, that was my plan B - there must be another - easier - way though.
I wish to update a lot of stuff (I will be recompiling/refreshing existing packages as well as adding new things I developed for "standard" Linux), but with this Android make system I am blind - it is very different to what I am used to in the Linux world.
To top it all off, I can't post in any of the devs forums yet as I do not have 10 posts!
Further to my previous post - I just found out a superb article about stripping out Android and removing unnecessary packages from it - http://wiki.cyanogenmod.com/wiki/Barebones
It lists various dependencies and shows what could be deleted and what cannot be - what I wanted really.
My only remaining problem - at least for now - is the making of specific packages without building the whole image.

Add htc_ime back into stripped down ICS roms

hey, just testing out a few of the stripped down ICS 4.0.3 roms. theyre really great, but the devs always take out the htc_ime. i really like to have that cause of the language selection.
i know i saw somewhere a .zip to flash it back in, but i cant find it now that i need it! anyone know where it is??
thanks!
I heard that HTC_IME is not compatible with ICS...
It is compatible - im using it with no problems. Even HTC trace works fine.
What you need to do (sorry i cant make a flashable zip)
download the zip from HERE
Extract the zip file
Push the HTC_IME.apk (from app folder) to /system/app (I use ES file explorer) and change permissions to RW-R-R
Then push the libs (from lib folder) to /system/lib and change permission to RW-R-R - there should be 5 in total.
Then reboot. I also wiped cache & Dalvik cache just to be sure.
NOTE: if you are using virtuous inquision the lib files are already present. This is the rom im using and since it is based from the HTC leak, the dev has not removed the libs. So all you need is the HTC_IME.apk into /system/app and then you should be able to select the HTC touch input in the keyboard list.
I hope this helps
Doesn't work. Even after copying all the files to their proper folders, ensuring permissions are correct, and wiping cache and dalvik... It still force closes as soon as Touch Input is selected. Just tried it on CM7.
I'm going to try to investigate this problem and see what I can come up with. I know everybody used to say that Clicker.apk was needed. But if you look at most of the ROMs out there, you'll see that they somehow use the HTC_IME keyboard without having Clicker.apk. So what's missing?
Edit: I feel like I'm going to give myself a headache trying to figure this out. The logcat for the FC said (amongst other things) that there is a ClassNotFoundException for KeyboardSettings. There's also a lot of ActivityThread errors which don't really mean much to me. A Google search revealed that it may be related to the AndroidManifest.xml in the APK file, but unfortunately it's not a standard XML file (try opening it to see what I mean). Not to mention, the APK is obviously fine, because I pulled it right from the ROM.
So basically, we need to somehow figure out what other files are needed by HTC_IME.apk, besides the libraries mentioned already in this thread. I assume that it worked for beady_uk because the ROM he was using already had the rest of the required files without him knowing. I'm going to continue looking to see if I can find more information, but I would definitely appreciate if anybody has any technical input into this situation. I can provide logcat information if needed.
Gamesoul Master said:
Doesn't work. Even after copying all the files to their proper folders, ensuring permissions are correct, and wiping cache and dalvik... It still force closes as soon as Touch Input is selected. Just tried it on CM7.
I'm going to try to investigate this problem and see what I can come up with. I know everybody used to say that Clicker.apk was needed. But if you look at most of the ROMs out there, you'll see that they somehow use the HTC_IME keyboard without having Clicker.apk. So what's missing?
Edit: I feel like I'm going to give myself a headache trying to figure this out. The logcat for the FC said (amongst other things) that there is a ClassNotFoundException for KeyboardSettings. There's also a lot of ActivityThread errors which don't really mean much to me. A Google search revealed that it may be related to the AndroidManifest.xml in the APK file, but unfortunately it's not a standard XML file (try opening it to see what I mean). Not to mention, the APK is obviously fine, because I pulled it right from the ROM.
So basically, we need to somehow figure out what other files are needed by HTC_IME.apk, besides the libraries mentioned already in this thread. I assume that it worked for beady_uk because the ROM he was using already had the rest of the required files without him knowing. I'm going to continue looking to see if I can find more information, but I would definitely appreciate if anybody has any technical input into this situation. I can provide logcat information if needed.
Click to expand...
Click to collapse
I believe that you have mis-read the 1st post.
The OP asked how to re-add the HTC_IME to a stripped down rom that the dev had removed.
This is what i have done and it worked - possibly because the roms are sense-based framework.
You have tried to install this on CM7 with is CM based framework so i think you will need more 'files' but that is beyond my knowledge.
Sorry i cant help further
You are correct. I was in a deep search for anything revolving around installing it, so I missed that part. I saw your post (which is the only place I've seen anybody mention installing those lib files), and I guess that caused further oversight on my part.
I do imagine this may not work on all the stripped down ROMs though, if any of the cooks stripped their ROMs like I stripped my old Win98 PC that had a 1GB hard drive in it... that is to say, remove every possible file that wouldn't cause stability issues

[Guide]Barclays mobile banking anti-anti-rootcheck patching

Edit: I've created a xposed module which works with the banking app version 1.7.1 see post below.
---------------------------------------------------
Edit: The changes needed to work with the latest version of the app (1.7.1) are listed in a post below below.
---------------------------------------------------
*There was a error in the diff file. I've uploaded the correct version. Also this patch will definitely not work with the latest version of the app.*
I managed to patch the Barclays mobile banking app version 1.4.2 to make it work with cyanagonmod 10.0 and cyanogenmod 11.
I realize that the current version on play store is 1.7.1 but I haven't updated to the latest version yet. If you do try the latest version please let me know if it differs greatly from the current version in it's root checks
I'm not going to attach the patched apk since using banking app from a stranger on the internet is really not a smart thing . Instead I will detail the work I did which hopefully someone else will find useful.
This guide is geared towards more technical people who already have some experience with android development. It will not give a detailed step by step how to, rather a general information about the process.
Obfuscation methods used in the app
The app obfuscates the names of some but not all of the namespaces/classes/methods which can stump some decompilers.
It seems to generously sprinkle useless switch statements and loops which does nothing but make the code appear way more complicated than it really is. I would guess quite a lot of the bulk in the code is coming through these dummy statements. smali2java-toolkit was of great help to figure this out.
All strings in the app have been encrypted by a simple xor algorithm which is then decrypted at run time just before they are used:
for example rather than
Code:
myfunction(“Hello world”)
the code writes something in the sort of:
Code:
myfunction(decrypt(“Juqqdxidqw”, 'x'))
The decryption function is a static method 'bЮЮЮЮЮЮ' in the class appears to be 'rrrrrr.srrrrr' (the method/class/namespace names are obfusecated)
I extracted the decompiled code from this method to write a console application which let me decrypt any string in the application:
Code:
static String decrypt(String crypStr, char keyChar) {
char[] arrayOfChar1 = crypStr.toCharArray();
char[] arrayOfChar2 = new char[arrayOfChar1.length];
for (int i = 0; i < arrayOfChar1.length; i++)
{
int j = keyChar ^ arrayOfChar1[i];
arrayOfChar2[i] = ((char)j);
}
return new String(arrayOfChar2);
}
Anti root methods used in the app
Checking for 'test-keys' string in the build tag. (/system/build.prop file)
Checking for superuser related package/apk files.
Checking for superuser hider package/apk files.
Checking for existance of 'su' binary
Attempting to execute 'su' binary​The above checks are done both in the java/dex code and in a native code library.
Defeating the anti-root methods in Java/dex code:
The Java code is fairly easy defeat since changing the strings of the apk/file names which are checked as root related will make it think that no 'bad' apps are on the phone.
A bulk of checks happen in the isRootedDevice method of the com.barclays.android.application.BMBApplication class. While it checks for quite a lot of apk's, for my particular purpose I only needed to patch 2 lines in the method:
Smali file line 306 – which starts the checks for “test-keys” string in the build tag.
Smali file line 407 – which start the check for the string “/system/app/Superuser.apk”.​The next method in the same class 'runRootCommand' attempts to execute 'su'
Smali line: 956 – which contains the string “su” which will be passed to java.lang.Runtime.exec
A (mostly?) duplicate of the isRootedDevice function exists in the com.barclays.android.container.DeviceData the relevant lines are :
smali file line 1237: "test-keys" string check
smali file line 1271: "/system/app/Superuser.apk" file check​All of the above checks can easily be defeated by changing the the string so that it will check for a non existent package or file.
Keep in mind that all the strings listed above are in encrypted form. You can use the decrypt function listed above to decode them. I found the key char/byte needed to decrypt a given string is in the very next line to the one containing the encrypted string.
Defeating the anti-root methods in Native library
From what I can see the exact same tests which were done in the Java code is repeated in the native code library 'libtest_ndk.so'. As this check appears to form part of the authentication mechanism i don't believe it's possible to simply stop this check from being called from the Java code.
Also the com.barclays.android.container.sampler.SharedLibraryLoader which loads the native library appears to be doing some kind of checksum validation. While this probably could be easily worked around, disassembling an arm shared library was non trivial for me.
My approach was to write another native library which would hook into all the system calls such as 'system' 'stat' 'fopen', '__system_property_get' and redirect any operations to non existent targets, or change the return value. This achieves the same thing as what was done for the java code.
I put in some extra code into the smali classes to load my native library and to call it's initializer with the path to the actual native library.
Basic steps performed to patch the library:
Use apktool to decompile the original apk.
Code:
apktool d barclays.apk barclays
Use smali2java as helper to understand the code: This tool cannot decompile the critical check functions due to obfuscation. However it made it easier to understand the smali files generated by the apktool.
Patch the smali files to work around the checks as described above.
Build the hooking native library seperately
Code:
~/adt/adt-bundle-linux-x86_64-20131030/sdk/tools/android update project --path . --target android-19
ndk-build
Include the hooking shared library into the lib/armeabi of the decompiled package and change the smali files to load the new shared library.
Use apktool to rebuild the apk.
Code:
Apktool b barclays barclays.apk
Sign the apk from using your own key.
Create keystore:
Code:
keytool.exe -genkey -v -keystore my-release-key.keystore -alias release -keyalg RSA -keysize 2048 -validity 20000
Sign Keystore:
Code:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore barclays.apk release
Attached is the code for the hook library native project and the diff for the smali changes. Please note that this is for the smali files for generated by apktool (v1.5.2) for the version 1.4.2 of the Barclays mobile banking app.
For Users of other ROMs/SU applications and root hiders.
The app checks for a lot of common packages which I did not bother to patch since I don't use them, but if you do then you should put fixes for all those package/file names in both the smali and native code hook library.
A non exhustive list of files it check are:
Code:
/system/bin/amphoras
/system/bin/su
/system/xbin/su
/system/app/superuser.apk
/data/data/com.amphoras.hidemyroot
/data/data/eu.chainfire.supersu
/data/data/stericson.busybox
/data/data/stericson.busybox.donate
/data/data/com.jrummy.busybox.installer.pro
/data/data/com.jrummy.busybox.installer
/data/data/com.rootuninstaller.free
/data/data/com.rootuninstaller
Hey i will try this out shortly and post a APK (whether you use it or not thats up to you, but i am well known in the xperia play section of this website and should be trusted, Still its up to you.)
EDIT: well i am not a android developer, i can follow almost all this post except the bits about the native library any chance of a bit more information
specifically this bit "Include the hooking shared library into the lib/armeabi of the decompiled package and change the smali files to load the new shared library."
i assume that means just simply copy the built lib file in to that folder then include the file in the code somewhere? where do i do that to?
Sorry about the late reply but I just saw this message.
fma965 said:
EDIT: well i am not a android developer, i can follow almost all this post except the bits about the native library any chance of a bit more information
specifically this bit "Include the hooking shared library into the lib/armeabi of the decompiled package and change the smali files to load the new shared library."
i assume that means just simply copy the built lib file in to that folder then include the file in the code somewhere? where do i do that to?
Click to expand...
Click to collapse
That's pretty much correct. There is already a 'libtest_ndk.so' file in the lib/armeabi folder of the apk. You just have to build my code from the zip file to get the libhooktest.so, which should then be copied into the lib/armeabi folder alongside the libtest_ndk.so.
Edit: Not sure if this is enough instructions. I'm just not good at writing instructions. Steps you need to build the native library are in my post. If you need more info i suggest about building the library http://code.google.com/p/awesomeguy/wiki/JNITutorial#Setup_Environment is a good
Afterwards you have to do the modifications I've listed in the diff to the .smali files.
But i have some bad news about this patch:
The diff file i have attached in the post is wrong. I've mistakenly uploaded the patch to reverse the changes i did . I will update the post with the correct diff file.
It will only work for Barclays app version 1.4.2. it will definitely not work for the latest version of the app which is 1.7.1.
I'm currently going through the code of 1.7.1 I've made some headway into the code but there I'm quite way off from getting it to work.
If you wish I can give you a copy of the original 1.4.2 of Barclays app, the built lib file and the patched app. I would recommend against using the patched app blindly but it might make it easier to figure out the changes i did. I would rather not upload them to xda though.
HiddenRambler said:
Sorry about the late reply but I just saw this message.
That's pretty much correct. There is already a 'libtest_ndk.so' file in the lib/armeabi folder of the apk. You just have to build my code from the zip file to get the libhooktest.so, which should then be copied into the lib/armeabi folder alongside the libtest_ndk.so.
Edit: Not sure if this is enough instructions. I'm just not good at writing instructions. Steps you need to build the native library are in my post. If you need more info i suggest about building the library http://code.google.com/p/awesomeguy/wiki/JNITutorial#Setup_Environment is a good
Afterwards you have to do the modifications I've listed in the diff to the .smali files.
But i have some bad news about this patch:
The diff file i have attached in the post is wrong. I've mistakenly uploaded the patch to reverse the changes i did . I will update the post with the correct diff file.
It will only work for Barclays app version 1.4.2. it will definitely not work for the latest version of the app which is 1.7.1.
I'm currently going through the code of 1.7.1 I've made some headway into the code but there I'm quite way off from getting it to work.
If you wish I can give you a copy of the original 1.4.2 of Barclays app, the built lib file and the patched app. I would recommend against using the patched app blindly but it might make it easier to figure out the changes i did. I would rather not upload them to xda though.
Click to expand...
Click to collapse
No worries about the late reply, yeah you basically told me what i assumed it was i had to do, however when i was trying to do it i didn't have a 1.4.2 apk so was trying ot use 1.7.X and obviously failed .
Yeah the modifications to smali files is easy well when you know what your changing xD
if you could upload the apk for 1.4.2 that would be great, i would assume that as long as the signature matches the official apk its untampered, your modified one will obviously be signed with a different signature though.
:cyclops:
Good news. I've managed to get latest version 1.7.1 patched . I will try to post the patch information this weekend. In the meantime i suggest anyone interested download a copy from the play store and keep a backup of the apk in case they release a new version.
Fix for latest version of the mobile banking app (version 1.7.1)
I've figured out the changes required for the v1.7.1 of the app which is the latest version as of this post.
Changes from the old 1.4.2 are:
Almost all the classes in the app are now obfuscated, whereas before only some of the core class names were obfuscated.
The string encryption has changed. rather than a single encryption function it now uses a group of functions to perform the encryption. rrrrrr/vuuuvu class seems to manage invoking the proper decryptor based on the arguments.
All root checking is now done via the native library.
Native library now does some checks as soon as it's loaded before any methods are called.
The last change is a big problem since its not possible to do the patching of the dll after loading it as was done before. The onload/init of the dll exits the whole application as soon as it detects the phone is rooted.
My solution was to use a modified version of the 'crazy_linker' custom loader library which comes with the ndk to load the library into memory without invoking it's onload/init functions. This lets us hook into the necessary functions before they are called.
I've attached the smali changes as a diff and the new native hook library in this post.
As a side note I think the version 1.4.2 is a far better version. Why on earth would a banking app need to permissions to take pictures, who spends their time 'customizing' a banking app with personal pictures.
Edit: I've fixed a bug where the root was still being detected when used with chainfire su app. Special thanks to lil-diabo for helping me fix the issue. :good:
Xposed module for barclays banking app 1.7.1
Edit: New version (BarcPosed1.1.apk) has some support for barclays pingit. I've not tested this my self as I don't use the application personally. If anyone tries it please let me know.
I've converted my patch into xposed module. This module is compatible with the current banking app (version 1.7.1).
Please consider this as a beta version for now. I've tested it on cyanogenmod but it might have some issues with other roms. If you try it please let me know if it worked.
Assuming you already have a working xposed installation the steps to get the app working are:
1) Install banking app from playstore. Make sure it's version 1.7.1
2) Install the BarcPosed.apk from my post.
3) Run the BarcPosed app and click the 'install' button. You will need to grant it root permissions.
4) Enable the module in xposed and reboot.
5) Use the barclays app as normal.
6) Disable automatic updates for the banking app to prevent it from updating.
I've included the source code for the app.
Thanks, works perfectly. You sir (or madam) are a genius
Sent from my GT-I9300 using XDA Premium 4 mobile app
Works like a charm
Just tested it and it works!
Most excellent, Thanks again for your hard work.
So much easier than having to manually edit the files etc.
It works,excellent job, finally can use Barclays mobile, thank you very much
sent from Samsung Galaxy S4 Active
Just tested and it worked marvellously. Could you please make a fix for pingit as well?
Zell Dinch said:
Just tested and it worked marvellously. Could you please make a fix for pingit as well?
Click to expand...
Click to collapse
HiddenRambler said:
Edit: New version (BarcPosed1.1.apk) has some support for barclays pingit. I've not tested this my self as I don't use the application personally. If anyone tries it please let me know.
Click to expand...
Click to collapse
I've updated my post with version that stops the rooted warning from pingit. Don't use pingit myself so don't know how successful it is. Let me know if you try it.
Brilliant, been struggling in vain with Root Cloak Plus on my N5 but this works perfectly. Many thanks.
Sent from my Xoom Wifi using Tapatalk
Before I switched to KK, I used Barclays App 1.3 doing a small trick with SuperSU. It worked perfectly. I signed the app myself so that it wouldn't update itself from the market and so that I could still use the automatic update in the market.
Do you think it would be possible to make your AMAZING solution work with my v1.3 signed app instead?
thnx
vivelafrance said:
Before I switched to KK, I used Barclays App 1.3 doing a small trick with SuperSU. It worked perfectly. I signed the app myself so that it wouldn't update itself from the market and so that I could still use the automatic update in the market.
Do you think it would be possible to make your AMAZING solution work with my v1.3 signed app instead?
thnx
Click to expand...
Click to collapse
You could try "root cloak" or "root cloak plus" they probably will work.
Actually, what I did, is sign the app with OneClickSigner and it worked fine. Now, the app is not attached to the market anymore since the signature changed, so that means I can continue to use the "automatic update" from the market and it won't ask me to update the app all the time when Barclays upload a new version.
thnx
HiddenRambler said:
...
I've converted my patch into xposed module. This module is compatible with the current banking app (version 1.7.1).
...
Click to expand...
Click to collapse
Hello,
I have a request, can you make it compatible with GingerBread plz?
Thanks.
LoMAX_HUN said:
Hello,
I have a request, can you make it compatible with GingerBread plz?
Thanks.
Click to expand...
Click to collapse
Can you try the attached apk. It's the same code but built as an app for gingerbread version (API lvl 10). I couldn't test it as I don't have a phone for that version.
If it doesn't work please give me a logcat.
Banking Works, but Not PingIt
HiddenRambler said:
Edit: New version (BarcPosed1.1.apk) has some support for barclays pingit. I've not tested this my self as I don't use the application personally. If anyone tries it please let me know.
I've converted my patch into xposed module. This module is compatible with the current banking app (version 1.7.1).
Please consider this as a beta version for now. I've tested it on cyanogenmod but it might have some issues with other roms. If you try it please let me know if it worked.
Assuming you already have a working xposed installation the steps to get the app working are:
1) Install banking app from playstore. Make sure it's version 1.7.1
2) Install the BarcPosed.apk from my post.
3) Run the BarcPosed app and click the 'install' button. You will need to grant it root permissions.
4) Enable the module in xposed and reboot.
5) Use the barclays app as normal.
6) Disable automatic updates for the banking app to prevent it from updating.
I've included the source code for the app.
Click to expand...
Click to collapse
xposed is fantastic!
This worked for me. It's so nice to be able to update my SU binaries without fear of breaking the app.
I'm running Cyanogenmod v10.2.0 on a Samsung Galaxy S3 (International) (i9300).
I tried using the v1.1 of the BarcPosed.apk with PingIt, but it still tried to gain root and then closed itself immediately.

Categories

Resources