[MOD][HOW-TO] Change Volume Panel Timeout - AT&T, Rogers, Bell, Telus Samsung Galaxy S III

Tired of the volume panel sitting on the screen for what seems like way too long? You can now change the timeout so it hides much quicker.
We're going to be working with the following two files:
SecSettings.apk
framework.jar
KEY
ADD what's in RED
SecSettings.apk
Navigate to /res/values/arrays.xml
Add the following to the end of the file
Code:
<string-array name="volume_panel_timeout_entries">
<item>0.5s</item>
<item>1s</item>
<item>1.5s</item>
<item>2s</item>
<item>2.5s</item>
<item>3s (Default)</item>
</string-array>
<string-array name="volume_panel_timeout_values">
<item>500</item>
<item>1000</item>
<item>1500</item>
<item>2000</item>
<item>2500</item>
<item>3000</item>
</string-array>
Navigate to /res/values/strings.xml
Add the following to the end of the file
Code:
<string name="volume_panel_timeout_title">Volume Panel Timeout</string>
<string name="volume_panel_timeout_summary">%s</string>
Navigate to /xml/display_settings.xml
Add the following line wherever you would like it to show in the menu
Code:
<ListPreference android:persistent="false" android:entries="@array/volume_panel_timeout_entries" android:title="@string/volume_panel_timeout_title" android:key="volume_panel_timeout" android:summary="@string/volume_panel_timeout_summary" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/volume_panel_timeout_values" />
Navigate to /smali/com/android/settings/DisplaySettings.smali
Code:
.field mSupportFolderType:Z
.field private mTouchKeyLight:Landroid/preference/ListPreference;
[COLOR="Red"].field mVolumePanel:Landroid/preference/ListPreference;[/COLOR]
.method private updateState()V
Code:
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v4, "display_battery_percentage"
invoke-static {v0, v4, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_4
move v0, v1
:goto_1
invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
[COLOR="red"]iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mVolumePanel:Landroid/preference/ListPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "volume_panel_timeout"
const/16 v5, 0x5
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v3
invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mVolumePanel:Landroid/preference/ListPreference;
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mVolumePanel:Landroid/preference/ListPreference;
invoke-virtual {v3}, Landroid/preference/ListPreference;->getEntry()Ljava/lang/CharSequence;
move-result-object v3
invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V[/COLOR]
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mTouchKeyLight:Landroid/preference/ListPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "button_key_light"
.method public onCreate(Landroid/os/BundleV
Code:
const-string v11, "display_battery_level"
invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v11
check-cast v11, Landroid/preference/CheckBoxPreference;
iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
[COLOR="red"]const-string v11, "volume_panel_timeout"
invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v11
check-cast v11, Landroid/preference/ListPreference;
iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mVolumePanel:Landroid/preference/ListPreference;
iget-object v11, p0, Lcom/android/settings/DisplaySettings;->mVolumePanel:Landroid/preference/ListPreference;
invoke-virtual {v11, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V[/COLOR]
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getActivity()Landroid/app/Activity;
move-result-object v11
invoke-static {v11}, Lcom/android/settings/Utils;->isTablet(Landroid/content/Context;)Z
move-result v11
if-eqz v11, :cond_6
.method public onPreferenceChange(Landroid/preference/Preference;Ljava/lang/ObjectZ
Code:
:catch_2
move-exception v0
.line 1038
const-string v1, "DisplaySettings"
const-string v2, "could not persist Touch key light setting"
invoke-static {v1, v2, v0}, Landroid/util/Log;->secE(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
goto/16 :goto_4
.line 1040
:cond_9
[COLOR="red"]const-string v2, "volume_panel_timeout"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_next
check-cast p2, Ljava/lang/String;
invoke-static {p2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result v0
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "volume_panel_timeout"
invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mVolumePanel:Landroid/preference/ListPreference;
invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v0
invoke-virtual {v1, v0}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mVolumePanel:Landroid/preference/ListPreference;
iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mVolumePanel:Landroid/preference/ListPreference;
invoke-virtual {v1}, Landroid/preference/ListPreference;->getEntry()Ljava/lang/CharSequence;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V
goto/16 :goto_4
:cond_next[/COLOR]
const-string v2, "quick_launch"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
That's it for SecSettings. Compile.
framework.jar
Navigate to /smali/android/view/VolumePanel.smali
Find .method private resetTimeout()V
and replace the entire thing with this:
Code:
.method private resetTimeout()V
.locals 5
.prologue
const/4 v4, 0x5
.line 16
iget-object v1, p0, Landroid/view/VolumePanel;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
.line 17
const-string v2, "volume_panel_timeout"
const/4 v3, 0x0
.line 16
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
.line 18
.local v0, temp:I
invoke-virtual {p0, v4}, Landroid/view/VolumePanel;->removeMessages(I)V
.line 19
if-eqz v0, :cond_0
.line 20
invoke-virtual {p0, v4}, Landroid/view/VolumePanel;->obtainMessage(I)Landroid/os/Message;
move-result-object v1
int-to-long v2, v0
invoke-virtual {p0, v1, v2, v3}, Landroid/view/VolumePanel;->sendMessageDelayed(Landroid/os/Message;J)Z
.line 24
:goto_0
return-void
.line 22
:cond_0
invoke-virtual {p0, v4}, Landroid/view/VolumePanel;->obtainMessage(I)Landroid/os/Message;
move-result-object v1
const-wide/16 v2, 0xbb8
invoke-virtual {p0, v1, v2, v3}, Landroid/view/VolumePanel;->sendMessageDelayed(Landroid/os/Message;J)Z
goto :goto_0
.end method
Now compile framework.jar (Make sure you compile it correctly adding back the META-INF and preloaded-classes files)

First. (;
Sent from my SGH-I747 using Tapatalk 4

Sajoeee said:
First. (;
Sent from my SGH-I747 using Tapatalk 4
Click to expand...
Click to collapse
First thanks
awesome mod man

Danvdh said:
First thanks
awesome mod man
Click to expand...
Click to collapse
(; ah, man. should have done that. Second thanks. (;
Sent from my SGH-I747 using Tapatalk 4

Nice work....how about some array detail? Looks like you forgot to post up your res/arrays info.
Thanks man.

Didact74 said:
Nice work....how about some array detail? Looks like you forgot to post up your res/arrays info.
Thanks man.
Click to expand...
Click to collapse
Awkward... will do that right now
Sent from my SAMSUNG-SGH-I747
EDIT: Done. Here's what needs to be added:
Navigate to /res/values/arrays.xml
Add the following to the end of the file
Code:
<string-array name="volume_panel_timeout_entries">
<item>0.5s</item>
<item>1s</item>
<item>1.5s</item>
<item>2s</item>
<item>2.5s</item>
<item>3s (Default)</item>
</string-array>
<string-array name="volume_panel_timeout_values">
<item>500</item>
<item>1000</item>
<item>1500</item>
<item>2000</item>
<item>2500</item>
<item>3000</item>
</string-array>

You're a king with this stuff buddy, great work still not really sure what this mod does, is it the timeout for the volume sliders? but definately gonna do it

loserskater said:
Awkward... will do that right now
Sent from my SAMSUNG-SGH-I747
Click to expand...
Click to collapse
Thanks man!

sbreen94 said:
You're a king with this stuff buddy, great work still not really sure what this mod does, is it the timeout for the volume sliders? but definately gonna do it
Click to expand...
Click to collapse
When you press the volume buttons and the slider pops up, this changes how long that is displayed for.

loserskater said:
When you press the volume buttons and the slider pops up, this changes how long that is displayed for.
Click to expand...
Click to collapse
Alright very cool, Lol this is a very general question, but how the heck did you find where that was located in the framework files lol

sbreen94 said:
Alright very cool, Lol this is a very general question, but how the heck did you find where that was located in the framework files lol
Click to expand...
Click to collapse
I decompiled framework and searched for volume. Luckily it was in framework.jar, otherwise I would have just kept decompiling different files until I found it.
Sent from my SAMSUNG-SGH-I747

loserskater said:
I decompiled framework and searched for volume. Luckily it was in framework.jar, otherwise I would have just kept decompiling different files until I found it.
Sent from my SAMSUNG-SGH-I747
Click to expand...
Click to collapse
Ahh so you just have a general idea of what you want to do for a mod and then you search for corresponding files for it.

Mod Works like a charm. Easy to do for the Galaxy S4

Hi! Thanks for this usefull mod Just one small question - is there any way how to set some value as default? After apply this mod and after restart, there wasn't any timeout selected and after volume change volume panel was still visible.

somin.n said:
Hi! Thanks for this usefull mod Just one small question - is there any way how to set some value as default? After apply this mod and after restart, there wasn't any timeout selected and after volume change volume panel was still visible.
Click to expand...
Click to collapse
I just updated this on my rom. I'll edit the OP with the changes.
EDIT: Updated. You'll just have to change the framework.jar

loserskater said:
I just updated this on my rom. I'll edit the OP with the changes.
EDIT: Updated. You'll just have to change the framework.jar
Click to expand...
Click to collapse
Once again thanks for your mods and effort :good:

loserskater said:
Tired of the volume panel sitting on the screen for what seems like way too long? You can now change the timeout so it hides much quicker.
We're going to be working with the following two files:
SecSettings.apk
Click to expand...
Click to collapse
I want volume panel timeout, so i did all other things except in DisplaySettings.smali, actually i cant find those lines in here, so requested to you, i am given here my DisplaySettings.smali, you check please and put those edit in the file and give.
Thanks ☺
Link- https://drive.google.com/file/d/0B-yQqsVcgEKWOXFzc1lxVHh3X2c/view?usp=drivesdk

Related

[REQ]Samsung Fascinate lock screen port?

So, I have been looking around in the Framework-res and I see the files needed to have the puzzle lock screen, like on the Fascinate. So, is there a way to use it the I don't know of? If not, could it be ported? Or point me in the right direction to do it myself.
enragedpaza said:
So, I have been looking around in the Framework-res and I see the files needed to have the puzzle lock screen, like on the Fascinate. So, is there a way to use it the I don't know of? If not, could it be ported? Or point me in the right direction to do it myself.
Click to expand...
Click to collapse
Try using the search button. This had been asked since the phone was released.
People have tried porting it and it ends up in a boot loop. Right now we are on a leaked version of froyo so I can bet no one had tried porting the puzzle lock for froyo yet untill we get an official release.
The images have been there since eclair. Just cause the images are there mean we cant use them. Theres a **** load of images that we never see thets in the framework
Sent from my SPH-D700 using Tapatalk
I used search, haha, but thanks for being smart about it.......
Didn't find what you must have seen then, SO SORRY I made one more thread
The ones I mainly found were from the Vibrant, Captivate, and the cross seas version....
They had ports, so I figured I would ask
Check out this thread!
http://forum.xda-developers.com/showthread.php?t=854191
That's interesting.
Sent from my SPH-D700 using Tapatalk
That is why I brought it up..... If people have found out how to do it for other devices, that are froyo, why not some Epic love?
enragedpaza said:
That is why I brought it up..... If people have found out how to do it for other devices, that are froyo, why not some Epic love?
Click to expand...
Click to collapse
I will take a look but I won't spend alot of time knowing we don't got official froyo yet
Sent from my SPH-D700 using Tapatalk
mysteryemotionz said:
I will take a look but I won't spend alot of time knowing we don't got official froyo yet
Sent from my SPH-D700 using Tapatalk
Click to expand...
Click to collapse
I am so limited on time that I can't really look into this. Most of my visits and replies on XDA are from my mobile but it seems that he has included source for this project so that it can be compiled into other roms. I know this would be a big hit for the Epic. I have seen many people asking about the puzzle lock screen. This is nice because you can select from three or four lock screens in your settings!
Sent from my SPH-D700 using XDA App
Thats Easy, No Port needed
Just get an original Fascinate rom. With 7zip find android.policy.jar in the framework folder in the system folder and push it with to one you have in adb
samurai3032 said:
Just get an original Fascinate rom. With 7zip find android.policy.jar in the framework folder in the system folder and push it with to one you have in adb
Click to expand...
Click to collapse
Funny how simple it seems but that will not work! I bet your phone won't even boot. Try it and let me know how it goes!
Sent from my SPH-D700 using XDA App
smoothone said:
Funny how simple it seems but that will not work! I bet your phone won't even boot. Try it and let me know how it goes!
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
You have much to learn young padawan. You can get the services jar for the puzzle lock and port it over which would require changes more just a simple extract and push. On the thread I mentioned there are three lock screens with the ability to change between them in your settings application. This would require you to compile its source into your rom or build it into your rom just as ADW is built into CM6 for example. That way you could go into your settings and actually choose which lock screen you like. It is part of the rom since its source is open and available, hence compiled into CM6. I'm not very good at explaining this so I hope it makes sense :~)
Sent from my SPH-D700 using XDA App
It is ported to the vibrant. So im guessing it can be done to ours aswell. (not saying it would be easy in anyways)
Sent from my SPH-D700 using XDA App
smoothone said:
You have much to learn young padawan. You can get the services jar for the puzzle lock and port it over which would require changes more just a simple extract and push. On the thread I mentioned there are three lock screens with the ability to change between them in your settings application. This would require you to compile its source into your rom or build it into your rom just as ADW is built into CM6 for example. That way you could go into your settings and actually choose which lock screen you like. It is part of the rom since its source is open and available, hence compiled into CM6. I'm not very good at explaining this so I hope it makes sense :~)
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
then why is it that to port the AOSP lock screen all you need to is push the android.policy.jar file in to place without any moding?
http://forum.xda-developers.com/showthread.php?t=862292
samurai3032 said:
then why is it that to port the AOSP lock screen all you need to is push the android.policy.jar file in to place without any moding?
http://forum.xda-developers.com/showthread.php?t=862292
Click to expand...
Click to collapse
Read the whole thread bro.
samurai3032 said:
then why is it that to port the AOSP lock screen all you need to is push the android.policy.jar file in to place without any moding?
http://forum.xda-developers.com/showthread.php?t=862292
Click to expand...
Click to collapse
If you read the entire thread you will see that in order for that AOSP lock screen to work with our rom it had to be compiled. When you port over a mod or app it is not just cut and paste like your saying. You don't always have to recompile certain things you port over, it depends what you are doing but changes still have to be made. This mod has to be ported over and compiled from source. It is not difficult but I don't have the free time right now to do it. I am mostly on this forum by means of my cell. Its hard for me to sit at my computer for a few hours. Just don't have the time. A simple google search on porting in Android will better educate you. Listen if your so adamant about your cut and paste method then try it yourself. Report back but it will not be good news I promise!
Sent from my SPH-D700 using XDA App
Magic Oreo said:
It is ported to the vibrant. So im guessing it can be done to ours aswell. (not saying it would be easy in anyways)
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
Yes it can be ported over. Not extremely difficult if you know what your doing. Anyone with some free time, lol.
Sent from my SPH-D700 using XDA App
samurai3032 said:
then why is it that to port the AOSP lock screen all you need to is push the android.policy.jar file in to place without any moding?
http://forum.xda-developers.com/showthread.php?t=862292
Click to expand...
Click to collapse
Here is some code that was added to the vibrant port to get a two lockscreen port working,
Code:
=====================================================================================================================================
line 26:
=====================================================================================================================================
.field private static final KEY_LOCK_SCREEN:Ljava/lang/String; = "lock_screen"
=====================================================================================================================================
line 62:
=====================================================================================================================================
.field protected mLockPatternUtils:Lcom/android/settings/LockPatternUtils;
.field private mLockScreen:Landroid/preference/ListPreference;
=====================================================================================================================================
line 610:
=====================================================================================================================================
iget-object v11, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
iget-object v12, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockPatternUtils:Lcom/android/settings/LockPatternUtils;
invoke-virtual {v12}, Lcom/android/settings/LockPatternUtils;->getLockConfig()I
move-result v12
invoke-static {v12}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v12
invoke-virtual {v11, v12}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
iget-object v11, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
invoke-virtual {v11}, Landroid/preference/ListPreference;->getValue()Ljava/lang/String;
move-result-object v11
invoke-direct {p0, v11}, Lcom/android/settings/SoundAndDisplaySettings;->updateUnlockScreenSummary(Ljava/lang/Object;)V
====================================================================================================================================
add this method:
====================================================================================================================================
.method private updateUnlockScreenSummary(Ljava/lang/Object;)V
.locals 6
.parameter "value"
.prologue
.line 343
invoke-virtual {p0}, Lcom/android/settings/SoundAndDisplaySettings;->getResources()Landroid/content/res/Resources;
move-result-object v3
const v4, 0x7f050026
invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getTextArray(I)[Ljava/lang/CharSequence;
move-result-object v1
.line 344
.local v1, summaries:[Ljava/lang/CharSequence;
iget-object v3, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
invoke-virtual {v3}, Landroid/preference/ListPreference;->getEntryValues()[Ljava/lang/CharSequence;
move-result-object v2
.line 345
.local v2, values:[Ljava/lang/CharSequence;
const/4 v0, 0x0
.local v0, i:I
:goto_0
array-length v3, v2
if-ge v0, v3, :cond_0
.line 346
const-string v3, "foo"
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;->()V
const-string v5, "Comparing entry "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
aget-object v5, v2, v0
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v4
const-string v5, " to current "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
iget-object v5, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
invoke-virtual {v5}, Landroid/preference/ListPreference;->getValue()Ljava/lang/String;
move-result-object v5
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
.line 347
aget-object v3, v2, v0
invoke-virtual {v3, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_1
.line 348
iget-object v3, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
aget-object v4, v1, v0
invoke-virtual {v3, v4}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V
.line 352
:cond_0
return-void
.line 345
:cond_1
add-int/lit8 v0, v0, 0x1
goto :goto_0
.end method
=========================================================================================================================================
line 1111:
=========================================================================================================================================
new-instance v6, Lcom/android/settings/LockPatternUtils;
invoke-virtual {p0}, Lcom/android/settings/SoundAndDisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
invoke-direct {v6, v5}, Lcom/android/settings/LockPatternUtils;->(Landroid/content/ContentResolver;)V
iput-object v6, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockPatternUtils:Lcom/android/settings/LockPatternUtils;
.line 229
const-string v6, "lock_screen"
invoke-virtual {p0, v6}, Lcom/android/settings/SoundAndDisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v6
check-cast v6, Landroid/preference/ListPreference;
iput-object v6, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
.line 230
iget-object v6, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
invoke-virtual {v6, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
==================================================================================================================================================
line 1320:
==================================================================================================================================================
const-string v3, "lock_screen"
invoke-virtual {p1}, Landroid/preference/Preference;->getKey()Ljava/lang/String;
move-result-object v4
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_3
move-object v0, p2
check-cast v0, Ljava/lang/String;
move-object v3, v0
invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result v2
.restart local v2 #value:I
:try_start_3
iget-object v3, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockPatternUtils:Lcom/android/settings/LockPatternUtils;
invoke-virtual {v3, v2}, Lcom/android/settings/LockPatternUtils;->setLockConfig(I)V
:goto_2
invoke-direct {p0, p2}, Lcom/android/settings/SoundAndDisplaySettings;->updateUnlockScreenSummary(Ljava/lang/Object;)V
:try_end_3
.catch Ljava/lang/NumberFormatException; {:try_start_3 .. :try_end_3} :catch_1
.end local v2 #value:I
:cond_3
:goto_3
==============================================================================================================================================================
line 1414:
==============================================================================================================================================================
:catch_1
move-exception v3
move-object v1, v3
.line 528
.restart local v1 #e:Ljava/lang/NumberFormatException;
const-string v3, "SoundAndDisplaysSettings"
const-string v3, "could not persist screen unlock setting"
invoke-static {v8, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
goto :goto_3
Just an example of what is involved, well chop chop lets get to work. Were all waiting!
Sent from my SPH-D700 using XDA App
lol i think we will be waiting a long time if hes doing it. his phone prolly wont turn on now cause he wanted to try his cut and paste method.
smoothone said:
Here is some code that was added to the vibrant port to get a two lockscreen port working,
Code:
=====================================================================================================================================
line 26:
=====================================================================================================================================
.field private static final KEY_LOCK_SCREEN:Ljava/lang/String; = "lock_screen"
=====================================================================================================================================
line 62:
=====================================================================================================================================
.field protected mLockPatternUtils:Lcom/android/settings/LockPatternUtils;
.field private mLockScreen:Landroid/preference/ListPreference;
=====================================================================================================================================
line 610:
=====================================================================================================================================
iget-object v11, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
iget-object v12, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockPatternUtils:Lcom/android/settings/LockPatternUtils;
invoke-virtual {v12}, Lcom/android/settings/LockPatternUtils;->getLockConfig()I
move-result v12
invoke-static {v12}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v12
invoke-virtual {v11, v12}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
iget-object v11, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
invoke-virtual {v11}, Landroid/preference/ListPreference;->getValue()Ljava/lang/String;
move-result-object v11
invoke-direct {p0, v11}, Lcom/android/settings/SoundAndDisplaySettings;->updateUnlockScreenSummary(Ljava/lang/Object;)V
====================================================================================================================================
add this method:
====================================================================================================================================
.method private updateUnlockScreenSummary(Ljava/lang/Object;)V
.locals 6
.parameter "value"
.prologue
.line 343
invoke-virtual {p0}, Lcom/android/settings/SoundAndDisplaySettings;->getResources()Landroid/content/res/Resources;
move-result-object v3
const v4, 0x7f050026
invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getTextArray(I)[Ljava/lang/CharSequence;
move-result-object v1
.line 344
.local v1, summaries:[Ljava/lang/CharSequence;
iget-object v3, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
invoke-virtual {v3}, Landroid/preference/ListPreference;->getEntryValues()[Ljava/lang/CharSequence;
move-result-object v2
.line 345
.local v2, values:[Ljava/lang/CharSequence;
const/4 v0, 0x0
.local v0, i:I
:goto_0
array-length v3, v2
if-ge v0, v3, :cond_0
.line 346
const-string v3, "foo"
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;->()V
const-string v5, "Comparing entry "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
aget-object v5, v2, v0
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v4
const-string v5, " to current "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
iget-object v5, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
invoke-virtual {v5}, Landroid/preference/ListPreference;->getValue()Ljava/lang/String;
move-result-object v5
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
.line 347
aget-object v3, v2, v0
invoke-virtual {v3, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_1
.line 348
iget-object v3, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
aget-object v4, v1, v0
invoke-virtual {v3, v4}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V
.line 352
:cond_0
return-void
.line 345
:cond_1
add-int/lit8 v0, v0, 0x1
goto :goto_0
.end method
=========================================================================================================================================
line 1111:
=========================================================================================================================================
new-instance v6, Lcom/android/settings/LockPatternUtils;
invoke-virtual {p0}, Lcom/android/settings/SoundAndDisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
invoke-direct {v6, v5}, Lcom/android/settings/LockPatternUtils;->(Landroid/content/ContentResolver;)V
iput-object v6, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockPatternUtils:Lcom/android/settings/LockPatternUtils;
.line 229
const-string v6, "lock_screen"
invoke-virtual {p0, v6}, Lcom/android/settings/SoundAndDisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v6
check-cast v6, Landroid/preference/ListPreference;
iput-object v6, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
.line 230
iget-object v6, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockScreen:Landroid/preference/ListPreference;
invoke-virtual {v6, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
==================================================================================================================================================
line 1320:
==================================================================================================================================================
const-string v3, "lock_screen"
invoke-virtual {p1}, Landroid/preference/Preference;->getKey()Ljava/lang/String;
move-result-object v4
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_3
move-object v0, p2
check-cast v0, Ljava/lang/String;
move-object v3, v0
invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result v2
.restart local v2 #value:I
:try_start_3
iget-object v3, p0, Lcom/android/settings/SoundAndDisplaySettings;->mLockPatternUtils:Lcom/android/settings/LockPatternUtils;
invoke-virtual {v3, v2}, Lcom/android/settings/LockPatternUtils;->setLockConfig(I)V
:goto_2
invoke-direct {p0, p2}, Lcom/android/settings/SoundAndDisplaySettings;->updateUnlockScreenSummary(Ljava/lang/Object;)V
:try_end_3
.catch Ljava/lang/NumberFormatException; {:try_start_3 .. :try_end_3} :catch_1
.end local v2 #value:I
:cond_3
:goto_3
==============================================================================================================================================================
line 1414:
==============================================================================================================================================================
:catch_1
move-exception v3
move-object v1, v3
.line 528
.restart local v1 #e:Ljava/lang/NumberFormatException;
const-string v3, "SoundAndDisplaysSettings"
const-string v3, "could not persist screen unlock setting"
invoke-static {v8, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
goto :goto_3
Just an example of what is involved, well chop chop lets get to work. Were all waiting!
Sent from my SPH-D700 using XDA App[/QUOTE]
Lol u wrote all of that from your phone, that must be tiring.
Sent from my GT-I9000 using XDA App
Click to expand...
Click to collapse
webstar1 said:
Lol u wrote all of that from your phone, that must be tiring.
Sent from my GT-I9000 using XDA App
Click to expand...
Click to collapse
We DO have copy / paste you know.
And please, people, don't quote large blocks of code, images, or text. Drives me insane.

[Guide] Add toggle settings to hide clock/AM/PM

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
****** For ICS 4.0.4, the code has changed a bit. Instead of changing the original tutorial, I'm providing a known working patch I did for an i9100 XWLPT build ******
(there's also a 2nd patch below to ignore regular swipe actions while using AOSP lockscreen)
https://github.com/shoman94/SHOstock2-XWLPT/commit/523075aac1730883a14e365e29c58eb8cce03248
https://github.com/shoman94/SHOstock2-XWLPT/commit/a55fb9b42a5f3f0c0c840c72e68372ab6a199cc2
This tutorial will be a bit involved, you've been warned! It was more of a learning experience, so here are the things you will see:
1. Add toggle settings via xml
2. Add global settings that are retained
3. Add code support for your toggles
4. Have your toggles be smart, and enable/disable other related toggles
5. Add a debug message using Slog, this is invaluable for any project!
Based on 4.0.3 LP3 base..Adjust resource IDs (bolded) for your base!!
--------------------------------------------------------------------------
Step 1. Adding the toggles to Settings/Date & Time (the easy part)
Decompile Settings.apk, modify the following:
public.xml, add:
Code:
<public type="string" name="disable_ampm" id="[b]0x7f0b0923[/b]" />
<public type="string" name="disable_ampm_text" id="[b]0x7f0b0924[/b]" />
<public type="string" name="disable_time" id="[b]0x7f0b0925[/b]" />
<public type="string" name="disable_time_text" id="[b]0x7f0b0926[/b]" />
strings.xml, add:
Code:
<string name="disable_time">Hide Time</string>
<string name="disable_time_text">Remove time from status bar</string>
<string name="disable_ampm">Hide AM/PM</string>
<string name="disable_ampm_text">Remove AM/PM from time in status bar</string>
xml/date_time_prefs.xml, add:
Code:
<CheckBoxPreference android:title="@string/disable_time" android:key="hide_time" android:summary="@string/disable_time_text" />
<CheckBoxPreference android:title="@string/disable_ampm" android:key="hide_ampm" android:summary="@string/disable_ampm_text" />
Compile settings.apk, u/l and reboot. Make sure the toggles are added!
Step 2. Adding code for the settings (the not so easy part). This code gets a bit involved since we have to handle the new settings, and also add 'toggle logic' for different combinations to enable/disable them.
Still in settings.apk, DateTimeSettings.smali:
At top, add:
Code:
.field private mHideTime:Landroid/preference/Preference;
.field private mHideAmPm:Landroid/preference/Preference;
Then in the '.method private initUI()V', find 'return-void' and add this code above it:
Code:
const-string v6, "hide_time"
invoke-virtual {p0, v6}, Lcom/android/settings/DateTimeSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v6
check-cast v6, Landroid/preference/Preference;
iput-object v6, p0, Lcom/android/settings/DateTimeSettings;->mHideTime:Landroid/preference/Preference;
const-string v6, "hide_ampm"
invoke-virtual {p0, v6}, Lcom/android/settings/DateTimeSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v6
check-cast v6, Landroid/preference/Preference;
iput-object v6, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideTime:Landroid/preference/Preference;
check-cast v0, Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
if-eqz v0, :no_disablebtns
const/4 v0, 0x0
iget-object v6, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
invoke-virtual {v6, v0}, Landroid/preference/Preference;->setEnabled(Z)V
iget-object v6, p0, Lcom/android/settings/DateTimeSettings;->mTime24Pref:Landroid/preference/Preference;
invoke-virtual {v6, v0}, Landroid/preference/Preference;->setEnabled(Z)V
:no_disablebtns
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mTime24Pref:Landroid/preference/Preference;
check-cast v0, Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
if-eqz v0, :no_disableampm
const/4 v0, 0x0
iget-object v6, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
invoke-virtual {v6, v0}, Landroid/preference/Preference;->setEnabled(Z)V
:no_disableampm
Now search for '.method public onPreferenceTreeClick' and on the line below, change .locals 2 to:
Code:
.locals 6
Now search for:
:cond_2
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mTime24Pref:Landroid/preference/Preference;
if-ne p2, v0, :cond_0
change the last line to:
Code:
if-ne p2, v0, :cond_new
About 10 lines below that, you will see 'invoke-direct {p0, v0}, Lcom/android/settings/DateTimeSettings;->set24Hour(Z)V', add this below that line:
Code:
iget-object v1, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
if-nez v0, :cond_hideampm
const/4 v0, 0x1
goto :set_ampm
:cond_hideampm
const/4 v0, 0x0
:set_ampm
invoke-virtual {v1, v0}, Landroid/preference/Preference;->setEnabled(Z)V
:cond_updatetime
Then search for 'goto :goto_0' about 10 lines below and add this before '.end method':
Code:
:cond_new
const-string v3, "hide_ampm"
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
if-ne p2, v0, :cond_new2
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
check-cast v0, Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v2
:save_ampm
invoke-virtual {p0}, Lcom/android/settings/DateTimeSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "hide_ampm"
invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto :cond_updatetime
:cond_new2
const-string v3, "hide_time"
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideTime:Landroid/preference/Preference;
if-ne p2, v0, :goto_0
iget-object v0, p0, Lcom/android/settings/DateTimeSettings;->mHideTime:Landroid/preference/Preference;
check-cast v0, Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v2
:save_time
invoke-virtual {p0}, Lcom/android/settings/DateTimeSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "hide_time"
invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
if-nez v2, :cond_hidebtns
const/4 v2, 0x1
goto :cond_setbtns
:cond_hidebtns
const/4 v2, 0x0
:cond_setbtns
iget-object v1, p0, Lcom/android/settings/DateTimeSettings;->mHideAmPm:Landroid/preference/Preference;
invoke-virtual {v1, v2}, Landroid/preference/Preference;->setEnabled(Z)V
iget-object v1, p0, Lcom/android/settings/DateTimeSettings;->mTime24Pref:Landroid/preference/Preference;
invoke-virtual {v1, v2}, Landroid/preference/Preference;->setEnabled(Z)V
goto :cond_updatetime
And that's it for Settings! Recompile and upload and check everything looks right in Settings/Date and Time and the toggles work.
Step 3. Modifying the clock code to handle new changes (kinda easy =)
Decompile SystemUI and open Clock.smali.
Search for the following in func getSmallTime:
.local v3, context:Landroid/content/Context;
invoke-static {v3}, Landroid/text/format/DateFormat;->is24HourFormat(Landroid/content/ContextZ
Then add this code BEFORE the invoke-static .. line above (NOTE: there's a constant below that refers to the clock resource in public.xml [<public type="id" name="clock" id="0x7f0e0027" />], be sure it matches!):
Code:
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v7, "hide_time"
const/4 v0, 0x0
invoke-static {v2, v7, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v7
const/4 v0, 0x0
if-eqz v7, :cond_nohide
const/16 v0, 0x8
:cond_nohide
const v1, [b]0x7f0e0027[/b]
invoke-virtual {p0, v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->findViewById(I)Landroid/view/View;
move-result-object v1
invoke-virtual {v1, v0}, Landroid/view/View;->setVisibility(I)V
About 20 lines below that, you will see:
.local v1, MAGIC2:C
invoke-virtual {v3, v5}, Landroid/content/Context;->getString(I)Ljava/lang/String;
move-result-object v4
Add this directly after:
Code:
if-nez v2, :cond_continue
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, "hide_ampm"
const/4 v0, 0x0
invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v7
########### Start of debug msg, can be removed #######
const-string v0, "ampm"
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "getint returned="
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I
########### End of debug msg ###########
move v2, v7
if-eqz v2, :cond_continue
const-string v4, "h:mm"
:cond_continue
That's it for Clock.smali.
Step 4. Almost there, now we just have to make one more change to SystemUI in PhoneStatusBar.smali.
Find '.method public showClock' and change .locals 2 to:
Code:
.locals 3
Find:
if-eqz p1, :cond_1
const/4 v0, 0x0
and insert this code after it:
Code:
iget-object v2, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, "hide_time"
invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
if-eqz v2, :goto_0
const/16 v0, 0x8
Recompile SystemUI and reboot. Now try out the new feature =)
Excellent.... built into my rom. Thanks !
...or just use 24h format which is shorter and more natural
sorg said:
...or just use 24h format which is shorter and more natural
Click to expand...
Click to collapse
Ummm You can use this to remove the clock completely....
I just updated to OP to include Step 4. I didn't realize the lock screen was interfering with the feature since I don't use one..Fixed now.
Building into mine as well, tonight if I don't fall asleep.
And a few moments of disagreeing with smali, got it going...thanks a bunch Jeboo!
nice, welldone!
but it s better to leave public.xml, add only the others xml and recompile once.
then decompile again to get the public xml
it s safer, and then match the smali changes with the new public values.
Anyway great guide
if your decompiling with smali/baksmali directly make sure to use the -l flag (thats a L) so you have local varibles instead of registers, learned this the hard way lol
This mod is amazing, thank you very much my friend works fabulously
Add a toggle for CRT Animation
Building upon the same theme from the OP, we can now add another toggle under display settings for CRT animation. This feature is controlled by the boolean animateScreenLights in framework-res.apk (thanks to whomever the original author was!).
Since adding the setting is pretty much identical to the procedure in the OP, I will just discuss the relevant code needed to access the new setting (I leave adding the setting up to you!). The only requirement is you name your setting 'crt_animation'.
Our patch point will be inside services.jar, specifically PowerManagerService$BrightnessState.smali (this is based on LP7):
Code:
iget-object v6, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
iget-boolean v6, v6, Lcom/android/server/PowerManagerService;->mAnimateScreenLights:Z
if-nez v6, :cond_19
NOTE: cond_19 may differ depending on your decompiler.
So we need to delete the 3 lines above. In its place, add our new code:
Code:
iget-object v0, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
invoke-static {v0}, Lcom/android/server/PowerManagerService;->access$4300(Lcom/android/server/PowerManagerService;)Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "crt_animation"
const/4 v4, 0x0
invoke-static {v0, v1, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v6
if-eqz v6, :cond_19
NOTE: Again, if cond_19 is different, fix the last line above!
Recompile settings.apk & services.jar, u/l and reboot!
Porting this mod to the skyrocket
Hey jeboo, as i told you I am trying to port this over to my rom but need some guidance in clock.smali and PhoneStatusBar.smali Thanks I appreciate the help I am attaching the smali files...
adding toggle CRT animation settings
jeboo said:
Building upon the same theme from the OP, we can now add another toggle under display settings for CRT animation. This feature is controlled by the boolean animateScreenLights in framework-res.apk (thanks to whomever the original author was!).
Since adding the setting is pretty much identical to the procedure in the OP, I will just discuss the relevant code needed to access the new setting (I leave adding the setting up to you!). The only requirement is you name your setting 'crt_animation'.
Our patch point will be inside services.jar, specifically PowerManagerService$BrightnessState.smali (this is based on LP7):
Code:
iget-object v6, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
iget-boolean v6, v6, Lcom/android/server/PowerManagerService;->mAnimateScreenLights:Z
if-nez v6, :cond_19
NOTE: cond_19 may differ depending on your decompiler.
So we need to delete the 3 lines above. In its place, add our new code:
Code:
iget-object v0, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
invoke-static {v0}, Lcom/android/server/PowerManagerService;->access$4300(Lcom/android/server/PowerManagerService;)Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "crt_animation"
const/4 v4, 0x0
invoke-static {v0, v1, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v6
if-eqz v6, :cond_19
NOTE: Again, if cond_19 is different, fix the last line above!
Recompile settings.apk & services.jar, u/l and reboot!
Click to expand...
Click to collapse
hi Mr Jeboo.. could u specify the settings in the strings.xml and public.xml in settings.apk? i assume u have got this mod to work.. I couldn't get what to add in this files.. thanks..
Apparently when I was redoing the whole thing to do AOSP/CRT toggle I placed the step 4 in the wrong spot.
How would we disable Weather in Lockscreen when AOSP is checked?
Clock.smali
Ok so I found out that the the statusbarservices is where I look instead of phonestatusbar.smali
however I'm having trouble with the Clock.smali inserts.
Could someone take a look, who knows, and make any suggestions or point me where i need to edit?
jeboo said:
...
Find:
if-eqz p1, :cond_1
const/4 v0, 0x0
and insert this code after it:
Code:
iget-object v2, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, "hide_time"
invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
if-eqz v2, [B][COLOR="DarkOrange"]:goto_0[/COLOR][/B]
const/16 v0, 0x8
Recompile SystemUI and reboot. Now try out the new feature =)
Click to expand...
Click to collapse
On LPD, instead of :goto_0, use :goto_e
Robobob1221 said:
Ok so I found out that the the statusbarservices is where I look instead of phonestatusbar.smali
however I'm having trouble with the Clock.smali inserts.
Could someone take a look, who knows, and make any suggestions or point me where i need to edit?
Click to expand...
Click to collapse
I took a quick look at your clock.smali, GB sure made things complicated (24 registers vs 9 in ICS). When the registers change that much, unfortunately you're going to have to track them, it sucks.
One major problem I see is the return value from is24hourfmt in your ver uses v9, so you need to update the line 'if-nez v2, :cond_continue' to use v9 as well. Try that and let me know.
Thanks to the others for helping with the other changes lately..I must admit I use a much shorter patch for personal use, so I can fall behind with the latest code changes =)
jeboo
jeboo said:
I took a quick look at your clock.smali, GB sure made things complicated (24 registers vs 9 in ICS). When the registers change that much, unfortunately you're going to have to track them, it sucks.
One major problem I see is the return value from is24hourfmt in your ver uses v9, so you need to update the line 'if-nez v2, :cond_continue' to use v9 as well. Try that and let me know.
Thanks to the others for helping with the other changes lately..I must admit I use a much shorter patch for personal use, so I can fall behind with the latest code changes =)
jeboo
Click to expand...
Click to collapse
Thanks for checking out my file.
So you mean that the line should be 'if-nez v2, v9 :cond_continue' or just replace v2 with v9?
Thanks for the help
私はローボーボブ。 Haro!!
Robobob1221 said:
Thanks for checking out my file.
So you mean that the line should be 'if-nez v2, v9 :cond_continue' or just replace v2 with v9?
Thanks for the help
私はローボーボブ。 Haro!!
Click to expand...
Click to collapse
if-nez v9, :cond_continue
Basically if you're using military time, there's no need to worry about am/pm.
Still no compiling
jeboo said:
if-nez v9, :cond_continue
Basically if you're using military time, there's no need to worry about am/pm.
Click to expand...
Click to collapse
In plain English it seems so simple! Lol!
Thanks again. I'll check it out and see if it works. I hope it does Thanks again for the help.
Ok I tried the change you suggested and it still won't compile
I tried a few other changes but it results in the same error '
Could not smali file: [email protected]'. Sometimes the numbers ate end vary but its the same result.
another set is this
[email protected]
私はローボーボブ。 Haro!!
jeboo said:
if-nez v9, :cond_continue
Basically if you're using military time, there's no need to worry about am/pm.
Click to expand...
Click to collapse
Hello Jeboo!
Weird to say but.. with ur tutorial I ve been able to make a toggle to choose Samsung lockscreen or the AOSP one credits for u in my next Simplistic Disaster III Rom
whoa!

[MOD][HOW-TO][2.0] Long press volume to skip tracks (the right way!)

This has been updated. Check out the new thread: http://forum.xda-developers.com/showthread.php?t=2254022
Now includes checkbox in settings to enable and disable!
Thanks to jakubklos for his diff file and getting me in the right direction.
And a HUGE thanks to the CM team.
CODE IN RED IS NEW!
CODE IN BLUE IS MODIFIED!
Some of your lines/variables may be different.
I've attached the original and modified files so you can diff them yourself!
First, decompile SecSettings.apk. If you're unsure how to do that you're going to have some pretty big issues ahead.
Navigate to res/values/strings.xml
and add the following to the end:
Code:
<string name="volbtn_music_controls_title">Volume rocker music controls</string>
<string name="volbtn_music_controls_summary">When screen off, long-pressing the volume rockers will seek music tracks</string>
Next navigate to res/xml/sound_settings.xml
and add the section in red:
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/sound_settings" android:key="sound_settings"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<com.android.settings.RingerVolumePreference android:persistent="false" android:title="@string/all_volume_title" android:key="ring_volume" android:widgetLayout="@layout/round_more_icon" android:dialogTitle="@string/all_volume_title" android:streamType="ring" />
<com.android.settings.VibrationFeedbackPreference android:title="@string/vibration_intensity" android:key="vibration_feedback_intensity" android:summary="" android:widgetLayout="@layout/round_more_icon" android:dialogTitle="@string/vibration_intensity" />
<PreferenceScreen android:title="@string/phone_profile" android:key="phone_profile" android:summary="@string/normal" android:fragment="com.android.settings.phoneprofile.PhoneProfileSettings" />
<Preference android:title="@string/musicfx_title" android:key="musicfx">
<intent android:targetPackage="com.android.musicfx" android:targetClass="com.android.musicfx.ControlPanelPicker" />
</Preference>
<PreferenceCategory android:title="@string/sound_category_calls_and_notification_title" android:key="category_calls_and_notification" />
<PreferenceScreen android:title="@string/download_ringtones" android:key="download_ringtone" android:summary="">
<intent android:action="android.intent.action.VIEW" android:data="http://waprd.telstra.com/redirect?target=3glatesttones" />
</PreferenceScreen>
<com.android.settings.DefaultRingtonePreference android:persistent="false" android:title="@string/ringtone_title" android:key="ringtone" android:widgetLayout="@layout/round_more_icon" android:dialogTitle="@string/ringtone_title" android:ringtoneType="ringtone" />
<com.android.settings.DefaultRingtonePreference android:persistent="false" android:title="@string/voice_call_ringtone2" android:key="ringtone2" android:widgetLayout="@layout/round_more_icon" android:dialogTitle="@string/voice_call_ringtone2" android:ringtoneType="ringtone2" />
<PreferenceScreen android:title="@string/phone_vibration_title" android:key="phone_vibration" android:summary="@string/phone_vibration_summary" android:widgetLayout="@layout/round_more_icon">
<intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.personalvibration.SelectPatternDialog" />
</PreferenceScreen>
<com.android.settings.DefaultRingtonePreference android:persistent="false" android:title="@string/notification_sound_title" android:key="notification_sound" android:widgetLayout="@layout/round_more_icon" android:dialogTitle="@string/notification_sound_dialog_title" android:ringtoneType="notification" />
<CheckBoxPreference android:persistent="false" android:title="@string/vibrate_on_ring_title" android:key="vibrate_when_ringing" />
<PreferenceCategory android:title="@string/sound_category_system_title" />
<CheckBoxPreference android:title="@string/dtmf_tone_enable_title" android:key="dtmf_tone" android:defaultValue="true" android:summaryOn="@string/dtmf_tone_enable_summary_on" android:summaryOff="@string/dtmf_tone_enable_summary_off" />
<CheckBoxPreference android:title="@string/sound_effects_enable_title" android:key="sound_effects" android:defaultValue="true" android:summaryOn="@string/sound_effects_enable_summary_on" android:summaryOff="@string/sound_effects_enable_summary_off" />
<CheckBoxPreference android:title="@string/lock_sounds_enable_title" android:key="lock_sounds" android:defaultValue="true" android:summaryOn="@string/lock_sounds_enable_summary_on" android:summaryOff="@string/lock_sounds_enable_summary_off" />
<CheckBoxPreference android:title="@string/gps_notification_sounds_title" android:key="gps_notification_sounds" />
<CheckBoxPreference android:title="@string/haptic_feedback_enable_title" android:key="haptic_feedback" android:defaultValue="true" android:summaryOn="@string/haptic_feedback_enable_summary_on" android:summaryOff="@string/haptic_feedback_enable_summary_off" />
<SwitchPreferenceScreen android:title="@string/auto_haptic" android:key="autohaptic_settings" android:fragment="com.android.settings.autohaptic.AutoHapticSettings" />
<ListPreference android:entries="@array/emergency_tone_entries" android:title="@string/emergency_tone_title" android:key="emergency_tone" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/emergency_tone_values" />
[COLOR="Red"]<CheckBoxPreference android:persistent="false" android:title="@string/volbtn_music_controls_title" android:key="volbtn_music_controls" android:summary="@string/volbtn_music_controls_summary" />[/COLOR]
</PreferenceScreen>
Now let's get into some smail.
Open up com/android/settings/SoundSettings.smali
Code:
.field private mSoundSettings:Landroid/preference/PreferenceGroup;
.field private mUnloadSoundEffectRunnable:Ljava/lang/Runnable;
.field private mVibrateWhenRinging:Landroid/preference/CheckBoxPreference;
[COLOR="red"].field private mVolBtnMusicCtrl:Landroid/preference/CheckBoxPreference;[/COLOR]
.field private mVolume:Lcom/android/settings/RingerVolumePreference;
method onCreate:
Code:
const-string v18, "lockscreen_sounds_enabled"
const/16 v20, 0x1
move-object/from16 v0, v18
move/from16 v1, v20
invoke-static {v15, v0, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v18
if-eqz v18, :cond_f
const/16 v18, 0x1
:goto_6
move-object/from16 v0, v19
move/from16 v1, v18
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
.line 291
[COLOR="red"]const-string v18, "volbtn_music_controls"
move-object/from16 v0, p0
move-object/from16 v1, v18
invoke-virtual {v0, v1}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v18
check-cast v18, Landroid/preference/CheckBoxPreference;
move-object/from16 v0, v18
move-object/from16 v1, p0
iput-object v0, v1, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/CheckBoxPreference;
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/CheckBoxPreference;
move-object/from16 v18, v0
const/16 v19, 0x0
invoke-virtual/range {v18 .. v19}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/CheckBoxPreference;
move-object/from16 v19, v0
const-string v18, "volbtn_music_controls"
const/16 v20, 0x1
move-object/from16 v0, v18
move/from16 v1, v20
invoke-static {v15, v0, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v18
if-eqz v18, :cond_long
const/16 v18, 0x1
:goto_long
move-object/from16 v0, v19
move/from16 v1, v18
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR]
const-string v18, "ringtone"
move-object/from16 v0, p0
move-object/from16 v1, v18
invoke-virtual {v0, v1}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
Code:
:cond_d
const/16 v18, 0x0
goto/16 :goto_4
.line 280
:cond_e
const/16 v18, 0x0
goto/16 :goto_5
.line 288
:cond_f
const/16 v18, 0x0
goto/16 :goto_6
[COLOR="red"]:cond_long
const/16 v18, 0x0
goto/16 :goto_long[/COLOR]
.line 315
.restart local v17 #vibrator:Landroid/os/Vibrator;
:cond_11
invoke-virtual/range {p0 .. p0}, Lcom/android/settings/SoundSettings;->getActivity()Landroid/app/Activity;
move-result-object v18
invoke-static/range {v18 .. v18}, Lcom/android/settings/Utils;->isTablet(Landroid/content/Context;)Z
method onPreferenceTreeClick:
Code:
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mLockSounds:Landroid/preference/CheckBoxPreference;
invoke-virtual {v4}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v4
if-eqz v4, :cond_e
:goto_8
invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_1
:cond_e
move v0, v1
goto :goto_8
.line 640
:cond_f
[COLOR="red"]iget-object v2, p0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/CheckBoxPreference;
if-ne p2, v2, :cond_next
.line 637
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, "volbtn_music_controls"
iget-object v4, p0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/CheckBoxPreference;
invoke-virtual {v4}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v4
if-eqz v4, :cond_long
:goto_long
invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_1
:cond_long
move v0, v1
goto :goto_long
:cond_next[/COLOR]
iget-object v0, p0, Lcom/android/settings/SoundSettings;->mMusicFx:Landroid/preference/Preference;
if-ne p2, v0, :cond_0
goto/16 :goto_2
.end method
Now recompile SecSettings and the setting should be there. It won't do anything though.
Next we need to decompile android.policy.jar.
First file is com\android\internal\policy\impl\PhoneWindowManager$PolicyHandler.smali
Add another switch statement:
Code:
:pswitch_4
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$PolicyHandler;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;
#calls: Lcom/android/internal/policy/impl/PhoneWindowManager;->enableSPenGesture()V
invoke-static {v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->access$300(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
goto :goto_0
[COLOR="red"]:pswitch_5
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$PolicyHandler;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;
iget-object v0, p1, Landroid/os/Message;->obj:Ljava/lang/Object;
check-cast v0, Landroid/view/KeyEvent;
invoke-virtual {v1, v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->dispatchMediaKeyWithWakeLockToAudioService(Landroid/view/KeyEvent;)V
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$PolicyHandler;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;
iget-object v0, p1, Landroid/os/Message;->obj:Ljava/lang/Object;
check-cast v0, Landroid/view/KeyEvent;
const/16 v3, 0x01
invoke-static {v0, v3}, Landroid/view/KeyEvent;->changeAction(Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;
move-result-object v0
invoke-virtual {v1, v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->dispatchMediaKeyWithWakeLockToAudioService(Landroid/view/KeyEvent;)V
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$PolicyHandler;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;
const/4 v2, 0x1
iput-boolean v2, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
goto :goto_0[/COLOR]
.line 828
:pswitch_data_0
.packed-switch 0x1
:pswitch_0
:pswitch_1
:pswitch_2
:pswitch_3
:pswitch_4
[COLOR="red"]:pswitch_5[/COLOR]
.end packed-switch
.end method
Next: com\android\internal\policy\impl\PhoneWindowManager$SettingsObserver.smali
method observe:
Code:
const-string v1, "incall_power_button_behavior"
invoke-static {v1}, Landroid/provider/Settings$Secure;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
[COLOR="red"]const-string v1, "volbtn_music_controls"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V[/COLOR]
.line 878
const-string v1, "accelerometer_rotation"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
Next: com\android\internal\policy\impl\PhoneWindowManager.smali
Code:
.field static final LONG_PRESS_POWER_NOTHING:I = 0x0
.field static final LONG_PRESS_POWER_SHUT_OFF:I = 0x2
[COLOR="Red"].field private static final LONG_PRESS_TIMEOUT:I = 0x190[/COLOR]
.field static final MINI_APP_DIALOG_LAYER:I = 0x5
.field static final MINI_APP_LAYER:I = 0x3
Code:
.field private mIsSensorhubEnabled:Z
.field private mIsVisibleSPenGestureView:Z
[COLOR="red"].field mIsVolumeAction:Z
.field mIsVolumeBlocking:Z[/COLOR]
.field mKeyboardTapVibePattern:[J
.field mKeyguard:Landroid/view/WindowManagerPolicy$WindowState;
Code:
.field mVoiceTalkDefaultLaunch:Z
.field mVoiceTalkIntent:Landroid/content/Intent;
[COLOR="red"].field mVolBtnMusicControls:I[/COLOR]
.field private mVolumeDownKeyConsumedByScreenshotChord:Z
method handleVolumeKey:
Code:
.method handleVolumeKey(II)V
.locals 5
[COLOR="red"]move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-nez v0, :cond_vc[/COLOR]
invoke-static {}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getAudioService()Landroid/media/IAudioService;
move-result-object v0
if-nez v0, :cond_0
.line 4898
[COLOR="Red"]:cond_vc[/COLOR]
:goto_0
return-void
.line 4875
:cond_0
Add the following after the above method handleVolumeKey
Code:
[COLOR="Red"].method handleVolumeLongPress(Landroid/view/KeyEvent;)V
.locals 11
.parameter "event"
.prologue
const/4 v7, 0x0
.line 26
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
.line 27
iput-boolean v7, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
.line 28
invoke-virtual {p1}, Landroid/view/KeyEvent;->getKeyCode()I
move-result v0
const/16 v1, 0x18
if-ne v0, v1, :cond_0
.line 29
const/16 v6, 0x57
.line 30
.local v6, newKeyCode:I
:goto_0
iget-object v9, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
const/4 v10, 0x6
.line 31
new-instance v0, Landroid/view/KeyEvent;
invoke-virtual {p1}, Landroid/view/KeyEvent;->getDownTime()J
move-result-wide v1
invoke-virtual {p1}, Landroid/view/KeyEvent;->getEventTime()J
move-result-wide v3
invoke-virtual {p1}, Landroid/view/KeyEvent;->getAction()I
move-result v5
invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;->(JJIII)V
.line 30
invoke-virtual {v9, v10, v0}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;
move-result-object v8
.line 32
.local v8, msg:Landroid/os/Message;
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
sget v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->LONG_PRESS_TIMEOUT:I
int-to-long v1, v1
invoke-virtual {v0, v8, v1, v2}, Landroid/os/Handler;->sendMessageDelayed(Landroid/os/Message;J)Z
.line 33
return-void
.line 29
.end local v6 #newKeyCode:I
.end local v8 #msg:Landroid/os/Message;
:cond_0
const/16 v6, 0x58
goto :goto_0
.end method
.method handleVolumeLongPressAbort()V
.locals 2
.prologue
.line 36
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
.line 37
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
const/4 v1, 0x6
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeMessages(I)V
.line 38
return-void
.end method[/COLOR]
method interceptKeyBeforeQueueing:
This one's kind of hard to find so here's some extra lines before and after:
Code:
.line 5201
const/16 v23, 0x0
move/from16 v0, v23
move-object/from16 v1, p0
iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownKeyConsumedByScreenshotChord:Z
.line 5202
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->cancelPendingPowerKeyAction()V
.line 5203
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->cancelPendingScreenrecordChordAction()V
.line 5204
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->interceptScreenshotChord()V
.line 5246
:cond_1a
:goto_8
if-eqz v5, [COLOR="Blue"]:cond_long[/COLOR]
.line 5247
invoke-static {}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getTelephonyService()Lcom/android/internal/telephony/ITelephony;
move-result-object v22
.line 5248
.local v22, telephonyService:Lcom/android/internal/telephony/ITelephony;
if-eqz v22, :cond_20
.line 5250
:try_start_0
invoke-interface/range {v22 .. v22}, Lcom/android/internal/telephony/ITelephony;->isRinging()Z
Code:
const-string v23, "WindowManager"
const-string v24, "ITelephony threw RemoteException"
move-object/from16 v0, v23
move-object/from16 v1, v24
invoke-static {v0, v1, v6}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
.line 5333
.end local v6 #ex:Landroid/os/RemoteException;
:cond_20
move-object/from16 v0, p0
[COLOR="Red"]iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenOnEarly:Z
if-nez v0, :cond_reg
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z
move-result v21
if-eqz v21, :cond_reg
const/16 v1, 0x1
move-object/from16 v0, p0
iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I
if-ne v0, v1, :cond_reg
move-object/from16 v0, p0
move-object/from16 v1, p1
invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress(Landroid/view/KeyEvent;)V
:cond_reg
move-object/from16 v0, p0[/COLOR]
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v23, v0
if-nez v23, :cond_1
and a couple lines down:
Code:
move-object/from16 v23, v0
invoke-virtual/range {v23 .. v23}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->start()V
goto/16 :goto_2
.line 5341
.end local v22 #telephonyService:Lcom/android/internal/telephony/ITelephony;
[COLOR="Blue"]:cond_long[/COLOR]
[COLOR="Red"]if-nez v5, :cond_vc
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-eqz v0, :cond_vc
const/16 v1, 0x1
move-object/from16 v0, p0
iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I
if-ne v0, v1, :cond_vc
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
if-nez v0, :cond_vc
move-object/from16 v0, p0
const/4 v3, 0x0
invoke-virtual {v0, v3, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_vc[/COLOR]
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v23, v0
if-eqz v23, :cond_1
method updateSettings:
Code:
const-string v19, "incall_power_button_behavior"
const/16 v20, 0x1
move-object/from16 v0, v19
move/from16 v1, v20
invoke-static {v13, v0, v1}, Landroid/provider/Settings$Secure;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v9
[COLOR="red"]const-string v19, "volbtn_music_controls"
const/16 v20, 0x0
move-object/from16 v0, v19
move/from16 v1, v20
invoke-static {v13, v0, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3[/COLOR]
.line 2006
const-string v19, "user_rotation"
Code:
iput v6, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mEndcallBehavior:I
.line 2028
move-object/from16 v0, p0
iput v9, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIncallPowerBehavior:I
[COLOR="red"]move-object/from16 v0, p0
iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I[/COLOR]
.line 2030
move-object/from16 v0, p0
iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mUserRotation:I
Newer Firmwares:(Sprint 4.1.2 MR2, etc.)
com\android\internal\policy\impl\PhoneWindowManager.smali
We need to edit one of the sections in method interceptKeyBeforeQueueing.
Remove the code in purple and add the code in green.
Code:
move-object/from16 v23, v0
invoke-virtual/range {v23 .. v23}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->start()V
goto/16 :goto_2
.line 5341
.end local v22 #telephonyService:Lcom/android/internal/telephony/ITelephony;
[COLOR="Blue"]:cond_long[/COLOR]
[COLOR="Red"]if-nez v5, :cond_vc
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-eqz v0, :cond_vc
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
if-nez v0, :cond_vc
move-object/from16 v0, p0
const/4 v3, 0x0
[COLOR="Purple"]invoke-virtual {v0, v3, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V[/COLOR]
[COLOR="Green"]iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v23, v0
move-object/from16 v0, v23
invoke-virtual {v0, v3, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->handleVolume(II)V[/COLOR]
:cond_vc[/COLOR]
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v23, v0
if-eqz v23, :cond_1
com\android\internal\policy\impl\PhoneWindowManager$SamsungVolumeControlThread.smali
method handleVolume:
Code:
.method handleVolume(II)V
.locals 6
[COLOR="Red"]iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-nez v0, :cond_vc[/COLOR]
iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;
iget-object v3, v3, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const-string v4, "audio"
invoke-virtual {v3, v4}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/media/AudioManager;
if-nez v0, :cond_0
[COLOR="red"]:cond_vc[/COLOR]
:goto_0
return-void
:cond_0
:try_start_0
invoke-virtual {v0}, Landroid/media/AudioManager;->dismissVolumePanel()V
sparse-switch p2, :sswitch_data_0
goto :goto_0
ISSUES:
Pressing volume up or down both turn the volume down(or up):
Looking at a little bit more from the last entry:
Code:
move-object/from16 v23, v0
invoke-virtual/range {v23 .. v23}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->start()V
goto/16 :goto_2
.line 5341
.end local v22 #telephonyService:Lcom/android/internal/telephony/ITelephony;
[COLOR="Blue"]:cond_long[/COLOR]
[COLOR="Red"]if-nez v5, :cond_vc
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-eqz v0, :cond_vc
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
if-nez v0, :cond_vc
move-object/from16 v0, p0
const/4 v3, 0x0
invoke-virtual {v0, v3, [COLOR="orange"]v15[/COLOR]}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_vc[/COLOR]
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v23, v0
if-eqz v23, :cond_1
.line 5342
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v23, v0
move-object/from16 v0, v23
invoke-virtual {v0, [COLOR="Orange"]v15[/COLOR], v5, v4}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->updateInfo(IZZ)V
Pull the variable in orange from the last line and replace the variable in line
Code:
invoke-virtual {v0, v3, [COLOR="orange"]v15[/COLOR]}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
Make sure you're not replacing the last line with anything, but using it as reference.
Cool
Sent from my SAMSUNG-SGH-I747 using xda app-developers app
This is great! made the changes and everything is running great.
Sent you a donation, Cheers! have a beer on me *Happy New Year!*
Thanks for all your hard work it is much appreciated
enewman17 said:
This is great! made the changes and everything is running great.
Sent you a donation, Cheers! have a beer on me *Happy New Year!*
Thanks for all your hard work it is much appreciated
Click to expand...
Click to collapse
Did you use the cond's in green? Or did you just replace the file?
loserskater said:
Did you use the cond's in green? Or did you just replace the file?
Click to expand...
Click to collapse
I did not use the cond's in green, I manually made the changes excluding them.
I am curious now if it will work using those cond's I will try it later. I'm just so happy you were able to get it working! and well!
I had problems compiling it with apktool after I made the changes, but doing it manually worked and now apktool will compile and decompile without error. I don't get it.
I've only tested it with the stock player and google play music and it works perfectly. I don't use anything else so i didn't test.
enewman17 said:
I did not use the cond's in green, I manually made the changes excluding them.
I am curious now if it will work using those cond's I will try it later. I'm just so happy you were able to get it working! and well!
I had problems compiling it with apktool after I made the changes, but doing it manually worked and now apktool will compile and decompile without error. I don't get it.
I've only tested it with the stock player and google play music and it works perfectly. I don't use anything else so i didn't test.
Click to expand...
Click to collapse
What showed up with apktool? It's possible you missed a cond somewhere...
loserskater said:
What showed up with apktool? It's possible you missed a cond somewhere...
Click to expand...
Click to collapse
I don't remember, something like false value blah blah...
I diff'ed the the files using win merge and they are exactly the same. It's not the first time it's happened to me seem's like it's the way notepad++ saves the file... maybe.... I had more problems using getdiz as a text editor. I don't know maybe it's me. But I do know it works.
When I changed the sound file in the SecContacts to get rid of the water drop sound from the dial pad I could not get apktool to compile it for the life of me, If I put the original sound back, apktool worked. Used manual commands and poof it worked like some sort of fairy magic. It was really starting to annoy me, but persistence pays off. Now apktool will decompile and compile my modded SecContacts with no problem. Also had the same problem when editing the SecPhone to get rid of the increasing ringtone. Same false value error. did it manually and it worked but I kind of figured it would happen cause that mod is kind of hacky to begin with, I didn't delete the lines for that mod, but rather omitted those lines with a #
Thanks for sharing man. Works great with both att and tmo!:good:
Thanks! Will be trying this soon.
First of all, thank you for this Tutorial. I'll try it now since a few hours, but it won't recompile. I'll tried it with the green ones and without it. Apktool gives me this errors:
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: [email protected]
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:243)
at brut.androlib.Androlib.buildSources(Androlib.java:200)
at brut.androlib.Androlib.build(Androlib.java:191)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:188)
at brut.apktool.Main.main(Main.java:70)
Drücken Sie eine beliebige Taste . . .
Maybe someone have an idea. Thank you (=
hells
hellsgod said:
First of all, thank you for this Tutorial. I'll try it now since a few hours, but it won't recompile. I'll tried it with the green ones and without it. Apktool gives me this errors:
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: [email protected]
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:243)
at brut.androlib.Androlib.buildSources(Androlib.java:200)
at brut.androlib.Androlib.build(Androlib.java:191)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:188)
at brut.apktool.Main.main(Main.java:70)
Drücken Sie eine beliebige Taste . . .
Maybe someone have an idea. Thank you (=
hells
Click to expand...
Click to collapse
I had trouble too, if your sure the changes you made are right you'll have to take the android.policy and manually decompile the dex file make the changes and recompile it again using smali commands. It should work and not give you any errors just using smali and baksmali
noob question here, Will this be avaliable in a flashable form? Im not familiar with decompiling but would really love this feature on my current rom
best thing to do when working with smalis is to drag the classes.dex out of the apk file such as systemui.apk & secsettings.apk and so forth and use a baksmali/smali tool and it'll decompile just the smalis rather then the whole apk and then causing a fuss later when compiling it.. Once thats done compile the classes.dex with ur edits done and then drag it back to apk & push to system and profit ..
svfreddy said:
noob question here, Will this be avaliable in a flashable form? Im not familiar with decompiling but would really love this feature on my current rom
Click to expand...
Click to collapse
I'll make a couple flashable zips for lk4 and lk3
loserskater said:
I'll make a couple flashable zips for lk4 and lk3
Click to expand...
Click to collapse
Thanks!!
Sent from my SPH-L710 using xda app-developers app
Thanks, I fixed ours using this in the Sprint section (here).
But just an FYI, I used WinMerge to check diff's between your org and mod, and it looks like you changed a bunch of :cond's towards the end which was unnecessary.
Here is the last part that is needed to change:
http://i16.photobucket.com/albums/b38/Migs351/first_zps538afb44.jpg
And here is where some of the unnecessary changes are:
http://i16.photobucket.com/albums/b38/Migs351/second_zps05e5de7c.jpg
For some reason you increased all the :cond's by 2, which doesn't actually change anything, as this is just a "label" for the if statements to goto if the statement returns true.
Just thought I'd point that out.
But other than that, nice job! No more need for those extra files. Simple code modification.
I'm curious though, for my own sanity anyways, what's the main difference here between the this mod and the original mod. (which didn't work, properly, in JB) I know the original one sent the MEDIA_NEXT and MEDIA_PREVIOUS keys to the system, and this was getting interpreted incorrectly and being sent to the default Media Player, regardless of what currently had Audio Focus.
What does this one use as it's method of changing the tracks, something more direct, or does it tap into another type of Media key?
I could go through the code and figure it out, but I'm too lazy right now.
Unknownforce said:
Thanks, I fixed ours using this in the Sprint section (here).
But just an FYI, I used WinMerge to check diff's between your org and mod, and it looks like you changed a bunch of :cond's towards the end which was unnecessary.
Here is the last part that is needed to change:
http://i16.photobucket.com/albums/b38/Migs351/first_zps538afb44.jpg
And here is where some of the unnecessary changes are:
http://i16.photobucket.com/albums/b38/Migs351/second_zps05e5de7c.jpg
For some reason you increased all the :cond's by 2, which doesn't actually change anything, as this is just a "label" for the if statements to goto if the statement returns true.
Just thought I'd point that out.
But other than that, nice job! No more need for those extra files. Simple code modification.
I'm curious though, for my own sanity anyways, what's the main difference here between the this mod and the original mod. (which didn't work, properly, in JB) I know the original one sent the MEDIA_NEXT and MEDIA_PREVIOUS keys to the system, and this was getting interpreted incorrectly and being sent to the default Media Player, regardless of what currently had Audio Focus.
What does this one use as it's method of changing the tracks, something more direct, or does it tap into another type of Media key?
I could go through the code and figure it out, but I'm too lazy right now.
Click to expand...
Click to collapse
Here from the Sprint GS III forums as unknownforce was able to convert your work to function for us Sprint folks. Just wanted to say thank you loserskater for your hard work on this and for getting this working. I have been waiting for this forever since upgrading to 4.1
Thanks loserskater and also thanks unknownforce,
Whiteice
Unknownforce said:
Thanks, I fixed ours using this in the Sprint section (here).
But just an FYI, I used WinMerge to check diff's between your org and mod, and it looks like you changed a bunch of :cond's towards the end which was unnecessary.
Here is the last part that is needed to change:
http://i16.photobucket.com/albums/b38/Migs351/first_zps538afb44.jpg
And here is where some of the unnecessary changes are:
http://i16.photobucket.com/albums/b38/Migs351/second_zps05e5de7c.jpg
For some reason you increased all the :cond's by 2, which doesn't actually change anything, as this is just a "label" for the if statements to goto if the statement returns true.
Just thought I'd point that out.
But other than that, nice job! No more need for those extra files. Simple code modification.
I'm curious though, for my own sanity anyways, what's the main difference here between the this mod and the original mod. (which didn't work, properly, in JB) I know the original one sent the MEDIA_NEXT and MEDIA_PREVIOUS keys to the system, and this was getting interpreted incorrectly and being sent to the default Media Player, regardless of what currently had Audio Focus.
What does this one use as it's method of changing the tracks, something more direct, or does it tap into another type of Media key?
I could go through the code and figure it out, but I'm too lazy right now.
Click to expand...
Click to collapse
That's why I added the conds in green so you don't have to change all of the ones after. But if you add the 21 and 22 you'll have multiple instances which throws errors when trying to compile.
The difference between this and the previous mod is that sending the media button presses would send an ordered broadcast and the app with the highest priority would take the broadcast and see if it needed it and then pass it along if it didn't. Well must audio apps haven't been updated to use this method. And if you changed it to just broadcast instead of offered all media players would get the broadcast do you'd have a bunch of apps trying to all play music. This uses private apis that that only the system can use and it's the same method the lockscreen controls use which is controlled by the audio service instead of broadcasts. I hope that all makes sense
loserskater said:
That's why I added the conds in green so you don't have to change all of the ones after. But if you add the 21 and 22 you'll have multiple instances which throws errors when trying to compile.
The difference between this and the previous mod is that sending the media button presses would send an ordered broadcast and the app with the highest priority would take the broadcast and see if it needed it and then pass it along if it didn't. Well must audio apps haven't been updated to use this method. And if you changed it to just broadcast instead of offered all media players would get the broadcast do you'd have a bunch of apps trying to all play music. This uses private apis that that only the system can use and it's the same method the lockscreen controls use which is controlled by the audio service instead of broadcasts. I hope that all makes sense
Click to expand...
Click to collapse
Oh! Yeah, the "named" method should work for most compilers, I don't see why it wouldn't, but I got it now.
Makes perfect sense, thanks for explaining. This makes for a much cleaner and friendlier method of doing it too, nice.
Is this only for Touchwiz?

[MOD][HOW-TO] Display/Hide Alarm icon in real time

This will allow you to hide/display the alarm icon in real time. Useful for users that always have an alarm and don't want the icon constantly in the statusbar.
We're going to be working with the following two files:
SecSettings.apk
SystemUI.apk
KEY
REMOVE what's in BLUE
ADD what's in RED
SecSettings.apk
Navigate to /res/values/strings.xml
Add the following to the end of the file
Code:
<string name="alarm_icon_title">Alarm icon</string>
<string name="alarm_icon_summary">Change alarm in order for it to take effect</string>
Navigate to /xml/display_settings.xml
Add the following line wherever you would like it to show in the menu
Code:
<CheckBoxPreference android:title="@string/alarm_icon_title" android:key="alarm_icon" android:summary="@string/alarm_icon_summary" />
Navigate to /smali/com/android/settings/DisplaySettings.smali
Code:
.field private mAccelerometerSecond:Landroid/preference/CheckBoxPreference;
[COLOR="Red"].field private mAlarmIcon:Landroid/preference/CheckBoxPreference;[/COLOR]
.field private mAnimationHandler:Landroid/os/Handler;
.method private updateState()V
Code:
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v4, "display_battery_percentage"
invoke-static {v0, v4, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_4
move v0, v1
:goto_1
invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
[COLOR="red"]iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mAlarmIcon:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v4, "alarm_icon"
invoke-static {v0, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_alarm
move v0, v1
:goto_alarm
invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR]
Code:
[COLOR="red"]:cond_alarm
move v0, v2
goto/16 :goto_alarm[/COLOR]
:cond_b
move v0, v2
goto :goto_8
:cond_c
move v1, v2
.line 856
goto :goto_9
.end method
.method public onCreate(Landroid/os/BundleV
Code:
const-string v11, "display_battery_level"
invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v11
check-cast v11, Landroid/preference/CheckBoxPreference;
iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
[COLOR="red"]const-string v11, "alarm_icon"
invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v11
check-cast v11, Landroid/preference/CheckBoxPreference;
iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mAlarmIcon:Landroid/preference/CheckBoxPreference;[/COLOR]
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getActivity()Landroid/app/Activity;
move-result-object v11
invoke-static {v11}, Lcom/android/settings/Utils;->isTablet(Landroid/content/Context;)Z
move-result v11
if-eqz v11, :cond_6
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/PreferenceZ
Code:
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 920
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "display_battery_percentage"
if-eqz v0, :cond_5
move v2, v1
:cond_5
invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto :goto_2
:cond_6
[COLOR="red"]iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mAlarmIcon:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_next
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mAlarmIcon:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "alarm_icon"
if-eqz v0, :cond_alarm
move v2, v1
:cond_alarm
invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_2
:cond_next[/COLOR]
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mNotificationPulse:Landroid/preference/CheckBoxPreference;
if-ne p2, v0, :cond_10
.line 923
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mNotificationPulse:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
Compile and test!
Now for SystemUI.apk
Navigate to /smali/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.smali
.method private final updateAlarm(Landroid/content/IntentV
Code:
.method private final updateAlarm(Landroid/content/Intent;)V
[COLOR="Red"].locals 5[/COLOR]
.parameter "intent"
.prologue
.line 194
[COLOR="Red"]const/4 v3, 0x0[/COLOR]
const-string v1, "alarmSet"
const/4 v2, 0x0
invoke-virtual {p1, v1, v2}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
move-result v0
[COLOR="red"]iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "alarm_icon"
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-nez v1, :cond_0
move v0, v3[/COLOR]
.line 195
.local v0, alarmSet:Z
[COLOR="red"]:cond_0[/COLOR]
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;->mService:Landroid/app/StatusBarManager;
const-string v2, "alarm_clock"
invoke-virtual {v1, v2, v0}, Landroid/app/StatusBarManager;->setIconVisibility(Ljava/lang/String;Z)V
.line 196
return-void
.end method
That's it. Compile and test!
On a roll I see. Thanks Loserskater
Worked. Thank you
Sent from my SAMSUNG-SGH-I747 using xda premium
Great mod boss, and very useful!!! :good::highfive:
This works perfectly on my Sprint GS3. Thanks for another great tutorial loserskater. By any chance do you have one for the bluetooth icon?
THX works for me with a hot boot, not in real time (I9100)
Perhaps any solutions for this ?
Thx
If you change, add, or delete an alarm this mod should take effect without a reboot.
metalfan78 said:
If you change, add, or delete an alarm this mod should take effect without a reboot.
Click to expand...
Click to collapse
You´re right THX
You're welcome

[Guide] Listview Animations for Lollipop

Listview Animations for Lollipop - MM files added for compare
This guide is based on the Sprint Galaxy S5 OA6 Lollipop 5.0 firmware.
framework.jar smali edits
\smali_classes2\android\widget\AbsListView$FlingRunnable$1.smali
Delete the line in RED and add the new code in BLUE
Make sure the values in the new code match surrounding code.
Code:
.method public run()V
.
.
.
:cond_2
iget-object v4, p0, Landroid/widget/AbsListView$FlingRunnable$1;->this$1:Landroid/widget/AbsListView$FlingRunnable;
[COLOR="Red"]invoke-virtual {v4}, Landroid/widget/AbsListView$FlingRunnable;->endFling()V
[/COLOR]
[COLOR="Blue"]const/4 v5, 0x0
invoke-virtual {v4, v5}, Landroid/widget/AbsListView$FlingRunnable;->endFling(Z)V
[/COLOR]
iget-object v4, p0, Landroid/widget/AbsListView$FlingRunnable$1;->this$1:Landroid/widget/AbsListView$FlingRunnable;
iget-object v4, v4, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
const/4 v5, 0x3
iput v5, v4, Landroid/widget/AbsListView;->mTouchMode:I
iget-object v4, p0, Landroid/widget/AbsListView$FlingRunnable$1;->this$1:Landroid/widget/AbsListView$FlingRunnable;
iget-object v4, v4, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
const/4 v5, 0x1
invoke-virtual {v4, v5}, Landroid/widget/AbsListView;->reportScrollStateChange(I)V
goto :goto_0
.end method
\smali_classes2\android\widget\AbsListView$FlingRunnable.smali
Rename the following method header in RED to the new name in BLUE:
Code:
[COLOR="Red"].method endFling()V
[/COLOR]
[COLOR="Blue"].method endFling(Z)V[/COLOR]
Add new method right above the newly renamed method:
Code:
.method endFling()V
.locals 1
const/4 v0, 0x1
invoke-virtual {p0, v0}, Landroid/widget/AbsListView$FlingRunnable;->endFling(Z)V
return-void
.end method
Now, make the following edits in BLUE in that newly renamed method also.
Code:
.method endFling(Z)V
.locals 2
iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
const/4 v1, -0x1
iput v1, v0, Landroid/widget/AbsListView;->mTouchMode:I
iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
invoke-virtual {v0, p0}, Landroid/widget/AbsListView;->removeCallbacks(Ljava/lang/Runnable;)Z
iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
iget-object v1, p0, Landroid/widget/AbsListView$FlingRunnable;->mCheckFlywheel:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/widget/AbsListView;->removeCallbacks(Ljava/lang/Runnable;)Z
iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
const/4 v1, 0x0
invoke-virtual {v0, v1}, Landroid/widget/AbsListView;->reportScrollStateChange(I)V
[COLOR="blue"]if-eqz p1, :cond_td[/COLOR]
iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
# invokes: Landroid/widget/AbsListView;->clearScrollingCache()V
invoke-static {v0}, Landroid/widget/AbsListView;->access$3100(Landroid/widget/AbsListView;)V
[COLOR="blue"]:cond_td[/COLOR]
Same smali, make the following edits in BLUE
and delete the lines in RED. Note the access$3100 in the following code in GREEN, we may need to change that right after this edit.
Code:
.method start(I)V
.locals 9
const v6, 0x7fffffff
const/4 v1, 0x0
[COLOR="Red"]if-gez p1, :cond_1[/COLOR]
[COLOR="blue"]invoke-static {p1}, Ljava/lang/Math;->abs(I)I
move-result v0
iget-object v3, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
invoke-static {v3}, Landroid/widget/AbsListView;->access$1234(Landroid/widget/AbsListView;)I
move-result v3
if-le v0, v3, :cond_td
iget-object v0, p0, Landroid/widget/AbsListView$FlingRunnable;->this$0:Landroid/widget/AbsListView;
invoke-static {v0}, Landroid/widget/AbsListView;->[COLOR="Green"]access$3100[/COLOR](Landroid/widget/AbsListView;)V
:cond_td
if-gez p1, :cond_td1[/COLOR]
.
.
.
:cond_0
return-void
[COLOR="Red"]:cond_1
[/COLOR] [COLOR="Blue"]:cond_td1
[/COLOR] move v2, v1
goto :goto_0
.end method
Now lets go confirm that the access$3100 that is called from this smali is the correct one.
Look in and confirm that the following method matches, if it doesn't change the access$3100 in the previous edit so that it does.
\smali_classes2\android\widget\AbsListView.smali
Code:
.method static synthetic access$3100(Landroid/widget/AbsListView;)V
.locals 0
invoke-direct {p0}, Landroid/widget/AbsListView;->clearScrollingCache()V
return-void
.end method
If it matches, perfect. We will continue working in this smali to add changes:
\smali_classes2\android\widget\AbsListView.smali
Add new code in BLUE to #instance fields.
Code:
# instance fields
[COLOR="blue"].field private mDecacheThreshold:I
.field mHeight:I
.field mIsGridView:Z
.field mIsScrolling:Z
.field mIsWidget:Z
.field mWidth:I
.field mvPosition:I
[/COLOR]
.field protected AIR_VIEW_WINSET:Z
.field private HOVERSCROLL_DELAY:I
.field private HOVERSCROLL_SPEED:F
Same smali, add new code in BLUE making sure values match surrounding code.
Code:
.method public constructor <init>(Landroid/content/Context;)V
.
.
.
iput v5, p0, Landroid/widget/AbsListView;->mActivePointerId:I
iput v4, p0, Landroid/widget/AbsListView;->mPointerCount:I
iput-boolean v4, p0, Landroid/widget/AbsListView;->mHapticOverScroll:Z
iput v4, p0, Landroid/widget/AbsListView;->mDirection:I
[COLOR="blue"]iput v4, p0, Landroid/widget/AbsListView;->mHeight:I
iput-boolean v4, p0, Landroid/widget/AbsListView;->mIsGridView:Z
[/COLOR]
iput v4, p0, Landroid/widget/AbsListView;->mHoverTopAreaHeight:I
iput v4, p0, Landroid/widget/AbsListView;->mHoverBottomAreaHeight:I
iput-wide v8, p0, Landroid/widget/AbsListView;->mHoverRecognitionDurationTime:J
Add new method in BLUE
Code:
.method static synthetic access$000(Landroid/widget/AbsListView;Z)V
.locals 0
invoke-direct {p0, p1}, Landroid/widget/AbsListView;->setFastScrollerEnabledUiThread(Z)V
return-void
.end method
[COLOR="Blue"].method static synthetic access$1234(Landroid/widget/AbsListView;)I
.registers 1
iget v0, p0, Landroid/widget/AbsListView;->mDecacheThreshold:I
return v0
.end method[/COLOR]
Same smali, add new code in BLUE making sure new values match surrounding code
Code:
.method private initAbsListView()V
.
.
.
iput v6, p0, Landroid/widget/AbsListView;->mTouchSlop:I
invoke-virtual {v1}, Landroid/view/ViewConfiguration;->getScaledMinimumFlingVelocity()I
move-result v6
iput v6, p0, Landroid/widget/AbsListView;->mMinimumVelocity:I
invoke-virtual {v1}, Landroid/view/ViewConfiguration;->getScaledMaximumFlingVelocity()I
move-result v6
iput v6, p0, Landroid/widget/AbsListView;->mMaximumVelocity:I
[COLOR="blue"] iget v6, p0, Landroid/widget/AbsListView;->mMaximumVelocity:I
div-int/lit8 v6, v6, 0x2
iput v6, p0, Landroid/widget/AbsListView;->mDecacheThreshold:I[/COLOR]
invoke-virtual {v1}, Landroid/view/ViewConfiguration;->getScaledOverscrollDistance()I
move-result v6
iput v6, p0, Landroid/widget/AbsListView;->mOverscrollDistance:I
invoke-virtual {v1}, Landroid/view/ViewConfiguration;->getScaledOverflingDistance()I
move-result v6
iput v6, p0, Landroid/widget/AbsListView;->mOverflingDistance:I
.
.
.
:cond_6
[COLOR="blue"]const/4 v1, 0x3
invoke-virtual {p0, v1}, Landroid/widget/AbsListView;->setPersistentDrawingCache(I)V
[/COLOR]
return-void
:catch_0
move-exception v4
goto :goto_0
:catch_1
move-exception v4
goto :goto_0
.end method
Add new code in BLUE making sure values match surrounding code.
Code:
.method private scrollIfNeeded(IILandroid/view/MotionEvent;)V
.
.
.
iget v3, v0, Landroid/widget/AbsListView;->mLastY:I
sub-int v3, p2, v3
add-int v21, v3, v34
:goto_1
const/16 v22, 0x0
move-object/from16 v0, p0
iget v3, v0, Landroid/widget/AbsListView;->mTouchMode:I
const/4 v4, 0x3
if-ne v3, v4, :cond_13
[COLOR="blue"]const/4 v3, 0x0
move-object/from16 v0, p0
iput-boolean v3, v0, Landroid/widget/AbsListView;->mIsWidget:Z
[/COLOR] move-object/from16 v0, p0
iget-object v3, v0, Landroid/widget/AbsListView;->mScrollStrictSpan:Landroid/os/StrictMode$Span;
if-nez v3, :cond_2
const-string v3, "AbsListView-scroll"
invoke-static {v3}, Landroid/os/StrictMode;->enterCriticalSpan(Ljava/lang/String;)Landroid/os/StrictMode$Span;
Add new line in BLUE making sure value matches surrounding code.
Code:
.method protected handleDataChanged()V
.locals 15
const/4 v14, 0x5
const/4 v13, -0x1
const/4 v8, 0x3
const/4 v9, 0x1
const/4 v12, 0x0
[COLOR="blue"]iput-boolean v9, p0, Landroid/widget/AbsListView;->mIsWidget:Z
[/COLOR]
iget v1, p0, Landroid/widget/AbsListView;->mItemCount:I
Add new code in BLUE making sure value matches surrounding code.
Code:
.method obtainView(I[Z)Landroid/view/View;
.
.
.
:cond_4
iget-object v7, p0, Landroid/widget/AbsListView;->mRecycler:Landroid/widget/AbsListView$RecycleBin;
invoke-virtual {v7, p1}, Landroid/widget/AbsListView$RecycleBin;->getScrapView(I)Landroid/view/View;
move-result-object v3
iget-object v7, p0, Landroid/widget/AbsListView;->mAdapter:Landroid/widget/ListAdapter;
invoke-interface {v7, p1, v3, p0}, Landroid/widget/ListAdapter;->getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
move-result-object v0
[COLOR="blue"]iget-boolean v7, p0, Landroid/widget/AbsListView;->mIsScrolling:Z
if-eqz v7, :cond_td
iget-boolean v7, p0, Landroid/widget/AbsListView;->mIsWidget:Z
if-nez v7, :cond_td
invoke-virtual {p0, v0}, Landroid/widget/AbsListView;->setAnimation(Landroid/view/View;)Landroid/view/View;
move-result-object v0
:cond_td
[/COLOR]
if-eqz v3, :cond_6
if-eq v0, v3, :cond_7
invoke-virtual {v3}, Landroid/view/View;->isAccessibilityFocused()Z
move-result v7
if-eqz v7, :cond_5
invoke-virtual {v3}, Landroid/view/View;->clearAccessibilityFocus()V
invoke-virtual {v0}, Landroid/view/View;->requestAccessibilityFocus()Z
Add new code in BLUE making sure value matches surrounding code.
Code:
.method protected onLayout(ZIIII)V
.
.
.
:cond_1
invoke-virtual {p0}, Landroid/widget/AbsListView;->layoutChildren()V
const/4 v2, 0x0
iput-boolean v2, p0, Landroid/widget/AbsListView;->mInLayout:Z
sub-int v2, p5, p3
div-int/lit8 v2, v2, 0x3
iput v2, p0, Landroid/widget/AbsListView;->mOverscrollMax:I
[COLOR="Blue"]invoke-virtual {p0}, Landroid/widget/AbsListView;->getHeight()I
move-result v2
iput v2, p0, Landroid/widget/AbsListView;->mHeight:I
invoke-virtual {p0}, Landroid/widget/AbsListView;->getWidth()I
move-result v2
iput v2, p0, Landroid/widget/AbsListView;->mWidth:I
[/COLOR]
iget-object v2, p0, Landroid/widget/AbsListView;->mFastScroll:Landroid/widget/FastScroller;
if-eqz v2, :cond_2
iget-object v2, p0, Landroid/widget/AbsListView;->mFastScroll:Landroid/widget/FastScroller;
invoke-virtual {p0}, Landroid/widget/AbsListView;->getChildCount()I
Add new code in BLUE making sure value matches surrounding code.
Code:
.method reportScrollStateChange(I)V
.
.
.
:goto_3
iput v5, p0, Landroid/widget/AbsListView;->mDVFSCookie:I
:cond_6
invoke-static {v5}, Landroid/os/DVFSHelper;->onScrollEvent(Z)V
iput-boolean v5, p0, Landroid/widget/AbsListView;->mDVFSLockAcquired:Z
:cond_7
iput p1, p0, Landroid/widget/AbsListView;->mLastScrollState:I
[COLOR="blue"]if-eqz p1, :cond_td
const/4 v0, 0x1
:goto_td
iput-boolean v0, p0, Landroid/widget/AbsListView;->mIsScrolling:Z
[/COLOR]
iget-object v0, p0, Landroid/widget/AbsListView;->mOnScrollListener:Landroid/widget/AbsListView$OnScrollListener;
if-eqz v0, :cond_8
iget-boolean v0, p0, Landroid/widget/AbsListView;->mHoverAreaEnter:Z
if-nez v0, :cond_8
iget v0, p0, Landroid/widget/AbsListView;->mQCstate:I
if-eq v0, v7, :cond_8
iget-object v0, p0, Landroid/widget/AbsListView;->mOnScrollListener:Landroid/widget/AbsListView$OnScrollListener;
invoke-interface {v0, p0, p1}, Landroid/widget/AbsListView$OnScrollListener;->onScrollStateChanged(Landroid/widget/AbsListView;I)V
:cond_8
return-void
[COLOR="blue"]:cond_td
const/4 v0, 0x0
goto :goto_td
[/COLOR]
:catch_0
move-exception v0
Add new method above .method public setAirScrollEnable(Z)V (or at the bottom if this method does not exist)
Code:
.method setAnimation(Landroid/view/View;)Landroid/view/View;
.locals 14
const/4 v5, 0x1
const/high16 v2, 0x3f800000
const/high16 v1, 0x3f000000
const/4 v4, 0x0
iget-object v3, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v6, "listview_animation"
invoke-static {v3, v6, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v10
const/4 v13, 0x0
const/4 v11, 0x0
:try_start_0
invoke-virtual {p0}, Landroid/widget/AbsListView;->computeVerticalScrollOffset()I
:try_end_0
.catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_0
move-result v13
:goto_0
if-nez v10, :cond_1
:cond_0
:goto_1
return-object p1
:catch_0
move-exception v9
iget v13, p0, Landroid/widget/AbsListView;->mvPosition:I
goto :goto_0
:cond_1
iget v3, p0, Landroid/widget/AbsListView;->mvPosition:I
if-ge v3, v13, :cond_2
const/4 v11, 0x1
:cond_2
iput v13, p0, Landroid/widget/AbsListView;->mvPosition:I
const/4 v0, 0x0
packed-switch v10, :pswitch_data_0
:goto_2
const-wide/16 v1, 0x1f4
invoke-virtual {v0, v1, v2}, Landroid/view/animation/Animation;->setDuration(J)V
iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "listview_interpolator"
const/4 v3, 0x0
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v12
packed-switch v12, :pswitch_data_1
:goto_3
if-eqz p1, :cond_0
invoke-virtual {p1, v0}, Landroid/view/View;->startAnimation(Landroid/view/animation/Animation;)V
goto :goto_1
:pswitch_0
new-instance v0, Landroid/view/animation/ScaleAnimation;
invoke-direct {v0, v1, v2, v1, v2}, Landroid/view/animation/ScaleAnimation;-><init>(FFFF)V
goto :goto_2
:pswitch_1
new-instance v0, Landroid/view/animation/ScaleAnimation;
move v3, v1
move v4, v2
move v6, v2
move v7, v5
move v8, v2
invoke-direct/range {v0 .. v8}, Landroid/view/animation/ScaleAnimation;-><init>(FFFFIFIF)V
goto :goto_2
:pswitch_2
new-instance v0, Landroid/view/animation/ScaleAnimation;
move v3, v1
move v4, v2
move v6, v1
move v7, v5
move v8, v1
invoke-direct/range {v0 .. v8}, Landroid/view/animation/ScaleAnimation;-><init>(FFFFIFIF)V
goto :goto_2
:pswitch_3
new-instance v0, Landroid/view/animation/AlphaAnimation;
invoke-direct {v0, v4, v2}, Landroid/view/animation/AlphaAnimation;-><init>(FF)V
goto :goto_2
:pswitch_4
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v1, p0, Landroid/widget/AbsListView;->mHeight:I
neg-int v1, v1
int-to-float v1, v1
invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
goto :goto_2
:pswitch_5
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v1, p0, Landroid/widget/AbsListView;->mHeight:I
int-to-float v1, v1
invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
goto :goto_2
:pswitch_6
if-eqz v11, :cond_3
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v1, p0, Landroid/widget/AbsListView;->mHeight:I
neg-int v1, v1
int-to-float v1, v1
invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
goto :goto_2
:cond_3
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v1, p0, Landroid/widget/AbsListView;->mHeight:I
int-to-float v1, v1
invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
goto :goto_2
:pswitch_7
if-eqz v11, :cond_4
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v1, p0, Landroid/widget/AbsListView;->mHeight:I
int-to-float v1, v1
invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
goto :goto_2
:cond_4
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v1, p0, Landroid/widget/AbsListView;->mHeight:I
neg-int v1, v1
int-to-float v1, v1
invoke-direct {v0, v4, v4, v1, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
goto :goto_2
:pswitch_8
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v1, p0, Landroid/widget/AbsListView;->mWidth:I
neg-int v1, v1
int-to-float v1, v1
invoke-direct {v0, v1, v4, v4, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
goto/16 :goto_2
:pswitch_9
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v1, p0, Landroid/widget/AbsListView;->mWidth:I
int-to-float v1, v1
invoke-direct {v0, v1, v4, v4, v4}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
goto/16 :goto_2
:pswitch_a
new-instance v0, Landroid/view/animation/RotateAnimation;
const/high16 v3, 0x43340000
move-object v2, v0
move v6, v1
move v7, v5
move v8, v1
invoke-direct/range {v2 .. v8}, Landroid/view/animation/RotateAnimation;-><init>(FFIFIF)V
goto/16 :goto_2
:pswitch_b
iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
const v2, 0x10a0005
invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V
goto/16 :goto_3
:pswitch_c
iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
const v2, 0x10a0006
invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V
goto/16 :goto_3
:pswitch_d
iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
const v2, 0x10a0004
invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V
goto/16 :goto_3
:pswitch_e
iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
const v2, 0x10a0007
invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V
goto/16 :goto_3
:pswitch_f
iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
const v2, 0x10a0008
invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V
goto/16 :goto_3
:pswitch_10
iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
const v2, 0x10a0009
invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V
goto/16 :goto_3
:pswitch_11
iget-object v1, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
const v2, 0x10a000a
invoke-static {v1, v2}, Landroid/view/animation/AnimationUtils;->loadInterpolator(Landroid/content/Context;I)Landroid/view/animation/Interpolator;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/view/animation/Animation;->setInterpolator(Landroid/view/animation/Interpolator;)V
goto/16 :goto_3
:pswitch_data_0
.packed-switch 0x1
:pswitch_0
:pswitch_1
:pswitch_2
:pswitch_3
:pswitch_4
:pswitch_5
:pswitch_6
:pswitch_7
:pswitch_8
:pswitch_9
:pswitch_a
.end packed-switch
:pswitch_data_1
.packed-switch 0x1
:pswitch_b
:pswitch_c
:pswitch_d
:pswitch_e
:pswitch_f
:pswitch_10
:pswitch_11
.end packed-switch
.end method
Add new method in BLUE
Code:
.method public setFriction(F)V
.locals 1
iget-object v0, p0, Landroid/widget/AbsListView;->mFlingRunnable:Landroid/widget/AbsListView$FlingRunnable;
if-nez v0, :cond_0
new-instance v0, Landroid/widget/AbsListView$FlingRunnable;
invoke-direct {v0, p0}, Landroid/widget/AbsListView$FlingRunnable;-><init>(Landroid/widget/AbsListView;)V
iput-object v0, p0, Landroid/widget/AbsListView;->mFlingRunnable:Landroid/widget/AbsListView$FlingRunnable;
:cond_0
iget-object v0, p0, Landroid/widget/AbsListView;->mFlingRunnable:Landroid/widget/AbsListView$FlingRunnable;
# getter for: Landroid/widget/AbsListView$FlingRunnable;->mScroller:Landroid/widget/OverScroller;
invoke-static {v0}, Landroid/widget/AbsListView$FlingRunnable;->access$2100(Landroid/widget/AbsListView$FlingRunnable;)Landroid/widget/OverScroller;
move-result-object v0
invoke-virtual {v0, p1}, Landroid/widget/OverScroller;->setFriction(F)V
return-void
.end method
[COLOR="blue"].method public setGridView(Z)V
.locals 0
iput-boolean p1, p0, Landroid/widget/AbsListView;->mIsGridView:Z
return-void
.end method[/COLOR]
Framework files have been added to the bottom of this post for diffing.
If you have a Galaxy S5, you might be able to get away with just replacing the modified framework files for this modification, however there are no guarantees it wont cause other issues with your build.
Continue to Post #2 to add the menu items for the toggles
Addendum:
Listview disabled by default.
Some users were complaining about listview being active on a fresh flash to this how to disable it as default until they go in and make a choice.
Replace the line in RED with the code in BLUE
\smali_classes2\android\widget\AbsListView.smali
Code:
.method setAnimation(Landroid/view/View;)Landroid/view/View;
.locals 14
const/4 v5, 0x1
const/high16 v2, 0x3f800000
const/high16 v1, 0x3f000000
const/4 v4, 0x0
iget-object v3, p0, Landroid/widget/AbsListView;->mContext:Landroid/content/Context;
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v6, "listview_animation"
[COLOR="Red"]invoke-static {v3, v6, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
[/COLOR] [COLOR="Blue"] invoke-static {v3, v6, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
[/COLOR]
Full credits to @Adi Aisiteru Reborn for the original thread HERE
also credit to @lacoursiere18 for the updated KitKat guide HERE
Adding Toggles/Menu Item for Listview
To add Listview Animations menu item to SecSettings, refer to the guide by @lacoursiere18 here:
[GUIDE][SMALI][4.4.2] How to port Mokee ListView Animation for TouchWiz 4.4.2
Note:
For lollipop, I believe the xml edit in res/xml the file to edit is going to be display_settings_2014.xml
_________________________________________________
To add Listview Animations menu item to CustomSettings.apk:
\res\values\arrays.xml
Add new items in BLUE
Code:
[COLOR="blue"]<string-array name="listview_animation_entries">
<item>@string/listview_off</item>
<item>@string/listview_wave_left</item>
<item>@string/listview_wave_right</item>
<item>@string/listview_scale</item>
<item>@string/listview_alpha</item>
<item>@string/listview_stack_top</item>
<item>@string/listview_stack_bottom</item>
<item>@string/listview_unfold</item>
<item>@string/listview_fold</item>
<item>@string/listview_translate_left</item>
<item>@string/listview_translate_right</item>
<item>@string/listview_rotate</item>
</string-array>
<string-array name="listview_animation_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
</string-array>
<string-array name="listview_interpolator_entries">
<item>@string/listview_off</item>
<item>@string/listview_accelerate_interpolator</item>
<item>@string/listview_decelerate_interpolator</item>
<item>@string/listview_accelerate_decelerate_interpolator</item>
<item>@string/listview_anticipate_interpolator</item>
<item>@string/listview_overshoot_interpolator</item>
<item>@string/listview_anticipate_overshoot_interpolator</item>
<item>@string/listview_bounce_interpolator</item>
</string-array>
<string-array name="listview_interpolator_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
</string-array>
[/COLOR]</resources>
\res\values\strings.xml
Add new items in BLUE
Code:
[COLOR="blue"]<string name="listview_off">Off</string>
<string name="listview_wave_left">Wave (left)</string>
<string name="listview_wave_right">Wave (right)</string>
<string name="listview_alpha">Alpha</string>
<string name="listview_scale">Scale</string>
<string name="listview_stack_top">Stack (top)</string>
<string name="listview_stack_bottom">Stack (bottom)</string>
<string name="listview_unfold">Unfold</string>
<string name="listview_fold">Fold</string>
<string name="listview_translate_left">Translate (left)</string>
<string name="listview_translate_right">Translate (right)</string>
<string name="listview_rotate">Rotate</string>
<string name="listview_accelerate_interpolator">Accelerate</string>
<string name="listview_decelerate_interpolator">Decelerate</string>
<string name="listview_accelerate_decelerate_interpolator">Accelerate decelerate</string>
<string name="listview_anticipate_interpolator">Anticipate</string>
<string name="listview_overshoot_interpolator">Overshoot</string>
<string name="listview_anticipate_overshoot_interpolator">Anticipate overshoot</string>
<string name="listview_bounce_interpolator">Bounce</string>
[/COLOR]</resources>
\res\xml\preferences.xml
Code:
<PreferenceScreen android:title="Mokee Listview Animations">
<ListPreference android:persistent="false" android:entries="@array/listview_animation_entries" android:title="Listview animation" android:key="listview_animation" android:summary="%s" android:dependency="listview_animation" android:entryValues="@array/listview_animation_values" />
<ListPreference android:persistent="false" android:entries="@array/listview_interpolator_entries" android:title="Listview interpolator" android:key="listview_interpolator" android:summary="%s" android:dependency="listview_interpolator" android:entryValues="@array/listview_interpolator_values" />
</PreferenceScreen>
Rom Control V2 Entries:
Code:
<string-array name="listview_animation_entries">
<item>Off</item>
<item>Wave Left</item>
<item>Wave Right</item>
<item>Scale</item>
<item>Alpha</item>
<item>Stack Top</item>
<item>Stack Bottom</item>
<item>Unfold</item>
<item>Fold</item>
<item>Translate Left</item>
<item>Translate Right</item>
<item>Rotate</item>
</string-array>
<string-array name="listview_animation_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
</string-array>
<string-array name="listview_interpolator_entries">
<item>Off</item>
<item>Accelerate</item>
<item>Decelerate</item>
<item>Accelerate decelerate</item>
<item>Anticipate</item>
<item>Overshoot</item>
<item>Anticipate overshoot</item>
<item>Bounce</item>
</string-array>
<string-array name="listview_interpolator_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
</string-array>
<PreferenceCategory
android:title="Mokee Listview Animations">
<com.wubydax.romcontrol.v2.prefs.MyListPreference
android:entries="@array/listview_animation_entries"
android:title="Listview animation"
android:key="listview_animation"
android:defaultValue="0"
android:dependency="listview_animation"
android:entryValues="@array/listview_animation_values" />
<com.wubydax.romcontrol.v2.prefs.MyListPreference
android:entries="@array/listview_interpolator_entries"
android:title="Listview interpolator"
android:key="listview_interpolator"
android:defaultValue="0"
android:dependency="listview_interpolator"
android:entryValues="@array/listview_interpolator_values" />
</PreferenceCategory>
Thanks for another great mod and guide. Works great. I wasn't sure what the animations looked like but figured I would try it out. Pretty cool options.
metalfan78 said:
Thanks for another great mod and guide. Works great. I wasn't sure what the animations looked like but figured I would try it out. Pretty cool options.
Click to expand...
Click to collapse
Yes it is pretty cool.
I'm still waiting for some feedback from some of the users that have a different phone to give the framework edits a try.
Its a big task but its worth it.
Yea, it took awhile, pretty neat
metalfan78 said:
Yea, it took awhile, pretty neat
Click to expand...
Click to collapse
Don't you still have the S5?
You could have just replaced the smali files with the ones I posted and been done with it except for adding the menu items.
Good practice though.
Yea, still s5. I did the edits just because I like to, then I diffed.
tdunham said:
Listview Animations for Lollipop
Click to expand...
Click to collapse
It's pretty cool guide.
This is my video from SGS4 i9500: https://youtube.com/watch?feature=youtu.be&v=Jx9_IKhtRKU
Surghikov said:
It's pretty cool guide.
This is my video from SGS4 i9500: https://youtube.com/watch?feature=youtu.be&v=Jx9_IKhtRKU
Click to expand...
Click to collapse
@Surghikov
Very nice. I am curious if you did the full framework modification or just used the files I provided.
I followed your instructions for modifications Framework & SecSettings, were minor discrepancies, but as you can see, it works on my sgs4 i9500.
Thank you and good luck!
@tdunham I am trying this mod on Note 3. it is stuck on boot logo, I attached my stock and modified smalis as well as log, If you could have time looking at my smalis and log and see what's the culprit I would be very thankful. :angel:
kmokhtar79 said:
@tdunham I am trying this mod on Note 3. it is stuck on boot logo, I attached my stock and modified smalis as well as log, If you could have time looking at my smalis and log and see what's the culprit I would be very thankful. :angel:
Click to expand...
Click to collapse
The smali you sent looks fine.
The log wasn't a lot of help so I look at the edit I did for AbsListView$FlingRunnable.smali and see new code for access$3100 where I ask you to check if yours matches the one I posted. I see your AbsListView;->access$3100 is for scrollingcache also. You didn't change that did you?
And just for reference, try plugging in my smali files to see what happens.
Also, send me the other 2 smalis that you edited.
tdunham said:
And just for reference, try plugging in my smali files to see what happens.
Also, send me the other 2 smalis that you edited.
Click to expand...
Click to collapse
OK, let me check.
This is my method which shows the same access
Code:
.method static synthetic access$3100(Landroid/widget/AbsListView;)V
.locals 0
.param p0, "x0" # Landroid/widget/AbsListView;
.prologue
.line 132
invoke-direct {p0}, Landroid/widget/AbsListView;->clearScrollingCache()V
return-void
.end method
I believe those samlis are identical but let's narrow it down the failure.
kmokhtar79 said:
OK, let me check.
This is my method which shows the same access
Code:
.method static synthetic access$3100(Landroid/widget/AbsListView;)V
.locals 0
.param p0, "x0" # Landroid/widget/AbsListView;
.prologue
.line 132
invoke-direct {p0}, Landroid/widget/AbsListView;->clearScrollingCache()V
return-void
.end method
I believe those samlis are identical but let's narrow it down the failure.
Click to expand...
Click to collapse
Right away I see you did not do the edits to AbsListView$FlingRunnable$1.smali or to AbsListView$FlingRunnable.smali because the new method .method endFling(Z)V is missing I think. Read the first part a little more closely, maybe my wording is difficult to understand.
tdunham said:
Right away I see you did not do the edits to AbsListView$FlingRunnable$1.smali or to AbsListView$FlingRunnable.smali because the new method .method endFling(Z)V is missing I think. Read the first part a little more closely, maybe my wording is difficult to understand.
Click to expand...
Click to collapse
Yes I did, I thought you remembering me in mixing up stuff. I uploaded the stock ones. Here I attached the modded smalis. BTW, is this mod going to control or use those animation resources in framework. Because I compiled it successfully and booted fine but there is no animation changes, all I have is stock animation.
kmokhtar79 said:
Yes I did, I thought you remembering me in mixing up stuff. I uploaded the stock ones. Here I attached the modded smalis. BTW, is this mod going to control or use those animation resources in framework. Because I compiled it successfully and booted fine but there is no animation changes, all I have is stock animation.
Click to expand...
Click to collapse
Yes, I got the new set and it looks good too.
Animations only take effect wherever you are scrolling through a list.
Did you add the toggles? Not sure, maybe check for the keys with a sql editor to see if they change on toggle.
tdunham said:
Yes, I got the new set and it looks good too.
Animations only take effect wherever you are scrolling through a list.
Did you add the toggles? Not sure, maybe check for the keys with a sql editor to see if they change on toggle.
Click to expand...
Click to collapse
Yes mate I am aware of that and confirming toggle works but no effect I guess there is something different on Note 3 smalis or resources, anyway thanks for help I think I should move on.
kmokhtar79 said:
Yes mate I am aware of that and confirming toggle works but no effect I guess there is something different on Note 3 smalis or resources, anyway thanks for help I think I should move on.
Click to expand...
Click to collapse
Not sure. I think @lacoursiere18 has a note 4 but not sure if he's tried this yet for his build. Maybe he can share his smali.
Have you tried mine yet? Straight up replacing yours.
tdunham said:
Not sure. I think @lacoursiere18 has a note 4 but not sure if he's tried this yet for his build. Maybe he can share his smali.
Have you tried mine yet? Straight up replacing yours.
Click to expand...
Click to collapse
You mean without comparing? Let me try if it works that way.

Categories

Resources