yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Android Development] tdunham:
Did you replace id with yours? He gave you only an example but you used the id from the example. If you have force closes, you need to learn how to get log of the error too.
[Galaxy S II Android Development] badboy_6120:
Yes I use these lines :

I don't know how to get the log

Can you tell me how???
[Galaxy S II Android Development] xpirt:
from adb:

or from terminal:
[Galaxy S II Android Development] tdunham:
100600b exists in your framework as a color resource? That is why I asked, you never changed it to a color resource in your framework.
[Galaxy S II Android Development] badboy_6120:
Here you go :

https://drive.google.com/file/d/0BzbyYHJHXED1NEh4MEw5ckRaVHM/view?usp=sharing

---------- Post added at 08:16 PM ---------- Previous post was at 08:07 PM ----------

at Values folder of framework-res.apk :

the line in Color.Xml is :

the line in Public.xml is :

at framework.jar :

in R$color.smali at smali\android location :

in R$color.smali at smali_classes2\com\android\internal location :

---------- Post added at 08:57 PM ---------- Previous post was at 08:16 PM ----------

I searched in all my system apks smali files and I couldn't find a single line that contain this :

but instead I found these two :
[Galaxy S II Android Development] xpirt:
disable xposed modules first..
[Galaxy S II Android Development] badboy_6120:
Xposed framework is installed but no modules is active or even installed
[Galaxy S II Android Development] xpirt:
....

/data/app/ic.lunar.xposed.kitkat.exthemer-1/base.apk

/data/app/kmod.xposed-1/base.apk

anyway if you are working with smali, you should have xposed uninstalled in the first place. have a nice day
[Galaxy S II Android Development] badboy_6120:
I uninstalled those app right after I create the logcat (Those apps were on my rom backup but they were not active in xposed. so anyway now those two apps and even xposed installer are gone. If it's necessary I can flash the rom again to get rid of the xposed framework too???)
[Galaxy S II Android Development] badboy_6120:
No one could figure this out ????

I uninstalled Xposed framework & All modules

Now should I get a new logcat ????
[Galaxy S II Android Development] xpirt:
yep
[Galaxy S II Android Development] badboy_6120:
Here you go dear

Thanks again for helping me

https://drive.google.com/file/d/0BzbyYHJHXED1cl9YR1dLNGlUQzg/view?usp=sharing
[Galaxy S II Android Development] tdunham:
Path is wrong or syntax maybe

E/AndroidRuntime(14060): Caused by: java.lang.NoSuchMethodError: No virtual method getColor(I)I in class Landroid/content/Context; or its super classes (declaration of 'android.content.Context' appears in /system/framework/framework.jar)
[Galaxy S II Android Development] renzetti.s:
My friend who answering you are the best you can found on xda...

Inviato dal mio LG-D802 utilizzando Tapatalk
[Galaxy S II Android Development] badboy_6120:
I said this in a few post back that there is no Landroid/content/Context;->getColor(I)I anywhere in my phone

but there is Landroid/content/res/Resources;->getColor(I)I all around the smali files

the getColor(l)l method is inside Resources.smali not Context.smali

I can upload both files if it helps

---------- Post added at 07:42 PM ---------- Previous post was at 07:37 PM ----------

Normally it's something like these to call a color from framework :
[Galaxy S II Android Development] tdunham:
have you tried it with resource path?
[Galaxy S II Android Development] badboy_6120:
I used this one and I get bootloop
[Galaxy S II Android Development] xpirt:
just saw you have lollipop so the above code won't work.

change this:

with this:

it should work fine.
[Galaxy S II Android Development] badboy_6120:
Thanks man:o

Those solved it and now everything is working just fine:victory:

Thank you so much;)
[Galaxy S II Android Development] bobfrantic:
I have an S4 GT-I9505, and used to use a great reboot menu from NunoFGrD. It wasn't so much the reboot menu I liked but the fact he had the long press back key set to put phone asleep as you do with power button. Well the rom on my phone isn't compatible with that reboot menu for some reason. I miss that long press back function mostly. I can make a reboot menu myself but no that function... I am sure it is an edit in the android.policy.jar but so far all searches with google and withing xda to find a tutorial how to do this have failed. Hope someone can share a link with instructions to do this please.... thanks in advance.
[Galaxy S II Android Development] lucadalba:
[MENTION=3065070]Goldie[/MENTION] infinite thanks for this thread!

I would never understand a word of smali without this!

Just a little question..

Can someone explain to me whats the difference between virtual, direct and static methods?

If I create methods, I always create virtual methods, but it would be great to know whats the difference between these 3 types of methods..

Thanks in advance!
[Galaxy S II Android Development] Warrior1988:
Does this work with 5.0
[Galaxy S II Android Development] RealWelder:
This is just what I needed, most of the new mods require RomControl. I'm running 4.4.2 so that wasn't an option. Now with this CustomSettings I can do all of the mods that require RomControl, just have to change the xml a bit. Thanks to Goldie and Ficeto, you guys are awesome!
[Galaxy S II Android Development] solquest3:
help disabling the status bar (preventing from expanding)

Hello.

I don't know anything about smali, but I'd like to do a thing and I've been told I have to implement things at smali level.

I'd like to disable the status bar (preventing from expanding) when an app is on.

I've tried contacting that app developer, but I haven't got any reply (last update was in 2013).

I've found this post http://www.techjini.com/blog/block-n...nding-android/ where there's described how to add a transparent window for covering the status bar, so it can not get the touches, but the problem is that I have no idea on how I can add that to the app (even if I can edit apk file).

I've open the app with Virtous Ten Studios, so I can change things, but I don't know what to do.

I've added

android:name=”android.permission.SYSTEM_ALERT_WIND OW”/>

to AndroidManifest.xml, but then I have no idea on where to write the other code.

Opening the app I have these folders

- original

- res

- smali

Do you know where I should write that code? Or what I have to look for?

Thanks a lot!

Luigi.

Android 5.0.2

rooted

stock rom
[Galaxy S II Android Development] millo1978:
Hi all :)

I'm able to color Landroid/widget/ImageView and Landroid/widget/TextView ...

but...

do you know if (and how) is it possible to color Landroid/widget/CheckBox and Landroid/widget/SeekBar ?

SetColorFilter don't work :(

Any Tip is welcome :)
[Galaxy S II Android Development] defaultzero1:
Wanted to bump this thread as this seems to be the most comprehensive smali info Ive came across.

My question is not related to roms. But just as a very simple exercise, How would I make an input box be invisible in an app?

I have tried adding android:visibility="gone" but doesnt work. I did that in the layout xml file. Do I need to add smali in order for that to work?? if so, how would I do it? I want to understand HOW to do it, not just do it.
[Galaxy S II Android Development] niaboc79:
Hi,

Various way to do it,

If you want to make something invisible, you can change layout height and width size. Set values to 0.0dip.

Or if you want to keep the layout but with a transparent background, you could replace the background by an invisible .9.png

Cheers
[Galaxy S II Android Development] defaultzero1:
Thank you. This would be done in the xmls so smali wouldnt be needed to be edited then?
[Galaxy S II Android Development] niaboc79:
That is right, xml only [emoji6]

Envoyé de mon H8266 en utilisant Tapatalk
[Galaxy S II Android Development] defaultzero1:
Awesome!! I am reversing an app to test and there are multiple xmls in layout, not sure which one to edit or do them all!

---------- Post added at 11:33 PM ---------- Previous post was at 11:31 PM ----------

what i mean is, there are multiple xmls for same activity it seems. Im not saying to do it on every xml in layoiut folder hahahaha

---------- Post added at 11:40 PM ---------- Previous post was at 11:33 PM ----------

Also, is there certain way to determine activities so corresponding xmls can be edited, or is it just trial and error on each xml? I dont doing by trial and error, but I am sure sure if there is a certain logic flow or process that could be followed to identify them easier
[Galaxy S II Android Development] niaboc79:
Trial and test ?
[Galaxy S II Android Development] Goldie:
Wow! This thread is still active! :D

Hope everyone is ok :)
[Galaxy S II Android Development] thereassaad:
Oooops look who's back , hope everything is ok in ur side Goldie ..
[Galaxy S II Android Development] defaultzero1:
Could someone help me understand what this smali is doing please? Please pm me
[Galaxy S II Android Development] Vivek_Neel:
Smali is Java enemy!
[Galaxy S II Android Development] davidwilson83:
See the line in the logcat that says:

It appears that the method might be searching for that class? The SecondHand smali calls on it a number of times too. Is there another smail file in com/sonymobile/systemui/lockscreen called LockscreenLoopsController.smali ? Maybe you need to add that in to allow the SecondHand to properly call on it?

Just a thought anyway, but I'm a smali noob so I am more than likely very wrong.
[Galaxy S II Android Development] levone1:
Thanks. That file is there. In my further messing around, I think I realized that it is a Java support error, because I got the layout inflate error with another unrelated mod also, where everything is in place and the settings option shows up, but the app crashes when selecting it. I tried to copy a bunch of stuff from /smali/android, but still the same. I think something needs to be updated...
[Galaxy S II Android Development] levone1:
Got it working...

https://xdaforums.com/showthread.php?p=78072668#post78072668
[Galaxy S II Android Development] FuNKSioN:
Anyone still checking this thread?

Can I get an example of how to instantiate a string[] of 20 string values?

For limited size arrays, I can set each value to a register variable, then load them all to the array. But we're limited to 14/15 registers.
[Galaxy S II Android Development] zuiffon:
Is there a website to learn syntax ?

sget-object v1, Landroid/os/Build;->MANUFACTURER:Ljava/lang/String;

I want to put "samsung" in v1

sget-object v1, "samsung":Ljava/lang/String; -> error

sget-object v1, "samsung"; -> error

v1 = "samsung"; -> error
[Galaxy S II Android Development] Widleboy:
sget-object v1, Landroid/os/Build;->MANUFACTURER:Ljava/lang/String;

const-string v1, "samsung"

return-object v1
[Galaxy S II Android Development] psycho\:
Is there anyone who can patch easyvictory.apk tool? I don't know much about smali, can anyone do it for me please?
[Galaxy S II Android Development] Goldie:
What is it?
[Galaxy S II Android Development] hasobist:
Hello @Goldie !

Love your guide ,simple instructions and well detailed. Almost went through the whole thread reading everyones experiences to incorporate a few.

Trying to remove an ad banner(vertical) from a launcher app which takes up the entire 1/3 rd of the screen on TV.

Took it up as a project to learn few skills, being new to understanding xmls and smalis etc

Used Apktool android and tried decompiling and making few changes in res/layout/string xml ,many trial and errors all in vain. One attempt did work but the ads come back later. Just reinstall and wait for the grace cycle. Ain't know where doing the mistake,sometimes just force closes.

Any suggestions and Guidance welcome.

Thank you.......

Cheers!
[Galaxy S II Android Development] Goldie:
Looks good to me :)
[Galaxy S II Android Development] remuntada78:
thank you for your explanations and your patience:angel:
[Galaxy S II Android Development] remuntada78:
with the last code I got this:

but it is a progress

when i choose a color whit colorpicker nothing happens
[Galaxy S II Android Development] Goldie:
Ok....thats cos your default color is not good. Change the default color in the code. E.g ics blue is -0xcc4a1a or -0x1 is white or -0x6a6a6a is light grey. Also....once you use the picker you will need to kill settings and reopen
[Galaxy S II Android Development] remuntada78:
-0x000000 isn't white?

could depend on the fact that my colorpicker is set so:

colorpicker.ColorPickerPreference android:title="@string/text_color_title" android:key="text_color" android:summary="@string/text_color_summary" android:defaultValue="0xffffffff" alphaSlider="true" />

edit:

Goldie you were right for -0x1 but now the issue is when i select a color with colorpicker the color does not change after kill settings and reopen and color picker is set again in the default
[Galaxy S II Android Development] Goldie:
Did you make sure the key in custom settings preferences.xml says "text_color"?
[Galaxy S II Android Development] Goldie:
It should be ok. Set a color and then open the database in data/data/com.android.providers.settings/databases/Settings.db with root explorer or sqlite database app and look at the bottom of the list to see if there is an entry for "text_color"

Also test it with custom settings app with key text_color to find if the issue is with your picker. The new code looks ok so im guessing the picker is the issue
[Galaxy S II Android Development] remuntada78:
no "text_color" entry in databases
[Galaxy S II Android Development] Goldie:
Im guessing you didn't add new in display settings smali for text color then in this way as statusbar color was done..

You will need a new field say mtextcolor and a new chunk of code for "text_color"
[Galaxy S II Android Development] remuntada78:
yessss it work look at this:

many many many thanks:good::laugh:
[Galaxy S II Android Development] Goldie:
Well done :)
[Galaxy S II Android Development] remuntada78:
Hi Goldie i need again your help

with your help I was able to choose the color of the Header like this

now I would like to apply the mod for each PreferenceCategory like this

the problem is i can't understand which smali files i need to find.Since now i'm convinced they are in SecSettings\smali\com\android\settings\widget but most probably i'm wrong

edit:definitly i'm wrong they aren't
[Galaxy S II Android Development] remuntada78:
today i was able to do the clock color look at this:

another thanks to Goldie:laugh:
[Galaxy S II Android Development] majdinj:
I want to add Context to get ContentResolver in a smali that doesn't have mContext field and no view super,, I have the following attempts:

Attempt #1

invoke-virtual {p0}, Lcom/android/newApp;->getContext()Landroid/content/Context;

move-result-object v2

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

Attempt #2

invoke-virtual {p0}, Lcom/android/newApp;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

Attempt #3

iget-object v0, p0, Lcom/android/newApp;->mContext:Landroid/content/Context;

invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

Attempt #4

move-object v0, p0

iget-object v2, v0, Lcom/sec/android/newApp;->mContext:Landroid/content/Context;

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

I have repeated attempt #3 and #4 after adding mContext field and then after adding mContext field and .method static synthetic access$xxx, but non of these worked :rolleyes:

Is there any other way to get ContentResolver???
[Galaxy S II Android Development] Sun90:
wont u think It would do good if u post this 'Guide' thread in the S2 'General Section ma8' :)

Just a thought, call is your's though :)
[Galaxy S II Android Development] Biftor:
Hi where did you want add context? And for which elements?maybe you are in wrong smali you can't use mcontext

Goodluck

Armin.
[Galaxy S II Android Development] Goldie:
You dont have to use mContext or getContext. You can pass existing context to a new method and store your integer or boolean etc in a field to be called and used in the method you want. Check the init of the smali for Context and then you can call your new method passing context during the init.

Post the smali mate :)
[Galaxy S II Android Development] majdinj:
Thanks for response m8,,

I want to add Context to get ContentResolver which then I will use to add key string, so I can use it as a reference for checkbox toggle in settings menu.. Here is the whole code example:

invoke-virtual {p0}, Lcom/android/newApp;->getContext()Landroid/content/Context;

move-result-object v2

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "my_key_for_toggle"

const/4 v0, 0x0

invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v2

if-eqz v2, :cond_new

Thanks in advance
[Galaxy S II Android Development] majdinj:
Here is the smali mate,,

I want to add toggle referral to "CscFeature_Camera_ShutterSoundMenu",,, all previous methods I mentioned I already use them but I don't know how to get ContentResolver here..
[Galaxy S II Android Development] remuntada78:
[MENTION=3065070]Goldie[/MENTION]

when i try to find the smali that i need to mod using SDK monitor tool , the name of smali is like show in the picture?

[ATTACH]2406731._xfImport[/ATTACH]
[Galaxy S II Android Development] Goldie:
Framework2.jar :)
[Galaxy S II Android Development] remuntada78:
really?so if i want to implement this mod http://xdaforums.com/showpost.php?p=47659484&postcount=1832 i need to search in framework2.jar?

can you explain me why?how work framework2.jar?
[Galaxy S II Android Development] Goldie:
Lol....you invoke setTextColor with v2 as the TextView. V2 currently holds a CharSequence! Look at the settext line. It invokes on the TextView with parameter v2 (the CharSequence). So......what v should come first in your setTextColor? ;)

Further up your log you will see vfy errors saying java.lang.CharSequence is not instance of android.widget.TextView :)
[Galaxy S II Android Development] Goldie:
You are invoking the textColor correctly now. But the problem is you are using p0 with getContext. This file doesn't have a getContext method. Hence you cant use p0. Instead use mContext...

iget-object v3, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mContext:Landroid/content/Context
[Galaxy S II Android Development] remuntada78:
how can i understand when use getContext or mContext?
[Galaxy S II Android Development] davidwilson83:
Amazing. There's not much I wouldn't give to have your knowledge of smali. *worships*
[Galaxy S II Android Development] Goldie:
Lol....well scratch what I just said! Im still learning too. Just seen it in the file using getContext on p0. I guess because super is LinearLayout its ok.

So....the problem was not that. :D

Remuntada78 you sure the file is unchanged apart from the red? Is a weird error if so
[Galaxy S II Android Development] remuntada78:
yes only the red part, is the first time i mod this file
[Galaxy S II Android Development] Goldie:
Post the whole method pls :)
[Galaxy S II Android Development] remuntada78:
ok look at this and thanks again

.method public setTitle(Ljava/lang/CharSequence;)V
.registers 4
.parameter "title"

.prologue
const/16 v1, 0x8

.line 123
if-eqz p1, :cond_18

.line 124
iget-object v0, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mTitleView:Landroid/widget/TextView;

invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

invoke-virtual {p0}, Lcom/android/internal/view/menu/ListMenuItemView;->getContext()Landroid/content/Context;

move-result-object v3

invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "text_color"

const v5, -0x1

invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

invoke-virtual {v0, v3}, Landroid/widget/TextView;->setTextColor(I)V

.line 126
iget-object v0, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mTitleView:Landroid/widget/TextView;

invoke-virtual {v0}, Landroid/view/View;->getVisibility()I

move-result v0

if-eqz v0, :cond_17

iget-object v0, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mTitleView:Landroid/widget/TextView;

const/4 v1, 0x0

invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

.line 130
:cond_17
:goto_17
return-void

.line 128
:cond_18
iget-object v0, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mTitleView:Landroid/widget/TextView;

invoke-virtual {v0}, Landroid/view/View;->getVisibility()I

move-result v0

if-eq v0, v1, :cond_17

iget-object v0, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mTitleView:Landroid/widget/TextView;

invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

goto :goto_17
.end method
[Galaxy S II Android Development] Goldie:
You have 4 registers but are using up to v5 :)

You need 6 for v0-v5. But...you are not using v2 at all. So change 3, 4, and 5 to 2, 3 and 4 and then registers to 5
[Galaxy S II Android Development] Goldie:
That really should work. Did you try the mContext line I posted instead if getContext? Are you 100% sure there is nothing left over from previous attempts and the only difference between stock is those red lines?
[Galaxy S II Android Development] Goldie:
Ahhh I remember. When using .registers you need one for each v and one for each param I think. So in the original method there is 4...v0, v1, p0 and p1. So try with .registers 7....v0, v1, v2, v3, v4, p0 and p1. Maybe that will help. When using .locals instead of .registers you only need one for each v.
[Galaxy S II Android Development] remuntada78:
ok this is another lesson i learned i'll try with this way, but i could use .local instead of .register?
[Galaxy S II Android Development] Goldie:
Not sure about switching. I *think* its down to the apktool or aapt version which you get. I have always had locals so not really sure
[Galaxy S II Android Development] remuntada78:
yesssss:laugh::laugh::laugh::laugh::laugh::laugh::laugh:whit this code now work thanks agains great teacher

.method public setTitle(Ljava/lang/CharSequence;)V
[COLOR="Red"] .registers 7 [/COLOR]
.parameter "title"

.prologue
const/16 v1, 0x8

.line 123
if-eqz p1, :cond_18

.line 124
iget-object v0, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mTitleView:Landroid/widget/TextView;

invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

[COLOR="Red"]iget-object v2, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mTitleView:Landroid/widget/TextView;

invoke-virtual {v2}, Landroid/widget/TextView;->getContext()Landroid/content/Context;

move-result-object v2

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "text_color"

const v4, -0x1

invoke-static {v2, v3, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v2

invoke-virtual {v0, v2}, Landroid/widget/TextView;->setTextColor(I)V[/COLOR]

.line 126
iget-object v0, p0, Lcom/android/internal/view/menu/ListMenuItemView;->mTitleView:Landroid/widget/TextView;

invoke-virtual {v0}, Landroid/view/View;->getVisibility()I
[Galaxy S II Android Development] Biftor:
Great,mate but change "register 7" to "register 5" or "local 5"

Because I can't see any register more than 4 in your method and codes

Goodluck

Armin.
[Galaxy S II Android Development] remuntada78:
Thanks for suggest but when i tried whit .register 5 the mod don't worked , instead as Goldie suggested whit .register 7 it work

Inviato dal mio GT-I9100 utilizzando Tapatalk
[Galaxy S II Android Development] Goldie:
Nice! I thought it was weird as your code looked right. Registers it was! :)