yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Android Development] Goldie:
Ahh yes I see. I looked if you could call the method that calls it but it traces back a good few methods. How about restarting ui instead? So create a new method in statusbariconview like this....

.method restartui()V

.locals 1

const-string v0, "pkill -TERM -f com.android.systemui"

invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

move-result-object v1

invoke-virtual {v1, v0}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;

.end method

Then you need to move the observer initialise into statusbariconview init method so it observes from when ui starts rather than in the set method.

Then in the observer just call restartui()V onchange. :)
[Galaxy S II Android Development] MyLifeRocks10:
Thanks mate for your help and guide. Now it is working great.:victory: Btw I had to make little changes to the above method to get it working like increase locals to 2 and add return-void before end method.:)
[Galaxy S II Android Development] Goldie:
Sorry yeah...wrote it on my phone in a hurry lol :D
[Galaxy S II Android Development] KIMBASINGER:
Hello my friend. Your work is very apreciated.

I send a pm...

Thanks for your generosity.
[Galaxy S II Android Development] Many40:
Hi,

Recently I implemented two similar methods into PhoneStatusbar.smali to hide/show two LinearLayouts in the tw_statusbar_expanded.xml following "Calling things by ID" way. I used two different keys for that.

Both work well separately but a situation when both are enabled in the same time should be avoided.

My question is: does anyone know a way to disable one of the options in SecSettings automaticaly when the second one is enabled (end vice versa) in order to restrict a user to enable both options at the same time?

Or maybe list of choices would fit better to this situation instead of toggling staff?

Thanks
[Galaxy S II Android Development] Goldie:
Android:dependency="key of the other one"

Then on the other one android:disableDependentsState="true"

:)
[Galaxy S II Android Development] Many40:
You are gold indeed :)

Would it be too "rude" if I asked where you would implement them? :o:D
[Galaxy S II Android Development] Goldie:
In the xml of the settings.

Or you could just call setvisibility of the other item to 0x8 when one is enabled and vice versa in your methods :)
[Galaxy S II Android Development] remuntada78:
Considering it seems impossible to do this, at least for me, what do you think about this http://xdaforums.com/showpost.php?p=49581000&postcount=1936

it's possible ti do? I have seen in SystemUI\smali\com\android\systemui\screenshot there are smali files about screenshoot.Are they for this?
[Galaxy S II Android Development] gerryS2:
I have create a thread for enable a multi-button with screenshot ;)

http://xdaforums.com/showthread.php?t=2538435
[Galaxy S II Android Development] Many40:
Hi,

As I wrote before I recently implemented two similar methods into PhoneStatusbar.smali to hide/show two LinearLayouts in the tw_statusbar_expanded.xml following "Calling things by ID" way. I used two different keys for that.

My idea was to make a mod to switch between toggles+display slider combo located on the top of statusbar expanded and on the bottom.

As I also wrote before that both work well separately but not together.

I thought that I made a mistake in methods in PhoneStatusbar.smali but finaly I realized that the main problem is that it's not possible to include the same 23 toggles and brightness slider two times (in two places) in the same tw_statusbar_expanded.xml file.

Poor Many40 :D Will have to find another way to do that :)
[Galaxy S II Android Development] Goldie:
Lol. I been thinking about that for a while. I was going to try setgravity but you can only do this to a linear layout. In 4.1.2 it may be possible like that. I also thought about programmatically adding layout_above to place them above the handle but again not sure if that will work. You could always use two base status bar xml that use different expanded xml but I don't like the multiple xml route really. Will think some more :)
[Galaxy S II Android Development] Biftor:
Hi mate,

you can do it,with "findViewbyId"

you should add your for example 23 toggle 2 time with 2 id in smali and xml,then

set visibility gone and visible for each one you want:) . with switch all of them is in op i think,

but mate if you need other help ask :) .

Goodluck

Armin.
[Galaxy S II Android Development] Many40:
Thank for helping me however this is exactly what I tried to do. I used findViewbyId method to show/hide 23toggles+brightness slider which I put together to LinearLayout to which I assigned a specific new ID. This ID I used in Phonestatusbar.smali. This worked well to show/hide LinearLayout but when I put again the same 23toggles+brightness slider into tw_statusbar_expanded.xml in the second LinearLayout (in different place in xml) and assigned the second/new ID - it didn't work. The content of the second LinearLayout was not shown properly.

IMO 23 toggles and brightness slider can't be put into xml two times in this way.
[Galaxy S II Android Development] Biftor:
ok,in first place thats ok,but in second place you should resign new id again in smali and xml for each elements.

for 23 toggle you you should add one new id and for slider you should add new id and for layout you should add new id again,

try find in not pad++ to find brightness stock id and you should new one same stock one...

thats all

Goodluck

Armin.
[Galaxy S II Android Development] Many40:
Do you mean that I should change IDs for all the elements inside the second LinearLayout (for 23 toggles and brightness slider)? :confused:

There are a lot of IDs:

1. For 23 toggles:

- exp_power_stat

- quicksetting_scroller

- quicksetting_container

2. For Brigtness slider:

- brightnees_controller

- brightness_icon

- brightness_group

- brightness

- autobrightness

My understanding up to now was - don't change them otherwise they will not work properly. Am I wrong? :eek:

These IDs have many references in other parts of apk IMO.

BTW what do you mean by "find brightness stock and add another brightness stock?
[Galaxy S II Android Development] Biftor:
yes,try search if each stock ids signed in smali you should add new one on that id smali and add switch for show or hide on that smali between stock and your id...

if you use new xml with switch between stock and your xml this is much easier than add new id,show or hide and...

edit:

i forgot try one by one first add your 23toggle in 2place if you will done that goto add other one.

you should make new one from stock:)

sorry for my bad English

Goodluck

Armin.
[Galaxy S II Android Development] Many40:
Thanks again for helping however (it's not due to your English but rather my limited knowledge) - have no idea how to realize what you suggested with all these ID changes :D
[Galaxy S II Android Development] remuntada78:
i think i found the solution for my issue whit button pressed here http://stackoverflow.com/questions/11242735/change-xml-selector-values-from-java-code

but even i'm not able to use eclipse to try it and i'm not able to translate java code

can you take a look:confused: thanks :p
[Galaxy S II Android Development] Vivek_Neel:
May be you need to build apk using eclipse and then decompile it to see the smali code
[Galaxy S II Android Development] remuntada78:
Yes thank you it works, so I had to put cond_13 instead of cond_2, inside the cond_12 for battery_icon_list

So if i want add another listpreference i've to put the new cond_new inside the cond_13 ?
[Galaxy S II Android Development] Goldie:
Well it moved to cond 12 which then needed to go to cond 13 to run your new code. The cond 2 is to finish up. So to add another you would put cond 14 inside the cond 13 and cond 14 would have the cond 2. Basically one cond goes to the next and the last one goes to cond 2. :)
[Galaxy S II Android Development] remuntada78:
thanks for your explanation

I'm trying to create a multi_toggle_theme, which makes choosing a list of icons directly from the menu Settings / Display.

thanks to your help I was able to finish the job with the SecSettings.apk

Now I have to work with the SystemUI.apk
[Galaxy S II Android Development] Goldie:
Glad I could help. Good luck in your quest! :)
[Galaxy S II Android Development] SkyaTura:
Waiting for the second one to see if I can make my idea happens :P

(I want to make this thing I've illustrated at Photoshop)
[Galaxy S II Android Development] Goldie:
Im not really sure what you're showing :p
[Galaxy S II Android Development] Adi Aisiteru Reborn:
Thanks for this guide sir :)

I am succed to add lockscreen torch on my device, but I want to add settings that can disable / enable it .

I try to learn from your Alliance rom settings , can you tell me where is this located modcfg_lock_torch_on

Thanks in adv :)
[Galaxy S II Android Development] Goldie:
Ummm that's a reference from the settings app that adds a file to sdcard called lock_torch_on. It is better to use a database switch with contentresolver though as the sdcard check type don't work when sdcard is in use when plugged or on boot.
[Galaxy S II Android Development] SkyaTura:
I want to put "OnGoingCart's content" into a container which will just be shown IF the OnGoingCart is "expanded". Is like creating a container which will be hided if a "checkbox" isn't checked...

I don't know how explain it :P but is a Expandable/Collapsible OnGoing Cart to show/hide fixed notifications...
[Galaxy S II Android Development] Many40:
Hi,

This was exactly what I was waiting for :good: Great job Goldie!

One question if I may - you wrote that the guides are in 3 sections:

"Coloring stuff" is already done.

Does it mean that 2 additinal parts will come soon?

Thanks
[Galaxy S II Android Development] Goldie:
Yes. But first I will do coloring images. Then the other two :)
[Galaxy S II Android Development] SkyaTura:
Can u tell us when second guide will come?

/sorry for being annoying :p
[Galaxy S II Android Development] Goldie:
When ive written it :p
[Galaxy S II Android Development] majdinj:
Nice [MENTION=3065070]Goldieking[/MENTION],,

Bookmark..!!!! ;)
[Galaxy S II Android Development] jimmydene84:
so what if the content doesnt already start with 3 identifiers? in my case

:cond_1

iget-object v1, p0, Lcom/android/systemui/statusbar/phone/IconMerger;->mOperatorLogoView:Landroid/view/View;

if-eqz v1, :cond_2

iget-object v1, p0, Lcom/android/systemui/statusbar/phone/IconMerger;->mOperatorLogoView:Landroid/view/View;

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

can i add the extra identifiers into the last line? invoke-virtual {v1, v2, v3}, Landroid/view/View;->getVisibility()| ?
[Galaxy S II Android Development] Goldie:
No no. What for? That's just looking if mOperatorLogoView is visible. What are you trying to do? You lost me with your question
[Galaxy S II Android Development] Goldie:
Should be const-string not const string
[Galaxy S II Android Development] majdinj:
Hi [MENTION=3065070]Goldieking[/MENTION]

I found this table while searching. It explains a lot of dalvik opcodes, so I thought it will be good to share:

>> Dalvik opcodes table

Smali language is like rocket science at the beginning, but the best thing when you understand a little, you will crave for more..!! :eek:

Cheers,,
[Galaxy S II Android Development] Goldie:
Nice find! :)

I remember seeing this a long time ago when I first started with smali. Made little to no sense. Now however its very useful :)
[Galaxy S II Android Development] remuntada78:
That's what I'm trying to do these days but it's all new to me
[Galaxy S II Android Development] Many40:
Hi Goldie, it's me again :)

I was thinking a little about "setgravity" way you mentioned but I'm wondering if it could be applied in a similar way (method) like in your "Calling things by ID" guide? For example using values: 0x50 for Bottom orientation and/or 0x30 for Top?
[Galaxy S II Android Development] Goldie:
Yes. This is what I mean. I think it can only be applied to a linear inside a linear. So it would need a new linear to enclose all drop down inside the overall frame layout and then another new linear to enclose the toggles and Slider with an id to setgravity on. Not had time to try but will try later. :)
[Galaxy S II Android Development] Many40:
I almost forgot one thing. I'm gonna also check another way you mentioned - two tw_super_status_bar.xml files with different tw_statusbar_expanded.xml inside plus a switch made in PhoneStatusbar.smali.

You mentioned you don't like this method - are there any serious disadvantages of it in your opinion?
[Galaxy S II Android Development] Goldie:
That way will definitely work. Reason I don't like are twofold:

1) any future changes have to be made in two places

2) we don't learn anything new :D
[Galaxy S II Android Development] Goldie:
I did it mate :)

Was a pain in the ass. Had to learn how to programmatically change layout values in smali to add an align bottom to a new relative layout that encloses all the other panel stuff. Will tidy up the gap that's left, add in the slider and add a toggle for it and then give you the method :)
[Galaxy S II Android Development] CNexus:
I just have to say, [MENTION=3065070]Goldie[/MENTION], this is the most informative and helpful smali guide I have come across...thanks for that! :good:

After reading through this thread, I think I can finally say that I understand smali :D :D :good:
[Galaxy S II Android Development] Goldie:
[MENTION=2174044]Many40[/MENTION] ......

:D

Was a little more difficult than I imagined. 113 line method, 4 new relative layouts and 3 ids. Have to add layout parameters via smali and then there was a gap at the top because the scrollview for notifications has a margintop added in phonestatusbar in 4.3 so had to override that too. :)
[Galaxy S II Android Development] Many40:
You smart ..... %£@£&..... !!! ;):D How have you done this :confused::eek:

Please lift a little the curtain on that for me, or better more than a little ;):D

Edit: the way you did it is impressive !!! :thumbup:

If you sometime would like to share your work I will be here ;)
[Galaxy S II Android Development] winterfoxy:
Hi Goldie

want ask something i tried to get set on the fly by regis some privat method in Phonestatusbar.smali to PhoneStatusBar$observer n i got work change but my statbar fc n back again the logcat is i got illlegal access error how regis method with different access to Observer

sory for my bad eng n thx u
[Galaxy S II Android Development] Goldie:
OK try to add to ontouch method in your existing smali. It's first parameter is the view so I reckon you can probably just add invoke on p1 setback ground color. Never looked there but assume there is an ontouch.
[Galaxy S II Android Development] remuntada78:
yes ontouch is on onCreate method of first smali and i suppose i need to implement it too.or i'm wrong?
[Galaxy S II Android Development] Goldie:
No I mean your existing smali that you want to mod for lockscreen. Find the ontouch and in it invoke on p1 setbackgroundcolor
[Galaxy S II Android Development] remuntada78:
no ontouch on smali i want to mod , this is why i'm confused
[Galaxy S II Android Development] Goldie:
What smali is it?
[Galaxy S II Android Development] remuntada78:
SimUnlockScreen.smali on android.policy i tried to search also in SimUnlockScreen$TouchInput.smali but nothing
[Galaxy S II Android Development] Goldie:
Do it in this method beforr return void. Invoke set background colour on p1
[Galaxy S II Android Development] remuntada78:
sorry but i think it's not possiblle add the code in onClick method because seems MotionEvent is not compatible with onClick method
[Galaxy S II Android Development] alvin551:
Hi Goldie what app is that please?
[Galaxy S II Android Development] Goldie:
What code? Just invoke-virtual {p1, vx} , Landroid/view/View;->setbackgroundColor(I)V before return void?
[Galaxy S II Android Development] Goldie:
Jota+ :)
[Galaxy S II Android Development] remuntada78:
so i need to add only the code for findViewById and then code for changecolor?
[Galaxy S II Android Development] Goldie:
You don't even need find. I guess onClick runs for every button press. And the view is already there as p1. Only need the getter for the color
[Galaxy S II Android Development] remuntada78:
nooo i'm now more confused:(

I was convinced of the need to add the id of image of button pressed
[Galaxy S II Android Development] Goldie:
Well the onclicklistener is set on all the buttons. So the view is passed to onClick when pressed. So acting on the view in p1 should change pressed background color. At least that would make sense to me. Hang on. I'm gonna try it
[Galaxy S II Android Development] remuntada78:
thanks you're the best:D
[Galaxy S II Android Development] Goldie:
Lol....I tried it in dialer. It draws a pattern as the button doesnt change back. So it stays the new color once pressed :silly:
[Galaxy S II Android Development] remuntada78:
:laugh:i guess it need onTouchListener and id of button pressed. you no?
[Galaxy S II Android Development] Goldie:
The listener is set on the id already. So when a view is touched it runs on that view. But to intercept you would (I think) have to mod the ontouch method itself which would apply to everything. So...not sure
[Galaxy S II Android Development] remuntada78:
You said that the listener is set on the id already, and if i add the setonTouchListener after each setonClickListener ?

like this

original

.line 126
const v0, 0x1020376

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

move-result-object v0

iput-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mBackSpaceButton:Landroid/view/View;

.line 127
iget-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mBackSpaceButton:Landroid/view/View;

invoke-virtual {v0, p0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

modded

.line 126
const v0, 0x1020376

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

move-result-object v0

iput-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mBackSpaceButton:Landroid/view/View;

.line 127
iget-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mBackSpaceButton:Landroid/view/View;

invoke-virtual {v0, p0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

[COLOR="Red"] const v0, 0x1020376

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

move-result-object v0

invoke-virtual {v0, p0}, Lcom/android/internal/policy/impl/SimUnlockScreen->setOnTouchListener(Landroid/view/View$OnTouchListener;)V[/COLOR]

and then add code for change color?
[Galaxy S II Android Development] Biftor:
Hi all

[MENTION=3065070]Goldie[/MENTION]

Check here

Thats not possible but happened!

Last night till now i am thinking but i haven't fault nothing to fix.

Mybe you have idea.

http://xdaforums.com/showthread.php?p=50110079

This is really interesting.

Thanks.

Goodluck

Armin.
[Galaxy S II Android Development] Goldie:
Not sure unless I see the code :)
[Galaxy S II Android Development] Biftor:
I am sure goldie color and switch both of them is register but color is not one register and switch only two value "0" or "1"

If you saw my video color workinga and switch enable working but disable that "0" value is not work on observer .

See my video i uploaded you see that .

Both of them(switch and color register)are same mthod for observer same always and both of them is in one method .

I am wondering for it this is not possible!!

Goodluck

Armin.
[Galaxy S II Android Development] Goldie:
I watched and I see what you mean but I've no idea without seeing the code
[Galaxy S II Android Development] Biftor:
ok see here

this is observers thats was available on stock slim system ui i just add my work at the end

class SettingsObserver extends ContentObserver {
SettingsObserver(Handler handler) {
super(handler);
}

void observe() {
ContentResolver resolver = mContext.getContentResolver();

resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.QUICK_TILES_BG_PRESSED_COLOR),
false, this, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.QUICK_TILES_BG_ALPHA),
false, this, UserHandle.USER_ALL);
/*
*
*
*Skip
*
*
*/
resolver.registerContentObserver(Settings.System.getUriFor("Biftor_Enable_statusbar_color"),
false, this, UserHandle.USER_ALL);

resolver.registerContentObserver(Settings.System.getUriFor("Biftor_statusbar_BG_color"),
false, this, UserHandle.USER_ALL);

update();
}

this is onchange method of observers

@Override
public void onChange(boolean selfChange, Uri uri) {
super.onChange(selfChange, uri);
/*
*
*
*Skip
*
*
*/
update();
BiftorStatusbarSettings(); //this is my systemui settings all things will set from this
}

and this is my method

protected void BiftorStatusbarSettings()
{

/*
*
*
*Skip
*
*
*/

//Statusbar BG Color
if(android.provider.Settings.System.getInt(mContext.getContentResolver(), "Biftor_Enable_statusbar_color", 0) == 1){
int i = android.provider.Settings.System.getInt(mContext.getContentResolver(), "Biftor_statusbar_BG_color", 0xff000000);
mStatusBarView.setBackgroundColor(i);}
//End Statusbar BG Color

/*
*
*
*Skip
*
*
*/

}
[Galaxy S II Android Development] Biftor:
[MENTION=3065070]Goldie[/MENTION] did you see codes?

Nothings??

This is very interesting problem.

Goodluck

Armin.
[Galaxy S II Android Development] Goldie:
I did but I suck at java. Would have to see in smali to have any clue lol
[Galaxy S II Android Development] Biftor:
Goldie in smali is same as this java configuration nothings different just converted to smali .

This code should work,because color observer working and switch ob server should work to,this is impossible thing i see in android :( .

Goodluck

Armin.
[Galaxy S II Android Development] Goldie:
Well I assume you setbackgroundColor on the choosing color. Then when you uncheck use Statusbar color it doesn't remove the color that is already set. It just tells it not to color it again. But it's already colored. I guess you need to set the color back to stock in the method that runs on unchecking use Statusbar color
[Galaxy S II Android Development] Biftor:
Ok,thanka Goldie,but no,if as your said Right after i restart statusbar colors should not back to default but no after i re start system ui and if that switch was '0' status bar bg will back to default as video i showed!

I wort one if first will check if if that was true will go to do work that color background and if was false dont read to do (work that color) and skip . if ='0' is havnt anythinga to do and will skip that.

i am sure about this configuration.

My pb is not only for statusbar bg drop down headers,wallpaper colors and ... Switches is same.

This is observers pb :( i really hanging about this.

Goodluck

Armin.
[Galaxy S II Android Development] Goldie:
Well of course it's removed when restart ui. You have a blank uncoloured bar then and use Statusbar color is 0 so it doesn't get colored. But when the observer is used the bar is already colored and you don't remove that color. It gets to use Statusbar color sees it's 0 and that's it. So the old color stays. You need to remove that color. It works on restart ui because the bar is already uncolored to start with
[Galaxy S II Android Development] Biftor:
Ok if i don't mistake you mean :

else

mStatusBarView.setBackgroundColor(default color integer);

For example 0x00000000 for default color.

Yes?i am Right?

But i already have it in my sammy rom don't need it!i have it for my wallpaper bg colors with switch in my sammy rom just one if no else needed!

Goodluck

Armin.
[Galaxy S II Android Development] Goldie:
That's what I think would fix it yes. I guess Sammy must have something that colors stock anyway in another file maybe. I don't know. But that makes sense as to why it doesn't work to me
[Galaxy S II Android Development] Vivek_Neel:
Ummm.

I was just reading your question and answers.

Guess what? ..tbh I understand nothing. :(

Just tried the guide in the first post and worked well.

Have to start soon my journey of understanding smali with the second post.