yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Android Development] Eko De Brayenz:
thank you sir top of this guide now I can experiment with color :fingers-crossed:
[Galaxy S II Android Development] remuntada78:
Hi Goldie, what do you think about 4 post above, I thought I had finished but I was wrong

thanks

edit:i realized that it is for missed call and missed msg so not for unlock effect , this time i think i finished with the mod
[Galaxy S II Android Development] remuntada78:
i tried to do this mod a few months ago http://xdaforums.com/showpost.php?p=46643423&postcount=16 and with the Goldie's help I was able to change SecSettings for the listpreference but i stopped with SystemUI because I did not know the code to switch pngs ,but now i think that with the new code for swith shared by Goldie it is possible, the only different thing by your request is you need to do id by id ,not with array:D
[Galaxy S II Android Development] remuntada78:
Hi Goldie this is also your merit http://xdaforums.com/showpost.php?p=50901340&postcount=1995
[Galaxy S II Android Development] remuntada78:
I would do it this way, first of all i would add a listpreference in SecSettings to choose the theme , something like this

then for the SystemUI part

.method public constructor <init>(Landroid/content/Context;)V
.locals[COLOR="Red"] 12[/COLOR]
.parameter "context"

.prologue
const/4 v7, 0x0

.line 112
const/4 v2, 0x0
[COLOR="Red"]
iget-object v9, p0, Lcom/android/systemui/statusbar/policy/quicksetting/AirplaneModeQuickSettingButton;->mContext:Landroid/content/Context;

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

move-result-object v9

const-string v10, "change_icon_toggle"

const v11, 0x0

invoke-static {v9, v10, v11}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v9

const v10, 0x1

if-eq v9, v11, :cond_new

const v10, 0x2

if-eq v9, v11, :cond_new2

const v3, 0x7f0a00f5 [COLOR="Blue"]|[/COLOR]

const v4, 0x7f0201ba [COLOR="Blue"]|[/COLOR]
[COLOR="Blue"]these are the stock icon[/COLOR]
const v5, 0x7f0201b9 [COLOR="Blue"]|[/COLOR]

const v6, 0x7f0201b8 [COLOR="Blue"]|[/COLOR]

goto :goto_new

:cond_new

const v3, 0x7f0a00f5[COLOR="Blue"]this is for the text i think it should remain the same[/COLOR]

const v4, 0xnew id

const v5, 0xnew id

const v6, 0xnew id

goto :goto_new

:cond_new2

const v3, 0x7f0a00f5[COLOR="Blue"]this is for the text i think it should remain the same[/COLOR]

const v4, 0xnew id

const v5, 0xnew id

const v6, 0xnew id

:goto_new[/COLOR]

move-object v0, p0

move-object v1, p1

move v8, v7

invoke-direct/range {v0 .. v8}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;IIIIII)V

.line 53
iput-boolean v7, p0, Lcom/android/systemui/statusbar/policy/quicksetting/AirplaneModeQuickSettingButton;->mIsWaitingForEcmExit:Z

then make it the same way for the others quicksettingbutton files
[Galaxy S II Android Development] CNexus:
[MENTION=5292754]remuntada78[/MENTION]

It's like I was saying before, you can't change the code that comes before QuickSettingButton;->init(...) because the call to the super constructor has to be the first line of code

This is roughly the equivalent java code:

public WifiQuickSettingButton(Context context){
super(context, null, textId, onId, offId, dimId, int, int);
mIsWaitingForEcmExit = false;
...

So you can't have all that change_icon code before the super constructor is called because that HAS to be the very first call...what you can do, as I said before, is to have the ids of the new icons and call the setIcon(IIII) [name is something similar to that but it's obvious by the fact that it takes all integers] and then set your new icons based on whether the "use new icons" toggle is on or off
[Galaxy S II Android Development] remuntada78:
ok i can understand the part where you said i can't change the code that comes before QuickSettingButton;->init(...) i was wrong as this

so i think i need to add the code after QuickSettingButton;->init(...) , but i' sorry i don't understand the part with setIcon(IIII), what you mean?:silly:
[Galaxy S II Android Development] CNexus:
What I mean by that is that there is a method to set the id's of the toggle icons to new ones

So after the constructor is called, you do you're switch code to set the new id's into v3, v4...etc and then call setIcon on those registers that hold the new id's
[Galaxy S II Android Development] CNexus:
Then he did it incorrectly in a way that was interpreted as more than one line of code...the java version of your smali [MENTION=3065070]Goldie[/MENTION] is still one line of code, so there is still no code before the actual call to the super constructor. I didn't mean no smali before the call to the super constructor, because obviously there is smali before the init call on the stock version of the smali itself

public WifiQuickSettingButton(Context context){
super(context, null, Settings.System.getInt(context.getContentResolver(), "toggle_icon_type", 0) != 0 ? (Settings.System.getInt(context.getContentResolver(), "toggle_icon_type", 0) == 1 ? newId1: newId2) : newId3,....idN)

...
}

It only works for if statements because you can stack it into one line that calls the super constructor. But try printing a log line or anything else and the vm will reject that smali file.
[Galaxy S II Android Development] Goldie:
Exactly. This is a smali thread. So even though it might be one line in java its not in smali. Hence you saying "you cant have all that change icon code before the call" was wrong. He can have it before the call in smali as he is just filling the registers. You have to remember that not everyone knows java so what you said would be confusing I would think. Looking at the code I posted there is indeed, to someone who doesnt know java, code before the call.

Anyway...it works so no point in going into it any further. Suppose the thing for people to take from this is that in smali you can have as many lines as you want before the actual call to fill the registers so long as they are filled before the call. :)
[Galaxy S II Android Development] remuntada78:
Hi Goldie thanks again for your shared code, now it work, i was turn around on it without success, the only thing i don't like is that icons change only if i restart the device.how can i do without restart?
[Galaxy S II Android Development] CNexus:
Content observer of course

What I did for that was to implement it inside the QuickSettingPanel...I can post my code later if you like, obviously you'll need to change the database keys it listens to for your settings
[Galaxy S II Android Development] remuntada78:
yes thanks i'll try to understand how to implement it:good:
[Galaxy S II Android Development] CNexus:
Yes as in you do want me to post my code..?
[Galaxy S II Android Development] remuntada78:
if it is in smali code is better,:p
[Galaxy S II Android Development] CNexus:
Yes I meant the smali of course
[Galaxy S II Android Development] remuntada78:
thanks
[Galaxy S II Android Development] remuntada78:
i suppose that in this {p0, v0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingPanel;->regObserver(Landroid/content/ContentResolver;)V

i 've to add invoke-direct, i'm right?

edit:

adding invoke-direct all work perfectly and without restart device thanks again:laugh:

can i consider this as a general way to add an observer,or it change case by case?
[Galaxy S II Android Development] CNexus:
Oh whoops, it didn't copy completely haha

But this way is generic, you only.need to make sure you change the constructor for the SettingsObserver class based on the type of the object you are updating (in this case it's QuickSettingPanel)

And then you need to change the access$400 method to call whatever method will correctly update the view...because that can vary by class too
[Galaxy S II Android Development] remuntada78:
Hi Goldie I need some clarification.

In the code for choose unlock effect we have

iget-object v2, p0, Lcom/android/internal/policy/impl/sec/CircleUnlockView;->mContext:Landroid/content/Context;

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

move-result-object v2

const-string v3, "unlock_effect"

const v4, 0x0

in the code for choose toggles icon we have

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

move-result-object v1

const-string v2, "toggles_chooser"

const v3, 0x0

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

why we have missed this string?

iget-object v2, p0, Lcom/android/internal/policy/impl/sec/xxxxxxxxx;->mContext:Landroid/content/Context;
[Galaxy S II Android Development] CNexus:
Are you asking why the second one doesn't have that code while the first does?

If so, the answer is simple

In the first mod, you are retrieving the mContext field to then get a contentresolver object from that

In the second one, you are getting the contentresolver from the parameter context that was passed to that particular method (p1)
[Galaxy S II Android Development] c_shekhar:
I never knew there existed such a wonderful thread.. Subscribing now...

Thanks to [MENTION=3065070]Goldie[/MENTION]
[Galaxy S II Android Development] :
Sir [MENTION=3065070]Goldie[/MENTION], & Sir [MENTION=4645794]CNexus[/MENTION],

I've ported one function from S2 beanstalk Rom, lockscreen wallpaper, mode.

I got it working from the settings but it's not actually changing the lock background.

So I would appreciate help for making it work completely.

I've a mediatek device running almost aosp rom.

Also please let me know what smali files I've to edit to make it work for changing lockscreen background.

Beanstalk ROM is 4.4 and my device is having 4.2

So the android.policy. jar is different and dont have keygaurdlock pattern smali files in Beanstalk android.policy.jar.

So please help in this.
[Galaxy S II Android Development] remuntada78:
Hi to all ,inyour opinion it's possible do real lensflare for 4.1.2 JB without install third app ,or it need 4.2.2 and more?

thanks in advance
[Galaxy S II Android Development] gerryS2:
I wanted to bring the lensflare lockscreen from android.policy of S2 plus with 4.2.2, but there are too many files to check.

To check I means the existence of particular methods in some file of framework folder, like framework.jar and framework2.jar ;)
[Galaxy S II Android Development] Paul Blake:
Belive me ... if you manage to port it you will be rewarded but porting it is impossible... 4.2.2 have lockscreen widgets and 4.1 doesn't
[Galaxy S II Android Development] remuntada78:
Hi, i've a new target, I would like to achieve show a random image in the pulldown notification panel, to do this i created an app with eclipse and extract this code for random, the example is with 3 new image

.field private mImageIds:[Ljava/lang/Integer;

.field final rand:Ljava/util/Random;

.
.
.

new-instance v0, Ljava/util/Random;

invoke-direct {v0}, Ljava/util/Random;->[COLOR="Red"]<init>()V <-- this change with the name of method where to add the new code[/COLOR]

iput-object v0, p0, Lcom/random/RandomActivity;->rand:Ljava/util/Random;

const/4 v0, 0x3

new-array v0, v0, [Ljava/lang/Integer;

const/4 v1, 0x0

const v2, 0x7f020001 [COLOR="Red"]<--id of new image[/COLOR]

invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

move-result-object v2

aput-object v2, v0, v1

const/4 v1, 0x1

const v2, 0x7f020002 [COLOR="Red"]<--id of new image[/COLOR]

invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

move-result-object v2

aput-object v2, v0, v1

const/4 v1, 0x2

const v2, 0x7f020003 [COLOR="Red"]<--id of new image[/COLOR]

invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

move-result-object v2

aput-object v2, v0, v1

iput-object v0, p0, Lcom/random/RandomActivity;->mImageIds:[Ljava/lang/Integer;

move-result-object v4

array-length v4, v4

invoke-virtual {v0, v4}, Ljava/util/Random;->nextInt(I)I

move-result v0

aget-object v2, v2, v3

invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I

move-result v2

invoke-virtual {v1, v2}, Landroid/widget/ImageView;->setBackgroundResource(I)V

the value of v registers are to fix.

I thought to implement the above code in PhoneStatusBar.smali but i don't know how, i think around here

.method protected loadDimens()V
.locals 7
.
.
.

.line 3734
:cond_2
const v4, 0x7f020071 [COLOR="Red"]<--this is id of notification_panel_bg[/COLOR]

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v4

iget-object v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelBackgroundPadding:Landroid/graphics/Rect;

invoke-static {v4, v5}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->getNinePatchPadding(Landroid/graphics/drawable/Drawable;Landroid/graphics/Rect;)V

some help:D

thanks in advance
[Galaxy S II Android Development] Biftor:
Great :)

Do it in makestatusbarView method

I cant remember main layout of expanded statusbar.xml have id or not if have id

Call that with find view by id and use

setbackgroundresource

Or setbackgroundrawable

If that layout haven't id add id for that and do above :)

And for random save your random value an integer and use that,for save you can use public static xyz

Or save that to settings data base wit xyz key

Same as getint method but this time you want to save value and use putint and your randome value,and then call and use that for set bg :)

I hope this can help you :)

Goodluck

Armin.
[Galaxy S II Android Development] remuntada78:
i believe i don't need to work with id of statusbar_expanded
[Galaxy S II Android Development] Biftor:
why???you need :)

Goodluck

Armin.
[Galaxy S II Android Development] remuntada78:
because ,in my case, the code i extracted for random work with id of new png added in drawable , not with statusbar_expanded.

I'm not saying i'm right, or maybe i don't understand what you mean:silly:
[Galaxy S II Android Development] Biftor:
First think about what i said,:)

I said call the notification_panel id with find view by id

Thats main layout of statusbar_expanded.xml

Call that and set your pngs drawable to background of notification_panel layout

With setbackgrounddrawable,if is drawable or setbackgroundresource if thats resource

Ok????

And for save your random int you can use putint for settings database or make that public static .

This is what i said .

I hope you understand now :)

Goodluck

Armin.
[Galaxy S II Android Development] Goldie:
I guess you want a random image on each boot so no need to putint to database.

Sent from my GT-I9305
[Galaxy S II Android Development] Biftor:
Yes but,if he want use that for other things i think thata better have that value same as reference :)

And can use that every where he want :)

Goodluck

Armin.
[Galaxy S II Android Development] remuntada78:
I mean when i scroll down the curtain i want that background show at random image

Inviato dal mio GT-I9100 utilizzando Tapatalk
[Galaxy S II Android Development] Biftor:
If i not mistake you should do same things i am saying

You should make new method and make your random int for bg and store that in settings database and add observer gor that,then make new method again and call notification_panel id as i said and use your random int for bg of that

after that call random method on method of when pull down is show (i dont know which methods from phonestatusbar.smali i should check but cant now)

And for last call your notification panel bg method in makestatubarView in phonestatusbar.smali

And done :)

Goodluck

Armin.
[Galaxy S II Android Development] Adi Aisiteru Reborn:
4.4 is in Keyguard.apk , not in android.policy.jar

located in system/priv-app/Keyguard.apk..

try to port it from stock CM10.1
[Galaxy S II Android Development] remuntada78:
ok, I thought it was more simple, but now i don't understand why i need to store in setting database:silly:
[Galaxy S II Android Development] Biftor:
Ok,then how do you want to add observer??

And use that random int??

Ok if you know why asking??????

Goodluck

Armin.
[Galaxy S II Android Development] remuntada78:
i'm asking because i want to learn,and in many cases i don't know how to achieve all the steps
[Galaxy S II Android Development] :
Dear Adi Sir,

It Can't be possible that you will mod something and I will not try that. As you said, I have taken few files from your 3 Sec SystemUI MOD and now the options are working properly, though I have to edit a lot to work on our MTK.

But a Ton of Thanks to you and [MENTION=3065070]Goldie[/MENTION] Sir & [MENTION=4645794]CNexus[/MENTION] Sir.

Here is my thread I ported your MODs. -- SLT-TSUNAMI Advanced Edition

One more thing Sir, I am getting SystemUI FC whenever I select custom image in Notification Drawer Option.

These Force close is because I removed these lines -

.line 297
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/NotificationPanelView;->mBackground:Landroid/widget/ImageView;

invoke-virtual {v0, v2}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

But when I include these lines then I am getting FC from very starting with error java NullPointerException.

I tried changing the "Drawable files from framework.jar/android/graphics/drawable/ but that also not working.

Please help me in this.
[Galaxy S II Android Development] CNexus:
Why are you removing those lines? The null pointer is probably because the v0 register is used somewhere later in the code but you removed the line where the object's value was stored into v0.
[Galaxy S II Android Development] :
Didn't understand.

There are two v0 register used. Do I've to change it or anything else please explain.
[Galaxy S II Android Development] CNexus:
OK, to start off, why are you removing those lines to begin with?
[Galaxy S II Android Development] :
Sir,

If I'll include these aforesaid line then after boot i get systemUI FC message regularly.

So i removed it. And now other option like color fill and transparency is working but not custom image.

Now v0 register in that method there are two v0 so I'm asking where I've to change.
[Galaxy S II Android Development] Goldie:
Your method name needs ()V at the end for a start to say it returns void

Sent from my GT-I9305
[Galaxy S II Android Development] remuntada78:
yes your right i forgot it, no need to add other strings?the value of register are right?:p
[Galaxy S II Android Development] Biftor:
And where is your BG ids?

Check your app smali,for better things

Make what I said in your app make new method and store your int then copy that method completely :)

To phonestatusbar. Smali

Goodluck

Armin.
[Galaxy S II Android Development] Adi Aisiteru Reborn:
the lockscreen customization/background is in com/android/internal/policy/impl/Lockscreen.smali CM10.1 ..

guud luck Bond :)
[Galaxy S II Android Development] remuntada78:
what you mean with "store your int"?

i know how to store a key, like this

const-string v4, "unlock_effect"
[Galaxy S II Android Development] Biftor:
You always before i think used "getInt" method for get your integer value but this time use "putInt" method with a key string

Thats same as "getInt" method :)

Goodluck

Armin.
[Galaxy S II Android Development] Biftor:
see my codes :))

invoke-virtual {p0}, Lcom/Biftor/Biftor/Biftor;->getContentResolver()Landroid/content/ContentResolver; #this is should change with your context

move-result-object v0

const-string v1, "your_key"

const v2, 0xff000000 #your int

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

do the same
[Galaxy S II Android Development] F@HIM:
guys how to use adb shell can anyone tell me
[Galaxy S II Android Development] Many40:
You are in the wrong thread mate.

This might be helpful for you:

https://docs.google.com/document/pub?id=1H5eQ5ytpjohtN48Pp1JUyEOjDu_SBv-i-93vorEzidI
[Galaxy S II Android Development] tdunham:
Yes, tons of threads about ADB, how it works, how to get started:

http://www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/
[Galaxy S II Android Development] remuntada78:
for now your suggested way to achieve this mod is too difficult for me:silly:

i was thinking ,it's not possible do it in the following way?

this is original code in PhoneStatusBar.smali

.line 3730
const v4, 0x7f0b0006

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getInteger(I)I

move-result v4

iput v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelGravity:I

.line 3731
iget v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelGravity:I

if-gtz v4, :cond_2

.line 3732
const/16 v4, 0x30

iput v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelGravity:I

.line 3734
:cond_2
const v4, 0x7f020071[COLOR="Red"]<--this is id of notification_panel_bg png in drawable folder[/COLOR]

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v4

iget-object v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelBackgroundPadding:Landroid/graphics/Rect;

invoke-static {v4, v5}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->getNinePatchPadding(Landroid/graphics/drawable/Drawable;Landroid/graphics/Rect;)V

.line 3740

this is code how i was thinking

.line 3730
const v4, 0x7f0b0006

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getInteger(I)I

move-result v4

iput v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelGravity:I

.line 3731
iget v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelGravity:I

if-gtz v4, :cond_2

.line 3732
const/16 v4, 0x30

iput v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelGravity:I

.line 3734
:cond_2
[COLOR="Red"]here i was thinking to add the code for show at random [/COLOR]

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v4

iget-object v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelBackgroundPadding:Landroid/graphics/Rect;

invoke-static {v4, v5}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->getNinePatchPadding(Landroid/graphics/drawable/Drawable;Landroid/graphics/Rect;)V

.line 3740

if it is possible then it is the first step then i'll think for the observer, if it is not possible then I will need time:D

thanks anyway
[Galaxy S II Android Development] Biftor:
Ok i will do what i said in my free time easy to do!

Goodluck

Armin.
[Galaxy S II Android Development] remuntada78:
i was thinking on this suggestion,why in this case i need to implement the key?

i can understand it if i implement a listpreference but not in this case

thanks in advance