Hello everyone...
I've always liked the concept of the Air Command window that pops up when the S Pen is removed, but I didn't like being limited to the 5 options it gave me, as I only ever use two of them. So after much trial and error, I finally came up with a way to replace the defaults with whatever apps you want.
NOTES
Do this at your own risk. I am not responsible for loss of data, bricked devices, or global thermonuclear war resulting from this guide.
***Before proceeding any further, MAKE A BACKUP.
***This should work on any stock or stock-based ROM, but it has only been tested on the T-Mobile Galaxy Note 3 (sm-n900t) running Tweaked 3.95
***This is one of my first real forays into smali modding, and I'm still just learning, so while fully-functional, the smali could probably be made 'cleaner' and more efficient. In fact, I'm sure of it. Any tips/suggestions/improvements are more than welcome.
***This guide assumes that you already know how to decompile/compile both .jar and .apk files.
***In order to use different apps, you must be able to find the package name and the main activity (or any other activity you'd like) of the app that you want to use. These can be found by decompiling the app and looking in the AndroidManifest. Some examples:
Sketchbook For Galaxy
Package name: com.adsk.sketchbookhd.galaxy.oem
Activity: com.adsk.sketchbook.SketchBook
Papyrus
Package name: com.steadfastinnovation.android.projectpapyrus
Activity: com.steadfastinnovation.android.projectpapyrus.application.HeadlessMainActivity
MyScript Calculator
Package name: com.visionobjects.calculator
Activity: com.visionobjects.calculator.activity.MainActivity
With all that out of the way, let's begin!
Pull your services.jar from /system/framework and decompile it. The file we are going to be working with is /com/android/server/smartclip/SpenGestureManagerService$6.smali.
TO REPLACE ACTION MEMO
-Either search or scoll all the way down and find this line:
Code:
nop
-Erase that line, and paste the following in it's place:
Code:
:pswitch_ms1
if-eqz v6, :cond_atd1
:cond_atd1
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$1300()Ljava/lang/String;
move-result-object v10
invoke-virtual {v10, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v10
const/4 v11, 0x1
if-ne v10, v11, :cond_atd2
goto/16 :goto_42
:cond_atd2
new-instance v4, Landroid/content/Intent;
.end local v4 #intent:Landroid/content/Intent;
invoke-direct {v4}, Landroid/content/Intent;->()V
.restart local v4 #intent:Landroid/content/Intent;
const/high16 v10, 0x1400
invoke-virtual {v4, v10}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
new-instance v10, Landroid/content/ComponentName;
const-string v11, "YOUR_APP_NAME"
const-string v12, "YOUR_APP_ACTIVITY"
invoke-direct {v10, v11, v12}, Landroid/content/ComponentName;->(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v4, v10}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
const-string v10, "selectIndex"
const/4 v11, 0x1
invoke-virtual {v4, v10, v11}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v4, v11}, Landroid/content/Context;->startActivityAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v3, v11}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
goto/16 :goto_42
nop
-In the section you just pasted, replace "YOUR_APP_NAME" with the package name from your app, and replace "YOUR_APP_ACTIVITY" with the main activity from your app.
-Either scroll all the way down or search for the line:
Code:
.packed-switch 0x0
-Directly below that, change ":pswitch_43" to ":pswitch_ms1"
TO REPLACE SCRAPBOOKER
***NOTE: Pay no attention to the .line numbers in the following, as yours may be different.
-Search for the line:
Code:
const-string v10, "com.sec.android.app.rakein"
-There will be two of these lines. We're interested in the first one.
-Delete the line in red:
Code:
.restart local v4 #intent:Landroid/content/Intent;
const-string v10, "com.sec.android.app.rakein"
const-string v11, "com.sec.android.app.rakein.RakeInService"
[color=red]invoke-virtual {v4, v10, v11}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;[/color]
-Add the blue lines:
Code:
.restart local v4 #intent:Landroid/content/Intent;
[color=blue]const/high16 v10, 0x1400
invoke-virtual {v4, v10}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
new-instance v10, Landroid/content/ComponentName;[/color]
const-string v10, "com.sec.android.app.rakein"
const-string v11, "com.sec.android.app.rakein.RakeInService"
[color=blue]invoke-direct {v10, v11, v12}, Landroid/content/ComponentName;->(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v4, v10}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;[/color]
-Replace "com.sec.android.app.rakein" with the package name of the new app.
-Replace "com.sec.android.app.rakein.RakeInService" with the main activity of the new app.
-Scroll down a few lines until you see this:
Code:
invoke-virtual {v10, v4, v11}, Landroid/content/Context;->startServiceAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)Landroid/content/ComponentName;
-Replace that line with this:
Code:
invoke-virtual {v10, v4, v11}, Landroid/content/Context;->startActivityAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
-Scroll down until you see see this line:
Code:
goto/16 :goto_42
-Delete everything after that line, until you come to the following:
Code:
.line 669
:cond_154
new-instance v4, Landroid/content/Intent;
-Add the line in blue:
Code:
.line 669
:cond_154
[color=blue][emoji14]switch_120[/color]
new-instance v4, Landroid/content/Intent;
-Once finished, it should look like this:
Code:
.line 648
.restart local v4 #intent:Landroid/content/Intent;
const/high16 v10, 0x1400
invoke-virtual {v4, v10}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
new-instance v10, Landroid/content/ComponentName;
const-string v11, "com.adsk.sketchbookhd.galaxy.oem"
const-string v12, "com.adsk.sketchbook.SketchBook"
invoke-direct {v10, v11, v12}, Landroid/content/ComponentName;->(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v4, v10}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
.line 649
const-string v10, "selectIndex"
const/4 v11, 0x1
invoke-virtual {v4, v10, v11}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
.line 650
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v4, v11}, Landroid/content/Context;->startActivityAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
.line 652
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v2, v11}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
.line 654
const-string v10, "selectIndex"
const/4 v11, 0x1
invoke-virtual {v3, v10, v11}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
.line 655
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v3, v11}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
goto/16 :goto_42
.line 669
:cond_154
[emoji14]switch_120
new-instance v4, Landroid/content/Intent;
.end local v4 #intent:Landroid/content/Intent;
invoke-direct {v4}, Landroid/content/Intent;->()V
TO REPLACE SCREEN WRITE
-Search for this line:
Code:
nop
-Erase that line, and paste the following in its' place:
Code:
[emoji14]switch_ms2
if-eqz v6, :cond_atd3
:cond_atd3
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$1300()Ljava/lang/String;
move-result-object v10
invoke-virtual {v10, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v10
const/4 v11, 0x1
if-ne v10, v11, :cond_atd4
goto/16 :goto_42
:cond_atd4
new-instance v4, Landroid/content/Intent;
.end local v4 #intent:Landroid/content/Intent;
invoke-direct {v4}, Landroid/content/Intent;->()V
.restart local v4 #intent:Landroid/content/Intent;
const/high16 v10, 0x1400
invoke-virtual {v4, v10}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
new-instance v10, Landroid/content/ComponentName;
const-string v11, "YOUR_APP_NAME"
const-string v12, "YOUR_APP_ACTIVITY"
invoke-direct {v10, v11, v12}, Landroid/content/ComponentName;->(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v4, v10}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
const-string v10, "selectIndex"
const/4 v11, 0x1
invoke-virtual {v4, v10, v11}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v4, v11}, Landroid/content/Context;->startActivityAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v3, v11}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
goto/16 :goto_42
nop
-In the section you just pasted, replace "YOUR_APP_NAME" with the package name from your app, and replace "YOUR_APP_ACTIVITY" with the main activity from your app.
-Either scroll all the way down or search for the line:
Code:
.packed-switch 0x0
-Below that, change "[emoji14]switch_b7" to "[emoji14]switch_ms2"
TO REPLACE S FINDER
-Find the line:
Code:
const-string v11, "com.samsung.android.app.galaxyfinder"
-Replace "com.samsung.android.app.galaxyfinder" with the package name of the new app.
-On the line directly below, replace "com.samsung.android.app.galaxyfinder.GalaxyFinderActivity" with the main activity of the new app.
TO REPLACE PEN WINDOW
-Search for this line:
Code:
nop
-Erase that line, and paste the following in its' place:
Code:
[emoji14]switch_ms3
if-eqz v6, :cond_atd5
:cond_atd5
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$1300()Ljava/lang/String;
move-result-object v10
invoke-virtual {v10, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v10
const/4 v11, 0x1
if-ne v10, v11, :cond_atd6
goto/16 :goto_42
:cond_atd6
new-instance v4, Landroid/content/Intent;
.end local v4 #intent:Landroid/content/Intent;
invoke-direct {v4}, Landroid/content/Intent;->()V
.restart local v4 #intent:Landroid/content/Intent;
const/high16 v10, 0x1400
invoke-virtual {v4, v10}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
new-instance v10, Landroid/content/ComponentName;
const-string v11, "YOUR_APP_NAME"
const-string v12, "YOUR_APP_ACTIVITY"
invoke-direct {v10, v11, v12}, Landroid/content/ComponentName;->(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v4, v10}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
const-string v10, "selectIndex"
const/4 v11, 0x1
invoke-virtual {v4, v10, v11}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v4, v11}, Landroid/content/Context;->startActivityAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
invoke-static {}, Lcom/android/server/smartclip/SpenGestureManagerService;->access$200()Landroid/content/Context;
move-result-object v10
sget-object v11, Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;
invoke-virtual {v10, v3, v11}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V
goto/16 :goto_42
nop
-In the section you just pasted, replace "YOUR_APP_NAME" with the package name from your app, and replace "YOUR_APP_ACTIVITY" with the main activity from your app.
-Either scroll all the way down or search for the line:
Code:
.packed-switch 0x0
-Below that, change "[emoji14]switch_1f8" to "[emoji14]switch_ms3"
NOTES
-Regardless of how many apps you change, you should only have one instance of the line:
Code:
nop
-It should be right before the array of switches at the bottom of the document.
-After you've made your changes, save the file, re-smali the classout folder, copy the resulting classes.dex into your services.jar, push to /system/framework, set permissions, wipe Cache and Dalvik (never hurts), and reboot.
CHANGING THE ICONS
-Decompile your framework-res.apk, and go to res/drawable-xxhdpi. The icons will all begin with "airbutton_global_icon". Simply find the one(s)
corresponding to the app(s) you've changed, and edit it however you want. Just be sure to keep the file name the same.
CHANGING THE TEXT
-To change the text that shows when you hover over the Air Command apps, go to your decompiled framework-res.apk
and open res/values/strings.xml. The default strings are as follows:
Action Memo -
Scrap Booker -
Screen Write -
S Finder -
Pen Window -
-Locate the one(s) you want to change, change the content of the string(s), save, recompile, push to system/priv-app, set permissions, and reboot.
***Note: You may have to change them in res/values-en-rUS/strings.xml also.
Enjoy!
Reserved
edit: Meant to post this thread in General rather than Themes & Apps....If a mod could be so kind as to move it....
Thanks for this. I will be doing this tomorrow morning when I might have a free sec or 2. I use another app currently that gives me other options, but it is very clunky and not ideal. Your solution should be perfect to replace unused items with useful things I need! Take care and thanks for sharing.
Chris
Good luck! If you need any help or run into any problems, let me know.
That's a great idea and some really excellent work man :fingers-crossed: I'd be interested to give it a try on my Note 4 at some point, probably not for a bit though as there are several things that I'd like to get "set up" first. One thing at the top of that list (which I mention because it seems like you might find it as useful as I do, if you don't use it already) is GMD S-pen Control. In terms of "optimizing" use of the S-pen and making use of it as the single most versatile navigational tool in addition to its other uses, that app can't be beat. On my N3 I had it set up so that just by scribbling something on the screen, I could: launch pretty much any semi-frequently used app, toggle radios, take me directly to any menu within settings, etc. Although I occasionally used air command, more often than not I found it "getting in the way" when I was trying to scribble a GMD gesture until I made it stop auto-launching, and just put it (along with most of the other Samsung native functions) in one of the several "Launchbars" that are a part of the GMD app - rather than launching whatever via gestures (or rather, in addition to), you can assign "actions" to buttons on various launchbars that can be triggered by drawing straight down from the top of the screen or right from the left side.
Anyway, just wanted to say nice work on a super-practical mod, and let you know about the kinds of things you can do with the GMD app if you've never tried it
Thanks for the feedback! Just be sure you have a good, working backup. I don't have a Note 4, so can't test it, but I imagine it will be similar.
The smali will be slightly different, and the file name might have changed as well (particularly the number at the end, after the $). As long as you can find the corresponding file, you'll probably be able to use the same long block of code from the OP, and just change the switch numbers in the array at the bottom of the file. If you want to send me your services.jar sometime, I's be happy to take a look at it!
As for GMD S-Pen Control, I had tried it a long time ago, and it seemed pretty useful, but it sounds like they've added a lot more functionality since then, so I'll check it out. Thanks for the heads up!
Morningstar said:
Thanks for the feedback! Just be sure you have a good, working backup. I don't have a Note 4, so can't test it, but I imagine it will be similar.
The smali will be slightly different, and the file name might have changed as well (particularly the number at the end, after the $). As long as you can find the corresponding file, you'll probably be able to use the same long block of code from the OP, and just change the switch numbers in the array at the bottom of the file. If you want to send me your services.jar sometime, I's be happy to take a look at it!
As for GMD S-Pen Control, I had tried it a long time ago, and it seemed pretty useful, but it sounds like they've added a lot more functionality since then, so I'll check it out. Thanks for the heads up!
Click to expand...
Click to collapse
Thanks man! Just browsing through the system files and apks, I'd say that the majority of then look familiar (a few clearly new, and a few more installed DynamicKat ROM).... I've only had the phone for a week, but I've developed the notion that the way the the system (Tmo's latest 4.4.4 release) definitely, (possibly), handles things like dependencies and kernel modules differently. This is a really appealing project though because the result would be super-useful (it had never really occurred to me before, but looking back, it's kind of surprising that customizing air command isn't already "a thing" (beyond themeing). Just makes a ton of sense About time man!) but also because I'm sure I'd learn a ton just giving it a shot - I'd like to (try) incorporating a bit of themeing action, so best case scenario: learn a ton trying to figure it out and end up with a sweet / functional air command, worst case: learn a ton trying to figure it out and end up with a restored nandroid.... and a bunch of knowledge that I'm sure will be applicable towards many things on modding the N4 later on.
The only "issue" I've run into with GMD is recording paths for a ton of different things, then not really using it much for a bit, then starting to again to find that I've forgotten most of the non-obvious pen paths that I've assigned However, using it regularly is a huge time saver.
Why is this not an X-Posed module or a .TAR or a flashable .ZIP file or .APK file?? Thank you very much for posting this, it truly is great!
I have been searching for days for something like this and it would seem that everyone is just " happy" with modding the **** out of their droid but don't touch the AirCommand menu. Also, it would seem that people are again, actually happy with all of the other shortcuts / functions of AirCommand which I never used and will never use since I do not find them useful at all.
I've only seen AnyApp Air Command which I am using right now on Phantom ROM but having a 5 app pop-up menu for just 1 app is redundant.
I have an N7100 and I will do a nandroid and post back the results here.
This really needs to be turned into something more user-friendly. Also, in case you're working on something like that already, here's a suggestion : an "Alt+Tab" like shortcut would be awesome! Often times you're browsing the net for something but want to switch back to gaming or Settings or whatever. So a "Switch to previous used app" shortcut would be really nice!
@Morningstar Great complete Guide
I did Microsoft doc and pdf ,
Thanks, guys! This was my first real attempt at a smali mod, so it's rather convoluted and has a lot of redundancy, though it does work. I've gotten it to where it's much simpler, as you can see here where I re-did it for the Note 4. I haven't updated this, because it didn't seem like there was much interest, but if anyone wants I can throw together the same sort of thing I did for the N4, so you only have to add in the lines for your app, and change a few numbers....Much easier that way lol...
Morningstar said:
Thanks, guys! This was my first real attempt at a smali mod, so it's rather convoluted and has a lot of redundancy, though it does work. I've gotten it to where it's much simpler, as you can see here where I re-did it for the Note 4. I haven't updated this, because it didn't seem like there was much interest, but if anyone wants I can throw together the same sort of thing I did for the N4, so you only have to add in the lines for your app, and change a few numbers....Much easier that way lol...
Click to expand...
Click to collapse
You have no idea how many people are fgsfds frustrated when they search for "customize air command menu / change air command apps / shortcuts" and all they get is "How to theme your Air Command menu"
So yes, please! Keep it up, you're doing an excellent job and thank you very much for this!
Thank you. I'll have a little simpler method up later tonight or tomorrow. It'll be in the general forum, not Themes and Apps....Put this one here by mistake lol
Haven't forgotten about this...I've just had a busy day. I still intend to get an updated version put up tonight, or early tomorrow, since it may be after midnight lol.
Morningstar said:
Haven't forgotten about this...I've just had a busy day. I still intend to get an updated version put up tonight, or early tomorrow, since it may be after midnight lol.
Click to expand...
Click to collapse
No hurry, bro. I'd personally be happy with a 1/month update
Updated posted HERE.
Lollipop version coming tomorrow...
Related
{
"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!
I've scoured these forums and come up with nothing so far on this (other than apps that don't work!). Here's what I'm looking to do:
I drive FREQUENTLY for work and have my ATT Note 2 in a dash mount in landscape position. I would like my in-call screen to rotate to landscape, and actually be able to see my Caller ID photo as well as the standard dial pad.
I've tried Ultimate Rotation Control (and several other apps), and they DO rotate the screen, but the buttons are abnormally large and cover 90% of the screen. This covers up caller id as well as the dialer pad if you try to use it.
I found a mod and how-to for the S2 (links below) that does EXACTLY what I want, so I'm pretty sure someone with coding experience can figure this out. I can't figure out how to decompile-recompile my SecPhone.apk without errors, so I can't test this myself.
Is there anyone who can try to make this happen? If so, I'd be happy to make a donation for your time/effort. Thanks!
http://forum.xda-developers.com/showthread.php?t=2018583 - Mod for S2
http://forum.xda-developers.com/showthread.php?t=1705215 - How to for S2
Mods, is it possible for one of you to move this to the dev section? I feel like this is a pretty significant issue and would like to get the attention of someone who can actually sit down and decipher the proper code settings for this. I've tried doing it myself, but can't get the apk to recompile without errors.
Bump
Ultimate Rotation Control. Lets you auto rotate per app, as well as lock screen. I set the phone app to auto rotate and it does it in landscape mode.
BlackPhantomX said:
Ultimate Rotation Control. Lets you auto rotate per app, as well as lock screen. I set the phone app to auto rotate and it does it in landscape mode.
Click to expand...
Click to collapse
I appreciate the reply, but please read OP. Ultimate Rotation Control and all other rotation mods from the app store do NOT work properly. Yes, they will rotate the screen, but for some reason they force the buttons to take up 90% of the screen covering the dial pad (if I try to open it) and any caller ID information / photos.
I'm looking for someone who can make some coding changes to secphone.apk to fix the problem. See OP for examples done on the S2. I've tried this myself and can't figure it out, since I don't really know what I'm doing.
Any other feedback on this? I can't be the only one that this bugs the crap out of...
BUMP
obviously, none of the devs are interested....and, I know that has not been possible on several of the Android phones I have had over the last 5 years..
I guess you will either have to live with this, or learn about development, and try it yourself..
Just seems like a relatively simple fix since the legwork was already done for the GS2. I have tried doing this on my own, but keep running into issues when trying to re-compile.
Did you try deleting these 3 directories from the directory \secphone\res:
values-es
values-es-rUS
values-it
I did not have any compile issues when I compiled with Beans Build 1o
---------- Post added at 02:29 PM ---------- Previous post was at 02:24 PM ----------
MothChewMoth said:
Just seems like a relatively simple fix since the legwork was already done for the GS2. I have tried doing this on my own, but keep running into issues when trying to re-compile.
Click to expand...
Click to collapse
I have been working with MothChewMoth on the side and came up with the below:
Making the Note 2 TW Dialer Rotate based on phone orientation
First Note: I am not an android developer or a developer at all for that matter. I make no warranty for these changes and do so at your own risk. I have been running this for 2 days on my Verizon Note 2 running Beans Build 10 with no issues.
Thanks to Mirko ddd for posting how to do this on the Galaxy S2 which gave me a start for the Note 2
The instructions below were built off of CleanRom 4.5 ACE as that is what MothChewMoth was running.
DeCompile the SecPhone.apk and go to
apk and go to smali/com/android/phone/
You will need to edit two files:
InCallScreen.smali (this allows for rotation changes while on the phone)
CallCard.smali (this allows for rotation changes when a call is coming in)
Open InCallScreen.smali with a text editor and find the code:
Code:
.line 7185
:cond_5
sget-boolean v0, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v0, :cond_6
const-string v0, "hardkeyboardhidden_no"
invoke-static {v0}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_c
iget v0, p1, Landroid/content/res/Configuration;->hardKeyboardHidden:I
if-ne v0, v1, :cond_c
.line 7187
:cond_6
iget v2, p1, Landroid/content/res/Configuration;->orientation:I
Remove the 2 lines:
Code:
If-eqz v0, :cond_c
Code:
If-ne v0, v1, :cond_c
Your new code should look like:
Code:
.line 7185
:cond_5
sget-boolean v0, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v0, :cond_6
const-string v0, "hardkeyboardhidden_no"
invoke-static {v0}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/String;)Z
move-result v0
iget v0, p1, Landroid/content/res/Configuration;->hardKeyboardHidden:I
.line 7187
:cond_6
iget v2, p1, Landroid/content/res/Configuration;->orientation:I
Save InCallScreen.smali
Open CallCard.smali with a text editor and find the code:
Code:
.line 720
sget-boolean v2, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v2, :cond_0
const-string v2, "hardkeyboardhidden_no"
invoke-static {v2}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_4
iget v2, v0, Landroid/content/res/Configuration;->hardKeyboardHidden:I
if-ne v2, v1, :cond_4
.line 722
:cond_0
iget v0, v0, Landroid/content/res/Configuration;->orientation:I
Remove the 2 lines:
Code:
If-eqz v2, :cond_4
Code:
If-ne v2, v1, :cond_4
Your new code should look like:
Code:
.line 720
sget-boolean v2, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v2, :cond_0
const-string v2, "hardkeyboardhidden_no"
invoke-static {v2}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/String;)Z
move-result v2
iget v2, v0, Landroid/content/res/Configuration;->hardKeyboardHidden:I
.line 722
:cond_0
iget v0, v0, Landroid/content/res/Configuration;->orientation:I
Save the CallCard.smali
Re-Compile your secphone.apk
Replace your secphone.apk in /system/app and make sure its permissions are rw-r-r
Reboot your phone and enjoy
Second Note: To get past the CleanRom compile errors I ended up deleting these 3 directories from the directory \secphone\res:
values-es
values-es-rUS
values-it
I did not have any compile issues with the Beans Build 10 version of the same fix
Sounds like this was fixed according the forum over at ScottsRoms. Can you post the compiled, correct apk for landscape mode in call?
shaxs said:
Sounds like this was fixed according the forum over at ScottsRoms. Can you post the compiled, correct apk for landscape mode in call?
Click to expand...
Click to collapse
The attached files are built from the following Roms:
Beans Build 10
CleanRom 4.5 ACE (sorry for the 7zip compression format, zip wouldn't compress the file small enough)
I AM NOT A DEVELOPER, just a guy who hacked around until he got things working so please install this at your own risk.
To install:
1) download the proper file
2) Unzip and extract SecPhone.apk
3) Move your current SecPhone.apk from /system/app to a backup location on your phone/sdcard
4) Copy your new SecPhone.apk to /system/app
5) Change permissions on SecPhone.apk to rw-r-r
6) Reboot your phone
View attachment SecPhoneBeans.zip
View attachment SecPhoneCleanRom.7z
samuri28 said:
Did you try deleting these 3 directories from the directory \secphone\res:
values-es
values-es-rUS
values-it
I did not have any compile issues when I compiled with Beans Build 1o
---------- Post added at 02:29 PM ---------- Previous post was at 02:24 PM ----------
I have been working with MothChewMoth on the side and came up with the below:
Making the Note 2 TW Dialer Rotate based on phone orientation
First Note: I am not an android developer or a developer at all for that matter. I make no warranty for these changes and do so at your own risk. I have been running this for 2 days on my Verizon Note 2 running Beans Build 10 with no issues.
Thanks to Mirko ddd for posting how to do this on the Galaxy S2 which gave me a start for the Note 2
The instructions below were built off of CleanRom 4.5 ACE as that is what MothChewMoth was running.
DeCompile the SecPhone.apk and go to
apk and go to smali/com/android/phone/
You will need to edit two files:
InCallScreen.smali (this allows for rotation changes while on the phone)
CallCard.smali (this allows for rotation changes when a call is coming in)
Open InCallScreen.smali with a text editor and find the code:
Code:
.line 7185
:cond_5
sget-boolean v0, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v0, :cond_6
const-string v0, "hardkeyboardhidden_no"
invoke-static {v0}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_c
iget v0, p1, Landroid/content/res/Configuration;->hardKeyboardHidden:I
if-ne v0, v1, :cond_c
.line 7187
:cond_6
iget v2, p1, Landroid/content/res/Configuration;->orientation:I
Remove the 2 lines:
Code:
If-eqz v0, :cond_c
Code:
If-ne v0, v1, :cond_c
Your new code should look like:
Code:
.line 7185
:cond_5
sget-boolean v0, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v0, :cond_6
const-string v0, "hardkeyboardhidden_no"
invoke-static {v0}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/String;)Z
move-result v0
iget v0, p1, Landroid/content/res/Configuration;->hardKeyboardHidden:I
.line 7187
:cond_6
iget v2, p1, Landroid/content/res/Configuration;->orientation:I
Save InCallScreen.smali
Open CallCard.smali with a text editor and find the code:
Code:
.line 720
sget-boolean v2, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v2, :cond_0
const-string v2, "hardkeyboardhidden_no"
invoke-static {v2}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_4
iget v2, v0, Landroid/content/res/Configuration;->hardKeyboardHidden:I
if-ne v2, v1, :cond_4
.line 722
:cond_0
iget v0, v0, Landroid/content/res/Configuration;->orientation:I
Remove the 2 lines:
Code:
If-eqz v2, :cond_4
Code:
If-ne v2, v1, :cond_4
Your new code should look like:
Code:
.line 720
sget-boolean v2, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v2, :cond_0
const-string v2, "hardkeyboardhidden_no"
invoke-static {v2}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/String;)Z
move-result v2
iget v2, v0, Landroid/content/res/Configuration;->hardKeyboardHidden:I
.line 722
:cond_0
iget v0, v0, Landroid/content/res/Configuration;->orientation:I
Save the CallCard.smali
Re-Compile your secphone.apk
Replace your secphone.apk in /system/app and make sure its permissions are rw-r-r
Reboot your phone and enjoy
Second Note: To get past the CleanRom compile errors I ended up deleting these 3 directories from the directory \secphone\res:
values-es
values-es-rUS
values-it
I did not have any compile issues with the Beans Build 10 version of the same fix
Click to expand...
Click to collapse
I am very interested in this mod. I think it is very strange that there are no custom roms with this features integrated, because many people use their telephone as GPS in their car, like me.
I understand that it is necessary to modify SecPhone.apk of each rom. So, I am trying to decompile SecPhone.apk with the tools I downloaded from http://forum.xda-developers.com/showthread.php?t=1755243.
I extracted SecPhone.apk and framework-res.apk from the rom zip.
I installed framework-res.apk and when I try to decompile SecPhone.apk, it goes:
- Loading resource table.....
- Loaded....
- Decoding...
- Loading resource table from C:/...
Then, I get an error, which says Exception in thread "main" java.lang.OutOfMemory ...
So, I am stuck.
I get errors, but it somehow succeeded decompiling smalis, and I see the lines to delete. So, I really would like to decompile and recompile.
I have downloaded several different apktools, but some give an empty "SecPhone" folder. Maybe I am doing something wrong, but I don't know where my mistake is. Could you please give me some advice?
Succeeded !! but a problem!!
Hello, since my last post above, I have been trying to decompile SecPhone.apk, but none of apktools I tried worked for me. BUT, finally, with APK multi-Tool from the great post below, I was able to decompile and recompile SecPhone.apk.
http://forum.xda-developers.com/showthread.php?t=1310151
I installed framework-res.apk and twframework-res.apk before working with Multi-Tool.
For compiling, I did not chose to keep the original files. (I said "n"). And, after compiling, I copied androidmanifest.xml from the original SecPhone.apk into the compiled apk, replacing the new one. (It did not work the 1st time I did not copy this file.) Certainly, there are other and better ways, but anyway I have a working SecPhone.apk.
However, there is a problem. When I make a call in landscape, I have no buttons on the right side as in the attached photo. (When I make a call in portrait, I have no buttons, neither.) But, I have buttons when I receive a call in landscape and in portrait.
I deleted the 2 lines in each smali (total 4 lines), and I did not change anything else. I am very happy I have a phone, which works in landscape, too, but I would like to have the buttons back. Can you give me some advice?
Thank you for the great thread!!
PS: I am on Scamus V4.
3to4 said:
Hello, since my last post above, I have been trying to decompile SecPhone.apk, but none of apktools I tried worked for me. BUT, finally, with APK multi-Tool from the great post below, I was able to decompile and recompile SecPhone.apk.
http://forum.xda-developers.com/showthread.php?t=1310151
I installed framework-res.apk and twframework-res.apk before working with Multi-Tool.
For compiling, I did not chose to keep the original files. (I said "n"). And, after compiling, I copied androidmanifest.xml from the original SecPhone.apk into the compiled apk, replacing the new one. (It did not work the 1st time I did not copy this file.) Certainly, there are other and better ways, but anyway I have a working SecPhone.apk.
However, there is a problem. When I make a call in landscape, I have no buttons on the right side as in the attached photo. (When I make a call in portrait, I have no buttons, neither.) But, I have buttons when I receive a call in landscape and in portrait.
I deleted the 2 lines in each smali (total 4 lines), and I did not change anything else. I am very happy I have a phone, which works in landscape, too, but I would like to have the buttons back. Can you give me some advice?
Thank you for the great thread!!
PS: I am on Scamus V4.
Click to expand...
Click to collapse
Can you show the code snippet before you made your changes? and highlight the lines you removed?
Also I ended up using the procedures listed here to finally get my de-compile/re-compile to work:
http://forum.xda-developers.com/showthread.php?t=1809649
samuri28 said:
Can you show the code snippet before you made your changes? and highlight the lines you removed?
Also I ended up using the procedures listed here to finally get my de-compile/re-compile to work:
http://forum.xda-developers.com/showthread.php?t=1809649
Click to expand...
Click to collapse
Thank you very much for your reply. Finally, I deleted another line in each file, and it seems to be working now.
I need to use the phone a little while to see if there is really no problem like freezing, but I got my buttons back.
The lines I deleted are in red.
InCallScreen.smali:
.line 7147
:cond_5
sget-boolean v0, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v0, :cond_6
const-string v0, "hardkeyboardhidden_no"
invoke-static {v0}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/StringZ
move-result v0
if-eqz v0, :cond_c
iget v0, p1, Landroid/content/res/Configuration;->hardKeyboardHidden:I
if-ne v0, v1, :cond_c
.line 7149
:cond_6
iget v2, p1, Landroid/content/res/Configuration;->orientation:I
CallCard.smali:
.line 719
if-eqz v0, :cond_4
.line 720
sget-boolean v2, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v2, :cond_0
const-string v2, "hardkeyboardhidden_no"
invoke-static {v2}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/StringZ
move-result v2
if-eqz v2, :cond_4
iget v2, v0, Landroid/content/res/Configuration;->hardKeyboardHidden:I
if-ne v2, v1, :cond_4
.line 722
:cond_0
iget v0, v0, Landroid/content/res/Configuration;->orientation:I
That's all.
Thank you again for your posts.
3to4 said:
Thank you very much for your reply. Finally, I deleted another line in each file, and it seems to be working now.
I need to use the phone a little while to see if there is really no problem like freezing, but I got my buttons back.
The lines I deleted are in red.
InCallScreen.smali:
.line 7147
:cond_5
sget-boolean v0, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v0, :cond_6
const-string v0, "hardkeyboardhidden_no"
invoke-static {v0}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/StringZ
move-result v0
if-eqz v0, :cond_c
iget v0, p1, Landroid/content/res/Configuration;->hardKeyboardHidden:I
if-ne v0, v1, :cond_c
.line 7149
:cond_6
iget v2, p1, Landroid/content/res/Configuration;->orientation:I
CallCard.smali:
.line 719
if-eqz v0, :cond_4
.line 720
sget-boolean v2, Lcom/android/phone/PhoneApp;->mIsDockConnected:Z
if-nez v2, :cond_0
const-string v2, "hardkeyboardhidden_no"
invoke-static {v2}, Lcom/android/phone/PhoneFeature;->hasFeature(Ljava/lang/StringZ
move-result v2
if-eqz v2, :cond_4
iget v2, v0, Landroid/content/res/Configuration;->hardKeyboardHidden:I
if-ne v2, v1, :cond_4
.line 722
:cond_0
iget v0, v0, Landroid/content/res/Configuration;->orientation:I
That's all.
Thank you again for your posts.
Click to expand...
Click to collapse
Was it this line that you also deleted?
if-nez v0, :cond_6
I wonder if this is a ROM specific change as my secPhone.apk still has that line in it.
samuri28 said:
Was it this line that you also deleted?
if-nez v0, :cond_6
I wonder if this is a ROM specific change as my secPhone.apk still has that line in it.
Click to expand...
Click to collapse
Yes. This may be rom specific, but as I am no programmer, I cannot tell.
The two additional lines I deleted are;
1) if-nez v0, :cond_6 in InCallScreen.smali
2) if-nez v2, :cond_0 in CallCard.smali.
What I don't really understand is this feature (landscape in-call screen) is integrated in android, but disabled somehow, and you have to hack it to profit from the feature!!
3to4 said:
Yes. This may be rom specific, but as I am no programmer, I cannot tell.
The two additional lines I deleted are;
1) if-nez v0, :cond_6 in InCallScreen.smali
2) if-nez v2, :cond_0 in CallCard.smali.
What I don't really understand is this feature (landscape in-call screen) is integrated in android, but disabled somehow, and you have to hack it to profit from the feature!!
Click to expand...
Click to collapse
From the research I did trying to figure out how to get Landscape In-Call it looks like Samsung for some reason intentionally disabled Docking Mode on its phones and in turn disable auto rotation when in a dock (we forced the phone to auto-rotate regardless of in a dock). However in AOSP this feature is a setting within the phone settings menu, so I am assuming another Samsung intentional exclusion.
Hello There
I have P6200 with PAC-Man milestone1 (JB 4.2.1) , and I'm tired to make InCall in Portrait mode post here (http://forum.xda-developers.com/showthread.php?t=2544636)
I follow this post and I can't find SecPhone.apk
is there any help ???
I present the stock 4.1.2 deodexed SecMms.apk with toggle to disable/enable the "Screen On" option when a message is received. Having this option allows the use of BLN without having to install a 3rd party messaging app like SMS Popup.
For those interested in applying the MOD themselves...
Go to: MessagingPreferenceActivity.smali
Located in: \SecMms\smali\com\android\mms\ui\
Delete the red line below @ line 6398
Code:
.local v2, NotiCategory:Landroid/preference/PreferenceCategory;
invoke-static {}, Lcom/android/mms/MmsConfig;->getEnableNotificationBacklight()Z
move-result v11
if-nez v11, :cond_6
.line 789
const-string v11, "pref_key_backlight"
invoke-virtual {p0, v11}, Lcom/android/mms/ui/MessagingPreferenceActivity;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v11
[COLOR="Red"] invoke-direct {p0, v2, v11}, Lcom/android/mms/ui/MessagingPreferenceActivity;->removePreference(Landroid/preference/PreferenceGroup;Landroid/preference/Preference;)V[/COLOR]
.line 791
:cond_6
invoke-static {}, Lcom/android/mms/MmsConfig;->getEnableCmas()Z
move-result v11
if-eqz v11, :cond_7
invoke-static {}, Lcom/android/mms/MmsConfig;->getCMASProvider()I
Thanks to shoman94 and this thread http://forum.xda-developers.com/showthread.php?t=2283971for the intel. Figured I would keep passing the knowledge along. This is my first thread and contribution to the XDA community, hope I didn't forget anything. Enjoy!
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
This guide was written based on the Sprint Samsung Galaxy S3 ND8 KitKat stock ROM but with the proper modifications may work for other KitKat ROMs. Please don't ask me to modify this to work with ROM xyz or to compile this for you into a ROM. I won't do it.
Background Info
As you know, Android 4.4 has a heads-up notification feature built in but disabled with no way to enable it from settings. While there are various Xposed modules that will enable this for you as well as give some additional functionality (such as whitelisting), I personally don't use Xposed because it causes conflicts on my ROM so I decided to figure out how to enable it myself. Simply enabling Heads Up notifications caused all sorts of force closes any time an ongoing notification presented itself so that had to be worked out as well.
Requirements
apktool 2.0 beta 9 and the knowledge of how to use it. There are various guides on how to use apktool on XDA. Find one and read it. Make sure to read the information on the apktool site as well since some of the options in 2.0 may be different from the guides you find.
A text editor that supports Unix-style text files. I recommend Notepad++.
Files
You'll be working with the following apks:
SystemUI.apk
SecSettings.apk
SystemUI.apk
Decompile SystemUI.apk using apktool.
Open smali\com\android\systemui\statusbar\BaseStatusBar.smali in your preferred text editor.
Find .method protected shouldInterrupt(Landroid/service/notification/StatusBarNotificationZ.
This method is of no use to us in it's current form and is what causes the force closes/ongoing notification issues so we are going to completely remove it and replace it with the following:
Code:
.method protected shouldInterrupt(Landroid/service/notification/StatusBarNotification;)Z
.locals 12
.param p1, "sbn" # Landroid/service/notification/StatusBarNotification;
.prologue
const/4 v8, 0x0
const/4 v9, 0x1
.line 1292
invoke-virtual {p1}, Landroid/service/notification/StatusBarNotification;->isOngoing()Z
move-result v4
if-nez v4, :cond_0
iget-object v10, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mPowerManager:Landroid/os/PowerManager;
invoke-virtual {v10}, Landroid/os/PowerManager;->isScreenOn()Z
move-result v1
:goto_0
return v1
:cond_0
move v1, v8
goto :goto_0
.end method
Save the file and recompile SystemUI using apktool. Don't forget to re-sign the APK (either use an APK signer if you have a ROM that has 3rd-party system app signatures enabled or copy the AndroidManifest.xml file and META-INF folder from the original to the new APK).
That's it for SystemUI.apk.
SecSettings.apk
Decompile SecSettings.apk with apktool.
First, we need to add the title and summary for the setting to enable Heads Up notifications. Open res\values\Strings.xml in your preferred text editor.
Add the following lines to the bottom of the file:
Code:
<string name="heads_up">Heads up notifications</string>
<string name="heads_up_desc">Enable heads up notifications</string>
Save the file and close it.
Next we need to add the setting entry. Open res\xml\display_settings.xml in your preferred text editor.
Add the following line underneath your preferred setting category (I chose to place it under "General" in my ROM):
Code:
<CheckBoxPreference android:title="@string/heads_up" android:key="heads_up_setting" android:widgetLayout="@touchwiz:layout/preference_widget_twcheckbox" />
Save the file and close it.
Finally, we will add the code to enable/disable Heads Up notifications. Open smali\com\android\settings\DisplaySettings.smali in your preferred text editor.
Find # instance fields and add the following line (on a new line) somewhere before # direct methods:
Code:
.field private mHeadsUp:Landroid/preference/CheckBoxPreference;
Find .method private updateState()V, then locate the section of code that looks similar to this:
Code:
:cond_0
invoke-direct {p0}, Lcom/android/settings/DisplaySettings;->updateInformativeScreenSummary()V
.line 1374
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_2
move v0, v1
:goto_0
invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
Your variables (v#'s), conditionals (cond_#'s), gotos (goto_#'s), and .line #'s may differ. Under the line invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V, add:
Code:
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mHeadsUp:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v4, "heads_up_enabled"
invoke-static {v0, v4, v2}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_8
move v0, v1
:goto_6
invoke-virtual {v3, v0}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
You'll want to change the variables to match the ones in the prior code section if they are different for you. Also make sure to change the conditional and goto labels to one hexadecimal numeral higher than the highest one already present in the method (for example, in stock ND8, the highest conditional is cond_7 so we choose cond_8 for the conditional here and the highest goto is goto_5 so we chose goto_6).
Scroll down to the end of the method and add the following above .end method:
Code:
:cond_8
move v0, v2
goto/16 :goto_6
Make sure to change v2 to whatever variable is defined at the beginning of the method as 0x0 (ie. const/4 v2, 0x0 in this case).
Find .method public onCreate(Landroid/os/BundleV, then locate the section of code that looks similar to the following:
Code:
const-string v0, "display_battery_level"
invoke-virtual {p0, v0}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v0
check-cast v0, Landroid/preference/CheckBoxPreference;
iput-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
Again, your variables (v#'s) may differ. Beneath the line iput-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;, add the following:
Code:
const-string v0, "heads_up_setting"
invoke-virtual {p0, v0}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v0
check-cast v0, Landroid/preference/CheckBoxPreference;
iput-object v0, p0, Lcom/android/settings/DisplaySettings;->mHeadsUp:Landroid/preference/CheckBoxPreference;
Make sure to change the variable #'s to match the ones in the prior code section.
Find .method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/PreferenceZ and locate the section of code that looks similar to:
Code:
:cond_a
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_c
.line 1530
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mDisplayBatteryLevel:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 1531
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v4, "display_battery_percentage"
if-eqz v0, :cond_b
move v3, v2
:cond_b
invoke-static {v1, v4, v3}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto :goto_3
.line 1533
:cond_c
As usual, your variables (v#'s), conditionals (cond_#'s), gotos (goto_#'s), and .line #'s may differ. Under :cond_c, add the following:
Code:
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mHeadsUp:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2b
.line 1530
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mHeadsUp:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 1531
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v4, "heads_up_enabled"
if-eqz v0, :cond_2c
move v3, v2
:cond_2c
invoke-static {v1, v4, v3}, Landroid/provider/Settings$Global;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_3
:cond_2b
Again, you'll want to change the variables to match the ones in the prior code section if they are different for you and make sure to change the conditional labels to one hexadecimal numeral higher than the highest one already present in the method. Change the goto/16 :goto_3 to match the one in the previous code section.
Save the file and close it.
That's it for SecSettings.apk. Recompile and re-sign it.
Install both files to your phone using your preferred method. You should already know this but I'll say it anyway, THESE FILES CANNOT BE INSTALLED LIKE NORMAL SIDE-LOADED APKs. I prefer to reboot to recovery and use ADB to push the files to the system, but you can use whatever method is easiest for you (ie. Aroma file manager, flashable zip, etc.).
So I guess those of us that aren't very good at this will have to wait then? Lol
Sent from my SPH-L710 using Tapatalk
Great tutorial man! Thank you looking forward to add this to all my releases soon. Great job!
Great, it compiles without mistakes with Dn3 4.4.2 for N7105, but I was playing with my 4 years old daughter and I'm sure something will be wrong, lol!
I just had to use cond 8 instead of 7, but I will report very likely my failure... It will take longer for me to let it work.
Anyway, it is a very useful tutorial and it's the only one here.
Mismatch?
I think there is a typo in the code for statusbar, it says mismatched input "p1" expecting END_METHOD_DIRECTIVE
I took this one from your original code (the one inside your rom) and it compiles fine
.method protected shouldInterrupt(Landroid/service/notification/StatusBarNotificationZ
.locals 12
.parameter "sbn"
.prologue
const/4 v8, 0x0
const/4 v9, 0x1
.line 1292
invoke-virtual {p1}, Landroid/service/notification/StatusBarNotification;->isOngoing()Z
move-result v4
if-nez v4, :cond_0
iget-object v10, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mPowerManager:Landroid/os/PowerManager;
invoke-virtual {v10}, Landroid/os/PowerManager;->isScreenOn()Z
move-result v1
:goto_0
return v1
:cond_0
move v1, v8
goto :goto_0
.end method
I will re-check the next steps, because last night I was unable to get everything working (I am not a dev).
Thanks again.
lucaoldb said:
I think there is a typo in the code for statusbar, it says mismatched input "p1" expecting END_METHOD_DIRECTIVE
I took this one from your original code (the one inside your rom) and it compiles fine
.method protected shouldInterrupt(Landroid/service/notification/StatusBarNotificationZ
.locals 12
.parameter "sbn"
.prologue
const/4 v8, 0x0
const/4 v9, 0x1
.line 1292
invoke-virtual {p1}, Landroid/service/notification/StatusBarNotification;->isOngoing()Z
move-result v4
if-nez v4, :cond_0
iget-object v10, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mPowerManager:Landroid/os/PowerManager;
invoke-virtual {v10}, Landroid/os/PowerManager;->isScreenOn()Z
move-result v1
:goto_0
return v1
:cond_0
move v1, v8
goto :goto_0
.end method
I will re-check the next steps, because last night I was unable to get everything working (I am not a dev).
Thanks again.
Click to expand...
Click to collapse
The code in the guide is taken straight from my ROM. All this method does is check to see if the notification is ongoing or not, then check to make sure the screen is on. also, I highly recommend using the latest version of apktool.
First of all, thank you.
I still have to edit the files by myself, but I have tested both your system ui and your secsettings on to the rom I am using (Dn3 4.4.2 for N7105) and they work fine, including heads up notifications... So I will keep these settings for some days, until I have the time to learn more about this matter.
Btw, I will try some of yor themed apps I found inside your rom, which are very good looking.
So what does the hud look like and how does it work? Not familiar with it.
Sent from my SPH-L710 using Tapatalk
Works great. Thank you moonknightus
Deleted
marcran75 said:
Deleted
Click to expand...
Click to collapse
???
Sent from my SPH-L710 using Tapatalk
Just an fyi, I just tried this on the S5 stock touchwiz (which is 4.4.2). I get an error when trying to compile SecSettings.apk.
Code:
I: Smaling smali folder into classes.dex...
..\_WorkArea1\_working\SecSettings.apk\smali\com\android\settings\DisplaySettings.smali[2936,4] There is already a label with that name.
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/settings/DisplaySettings.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:71)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:55)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:358)
at brut.androlib.Androlib.buildSources(Androlib.java:298)
at brut.androlib.Androlib.build(Androlib.java:284)
at brut.androlib.Androlib.build(Androlib.java:258)
at brut.apktool.Main.cmdBuild(Main.java:240)
at brut.apktool.Main.main(Main.java:89)
It seems like the method or something is already being duplicated. SystemUI recompiled perfectly.
tp2215 said:
Just an fyi, I just tried this on the S5 stock touchwiz (which is 4.4.2). I get an error when trying to compile SecSettings.apk.
Code:
I: Smaling smali folder into classes.dex...
..\_WorkArea1\_working\SecSettings.apk\smali\com\android\settings\DisplaySettings.smali[2936,4] There is already a label with that name.
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/settings/DisplaySettings.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:71)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:55)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:358)
at brut.androlib.Androlib.buildSources(Androlib.java:298)
at brut.androlib.Androlib.build(Androlib.java:284)
at brut.androlib.Androlib.build(Androlib.java:258)
at brut.apktool.Main.cmdBuild(Main.java:240)
at brut.apktool.Main.main(Main.java:89)
It seems like the method or something is already being duplicated. SystemUI recompiled perfectly.
Click to expand...
Click to collapse
Either a goto or a conditional label is being duplicated. Reread the instructions paying attention to the part that says to adjust the labels accordingly. The S3 and S5 use very similar code but by no means is it identical.
Thanks moonknightus for this guide. I manage to apply this mod to my tablet.:good: .Now my only problem is your other mod.
@moonknightus please check your PM sir
Do I actually need to sign the apks our can I just use them once they are modified
Sent from my SPH-L710 using Tapatalk
bigwillyg said:
Do I actually need to sign the apks our can I just use them once they are modified
Sent from my SPH-L710 using Tapatalk
Click to expand...
Click to collapse
Either use an APK signer if you have a ROM that has 3rd-party system app signatures enabled or copy the AndroidManifest.xml file and META-INF folder from the original to the new APK.As stated by moonknightus in his other thread.
filchi756 said:
Either use an APK signer if you have a ROM that has 3rd-party system app signatures enabled or copy the AndroidManifest.xml file and META-INF folder from the original to the new APK.As stated by moonknightus in his other thread.
Click to expand...
Click to collapse
Ah gotcha. Thanks
Sent from my SPH-L710 using Tapatalk
Shouldn't this be :cond_8?
Code:
[COLOR="Red"]:cond_7
[/COLOR] move v0, v2
goto/16 :goto_6
tdunham said:
Shouldn't this be :cond_8?
Code:
[COLOR="Red"]:cond_7
[/COLOR] move v0, v2
goto/16 :goto_6
Click to expand...
Click to collapse
Yup