yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Android Development] Many40:
Yep I at the end took a dump and started reviewing it but gave up quickly (tired after hard day at work). Will come back to it tomorrow (now I'm away from my laptop). Tbh I'm not an expert at finding FC culprits from logs so probably will bother you again, if you don't mind of course ;)
[Galaxy S II Android Development] Goldie:
Of course not. Dumpstates are easy. Just search the word fatal or the word dumpstate. You will see a load of lines prefixed with E. That's the problem. Post if you get stuck :)
[Galaxy S II Android Development] remuntada78:
As Goldie said me many times you also need to look a pair of lines above where there are VFY: this lines tell you what errors are
[Galaxy S II Android Development] Many40:
Thanks but it's not so easy. There are no VFY lines in my dumpstate ...

Edit: Ooops ... I found a few .... checking :)
[Galaxy S II Android Development] Many40:
Unfortunately nothing obvious (at least for me). I got two FC of SystemUI after flashing the new mod:

1. 1st just during boot. This is what I got above Fatal error line:

12-04 21:19:04.920 5233 5233 E Trace : error opening trace file: No such file or directory (2)
12-04 21:19:04.920 5065 5065 D AndroidRuntime: Shutting down VM
12-04 21:19:04.920 5065 5065 W dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41a912a0)

2. 2nd time (after about 2 minutes) after boot:

12-04 21:20:58.725 5783 5783 D SystemUIService: loading: class com.android.systemui.statusbar.phone.PhoneStatusBar
12-04 21:20:58.735 5783 5783 D dalvikvm: DexOpt: couldn't find field Lcom/android/systemui/statusbar/phone/PhoneStatusBar;.mIcons
12-04 21:20:58.735 5783 5783 W dalvikvm: VFY: unable to resolve instance field 3823
12-04 21:20:58.735 5783 5783 D dalvikvm: VFY: replacing opcode 0x54 at 0x0002
12-04 21:20:58.735 5783 5783 D dalvikvm: DexOpt: couldn't find field Lcom/android/systemui/statusbar/phone/PhoneStatusBar;.mIcons
12-04 21:20:58.735 5783 5783 I dalvikvm: DexOpt: unable to optimize instance field ref 0x0eef at 0x16 in Lcom/android/systemui/statusbar/phone/PhoneStatusBar$1;.onAnimationEnd
12-04 21:20:58.745 5783 5783 D SystemUIService: running: com.android.systemui.statusbar.phone.PhoneStatusBar@426bc420
12-04 21:20:58.765 2331 5327 I StatusBarManagerService: registerStatusBar bar=com.android.internal.statusbar.IStatusBar$Stub$Proxy@425a4828
12-04 21:20:59.030 5783 5783 D STATUSBAR-QuickSettingButton: Button OFF
12-04 21:20:59.045 5783 5783 D STATUSBAR-QuickSettingButton: Button OFF
12-04 21:20:59.055 5783 5783 D STATUSBAR-QuickSettingButton: Button OFF
12-04 21:20:59.055 5783 5783 W STATUSBAR-QuickSettingPanel: AllShareCastnotClassNotFoundException
12-04 21:20:59.065 5783 5783 D STATUSBAR-QuickSettingButton: Button OFF
12-04 21:20:59.065 5783 5783 W STATUSBAR-QuickSettingPanel: SyncnotClassNotFoundException
12-04 21:20:59.065 5783 5783 D STATUSBAR-QuickSettingPanel: mDisplayButtonCnt : 9 mCurButtonNum : 5
12-04 21:20:59.070 5783 5783 W STATUSBAR-QuickSettingPanel: prepareTranslationXfalse 240
12-04 21:20:59.130 5783 5788 D dalvikvm: GC_CONCURRENT freed 794K, 11% free 13923K/15559K, paused 13ms+3ms, total 57ms
12-04 21:20:59.130 5783 5783 D dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 35ms
12-04 21:20:59.150 5783 5783 D AndroidRuntime: Shutting down VM

Complete dumpstate attached.
[Galaxy S II Android Development] Goldie:
Can you post the PhoneStatusBar too? Maybe the invoke comes before the field is available :)
[Galaxy S II Android Development] Many40:
You are so kind :)
[Galaxy S II Android Development] Goldie:
Hmm...looks ok. Is the id definitely right and also the id of a FrameLayout?
[Galaxy S II Android Development] Many40:
Hi,

Thanks for info.

Id of the image is right but concerning an Id of FrameLayout I'm not so sure how I should apply it based on your guide.

My FrameLayout from tw_status_bar.xml looks like this:

<FrameLayout android:gravity="center" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_centerInParent="true">
<com.android.systemui.statusbar.policy.KeyButtonView android:gravity="left|center" android:id="@id/back" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/sale_trans" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/sale_trans" />
</FrameLayout>

So as image Id I used Id of "sale_trans" image (0x7f020322) but what should I use as a FrameLayout Id which you mentioned? :confused: (there is only "back")
[Galaxy S II Android Development] Goldie:
Add a new id straight after first FrameLayout word. Something like "power_button". Then add it to ids.xml. Then use that id in the smali :)
[Galaxy S II Android Development] Many40:
Thanks for info, however it still doesn't work (SystemUI crashes).

I did (at least I think ;)) what you suggested:

- made an ID in ids.xml as:

<item type="id" name="power_button_sb">false</item>

then added it to my FrameLayout in tw_status_bar.xml as:

<FrameLayout android:id="@id/power_button_sb" android:gravity="center" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_centerInParent="true">

and used it in PhoneStatusBar.smali as (hope in a proper way):

const-string v2, "power_button_sb"

Image ID I kept unchanged.

Still I must do something wrong .... :(

Probably I will never make this mod but I haven't given up yet ;)

Nevertheless thanks for your time.

BTW dumpstate attached.

Edit: Finally no FC of SystemUI when I place a FrameLayout's ID (taken from public.xml) instead of image ID but toggling it from settings seems has no infuence on power button (the mod still works when I "disable"/hide the button) ...
[Galaxy S II Android Development] Goldie:
Did you reboot or restart systemui after toggling? There is no observer so it won't take effect immediately and will need a reboot.

And for I info....above where you posted "I used the id....const-string v2"....that is the key rather than the id. And will must match with the key in the toggle in settings. The id as you found out is the public number of the id for the FrameLayout :)
[Galaxy S II Android Development] Many40:
No but did it just now and it woooooorks !!! Thanks mate :D

Next step will be to have it changing on-the-fly. Is it very complicated or doable?

Anyway, thanks a lot mate :D:good:
[Galaxy S II Android Development] Goldie:
Do you have a file called PhoneStatusBar$SettingsObserver?
[Galaxy S II Android Development] Many40:
Yes.
[Galaxy S II Android Development] Goldie:
Then its easy. Remember traffic mod?

In PhoneStatusBar$SettingsObserver duplicate these 4 lines in observe method. They will already exist for a different key...

...substitute "recents_button" with your key.

Then duplicate these 2 lines in onchange method...

....substituting "update_recents_button" with the name of your method.

Done :)
[Galaxy S II Android Development] Many40:
I have to (at the first opportunity) invite you for good beer (if you are over 18 of course ;))

Sorry for OT :)
[Galaxy S II Android Development] sbreen94:
Hey Goldie, I have a quick, probably dumb question:cyclops: about changing the text colors for things.

When i search for setText(Ljava/lang/CharSequence;)V In systemui in smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali it returns a number of results for different things to change the text color in this setup:

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

Do i need to change that first line to something like this before i can add the rest of the code that you laid out in the 2nd post?

invoke-virtual {v1, v2}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setText([COLOR="rgb(221, 160, 221)"]Ljava/lang/CharSequence[/COLOR]V

Thanks for any help or info you can give!
[Galaxy S II Android Development] Goldie:
No. In the example Dateview is itself a textview so setText is invoked directly on it ( see the p0 first in the brackets means " this " file.)

PhoneStatusBar has many views in it. You will see an iget v1 or a check-cast v1 further up the code that puts a textview into v1. Hence the invoke for setText is on Landroid/widget/textview (the v1 in the brackets).

Your setTextColor will also be invoked on Landroid/widget/TextView so the same v1 will be first in the brackets.

Make sense? :)
[Galaxy S II Android Development] remuntada78:
Hi Goldie I noticed a strange thing, i was able to apply your color image tutorial for icon in statusbar,but the clock alarm icon and bluetooth icon

change color only if i restart device, it's not a big problem but they should work in this way?
[Galaxy S II Android Development] sbreen94:
Alright i think ive got what you are saying, so im looking to change colors of the text on the power menu and in GlobalActions$SinglePressAction i found the setText(Ljava/lang/CharSequence and added this code afterwards.

iget-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->mMessage:Ljava/lang/CharSequence;

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

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

move-result-object v4

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

move-result-object v4

const-string v5, "epm_color"

const v6, -0xcc4a1a

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

move-result v4

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

.line 1698

although the text color doesnt change. Do i have an error in the above code, or maybe the wrong spot..

Thanks again for your help

Edit: Figured it out! :) There is another set text controlling the same thing that i was missing :) Thanks again Goldie!
[Galaxy S II Android Development] sbreen94:
Alright haha, got another quick question for you :o Can i use the same key through different smali files? I have coloring working for All the options on my power menu except airplane mode which is controlled by GlobalActions$ToggleAction.smali while all the other are controlled by GlobalActions$SinglePressAction.smali. Can i use the key i used in the singlepressaction.smali to link the smali in toggleaction.smali so they all get colored the same thing like at once?

Thanks :angel:
[Galaxy S II Android Development] remuntada78:
yes if you mean to change the color text with the same colorpicker
[Galaxy S II Android Development] Goldie:
Yes you can :)
[Galaxy S II Android Development] sbreen94:
Alright good to know, thanks! I'll probably have more questions as i get in deeper with all this fun-ness :good:
[Galaxy S II Android Development] Goldie:
Logcat zip is corrupt :/
[Galaxy S II Android Development] remuntada78:
try now
[Galaxy S II Android Development] Goldie:
Need the vfy errors from further up the log :)

Upload the dumpstate_sys_error
[Galaxy S II Android Development] remuntada78:
the fact is there aren't VFY errors related to AlertController but only these

W/dalvikvm( 5079): VFY: unable to resolve static method 1608: Landroid/provider/Telephony$Sms;.getDefaultSmsPackage (Landroid/content/Context;)Ljava/lang/String;

D/dalvikvm( 5079): VFY: replacing opcode 0x71 at 0x005b

I/dalvikvm( 5079): Could not find method android.telephony.TelephonyManager.getMmsUserAgent, referenced from method fo.C

W/dalvikvm( 5079): VFY: unable to resolve virtual method 6807: Landroid/telephony/TelephonyManager;.getMmsUserAgent ()Ljava/lang/String;

D/dalvikvm( 5079): VFY: replacing opcode 0x6e at 0x000f

edit

i can upload logcat so i put it in my dropbox https://www.dropbox.com/s/x29gqwwyfuexfyu/logcat.zip
[Galaxy S II Android Development] Goldie:
No vfy for alertcontroller huh?!

Trying to use v4 in setupContent when it holds nothing :)
[Galaxy S II Android Development] Goldie:
Oh sorry...type 4 lol! Tried registers 13? You have p0, p1 and your using up to v10 ;)

Although original code only looked to use up to v5 so you could have used 6, 7 and 8 and registers including p0 and p1 as 10 :)
[Galaxy S II Android Development] remuntada78:
I have not tried it yet with register 13 but i'm confused again because without the code for toggle on/off the change color code worked.

but you're right i need to increase register to 13

edit

as always you were right with register 13 it work:good:
[Galaxy S II Android Development] sbreen94:
Hey Goldie. I have another general question. How do you decide which registers numbers like v5 etc to use when coding in a new toggle for color picker or toggle etc. Do you have any general guidelines?

Thanks
[Galaxy S II Android Development] remuntada78:
Coloring Stuff:

Text Colors

Now we need to add some code to look up that entry and return the color to the smali. There are 3 elements to this:

The ContentResolver

This is used to resolve the entry in the database. In order to use the content resolver we must put it into a register as we mentioned earlier. At the top of the method you will see .locals X where X is a number. This is the number of registers used in the method. So if it says .locals 5 there will be v0,v1,v2,v3 and v4. We need to add 3 to this value as we will be using 3 new registers. One for the resolver, one for the default color (in case there is no entry in the database it needs to have a color to set) and one for the key.

Now we need context in order to get the content resolver. There are a few ways to do this. A lot of files have a field called mContext. This can be used directly like this:

iget-object v5, p0, Lcom/android/systemui/statusbar/policy/BrightnessController;->mContext:Landroid/content/Context;

This is using iget-object to put mContext into v5. As mentioned earlier the p0 mean “this”.

The v5 should be the first of the new registers you added. So if previously .locals was 5 and you changed it to 8 then this would be v5 as v0 to v4 already exist. You can reuse registers but you can run into problems if it is needed further through the code so it is advisable to add new.

￼

Inviato dal mio GT-I9100 utilizzando Tapatalk
[Galaxy S II Android Development] sbreen94:
Makes sense. Thanks for the clarification :)
[Galaxy S II Android Development] remuntada78:
sorry if i post here :angel: i would like to know what you think about this http://xdaforums.com/showpost.php?p=48458240&postcount=1880
[Galaxy S II Android Development] majdinj:
[MENTION=3065070]Goldie[/MENTION] you are amazing man by writing such comprehensive tutorials for understanding smali codes..

I just logged in and guess what; a great thread is there. :laugh:

I really learned from you a lot, and your thread helped me to polish my existing knowledge about smali.. :good:

...BETTER SHARE, BETTER CARE...

Don't you think it would be better if you move this great thread into xda university section?

It will be such excellent reference for all users (or just as I thought :))
[Galaxy S II Android Development] Goldie:
Thanks but I think you exaggerate. I dont think you needed any polishing ;)

With regard to moving...things tend to get lost in the general forums. This thread is in s3 and note2 forums too and has pretty much zero posts :)
[Galaxy S II Android Development] Vivek_Neel:
invoke-static {v5,v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

Hi goldie..:)..I need a clarification.

My understanding:

Invoke static {v5, v6, v7}::

Invokes the get int () with parameters v5, v6, v7

Landroid/provider/Settings$System; ---

Its the object type class

getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I --

Its the method with two parameters (Landroid/content/ContentResolver;Ljava/lang/String;) which has been called .

Am I right mate?..:(

Unlike java smali is so difficult to understand :(
[Galaxy S II Android Development] Goldie:
Yes...getint is the method , Landroid/provider/Settings$System is the file its in and the stuff in brackets is parameters. In this case three contentresolver, string and integer. The I after brackets is the return type. :)
[Galaxy S II Android Development] remuntada78:
[MENTION=3065070]Goldie[/MENTION]

Hi Goldie i hope you give us a special xmas gift with another great tutorial:D
[Galaxy S II Android Development] Vivek_Neel:
First time I did a mod by not just following the guide blindly but by understanding .

Now I can change the dropdown date to any colour.

Am damn happy.

Thanks a lot goldie..and to all my friends advance happy Christmas and Happy new year.
[Galaxy S II Android Development] remuntada78:
Merry Christmas and Happy new year to you too and to Goldie the great teacher and to all xda users
[Galaxy S II Android Development] Goldie:
Merry Christmas guys. Im away for a few days til 30th. Have a good one :)
[Galaxy S II Android Development] sbreen94:
Merry Christmas to you as well Goldie :))
[Galaxy S II Android Development] phenomarc:
Thanks [MENTION=3065070]Goldie[/MENTION]. With the help of your guides, I've added a lot of options to change color to my ROM.

Thanks again and Merry Christmas.
[Galaxy S II Android Development] remuntada78:
http://xdaforums.com/showpost.php?p=47939586&postcount=191

trying to understand what was wrong, i thought the values ​​that I gave to the registers were in conflict because i put v7,v8,v9 and v7 was already implemented after in the method, so I increased

.method public create(Landroid/content/Context;Landroid/view/View;Landroid/view/ViewGroup;Landroid/view/LayoutInflater;)Landroid/view/View;

.registers 15

registers 15 to registers 16

and v7,v8,v9 to v8,v9,v10

now it work perflectly:laugh:

happy xmas:laugh::laugh::laugh:
[Galaxy S II Android Development] remuntada78:
[MENTION=3065070]Goldie[/MENTION], hi Goldie and Happy new year, i tried to implement change text color in simunlock screen and as you can see i was able with highlighted in red,but with highlighted in green not

i think it depend on .method private getSimUnlockProgressDialog()Landroid/app/Dialog;

.method private getSimUnlockProgressDialog()Landroid/app/Dialog;
.registers 4

.prologue
.line 320
iget-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;

if-nez v0, :cond_32

.line 321
new-instance v0, Landroid/app/ProgressDialog;

iget-object v1, p0, Landroid/view/View;->mContext:Landroid/content/Context;

invoke-direct {v0, v1}, Landroid/app/ProgressDialog;-><init>(Landroid/content/Context;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;

.line 322
iget-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;

iget-object v1, p0, Landroid/view/View;->mContext:Landroid/content/Context;

const v2, 0x104040b

invoke-virtual {v1, v2}, Landroid/content/Context;->getString(I)Ljava/lang/String;

move-result-object v1

invoke-virtual {v0, v1}, Landroid/app/ProgressDialog;->setMessage(Ljava/lang/CharSequence;)V

.line 324
iget-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;

const/4 v1, 0x1

invoke-virtual {v0, v1}, Landroid/app/ProgressDialog;->setIndeterminate(Z)V

.line 325
iget-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;

const/4 v1, 0x0

invoke-virtual {v0, v1}, Landroid/app/Dialog;->setCancelable(Z)V

.line 326
iget-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;

invoke-virtual {v0}, Landroid/app/Dialog;->getWindow()Landroid/view/Window;

move-result-object v0

const/16 v1, 0x7d9

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

.line 329
:cond_32
iget-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mSimUnlockProgressDialog:Landroid/app/ProgressDialog;

return-object v0
.end method

but inside there isn't setText code ,so which code i need to implement?

thanks

edit:maybe i need to edit ProgresDialog smali in framework.jar it's right?
[Galaxy S II Android Development] Goldie:
Happy New Year to you too :)

What does that text say and what does id 4040d refer to?
[Galaxy S II Android Development] remuntada78:
id 4040d refer to lockscreen_sim_unlock_progress_dialog_message
[Galaxy S II Android Development] Goldie:
And lockscreen_sim_unlock_progress_dialog_message string is the text you circled in red?
[Galaxy S II Android Development] remuntada78:
no,lockscreen_sim_unlock_progress_dialog_message string is "Unlocking SIM card…" string but i need "SIM/RUIM card is locked" string which has id 0104040a but i can't find it in android.policy,framework,framework2.
[Galaxy S II Android Development] Goldie:
Probably set in layout then. Check the layout for the string name. Then if its there call its id and set it like that in the same place as your other text colors :)
[Galaxy S II Android Development] remuntada78:
i'm sorry i don't understand exactly what you mean
[Galaxy S II Android Development] Goldie:
Well in the layout xml it will have textview with that string. If it has an id in the layout just follow the tutorial to call the text by its id and put it in a register. If it doesnt then add the android id = in the xml and do the same. Then apply color as normal. :)
[Galaxy S II Android Development] remuntada78:
ok how to find id it is carrier id, but i'm not sure where to add the code ,in which smali file,maybe the same where i add the other code for simunlock?
[Galaxy S II Android Development] Vivek_Neel:
Don't u have android: id="@id/...." In < text view line

Copy that string after @id/ and search in public.xml

Copy that I'd and paste it in smali.
[Galaxy S II Android Development] Goldie:
Yes same smali
[Galaxy S II Android Development] remuntada78:
ok i've found another way, in the KeyguardStatusViewManager.smali there are codes for carrier so i've implemented the code for change textxcolor and now it work:laugh:

thanks to both of you
[Galaxy S II Android Development] maskerwsk:
Hi.

is it possible to create a new method and porterduff to colour the below?
[Galaxy S II Android Development] Goldie:
Yes but you would need to apply the colorfilter to the drawable in v1 before it is used in setimageDrawable
[Galaxy S II Android Development] maskerwsk:
would that be done here:
[Galaxy S II Android Development] remuntada78:
Hi Goldie I was watching SimUnlockScreen.smali where i implemented code to change color, and I noticed codes for

CALLING THINGS BY ID like your tutorial

.line 124
const v0, 0x1020373

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

move-result-object v0

check-cast v0, Landroid/widget/TextView;

iput-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mLockinfoText:Landroid/widget/TextView;

.line 125
const v0, 0x1020375

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

move-result-object v0

check-cast v0, Landroid/widget/TextView;

iput-object v0, p0, Lcom/android/internal/policy/impl/SimUnlockScreen;->mPinText:Landroid/widget/TextView;

I would like to know what mean check-cast

thanks
[Galaxy S II Android Development] Goldie:
check-cast is used to change something into something else. So in the above it is calling a view and casting or making it a TextView.
[Galaxy S II Android Development] Goldie:
Well here it is put into v0. Paste the few lines above your line you wanted to color. There will be an iget or move for v1 that relates to a drawable
[Galaxy S II Android Development] maskerwsk:
here is the method im trying to mod :)
[Galaxy S II Android Development] Goldie:
Ok...well the invoke p0 v1 is to put blank in the slot. So you need to apply color to v0 after move-result-object v0
[Galaxy S II Android Development] maskerwsk:
ok thanks goldie, ill give that a try :)

---------- Post added at 09:53 AM ---------- Previous post was at 09:20 AM ----------

Hi again, im really struggling with this one.

here is what ive done. am I even in the right ball park?