[GUIDE][SOLUTION] How to add EXTRA\hidden notification panel TOGGLES in S5 MM 6.0.1 WITHOUT LOSING THEM on REBOOT
Hello to all.
Hope this guide will be useful
As you can know, there are some extra toggles that can be added in notification panel.
Working extra toggles are:
-
TorchLight
- SFinder
- QuickConnect
- AirGesture
- AirView
- SBeam
All toggles list are located in System section of ettings DB.
In S5 there are 3 items for the toggles in Setings DB:
-
notification_panel_active_app_list (this contains the ACTUAL order of toggles and if we edit toggles order, the new order will be saved here, and if we edit its value, toggles order will be immediately edited)
-
notification_panel_active_app_list_for_reset (this contains the default toggles order, if we press reset button in notification panel settings, his value will be put in notification_panel_active_app_list, so toggles order will be resetted)
-
notification_panel_default_active_app_list (it has the same value of notification_panel_active_app_list_for_reset but it is never used)
For editing this strings we could install
@Wuby986 and
@daxgirl's DBeditor and change the value of this 3 items adding extra toggles names, and it works fine, UNTIL YOU REBOOT
It's strange but when you reboot (if you add extra toggles)
notification_panel_active_app_list and notification_panel_active_app_list_for_reset WILL BE RESETTED TO A DEFAULT VALUE (wrotten in SecSettingsProvider)
So searching in SecSettingsProvider smali, I've found that
some toggles are not allowed by some CSC, so if you put extra (not allowed) toggles in your notification panel, the toggles order (notification_panel_active_app_list but also notification_panel_active_app_list_for_reset) will be resetted after reboot.
So how to solve?
It isn't properly a fix, but a good solution in my opinion.
We will use the item
notification_panel_default_active_app_list because
it's NEVER USED and above all
it WILL *NOT* BE RESETTED AFTER REBOOT.
When you edit toggles order with settings, the new order will be saved in notification_panel_active_app_list (that will be resetted on reboot if contains extra toggles).
What we are going to do is edit SecSettings.apk to get the edited toggles will be saved also in
notification_default_panel_active_app_list.
Then we will use
@Wuby986 and
@daxgirl's BootReceiver (an app that execute its own actions IMMEDIATELY AFTER REBOOT) to put the value of notification_panel_default_active_app_list (that now contains new toggle order) into notification_panel_active_app_list (that contains the actual toggles order and it is resetted after reboot).
So
let's start!
Decompile
SecSettings.apk and go into
/smali/com/android/settings/NotificationPanelMenu.smali
Search for method
.method private saveAppslist()V and
ADD the highlihted BLUE code
Code:
.method private saveAppslist()V
.
.
.
.
invoke-virtual {p0}, Lcom/android/settings/NotificationPanelMenu;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v5, "notification_panel_active_app_list"
invoke-static {v4, v5, v0}, Landroid/provider/Settings$System;->putString(Landroid/content/ContentResolver;Ljava/lang/String;Ljava/lang/String;)Z
[COLOR=blue]invoke-virtual {p0}, Lcom/android/settings/NotificationPanelMenu;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v5, "notification_panel_default_active_app_list"
invoke-static {v4, v5, v0}, Landroid/provider/Settings$System;->putString(Landroid/content/ContentResolver;Ljava/lang/String;Ljava/lang/String;)Z[/COLOR]
invoke-virtual {p0}, Lcom/android/settings/NotificationPanelMenu;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v5, "notification_panel_active_number_of_apps"
const/16 v6, 0xa
invoke-static {v4, v5, v6}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
iput v4, p0, Lcom/android/settings/NotificationPanelMenu;->mActiveAppsNum:I
return-void
.end method
When you change toggles order, the above code will save the new order also in notification_panel_default_active_app_list (that will NOT be resetted after reboot)
Now search for method
.method private resetPanel()V and
ADD the highlihted BLUE code
Code:
.method private resetPanel()V
.locals 6
.prologue
invoke-virtual {p0}, Lcom/android/settings/NotificationPanelMenu;->getActivity()Landroid/app/Activity;
move-result-object v3
const-string v4, "com.android.settings"
const-string v5, "RQSB"
invoke-static {v3, v4, v5}, Lcom/android/settings/Utils;->insertLog(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {p0}, Lcom/android/settings/NotificationPanelMenu;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
.local v2, "cr":Landroid/content/ContentResolver;
const-string v3, "notification_panel_active_app_list_for_reset"
invoke-static {v2, v3}, Landroid/provider/Settings$System;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
.local v0, "activeApps":Ljava/lang/String;
const-string v3, "notification_panel_active_number_of_apps_for_reset"
const/16 v4, 0xa
invoke-static {v2, v3, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
.local v1, "activeAppsNum":I
invoke-virtual {p0}, Lcom/android/settings/NotificationPanelMenu;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "notification_panel_active_app_list"
invoke-static {v3, v4, v0}, Landroid/provider/Settings$System;->putString(Landroid/content/ContentResolver;Ljava/lang/String;Ljava/lang/String;)Z
[COLOR=blue]invoke-virtual {p0}, Lcom/android/settings/NotificationPanelMenu;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "notification_panel_default_active_app_list"
invoke-static {v3, v4, v0}, Landroid/provider/Settings$System;->putString(Landroid/content/ContentResolver;Ljava/lang/String;Ljava/lang/String;)Z[/COLOR]
.
.
.
.
.end method
When you reset toggles order, the above code will also reset notification_panel_default_active_app_list, because (thanks to BootReceiver) when you reboot, its value will become the actual toggles order, and if you reset toggles and not reset this value, you will got old toggles order after reboot.
Now save changes, recompile the app and put it into /system/priv-app/SecSettings (and give rwxr-xr-x permissions to the folder and rw-r--r-- permissions to the apk).
Now you have to
FLASH THE ZIP ATTACHED AT THIS POST to install edited (by myself) BootReceiver for automatically adding the 6 extra toggles wrotten at the top of this post and for making this mod fully working, or you can also
BUILD BOOTRECEIVER FROM MY SOURCES (because they contains the proper code for this mod) and then install it in /system/priv-app .
The second option (building BootReceiver from sources) should be used (for this mod) only if you want to edit the default toggles order (adding or deleting toggles) and you just need to edit a string in strings.xml .
DO NOT EDIT OTHER STRINGS or JAVA CODE if you don't know what you're doing!!
Anyway I want to remember that BootReceiver is OPEN SOURCE and if you build it from sources and you use it into your rom, you
MUST PROVIDE YOUR SOURCES.
So, if you want to build from my sources and share into your rom, here is how to do (I want to remember BootReceiver code has been created by
@daxgirl and
@Wuby986 , I link my sources because they are edited properly for this mod and anyway they are forked from original repository, that can be accessed
here)
1. Log into your GitHub account (don't have one? Join it! It's a simple operartion and you will need GitHub to share your sources)
2. Open this link (my repository):
https://github.com/lucadalba/BootReceiver
3. Now CLICK ON
FORK button on top right corner of page (this will create a copy of this repository into your account)
4. Now GitHub will redirect you to your copy of BootReceiver repository
5. Click on
COPY OR DOWNLOADbutton, so COPY THE LINK THAT WILL APPEAR IN THE TEXTBOX (I will call it "Your repo URL")(should be
https://github.com/yourusername/BootReceiver.git )
6. Open Android Studio, click on File>New>Project from Version Control>Git
7. Paste
Your repo URL in Git Repository Url and then click on Clone
8. Wait all processes will finish (if you get gradle error, in the log you should found a link to automatically fix, click on it and continue)
9. Now open the Project tab on the right of the window and go in /app/res/values/double click on strings.xml
Here is what you will found. You should need to edit only the BLUE HIGHLIGHTED string
Code:
<resources>
<!--App strings-->
<string name="app_name">Boot Receiver</string>
<string name="boot_complete_toast">Boot completed - Quickpanel toggles setted</string>
<!--Keys and values - untranslatable-->
<!--Key of the item in Settings DB that contains ACTUAL TOGGLES ORDER-->
<!--It will be resetted on reboot and you have to apply xda mod to solve-->
<string name="tiles_key" translatable="false">notification_panel_active_app_list</string>
<!--Key of the item in Settings DB that contains toggles order APPLIED WHEN YOU RESET TOGGLES order-->
<!--It will be resetted on reboot and you have to apply xda mod to solve-->
<string name="tiles_reset_key" translatable="false">notification_panel_active_app_list_for_reset</string>
<!--Key of the item in Settings DB that is never used by the system-->
<!--So we have previously edited this (with xda mod) and now it will contain the same value of notification_panel_active_app_list-->
<!--The advantage is that this will NEVER BE RESETTED on reboot and so (because this contains notification_panel_active_app_list BEFORE REBOOT)-->
<!--we will take the Settings DB value of this item and we will put it into notification_panel_active_app_list AFTER REBOOT-->
<string name="tiles_default_key" translatable="false">notification_panel_default_active_app_list</string>
<!--This contains the names of all toggles we want in Notification Panel -->
<!--This will be put into notification_panel_active_app_list_for_reset on every reboot -->
<!--On first rom boot it will be put also in notification_panel_active_app_list and notification_panel_default_active_app_list -->
<string name="tiles_reset_value" translatable="false">[COLOR=blue]Wifi;MobileData;Location;TorchLight;SilentMode;AutoRotate;Bluetooth;WiFiHotspot;AirplaneMode;DormantMode;Nfc;SBeam;AllShareCast;CarMode;QuickConnect;Toolbox;MultiWindow;TouchSensitivity;PowerSaving;UltraPowerSaving;AirGesture;AirView;SmartStay;SmartPause;NetworkBooster;PersonalMode;SFinder;Sync;[/COLOR]</string>
</resources>
Every toggle is called as following:
So if you know other extra toggles names you can put their name into string, if you want to delete some toggles, just delete their names.
You can also edit toggles order on reset moving toggles names in the string.
When you have done your modifications, click on Build>Build APK , wait a minute and a notification should notice you that apk has been created.
Click on notification link and you should see app-debug.apk and app-debug-unaligned.apk
Raname
app-debug.apk to BootReceiver.apk , copy it into /system/
priv-app/BootReceiver into your phone and give rwxr-xr-x perms to folder and rw-r--r-- perms to apk.
Then reboot.
Done!
For sharing your updated sources press on VCS>Git>Push , it will appear a list with edited files to upload and a Comment section.
In the comment section write a small description of your edits, then click on "Commit and PUSH".
It will appear a login window and you have to put into it your github username and password, than login (if a window will ask you to set a new password, do it), after this click on Push button and updated files will be uploaded into your repo
Hope this guide will be useful and sorry if there aren't some informations or this is too long.. it's my first guide more difficult than previos 2 i shared.
Thanks to xda and to
@tdunham and all Samsung modders for this fantastic thread and guides