Help to port MOD Touchwiz from AT&T to i9300 intl - Galaxy Note II, Galaxy S III Developer Discussion

Hi all!
I'm trying to port a touchwiz mod from AT&T to i9300 intl. The goal is to center all apps icon in touchwiz. Hotseat.smali are very different from one version to other.
The problem is (I think) ".field private static final sAllAppsButtonRank:I" doesn't exists in hotseat international version.
Originally the how-to was made by magn2o in this post http://forum.xda-developers.com/showpost.php?p=30909479&postcount=70
And this is the code to modify:
Code:
@@ -24,7 +24,7 @@
# static fields
.field private static final TAG:Ljava/lang/String; = "Hotseat"
-.field private static final sAllAppsButtonRank:I = 0x4
+.field private static final sAllAppsButtonRank:I = 0x2
# instance fields
@@ -306,7 +306,7 @@
.prologue
.line 116
- const/4 v0, 0x4
+ const/4 v0, 0x2
if-ne p0, v0, :cond_0
@@ -1915,7 +1915,7 @@
.prologue
const v12, 0x7f0e002a
- const/4 v11, 0x4
+ const/4 v11, 0x2
const/4 v3, 0x0
Greetings!

I just want to make sure I'm interpreting your message correctly: The purpose of that mod is to cause the app drawer icon on the home screen to be in the center of the dock instead of the right side of the dock?
How familiar with smali are you?
You might have to get the proper apk from an AT&T firmware, decompile it, and study the smali, and then do the same with an international apk. Use the AT&T one just to provide "hints" on the general things to look for in the international one.
Take care
Gary

garyd9 said:
I just want to make sure I'm interpreting your message correctly: The purpose of that mod is to cause the app drawer icon on the home screen to be in the center of the dock instead of the right side of the dock?
Click to expand...
Click to collapse
Yes, that is.
garyd9 said:
How familiar with smali are you?
Click to expand...
Click to collapse
I started learning a month ago (totally noob). I've published a rom (based on stock) in my blog site with some modifications. Learned some mod tutorials and how-to from xda.
garyd9 said:
You might have to get the proper apk from an AT&T firmware, decompile it, and study the smali, and then do the same with an international apk. Use the AT&T one just to provide "hints" on the general things to look for in the international one.
Take care
Gary
Click to expand...
Click to collapse
I've decompiled SecLauncher2.apk modified (from AT&T MOD thread) compared some files and code and no luck with that.
For example, mod is based in this: private static final sAllAppsButtonRank:I = 0x2 (change 0x4 to 0x2). But intl version does not have sAllAppsButtonRank in code. Tried to add this code in hotseat.smali and modified LauncherModel$LoaderTask and LauncherProvider$DatabaseHelper. Of course (because I'm noob), it doesn't works. I've found some web sites to start learning smali code but not a "complete" guide.
Thanks a lot for your help!

cybdani said:
For example, mod is based in this: private static final sAllAppsButtonRank:I = 0x2 (change 0x4 to 0x2). But intl version does not have sAllAppsButtonRank in code. Tried to add this code in hotseat.smali and modified LauncherModel$LoaderTask and LauncherProvider$DatabaseHelper. Of course (because I'm noob), it doesn't works. I've found some web sites to start learning smali code but not a "complete" guide.
Click to expand...
Click to collapse
You cant just drop in a variable and expect code to suddenly use it just because it exists. Chances are that the international version does nearly the same thing, but without the constant variable. You'll have to figure out how the code works; it's not enough to just copy things. That's the difference between developing and just taking stuff from other people.
When I get to my PC later, I'll give you a link that explains what the smali commands do, and you can reverse engineer from that.
The expectation is that you'd rather learn HOW to do this type of thing... Not just have someone do it for you (or give you the exact steps for it.)
Sent from my Nexus 7 using Tapatalk 2

here's the link as promised: http://s.android.com/tech/dalvik/dalvik-bytecode.html

Thank you very much.
Time to learn now :good:

Related

[MOD] YouTube that always defaults to high quality

I got fed up with the YouTube app starting videos in normal quality. To watch high quality I had to click menu and select it. The app is supposed to default to a quality suitable for your current connection but IMHO it sucks at that.
My solution was to mod the app so it always defaults to high quality. It was a 2 minute hack using apktool from brut.all (great tool, thanks!). Changes was made to PlayerActivity.smali. All I did was to remove a if condition statement by adding a # first on the line (comment) so preferHiRes always is true.
Code:
.line 166
invoke-virtual {p0}, Lcom/google/android/youtube/PlayerActivity;->getNetworkSpeed()I
move-result v0
const/4 v1, 0x3
#if-ne v0, v1, :cond_0
const/4 v0, 0x1
:goto_0
iput-boolean v0, p0, Lcom/google/android/youtube/PlayerActivity;->preferHiRes:Z
.line 168
invoke-direct {p0}, Lcom/google/android/youtube/PlayerActivity;->loadYouTubePlayer()V
Source apk is YouTube.apk from gapps-passion-EPE54B-signed.zip.
Download HQ mod
Install (root required, tested on CM 5.0.6):
Extract the apk from the zip (it's NOT a flashable update.zip)
Push it to /system/app
Code:
adb remount
adb push YouTube.apk /system/app/YouTube.apk
This mod is provided as is without guarantees. It works for me and I though I'd share it in case anyone else wanted it. Nandroid first is always good.
AWESOME!!!
There's a thread in the general forum with a modified apk file. Works great
http://forum.xda-developers.com/showthread.php?t=632969&page=6
jonasl, just a nood question...
Where would it have to put "#" to set low qualitiy as default?
Missed the other one completely... I didn't look for app mods in the Q&A section
To get normal quality as default you should ensure that the boolean variable preferHiRes always is false. There are several ways to do this. A rough translation of the original assembly code to java would look something like this
Code:
if(getNetworkSpeed() == 3)
preferHiRes = true;
else
preferHiRes = false;
loadYouTubePlayer()
My mod takes away the if so the code logically runs like this
Code:
if(true)
preferHiRes = true;
else
preferHiRes = false;
loadYouTubePlayer()
You want something like
Code:
if(true)
preferHiRes = false;
else
preferHiRes = false;
loadYouTubePlayer()
This could be done like this
Code:
.line 166
invoke-virtual {p0}, Lcom/google/android/youtube/PlayerActivity;->getNetworkSpeed()I
move-result v0
const/4 v1, 0x3
#if-ne v0, v1, :cond_0
const/4 v0, 0x0
:goto_0
iput-boolean v0, p0, Lcom/google/android/youtube/PlayerActivity;->preferHiRes:Z
.line 168
invoke-direct {p0}, Lcom/google/android/youtube/PlayerActivity;->loadYouTubePlayer()V
Notice that I have only changed const/4 v0, 0x1 to const/4 v0, 0x0. This corresponds to the pseudo java code outlined above.
Of course one could rewrite it all a little bit more for easier reading:
Code:
preferHiRes = false;
loadYouTubePlayer()
This would correspond to
Code:
.line 166
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/google/android/youtube/PlayerActivity;->preferHiRes:Z
.line 168
invoke-direct {p0}, Lcom/google/android/youtube/PlayerActivity;->loadYouTubePlayer()V
.line 169
return-void
.end method
Find .line 166 in PlayerActivity.smali and substitute everything between it and .end method with the snippet above. Change const/4 v0, 0x0 to const/4 v0, 0x1 to default to high quality.
Hope you learned something from this... I know I suck at explaining things that I think are simple but I'm trying Sharing knowledge is what pushes this and other communities forward.
Thanx for taking your time and sharing knowledge, I appreciate it!
jonasl said:
I know I suck at explaining things that I think are simple but I'm trying
Click to expand...
Click to collapse
You don't suck. That was excellent.
Thanks.
wow~thanks!!!!
it works for my hero!
btw, do you know how can i set my location in this app?
my previous youtube app's front page showed the video according to my location(Hong Kong ) such as Most viewed, most discussed...etc...
but now seems to be connected to worldwide...
No idea about the localization. Everything changed is outlined above (ie I haven't touched it). I would guess that the application checks your locale to determine what to show since that's how other Google stuff works (GeneWidget for example). Maybe other versions of the apps works different from this one.
thanks for your reply!
actually i've tried several versions of Youtube.apk...
only some older versions could check my locale correctly, but, those are not high quality supported in 3G connection...
it's there any methods that can change the older versions youtube.apk to default always high quality??
not to be condescending, but a youtube that defaults to HQ was done like back in january...
http://alldroid.org/threads/14738-app-script-xUltimate-v1.2.4-**UPDATED-02-17-10**
and thats just to show that a patcher xeudoxus created already had it implemented by the end of january...i dont remember exactly how much further back it was actually released.
Wow~finally I did it too!
I followed your instruction and usee apktool to modify the older version YouTube.apk and it really work on my Hero
There was some differents as it didn't have PlayerActivity.smali, instead, i found YouTubeplayer.smali which is similar to it.
I just removed the whole line of ' if-ne v0, v1, :cond_0 ' and didn't change anything.
Really thanks for your instruction. I can now see the local high quality videos!
File is uploaded in case someone needs.
I tried to push the YouTube.apk to /system/app/YouTube.apk but it gives me an error about read only file system.
Does anyone know how to solve this?
Thanks.
crimsondr said:
I tried to push the YouTube.apk to /system/app/YouTube.apk but it gives me an error about read only file system.
Does anyone know how to solve this?
Thanks.
Click to expand...
Click to collapse
do:
adb remount
first.
gIMpSTa said:
do:
adb remount
first.
Click to expand...
Click to collapse
That worked. Thanks!
MYxdaUSERNAME said:
not to be condescending, but a youtube that defaults to HQ was done like back in january...
http://alldroid.org/threads/14738-app-script-xUltimate-v1.2.4-**UPDATED-02-17-10**
and thats just to show that a patcher xeudoxus created already had it implemented by the end of january...i dont remember exactly how much further back it was actually released.
Click to expand...
Click to collapse
Off topic: Not getting what you are trying to say and the link doesn't contain any details. Personally I don't really care if someone made a similar or identical mod before me. I'm not in for the attention. I'm in for the fun of it and then share stuff I think others will enjoy as well (including the know how). Also, this mod isn't exactly that advanced so anyone with some basic Dalvik experience could have done it independently just as I did.
On topic:
If you are getting messages about xml parser errors (that can just be dismissed my hitting back):
I've been getting this more and more myself both prior to applying my HQ mod and afterward. It's not related, not if you are using my mod anyway. What's changed in my mod is described in detail in this thread and it's not related to xml parsing. Several users of stock firmware have this issue as well, here are some examples:
http://www.google.com/support/forum/p/android/thread?tid=7520c38a6e2e4ce3&hl=en
http://www.google.com/support/forum/p/android/thread?tid=44b225740841f9d4&hl=en
http://www.droidforums.net/forum/te...ggestions/20880-connection-error-youtube.html
The solution seems to be to clear the YouTube data and cache in Manage Applications. Try this if you run into this issue.
Always HQ built into version 1.6.20
I just discovered that Youtube version 1.6.20 has this option built in already. It's in the settings menu. I pulled it from Paul's Desire rom and it works perfectly. It also has a HQ toggle button on the right side of the time slider.
gj13 said:
I just discovered that Youtube version 1.6.20 has this option built in already. It's in the settings menu. I pulled it from Paul's Desire rom and it works perfectly. It also has a HQ toggle button on the right side of the time slider.
Click to expand...
Click to collapse
Could you post the apk?
hey i do i go back to the regular setting theres alot of videos that dont have the high quality option im assuming so they wont even play for me
Aitese said:
Could you post the apk?
Click to expand...
Click to collapse
here: YouTube 1.6.20 (E)

Problems on SMS text limitation to 1000 per conversation

Hey guys, I am very upset towards the limitation over the stock sms apps in my razr maxx as I would certainly like to store something SMS sent from my dearest.
So I desired to make some tweaks over the messaging apps. I search over and over and finally got the setting code in MessageSettings.smali.
Let me give you some code about it
.field private static final MMS_MAX_SMIL_SIZE:I = 0xc8
.field public static final SMS_MMS_DEFAULT_MESSAGE_COUNT_PER_THREAD:I = 0xc8
.field public static final SMS_MMS_MAX_MESSAGE_COUNT_PER_THREAD:I = 0x3e8
.method public static getConversationMessageLimit()I
.locals 3
.prologue
.line 1280
sget-object v0, Lcom/motorola/messaging/settings/MessageSettings;->mDefaultPrefs:Landroid/content/SharedPreferences;
const-string v1, "MaxMessagesPerThread"
const/16 v2, 0x3e8
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I
move-result v0
return v0
.end method
Click to expand...
Click to collapse
I modify them, both the default and max limitation to "0xffff", and replace the original apk in system, seems the 1000 limitation is still there:crying:
Anyone knows exactly what's wrong with my modification? Or I need to make more changes in other files?
Thx guys!
Please, don't ask me to use 3rd party SMS apps, as I love my stock SMS apps a lot except for such a limitation!

[APP][MOD][TUT]Discussion: Plex w. Android TV UI for ANY DEVICE

So, I have a Nexus Player, and I absolutely LOVE the way the UI for Plex looks on it. It has a number of added categories and features, and overall, it's just really pretty, and highly preferable to the regular "TV" option in the Plex app.
Unfortunately, the good folks at Plex decided to reserve this only for Android TV...which sucks. I just bought a RikoMagic V5 Rk3288-based Android on a stick to replace my aging RK2066 device, and when it arrives, I'd like the same sexy experience as I have on the Nexus player.
I can already install the leanback launcher...so why not get the plex UI to go with it?
So that's what I did.
EDIT: LOL. So, instead of modifying the APK, it looks like we can just add the permission file it's checking for to /system/etc/permissions/ I've attached it...simply download, extract, copy to /system/etc/permissions, and reboot. Presto! Pretty plex.
I'll leave the other method simply because it's good to know how to do, and can be applicable to many other situations.
HOWEVER, there's an obvious problem. You either have to have purchased the app, or have a Plex Pass to use it. I have not explored the paid version of the app yet, just the Plex Pass one...but that will be done shortly. First I wanted to share my discovery.
Basically, the check for whether or not the device is an Android TV lives in \smali\com\plexapp\plex\application\PlexApplication.smali when you decompile the APK.
In this method:
Code:
.method public B()Z
.locals 2
invoke-virtual {p0}, Lcom/plexapp/plex/application/PlexApplication;->a()Z
move-result v0
if-eqz v0, :cond_0
invoke-virtual {p0}, Lcom/plexapp/plex/application/PlexApplication;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
const-string v1, "android.software.leanback"
invoke-virtual {v0, v1}, Landroid/content/pm/PackageManager;->hasSystemFeature(Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_1
:cond_0
const/4 v0, 0x0
:goto_0
return v0
:cond_1
const/4 v0, 0x1
goto :goto_0
.end method
Here, the code is obfuscated, but the original method is called isAndroidTV. Either way, searching for "android.software.leanback" should get you into the method.
Now, all this is really doing is asking the system if it has the flag "android.software.leanback", so we could probably modify build.prop? to have that flag and be right with the world. But, I haven't tried that yet.
Instead, if we read through what the method is doing, we can see that if it finds "android.software.leanback", it goes to condit_1, which sets const v0 to 0x1, or a "yes" return. So, what if it fails? It runs to cond_0, which instead sets const_v0 to 0x0, or "no".
So, the obvious fix to this is to just make cond_0 return 0x1, or the following code:
Code:
.method public B()Z
.locals 2
invoke-virtual {p0}, Lcom/plexapp/plex/application/PlexApplication;->a()Z
move-result v0
if-eqz v0, :cond_0
invoke-virtual {p0}, Lcom/plexapp/plex/application/PlexApplication;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
const-string v1, "android.software.leanback"
invoke-virtual {v0, v1}, Landroid/content/pm/PackageManager;->hasSystemFeature(Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_1
[B][U] :cond_0
const/4 v0, 0x1
[/U][/B]
:goto_0
return v0
:cond_1
const/4 v0, 0x1
goto :goto_0
.end method
That's it. Just flip the 0x0 to a 0x1 and recompile the apk. Due to it being a Play Store app, it's also necessary to resign with a test key so we can install it.
Here is a link to the final output that I was able to install on my 5.0.1 (lollipop) GPE ROM running on a HTC M8. At this time, I'm unsure whether it will A. Work on a non-lollipop ROM or B. Work on a ROM that doesn't allow test-key signed apps.
However, it is a working proof of concept, and could prove useful to others who use android devices as media center devices.
Also, attached is a screenshot of the POC, albeit looking poor on my phone.
Feel free to try the attached APK and let me know how it works for you. Mods - this is the free Plex Pass version - aside from changing the above .smali, I have not modified or circumvented any other security features (like making it work for everybody). You must have a Plex Pass account to use this.
Post2: Compatibility testing, screenshots.
So, I was able to successfully install the apk on a stock, unrooted Galaxy Tab 4 running android 4.4.2, so it looks like this should work for a lot of people. Screenshots attached. It looks beautiful on a tablet, and despite being made for TV, all touch input works properly.
digitalhigh said:
Post2: Compatibility testing, screenshots.
So, I was able to successfully install the apk on a stock, unrooted Galaxy Tab 4 running android 4.4.2, so it looks like this should work for a lot of people. Screenshots attached. It looks beautiful on a tablet, and despite being made for TV, all touch input works properly.
Click to expand...
Click to collapse
can you mod the non-plexpass version of plex to do this?
defconoi said:
can you mod the non-plexpass version of plex to do this?
Click to expand...
Click to collapse
Unfortunately, it doesn't look like they've pushed that UI to the non-pass version. More than likely, they'll roll it out to all users in the next update or the one after that - at least - that's how Plex usually does things.
When that happens, I'll *still* not be able to release it, as it's a paid version of the app. However, it's possible I could provide a tool to do all the work for people who do have it.
Digitalhigh,
I cannot thank you enough! love your work.
Rob.
I tried it on my xiaomi mibox mini which is running Android 4.4.2. The app starts in leanback mode and I can browse the contents but can't play anything
Sent from my MI NOTE LTE using Tapatalk

[How to] whitelist packages on almost any MTCD head unit

Assumptions:
The unit should be rooted. Otherwise you can’t update system files.
MTCManager.apk should be de-odexed. I was able to do this successfully with "Tickle my Android". Thanks to post below for the suggestion.
The unit is configured for auto-sleep (not delayed shutdown)
Background:
When the unit goes to sleep, most processes and services are “killed”. There is an app by Graser, which goes by the name Dasaita and runs as an Xposed module, that allows apps to be whitelisted and then they will not be killed. However it doesn’t at this time work in Oreo, at least in my experience, and it does not work on Services so it doesn’t help with accessibility services.
General procedure:
1. Extract mtcmanager.apk from the head unit
2. Decompile mtcmanager.apk with apktool.exe
3. Edit a smali file
4. Recompile
5. Copy over the original apk (make a backup of course)
6. Set permissions and owner
7. Restart the HU
Details:
1. The location of MTCManager.apk is /system/priv-app/MTCManager. It requires a file manager that uses root to access it. I like Root Explorer. Copy to USB or SD.
2. Locate apktool and follow the installation instructions to install on a Windows machine. I don’t know if it is or isn’t available for a Unix or Linux machine (or a mac). Make MTCManager.apk readable on the machine where apktool is installed. Enter the command
Apktool d -o <where to decompile> <full path to MTCManager.apk>
Recommend entering “MTCManager.apk” with the original capitalization so it’s easy to copy back.
3. On Oreo the file is c.smali. There are two lists, the first is services and the second processes. Malaysk has added Tasker to both lists. I add as required to both lists. One app didn’t work exactly right and it helped to remove it from the process list.
Note there is a constant before each list specifying the list length.
Adding to the lists is a simple programming task. Roughly speaking duplicate 3 lines of code,change the index (subscript) and app name string, for each of the packages to be added to each list.
4. Enter the command apktool b -c <path where it was decompiled>
This will create a directory called “dist”, containing the modified apk.
5. Copy the new apk to usb or sd, then on the HU copy over the original mtcmanager.apk. Overwriting seems to be the most reliable way to install.
6. Use the file manager to change the permissions to 644, and the owner and group to <root>.
7. Restart the HU.
Thank you for the instructions. This got me started on the right path. However I believe the instructions above are missing a step. You also need to increase the size of the array(s) if you are adding additional applications to the whitelist.
My original c.smail I had the following starting in line 222:
const-string/jumbo v1, "net.dinglisch.android.tasker"
const/16 v2, 0x19
aput-object v1, v0, v2​
This is the last entry added by Malaysk in the services section.
These lines do the following:
Copy "net.dinglisch.android.tasker" to the variable v1
Copy 0x19 (decimal 25) to the variable v2
Add v1 ("net.dinglisch.android.tasker") to Array v0 at position v2 (25)
If you are not using tasker, then you can just replace "net.dinglisch.android.tasker", with the application of your choosing. Otherwise you must add another row to the array.
First you must increase the size of the array.
Starting on line 57 I had:
const/16 v0, 0x1a
new-array v0, v0, [Ljava/lang/String;​
These 2 lines establish array v0.
Copy 0x1a (decimal 26) to the variable v0
Create array v0 of size v0 (26)
To increase the size the array so that you can add another entry, change this to:
const/16 v0, 0x1b
new-array v0, v0, [Ljava/lang/String;​And add a new entry below the tasker entry:
const-string/jumbo v1, "com.teslacoilsw.launcher"
const/16 v2, 0x1a
aput-object v1, v0, v2​The entire process must be repeated again, if you wish to add to the process section.
On line 232 I had:
const/16 v0, 0x1b ==> Changed to 0x1c
new-array v0, v0, [Ljava/lang/String;​Added below tasker entry on line 404:
const-string/jumbo v1, "com.teslacoilsw.launcher"
const/16 v2, 0x1b
aput-object v1, v0, v2​After compiling with apktool, copying MTCManager.apk to the head unit and rebooting, everything works as expected.
albtross said:
Thank you for the instructions. This got me started on the right path. However I believe the instructions above are missing a step. You also need to increase the size of the array(s) if you are adding additional applications to the whitelist.
My original c.smail I had the following starting in line 222:
const-string/jumbo v1, "net.dinglisch.android.tasker"
const/16 v2, 0x19
aput-object v1, v0, v2
This is the last entry added by Malaysk in the services section.
These lines do the following:
Copy "net.dinglisch.android.tasker" to the variable v1
Add v1 ("net.dinglisch.android.tasker") to Array v0 at position v2 (25)
If you are not using tasker, then you can just replace "net.dinglisch.android.tasker", with the application of your choosing. Otherwise you must add another row to the array.
First you must increase the size of the array.
Starting on line 57 I had:
const/16 v0, 0x1a
new-array v0, v0, [Ljava/lang/String;
These 2 lines establish array v0.
Copy 0x1a (decimal 26) to the variable v0
Create array v0 of size v0 (26)
To increase the size the array so that you can add another entry, change this to:
const/16 v0, 0x1b
new-array v0, v0, [Ljava/lang/String;
And add a new entry below the tasker entry:
const-string/jumbo v1, "com.teslacoilsw.launcher"
const/16 v2, 0x1a
aput-object v1, v0, v2
The entire process must be repeated again, if you wish to add to the process section.
On line 232 I had:
const/16 v0, 0x1b ==> Changed to 0x1c
new-array v0, v0, [Ljava/lang/String;
Added below tasker entry on line 404:
const-string/jumbo v1, "com.teslacoilsw.launcher"
const/16 v2, 0x1b
aput-object v1, v0, v2
After compiling with apktool, copying MTCManager.apk to the head unit and rebooting, everything works as expected.
Click to expand...
Click to collapse
Is it possible to post your modified apk ? Are you on malaysk Oreo ?
Yes I'm on Malaysk Oreo.
I can post the apk, but since I only added com.teslacoilsw.launcher & de.dieterthiess.ipwidget, I'm not sure it will do you much good.
albtross said:
Yes I'm on Malaysk Oreo.
I can post the apk, but since I only added com.teslacoilsw.launcher & de.dieterthiess.ipwidget, I'm not sure it will do you much good.
Click to expand...
Click to collapse
I want to do it myself, it's only to compare it with yours as a reference.
I never done this, don't even know what array size is....
albtross said:
Yes I'm on Malaysk Oreo.
I can post the apk, but since I only added com.teslacoilsw.launcher & de.dieterthiess.ipwidget, I'm not sure it will do you much good.
Click to expand...
Click to collapse
I am at Malaysk Oreo and my c.smali is not the same at line 57.
I would like too to see how have you modified the file, as Wout2426 says I want to do it but I don't really understand your post and it would be nice to have an example to understand it.
I've tried to change tasker for another task (radardroid) and it is working well. Now I want to whitelist more tasks, not only replace tasker.
Thanks in advance
Sorry for the delay, but I've been out of town. This is my modified c.smali from Malaysk Oreo version 1.1.
I followed the guide, decompiled the MTCManager.apk. Replaced the tasker entry into com.ankai.cardvr (my dashcam app), re-compiled, and put it in system/etc/mtcmanager, with 0644 permission.
And, it works. After hu is started dvr app starts. It's a dashcam with it's own sd card, so it will start recording anyway, but now it shows correct time and gps coordinates in the time stamp.
Thx guys !
xdamember2 said:
Assumptions:
The unit should be rooted. Otherwise you can’t update system files.
MTCManager.apk should be de-odexed. On Oreo this means installing the Malaysk mod.
The unit is configured for auto-sleep (not delayed shutdown)
Background:
When the unit goes to sleep, most processes and services are “killed”. There is an app by Graser, which goes by the name Dasaita and runs as an Xposed module, that allows apps to be whitelisted and then they will not be killed. However it doesn’t at this time work in Oreo, at least in my experience, and it does not work on Services so it doesn’t help with accessibility services.
General procedure:
1. Extract mtcmanager.apk from the head unit....
........
7. Restart the HU.
Click to expand...
Click to collapse
Hi! I have a problem with recompilation. I copied mtcdmanager for from unit. Inside I have a APK file and directory oat\arm64 with odex files. When I execute apk tool it creates original dir and res. I can't find c.smali file anywhere. I'm using stock Oreo
Ok I get it, needs to be deoxeted.
Regards
Greg
Rather than whitelisting, is it possible to modify MTCManager so it doesn't kill anything?
Aaaron16 said:
Rather than whitelisting, is it possible to modify MTCManager so it doesn't kill anything?
Click to expand...
Click to collapse
That's a good question. I may try it at some point.
Id be really interested, but can't try myself due to stock rom and missing GPS slot.
By revising the c.smali, did you find the Clearprocess.java mentioned at the top? Should be stated to kill everything in that class..?
xdamember2 said:
That's a good question. I may try it at some point.
Click to expand...
Click to collapse
I like that the device sleeps. I dislike that the device kills the services
Will be looking at a non-root way to get this working (or an easy way to root haha)
Xorit said:
Id be really interested, but can't try myself due to stock rom and missing GPS slot.
By revising the c.smali, did you find the Clearprocess.java mentioned at the top? Should be stated to kill everything in that class..?
Click to expand...
Click to collapse
I am now more interested, I'm finding mild instability after wake. Yes, c.smali mentions Clearprocess.java.
Update: I am trying a "no kill" solution, I have added a line "return v5" in the methods ha and gz close to the top of each, just after the two constants. HU is working ok. I added an accessibility service and confirmed it persisted. I'm not sure what else to test. I will see what I notice in use.
xdamember2 said:
I am now more interested, I'm finding mild instability after wake. Yes, c.smali mentions Clearprocess.java.
Update: I am trying a "no kill" solution, I have added a line "return v5" in the methods ha and gz close to the top of each, just after the two constants. HU is working ok. I added an accessibility service and confirmed it persisted. I'm not sure what else to test. I will see what I notice in use.
Click to expand...
Click to collapse
Nice, tell us more when you got time to test.
Ive had some troubles decompiling/recompiling and found that my used framework was outdated.
Advanced apktool from xda got me the right framework AND to get the whole thing to work, you have to sign the apk after recompiling..
Though, any additions work as intended.
Cheers
Also give this a try for a non root approach
https://forum.xda-developers.com/an...elopment/start-app-service-wake-root-t3803636
I've been running no-kill for a week with no problems. Occasional crashes in Gmaps and Google have stopped it seems.
That's awesome! Mind posting your fixed apk for those of us having compilation issues?
little more details for the smali noobs would be cool tho
Found that adding FCC launcher to the whitelist makes it unresponsive after wake, but removing it will stop the clock ^_^
xdamember2 said:
I've been running no-kill for a week with no problems. Occasional crashes in Gmaps and Google have stopped it seems.
Click to expand...
Click to collapse
Could you upload your no-kill version of mtcmanager? I have been trying to compile my own version but no luck so far. Thanks!

[GUIDE] How to make your GCam mod work without Gapps or microG

notice: I have only tried this with two APKs, with similar versions. Older or newer versions might differ. Here be dragons.
If you're someone like me, who don't install Google apps on your phone for one reason or another, but still want to use Google Camera for the quality improvements it brings, this topic might help you out!
If you didn't know, not having Gapps installed will usually make Google Camera crash right away, even if your phone's compatible with the mod you are using. My workaround for this was setting up microG and disabling it's Google server connections, but I wanted to learn modding APKs, so I thought this would be a good way to start on it. Fortunately, this was very easy to do, as not many features depend on Gapps.
Requirements:
Intermediate knowledge on Android tinkering
A GCam APK for your phone, preferably one that can disable Google Photos and Lens integrations (which will probably stop working with this patch)
apktool
adb
1. Open the camera and get the crash stacktrace through adb logcat. You will need this to find out which class to edit.
In the following stacktrace snippet, the bolded part is what you will be looking for. For the rest of this guide, the name of the class is assumed to be 'kas'.
Code:
java.lang.RuntimeException: Unable to create application com.google.android.apps.camera.legacy.app.app.CameraApp: java.lang.SecurityException: Failed to find provider com.google.android.gsf.gservices for user 0; expected to find a valid ContentProvider for this authority
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
<snip>
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.SecurityException: Failed to find provider com.google.android.gsf.gservices for user 0; expected to find a valid ContentProvider for this authority
<snip>
at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1924)
at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1913)
[B] at kas.a(Unknown Source:34)
at kas.b(Unknown Source:3)
at kas.a(Unknown Source:0)[/B]
at com.google.android.apps.camera.legacy.app.app.CameraApp.onCreate(Unknown Source:33)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
<snip>
2. Decompile the APK, and find the class
Not much to explain here. apktool and the find command (for *nix at least) should work pretty well. You will probably find it under ./smali.
3. Find some interesting fields
In the smali file, near the top, you will see two private static final fields with the type of android.net.Uri. In my case, they are named b and c (will refer to them as kas.b or kas.c from now on)
Code:
.field private static final b:Landroid/net/Uri;
.field private static final c:Landroid/net/Uri;
Inside the constructor you should find two strings with com.google.android.gsf.gservices. We need to trace the constructor to find out which one maps to which field:
Code:
const-string v0, "content://com.google.android.gsf.gservices"
invoke-static {v0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v0
sput-object v0, Lkas;->c:Landroid/net/Uri; # put v0 into [B]kas.c[/B]. this might be referred to as [B]field 1[/B] later on
const-string v0, "content://com.google.android.gsf.gservices/prefix"
invoke-static {v0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v0
sput-object v0, Lkas;->b:Landroid/net/Uri; # put v0 into [B]kas.b[/B]. this might be referred to as [B]field 2[/B] later on (URI ends with /prefix)
This step is needed because the order of these fields change between versions and different obfuscations.
4. Delete the broken parts
Now, do a search for ContentResolver;->registerContentObserver in the file. There should be a single result.
Go upwards and find the sget-object call for field 1 (kas.c).
Delete everything in between, and including, sget-object and invoke-virtual
Then, do another search for Lkas;->b (kas.b / field 2), and find the only sget-object line containing it.
Then, delete the invoke-virtual/range and the following move-result-object lines.
Scroll a little lower, and replace the if-eqz v1 line after the new TreeMap with a goto.
5. Pack it up
Build the APK, sign/align and push into your phone. It should be good to go!
I have found a very simple solution: install the apk linked there https://github.com/lukaspieper/Gcam-Services-Provider and GCam is working without gapps!

Categories

Resources