[MOD] [TUTORIAL] [5.0 LOLLIPOP] Add Flashlight and Screenshot to Power Menu

Search This thread

ambasadii

Senior Member
May 9, 2011
2,574
8,481
Warsaw
sites.google.com
Hi xda!
This is not mine tutorial ,credits go to darkera13 (SAMSUNG Developer) from Samsungviet
Link to orginal thread here
I decided to translate it made some changes in code to work with G900F
This works only with deodex system files!

So lets start modding:

Decompile android.policy.jar and go to /com/android/internal/policy/impl/GlobalActions.smali

Search for:

Code:
[COLOR="SeaGreen"].field private mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

Add something like the following:

Code:
[COLOR="SeaGreen"].field private mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

[COLOR="Red"].field private mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

.field private mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

.field private mScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

Search for:

Code:
[COLOR="SeaGreen"]iput-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

sget-object v3, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;[/COLOR]

Add something like the following:

Code:
[COLOR="SeaGreen"]iput-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

sget-object v3, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;[/COLOR]

[COLOR="Red"]iput-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

sget-object v3, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;[/COLOR]

Search for:

Code:
[COLOR="SeaGreen"].method static synthetic access$4700()Ljava/lang/String;[/COLOR]

Add to the below like this:

Code:
[COLOR="SeaGreen"].method static synthetic access$4700()Ljava/lang/String;
    .registers 1

    .prologue
    .line 158
    sget-object v0, Lcom/android/internal/policy/impl/GlobalActions;->mScafe:Ljava/lang/String;

    return-object v0
.end method[/COLOR]

[COLOR="Red"]
.method static synthetic access$500(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
    .registers 2

    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$5000(Lcom/android/internal/policy/impl/GlobalActions;)Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
    .registers 2

    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    return-object v0
.end method

.method static synthetic access$5001(Lcom/android/internal/policy/impl/GlobalActions;)Z
    .registers 2

    invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->getTorchStatus()Z

    move-result v0

    return v0
.end method[/COLOR]

Search for:

Code:
[COLOR="SeaGreen"] iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

Add something like the following (* Note this paragraph have the id, id have to create the corresponding public.xml then replaced in right here, guiding the bottom):
Code:
[COLOR="SeaGreen"] iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

 [COLOR="Red"]new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$Flashlight;

 const v4, 0x1080b74

 const v5, 0x1080b75

 const v6, 0x1040ba4

 const v7, 0x1040ba6

 const v8, 0x1040ba7

 move-object/from16 v3, p0

 invoke-direct/range {v2 .. v8}, Lcom/android/internal/policy/impl/GlobalActions$Flashlight;-><init>(Lcom/android/internal/policy/impl/GlobalActions;IIIII)V

 move-object/from16 v0, p0

 iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

 new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$Screenshot;

 const v3, 0x1080b76

 const v4, 0x1040ba3

 move-object/from16 v0, p0

 invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$Screenshot;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

 move-object/from16 v0, p0

 iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

Search for:

Code:
[COLOR="SeaGreen"] const/16 v2, 0x100[/COLOR]

Add the following:

Code:
[COLOR="SeaGreen"]
const/16 v2, 0x100

invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->getBugReportAction()Lcom/android/internal/policy/impl/GlobalActions$Action;

move-result-object v3

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

const/4 v5, 0x1

move-object/from16 v0, p0

invoke-direct {v0, v2, v3, v4, v5}, Lcom/android/internal/policy/impl/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/internal/policy/impl/GlobalActions$Action;Ljava/util/ArrayList;Z)Z[/COLOR]

[COLOR="Red"]const/16 v2, 0x200

 move-object/from16 v0, p0

 iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

 move-object/from16 v0, p0

 iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

 const/4 v5, 0x1

 move-object/from16 v0, p0

 invoke-direct {v0, v2, v3, v4, v5}, Lcom/android/internal/policy/impl/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/internal/policy/impl/GlobalActions$Action;Ljava/util/ArrayList;Z)Z

 const/16 v2, 0x400

 move-object/from16 v0, p0

 iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

 move-object/from16 v0, p0

 iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

 const/4 v5, 0x1

 move-object/from16 v0, p0

 invoke-direct {v0, v2, v3, v4, v5}, Lcom/android/internal/policy/impl/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/internal/policy/impl/GlobalActions$Action;Ljava/util/ArrayList;Z)Z[/COLOR]

Search for:

Code:
[COLOR="SeaGreen"]const-string v2, "emergencymode"[/COLOR]

change this value like this:

Code:
 [COLOR="Red"] if-eqz v2, :cond_315[/COLOR]

Add to the above as follows::

Code:
[COLOR="SeaGreen"]    const-string v2, "emergencymode"

    invoke-virtual {v2, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

[COLOR="Red"]    if-eqz v2, :cond_315[/COLOR]

    .line 1255
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mEmergency:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_24b

[COLOR="Red"]	.line 1255
    :cond_315
    const-string v2, "flashlight"

    invoke-virtual {v2, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_32a

    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_24b

    :cond_32a
    const-string v2, "screenshot"

    invoke-virtual {v2, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_2ca

    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

    invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_24b[/COLOR]
[/COLOR]

Search for:

Code:
[COLOR="SeaGreen"].method private prepareDialog()V
    .registers 8[/COLOR]

Add to the below as follows:

Code:
[COLOR="SeaGreen"].method private prepareDialog()V
    .registers 8[/COLOR]

[COLOR="Red"]	.prologue
    .line 1820
	
	invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->getTorchStatus()Z

    move-result v1

    if-eqz v1, :cond_b

    sget-object v4, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->On:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

    iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

    goto :goto_10

    :cond_b
    sget-object v4, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

    iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

    goto :goto_10[/COLOR]


search for:

Code:
[COLOR="SeaGreen"].method private handleShow()V
    .registers 5[/COLOR]

Add to the above as follows:

Code:
[COLOR="Red"].method private getTorchStatus()Z
    .registers 5

    .prologue
    const/4 v0, 0x0

    iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

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

    move-result-object v1

    const-string v2, "torch_light"

    const/4 v3, -0x2

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

    move-result v1

    if-eqz v1, :cond_11

    const/4 v0, 0x1

    :cond_11
    return v0
.end method[/COLOR]

[COLOR="SeaGreen"].method private handleShow()V
    .registers 5[/COLOR]

Search for:

Code:
[COLOR="SeaGreen"] const-string v4, "content://com.sec.knox.provider2/KnoxCustomManagerService1"[/COLOR]

Add to the above like this:

Code:
[COLOR="Red"]	.line 1840
	iget-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    iget-object v5, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

    invoke-virtual {v4, v5}, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;->updateState(Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;)V[/COLOR]
	
[COLOR="SeaGreen"]    .line 1842
    const-string v4, "content://com.sec.knox.provider2/KnoxCustomManagerService1"[/COLOR]

Save and unzip attachments GlobalMenu_darkera13_samsungviet.vn.zip copy the entire file in andorid.policy in / com / android / internal / policy / impl /

Decompile framework-res.apk and go to /res/values/arrays.xml

Search for:
Code:
[COLOR="SeaGreen"] <string-array name="config_globalActionsList">[/COLOR]

Add the following:

Code:
[COLOR="SeaGreen"]<string-array name="config_globalActionsList">
<item>power</item>
<item>datamode</item>
<item>airplane</item>
<item>restart</item>
<item>lockdown</item>
<item>bugreport</item>
<item>users</item>
<item>emergencymode</item>[/COLOR]
[COLOR="Red"]<item>flashlight</item>
<item>screenshot</item>[/COLOR]
[COLOR="SeaGreen"]</string-array>[/COLOR]

Save and open files /res/values/strings.xml

Add to the end of the file is as follows:

Code:
[COLOR="Red"] <string name="global_action_screenshot">Take Screenshot</string>
 <string name="global_action_flashlight">Flashlight</string>
 <string name="global_actions_flashlight_on_status">On</string>
 <string name="global_actions_flashlight_off_status">Off</string>[/COLOR]
[COLOR="SeaGreen"] </resources>[/COLOR]

Save and open files /res/values/public.xml

Add to the end of the file is as follows:

Code:
[COLOR="Red"] <public type="string" name="global_action_screenshot" id="0x01040ba3" />
 <public type="string" name="global_action_flashlight" id="0x01040ba4" />
 <public type="string" name="global_actions_flashlight_on_status" id="0x01040ba5" />
 <public type="string" name="global_actions_flashlight_off_status" id="0x01040ba6" />
 <public type="drawable" name="tw_ic_lock_flashlight_on" id="0x01080b74" />
 <public type="drawable" name="tw_ic_lock_flashlight_off" id="0x01080b75" />
 <public type="drawable" name="tw_ic_lock_screenshot" id="0x01080b76" />[/COLOR]


The id of public.xml may vary depending on the change of the file before public.xml so id have to figure out the right to revise section above id.
The principle of the id is constantly and have the right type, each type will have its own code (eg look at the section on the string is found 0x0104, 0x0108 will be drawable)

So to know the correct id id must be the biggest find in each type, try before going straight string,
here we see this guy 0x0104xxxx code is wrong we try to thousands and hundreds, tens and units ie instead of to find us every turn from 0x01040 -> 0x01049 guy, the guy does not have before it the biggest guy,
for example 0x01045 guy does not have the biggest guy thousands of it is 0x01044, so look down to the hundreds, tens and units. Note small as it used id hexadecimal should turn from small to large 0 -> 9, a, b, c, d, e, f

After finding the largest id translational then 1 unit and instead turn to the id in public.xml similar.

Afterward, they must determine the correct id id in the code Smail (noted above) with the correct id (Note that in the smali code id dropping 1 to 0 on, eg 0x01040ba3 going into 0x1040ba3)

something like this:

Code:
<public type="drawable" name="tw_ic_lock_flashlight_off" id="0x01080b84" /> ->	0x1080b84 -> const v5
<public type="drawable" name="tw_ic_lock_flashlight_on" 	id="0x01080b85" /> ->	0x1080b85 -> const v4
<public type="drawable" name="tw_ic_lock_screenshot" id="0x01080b86" /> -> 0x1080b86 	-> const v3

<public type="string" name="global_action_screenshot" id="0x01040b85" /> -> 0x1040b85 -> const v4
<public type="string" name="global_actions_flashlight_on_status" id="0x01040b87" /> -> 0x1040b87 -> const v7
<public type="string" name="global_actions_flashlight_off_status" id="0x01040b88" />	-> 0x1040b88	 -> const v8
<public type="string" name="global_action_flashlight" 	id="0x01040b86" /> -> 0x1040b86  -> const v6

Next copy the image file in framework-res attachments / *. Png into the framework-res / res / drawable-xhdpi

Recompile and done!

Download smali and framework-res files from here

Power Menu Mod with screenshot and flashlight button + 5 way reboot menu (G900FXXU1BNL9)
download

Credits:
@darkera13
 

Attachments

  • Screenshot_2015-01-24-12-49-41.png
    Screenshot_2015-01-24-12-49-41.png
    109 KB · Views: 10,514
Last edited:

ambasadii

Senior Member
May 9, 2011
2,574
8,481
Warsaw
sites.google.com
i didn't test it yet , if someone make it for deodex android.policy.jar and framework-res.apk (only clean not earlier modded) please share with us here and wrote phone model, thank you
 
Last edited:

ambasadii

Senior Member
May 9, 2011
2,574
8,481
Warsaw
sites.google.com
Can you please share how?

Thanx in advance :)
1) download from playstore SQLite Editor
2) install and run, we grant root permissions
3) find the APPS tab and go to "this" and open it
4) press the "settings.db" and then select "system"
5) locate the "notification_panel_active_app_list" and press it to be is highlighted in gray after which choose the pencil icon to enter the settings, see here
6) complement entry with missing buttons below:

Wifi;MobileData;Bluetooth;Location;AutoRotate;SilentMode;Location;NetworkBooster;Toolbox;SFinder;QuickConnect;MultiWindow;WiFiHotspot;Nfc;SBeam;AllShareCast;SmartStay;SmartPause;Sync;AirView;AirGesture;AirplaneMode;CarMode;PersonalMode;Ebook;UltraPowerSaving;PowerSaving;TouchSensitivity;DormantMode;SideKey;FloatingMessage;Flashlight;

7) press "save" and restart the phone
 
Last edited:

seky0405

Senior Member
Apr 16, 2011
354
228
1) download from playstore SQLite Editor
2) install and run, we grant root permissions
3) find the APPS tab "Pamięć ustawień" and open it
4) press the "settings.db" and then select "system"
5) locate the "notification_panel_active_app_list" and press it to be is highlighted in gray after which choose the pencil icon to enter the settings, see tutaj
6) complement entry with missing buttons below:

Wifi;MobileData;Bluetooth;Location;AutoRotate;SilentMode;Location;NetworkBooster;Toolbox;SFinder;QuickConnect;MultiWindow;WiFiHotspot;Nfc;SBeam;AllShareCast;SmartStay;SmartPause;Sync;AirView;AirGesture;AirplaneMode;CarMode;PersonalMode;Ebook;UltraPowerSaving;PowerSaving;TouchSensitivity;DormantMode;SideKey;Flashlight

7) press "save" and restart the phone

WoW! Thanx :) :good: :good: :good:
 

ambasadii

Senior Member
May 9, 2011
2,574
8,481
Warsaw
sites.google.com
ok i make the power menu here
the screenshoot buton works good but when i push flashlight the phone reboots
when i do a mistake ?
logcat attacet!

meaby something here:

.line 2810
.restart local v0 # "airplaneModeOn":Z
:cond_25
sget-object v1, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

goto :goto_19
.end method

.method private getTorchStatus()Z
.locals 4

.prologue
const/4 v0, 0x0

iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

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

move-result-object v1

const-string v2, "torch_light"

const/4 v3, -0x2

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

move-result v1

if-eqz v1, :cond_0

const/4 v0, 0x1

:cond_0
return v0
.end method


.method private prepareDialog()V
.registers 8

invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->getTorchStatus()Z

move-result v1

if-eqz v1, :cond_20

sget-object v4, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->On:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

goto :cond_21

:cond_20
sget-object v4, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

goto :cond_21

:cond_21


.prologue
.line 1820
iget-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->cm:Landroid/net/ConnectivityManager;
 

Attachments

  • 2015-01-24-18-55-08.txt
    393.8 KB · Views: 53
Last edited:

Mirhawk

Senior Member
Jan 31, 2014
1,453
638
Hi, I know this thread is for Galaxy S5, but can similar be implemented on any phone running Android Lollipop AOSP? I have a Xperia S, which has Android Lollipop AOSP, and I found somewhat similar code in the android.policy.jar of My ROM too. I just want to implement the Screenshot shortcut, not the flashlight one.
 

ambasadii

Senior Member
May 9, 2011
2,574
8,481
Warsaw
sites.google.com
Hi, I know this thread is for Galaxy S5, but can similar be implemented on any phone running Android Lollipop AOSP? I have a Xperia S, which has Android Lollipop AOSP, and I found somewhat similar code in the android.policy.jar of My ROM too. I just want to implement the Screenshot shortcut, not the flashlight one.
yes i think you can try it, good look mate!
 

Kamy

Senior Member
Aug 29, 2012
5,335
19,304
Beijing
ok i make the power menu here
the screenshoot buton works good but when i push flashlight the phone reboots
when i do a mistake ?

meaby something here:

.line 2810
.restart local v0 # "airplaneModeOn":Z
:cond_25
sget-object v1, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

goto :goto_19
.end method

.method private getTorchStatus()Z
.locals 4

.prologue
const/4 v0, 0x0

iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

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

move-result-object v1

const-string v2, "torch_light"

const/4 v3, -0x2

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

move-result v1

if-eqz v1, :cond_0

const/4 v0, 0x1

:cond_0
return v0
.end method


.method private prepareDialog()V
.registers 8

invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->getTorchStatus()Z

move-result v1

if-eqz v1, :cond_20

sget-object v4, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->On:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

goto :cond_21

:cond_20
sget-object v4, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;

goto :cond_21

:cond_21


.prologue
.line 1820
iget-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->cm:Landroid/net/ConnectivityManager;

Did you check whether those IDs created in framework are matched in andoid.policy?
 

ambasadii

Senior Member
May 9, 2011
2,574
8,481
Warsaw
sites.google.com
Did you check whether those IDs created in framework are matched in andoid.policy?
yes mate i check it:

<public type="drawable" name="tw_ic_lock_flashlight_off" id="0x01080b84" /> 0x1080b84 const v5
<public type="drawable" name="tw_ic_lock_flashlight_on" id="0x01080b85" /> 0x1080b85 const v4
<public type="drawable" name="tw_ic_lock_screenshot" id="0x01080b86" /> 0x1080b86 const v3


<public type="string" name="global_action_screenshot" id="0x01040b85" /> 0x1040b85 const v4
<public type="string" name="global_actions_flashlight_on_status" id="0x01040b87" /> 0x1040b87 const v7
<public type="string" name="global_actions_flashlight_off_status" id="0x01040b88" /> 0x1040b88 const v8
<public type="string" name="global_action_flashlight" id="0x01040b86" /> 0x1040b86 const v6
 

Kamy

Senior Member
Aug 29, 2012
5,335
19,304
Beijing
yes mate i check it:

<public type="drawable" name="tw_ic_lock_flashlight_off" id="0x01080b84" /> 0x1080b84 const v5
<public type="drawable" name="tw_ic_lock_flashlight_on" id="0x01080b85" /> 0x1080b85 const v4
<public type="drawable" name="tw_ic_lock_screenshot" id="0x01080b86" /> 0x1080b86 const v3


<public type="string" name="global_action_screenshot" id="0x01040b85" /> 0x1040b85 const v4
<public type="string" name="global_actions_flashlight_on_status" id="0x01040b87" /> 0x1040b87 const v7
<public type="string" name="global_actions_flashlight_off_status" id="0x01040b88" /> 0x1040b88 const v8
<public type="string" name="global_action_flashlight" id="0x01040b86" /> 0x1040b86 const v6

I am seeing you are linking same ID for string and drawable.

Code:
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$Flashlight;

const v4, 0x1080b74 <public type="[COLOR="Red"]drawable[/COLOR]" name="tw_ic_lock_flashlight_on" id="

const v5, 0x1080b75 <public type="[COLOR="red"]drawable[/COLOR]" name="tw_ic_lock_flashlight_off" id="

const v6, 0x1040ba4 <public type="[COLOR="red"]string[/COLOR]" name="global_action_flashlight" id="

const v7, 0x1040ba6 <public type="[COLOR="red"]string[/COLOR]" name="global_actions_flashlight_off_status" id="

const v8, 0x1040ba7 <public type="[COLOR="red"]string[/COLOR]" name="global_actions_flashlight_on_status" id="

move-object/from16 v3, p0

invoke-direct/range {v2 .. v8}, Lcom/android/internal/policy/impl/GlobalActions$Flashlight;-><init>(Lcom/android/internal/policy/impl/GlobalActions;IIIII)V

move-object/from16 v0, p0

iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$Screenshot;

const v3, 0x1080b76 <public type="[COLOR="red"]drawable[/COLOR]" name="tw_ic_lock_screenshot" id="

const v4, 0x1040ba3 <public type="[COLOR="red"]string[/COLOR]" name="global_action_screenshot" id="

move-object/from16 v0, p0

Check your IDs again. Just to double check did you recompile after modifying framework and again decompile? IDs in public has to be created you cannot leave a random id there sorry I have to be precise to narrow down problems.
 

ambasadii

Senior Member
May 9, 2011
2,574
8,481
Warsaw
sites.google.com
I am seeing you are linking same ID for string and drawable.

Code:
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$Flashlight;

const v4, 0x1080b74 <public type="[COLOR="Red"]drawable[/COLOR]" name="tw_ic_lock_flashlight_on" id="

const v5, 0x1080b75 <public type="[COLOR="red"]drawable[/COLOR]" name="tw_ic_lock_flashlight_off" id="

const v6, 0x1040ba4 <public type="[COLOR="red"]string[/COLOR]" name="global_action_flashlight" id="

const v7, 0x1040ba6 <public type="[COLOR="red"]string[/COLOR]" name="global_actions_flashlight_off_status" id="

const v8, 0x1040ba7 <public type="[COLOR="red"]string[/COLOR]" name="global_actions_flashlight_on_status" id="

move-object/from16 v3, p0

invoke-direct/range {v2 .. v8}, Lcom/android/internal/policy/impl/GlobalActions$Flashlight;-><init>(Lcom/android/internal/policy/impl/GlobalActions;IIIII)V

move-object/from16 v0, p0

iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$Screenshot;

const v3, 0x1080b76 <public type="[COLOR="red"]drawable[/COLOR]" name="tw_ic_lock_screenshot" id="

const v4, 0x1040ba3 <public type="[COLOR="red"]string[/COLOR]" name="global_action_screenshot" id="

move-object/from16 v0, p0

Check your IDs again. Just to double check did you recompile after modifying framework and again decompile? IDs in public has to be created you cannot leave a random id there sorry I have to be precise to narrow down problems.
yest i add strings to framework-res and recompile again new framework-res to check random id in public, ok i check it again,thx
 

Top Liked Posts

  • There are no posts matching your filters.
  • 28
    Hi xda!
    This is not mine tutorial ,credits go to darkera13 (SAMSUNG Developer) from Samsungviet
    Link to orginal thread here
    I decided to translate it made some changes in code to work with G900F
    This works only with deodex system files!

    So lets start modding:

    Decompile android.policy.jar and go to /com/android/internal/policy/impl/GlobalActions.smali

    Search for:

    Code:
    [COLOR="SeaGreen"].field private mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

    Add something like the following:

    Code:
    [COLOR="SeaGreen"].field private mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]
    
    [COLOR="Red"].field private mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
    
    .field private mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
    .field private mScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

    Search for:

    Code:
    [COLOR="SeaGreen"]iput-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
    sget-object v3, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;[/COLOR]

    Add something like the following:

    Code:
    [COLOR="SeaGreen"]iput-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
    sget-object v3, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;[/COLOR]
    
    [COLOR="Red"]iput-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
    sget-object v3, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;[/COLOR]

    Search for:

    Code:
    [COLOR="SeaGreen"].method static synthetic access$4700()Ljava/lang/String;[/COLOR]

    Add to the below like this:

    Code:
    [COLOR="SeaGreen"].method static synthetic access$4700()Ljava/lang/String;
        .registers 1
    
        .prologue
        .line 158
        sget-object v0, Lcom/android/internal/policy/impl/GlobalActions;->mScafe:Ljava/lang/String;
    
        return-object v0
    .end method[/COLOR]
    
    [COLOR="Red"]
    .method static synthetic access$500(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
        .registers 2
    
        iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    
        return-object v0
    .end method
    
    .method static synthetic access$5000(Lcom/android/internal/policy/impl/GlobalActions;)Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
        .registers 2
    
        iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
    
        return-object v0
    .end method
    
    .method static synthetic access$5001(Lcom/android/internal/policy/impl/GlobalActions;)Z
        .registers 2
    
        invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->getTorchStatus()Z
    
        move-result v0
    
        return v0
    .end method[/COLOR]

    Search for:

    Code:
    [COLOR="SeaGreen"] iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

    Add something like the following (* Note this paragraph have the id, id have to create the corresponding public.xml then replaced in right here, guiding the bottom):
    Code:
    [COLOR="SeaGreen"] iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]
    
     [COLOR="Red"]new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$Flashlight;
    
     const v4, 0x1080b74
    
     const v5, 0x1080b75
    
     const v6, 0x1040ba4
    
     const v7, 0x1040ba6
    
     const v8, 0x1040ba7
    
     move-object/from16 v3, p0
    
     invoke-direct/range {v2 .. v8}, Lcom/android/internal/policy/impl/GlobalActions$Flashlight;-><init>(Lcom/android/internal/policy/impl/GlobalActions;IIIII)V
    
     move-object/from16 v0, p0
    
     iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
    
     new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$Screenshot;
    
     const v3, 0x1080b76
    
     const v4, 0x1040ba3
    
     move-object/from16 v0, p0
    
     invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$Screenshot;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
    
     move-object/from16 v0, p0
    
     iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

    Search for:

    Code:
    [COLOR="SeaGreen"] const/16 v2, 0x100[/COLOR]

    Add the following:

    Code:
    [COLOR="SeaGreen"]
    const/16 v2, 0x100
    
    invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->getBugReportAction()Lcom/android/internal/policy/impl/GlobalActions$Action;
    
    move-result-object v3
    
    move-object/from16 v0, p0
    
    iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
    
    const/4 v5, 0x1
    
    move-object/from16 v0, p0
    
    invoke-direct {v0, v2, v3, v4, v5}, Lcom/android/internal/policy/impl/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/internal/policy/impl/GlobalActions$Action;Ljava/util/ArrayList;Z)Z[/COLOR]
    
    [COLOR="Red"]const/16 v2, 0x200
    
     move-object/from16 v0, p0
    
     iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
    
     move-object/from16 v0, p0
    
     iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
    
     const/4 v5, 0x1
    
     move-object/from16 v0, p0
    
     invoke-direct {v0, v2, v3, v4, v5}, Lcom/android/internal/policy/impl/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/internal/policy/impl/GlobalActions$Action;Ljava/util/ArrayList;Z)Z
    
     const/16 v2, 0x400
    
     move-object/from16 v0, p0
    
     iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
    
     move-object/from16 v0, p0
    
     iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
    
     const/4 v5, 0x1
    
     move-object/from16 v0, p0
    
     invoke-direct {v0, v2, v3, v4, v5}, Lcom/android/internal/policy/impl/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/internal/policy/impl/GlobalActions$Action;Ljava/util/ArrayList;Z)Z[/COLOR]

    Search for:

    Code:
    [COLOR="SeaGreen"]const-string v2, "emergencymode"[/COLOR]

    change this value like this:

    Code:
     [COLOR="Red"] if-eqz v2, :cond_315[/COLOR]

    Add to the above as follows::

    Code:
    [COLOR="SeaGreen"]    const-string v2, "emergencymode"
    
        invoke-virtual {v2, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    
        move-result v2
    
    [COLOR="Red"]    if-eqz v2, :cond_315[/COLOR]
    
        .line 1255
        move-object/from16 v0, p0
    
        iget-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
    
        move-object/from16 v0, p0
    
        iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mEmergency:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
    
        invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    
        goto :goto_24b
    
    [COLOR="Red"]	.line 1255
        :cond_315
        const-string v2, "flashlight"
    
        invoke-virtual {v2, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    
        move-result v2
    
        if-eqz v2, :cond_32a
    
        move-object/from16 v0, p0
    
        iget-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
    
        move-object/from16 v0, p0
    
        iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
    
        invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    
        goto :goto_24b
    
        :cond_32a
        const-string v2, "screenshot"
    
        invoke-virtual {v2, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
    
        move-result v2
    
        if-eqz v2, :cond_2ca
    
        move-object/from16 v0, p0
    
        iget-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
    
        move-object/from16 v0, p0
    
        iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
    
        invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    
        goto :goto_24b[/COLOR]
    [/COLOR]

    Search for:

    Code:
    [COLOR="SeaGreen"].method private prepareDialog()V
        .registers 8[/COLOR]

    Add to the below as follows:

    Code:
    [COLOR="SeaGreen"].method private prepareDialog()V
        .registers 8[/COLOR]
    
    [COLOR="Red"]	.prologue
        .line 1820
    	
    	invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->getTorchStatus()Z
    
        move-result v1
    
        if-eqz v1, :cond_b
    
        sget-object v4, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->On:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
        iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
        goto :goto_10
    
        :cond_b
        sget-object v4, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;->Off:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
        iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
        goto :goto_10[/COLOR]


    search for:

    Code:
    [COLOR="SeaGreen"].method private handleShow()V
        .registers 5[/COLOR]

    Add to the above as follows:

    Code:
    [COLOR="Red"].method private getTorchStatus()Z
        .registers 5
    
        .prologue
        const/4 v0, 0x0
    
        iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    
        invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
    
        move-result-object v1
    
        const-string v2, "torch_light"
    
        const/4 v3, -0x2
    
        invoke-static {v1, v2, v0, v3}, Landroid/provider/Settings$System;->getIntForUser(Landroid/content/ContentResolver;Ljava/lang/String;II)I
    
        move-result v1
    
        if-eqz v1, :cond_11
    
        const/4 v0, 0x1
    
        :cond_11
        return v0
    .end method[/COLOR]
    
    [COLOR="SeaGreen"].method private handleShow()V
        .registers 5[/COLOR]

    Search for:

    Code:
    [COLOR="SeaGreen"] const-string v4, "content://com.sec.knox.provider2/KnoxCustomManagerService1"[/COLOR]

    Add to the above like this:

    Code:
    [COLOR="Red"]	.line 1840
    	iget-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlight:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
    
        iget-object v5, p0, Lcom/android/internal/policy/impl/GlobalActions;->mFlashlightState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
    
        invoke-virtual {v4, v5}, Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;->updateState(Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;)V[/COLOR]
    	
    [COLOR="SeaGreen"]    .line 1842
        const-string v4, "content://com.sec.knox.provider2/KnoxCustomManagerService1"[/COLOR]

    Save and unzip attachments GlobalMenu_darkera13_samsungviet.vn.zip copy the entire file in andorid.policy in / com / android / internal / policy / impl /

    Decompile framework-res.apk and go to /res/values/arrays.xml

    Search for:
    Code:
    [COLOR="SeaGreen"] <string-array name="config_globalActionsList">[/COLOR]

    Add the following:

    Code:
    [COLOR="SeaGreen"]<string-array name="config_globalActionsList">
    <item>power</item>
    <item>datamode</item>
    <item>airplane</item>
    <item>restart</item>
    <item>lockdown</item>
    <item>bugreport</item>
    <item>users</item>
    <item>emergencymode</item>[/COLOR]
    [COLOR="Red"]<item>flashlight</item>
    <item>screenshot</item>[/COLOR]
    [COLOR="SeaGreen"]</string-array>[/COLOR]

    Save and open files /res/values/strings.xml

    Add to the end of the file is as follows:

    Code:
    [COLOR="Red"] <string name="global_action_screenshot">Take Screenshot</string>
     <string name="global_action_flashlight">Flashlight</string>
     <string name="global_actions_flashlight_on_status">On</string>
     <string name="global_actions_flashlight_off_status">Off</string>[/COLOR]
    [COLOR="SeaGreen"] </resources>[/COLOR]

    Save and open files /res/values/public.xml

    Add to the end of the file is as follows:

    Code:
    [COLOR="Red"] <public type="string" name="global_action_screenshot" id="0x01040ba3" />
     <public type="string" name="global_action_flashlight" id="0x01040ba4" />
     <public type="string" name="global_actions_flashlight_on_status" id="0x01040ba5" />
     <public type="string" name="global_actions_flashlight_off_status" id="0x01040ba6" />
     <public type="drawable" name="tw_ic_lock_flashlight_on" id="0x01080b74" />
     <public type="drawable" name="tw_ic_lock_flashlight_off" id="0x01080b75" />
     <public type="drawable" name="tw_ic_lock_screenshot" id="0x01080b76" />[/COLOR]


    The id of public.xml may vary depending on the change of the file before public.xml so id have to figure out the right to revise section above id.
    The principle of the id is constantly and have the right type, each type will have its own code (eg look at the section on the string is found 0x0104, 0x0108 will be drawable)

    So to know the correct id id must be the biggest find in each type, try before going straight string,
    here we see this guy 0x0104xxxx code is wrong we try to thousands and hundreds, tens and units ie instead of to find us every turn from 0x01040 -> 0x01049 guy, the guy does not have before it the biggest guy,
    for example 0x01045 guy does not have the biggest guy thousands of it is 0x01044, so look down to the hundreds, tens and units. Note small as it used id hexadecimal should turn from small to large 0 -> 9, a, b, c, d, e, f

    After finding the largest id translational then 1 unit and instead turn to the id in public.xml similar.

    Afterward, they must determine the correct id id in the code Smail (noted above) with the correct id (Note that in the smali code id dropping 1 to 0 on, eg 0x01040ba3 going into 0x1040ba3)

    something like this:

    Code:
    <public type="drawable" name="tw_ic_lock_flashlight_off" id="0x01080b84" /> ->	0x1080b84 -> const v5
    <public type="drawable" name="tw_ic_lock_flashlight_on" 	id="0x01080b85" /> ->	0x1080b85 -> const v4
    <public type="drawable" name="tw_ic_lock_screenshot" id="0x01080b86" /> -> 0x1080b86 	-> const v3
    
    <public type="string" name="global_action_screenshot" id="0x01040b85" /> -> 0x1040b85 -> const v4
    <public type="string" name="global_actions_flashlight_on_status" id="0x01040b87" /> -> 0x1040b87 -> const v7
    <public type="string" name="global_actions_flashlight_off_status" id="0x01040b88" />	-> 0x1040b88	 -> const v8
    <public type="string" name="global_action_flashlight" 	id="0x01040b86" /> -> 0x1040b86  -> const v6

    Next copy the image file in framework-res attachments / *. Png into the framework-res / res / drawable-xhdpi

    Recompile and done!

    Download smali and framework-res files from here

    Power Menu Mod with screenshot and flashlight button + 5 way reboot menu (G900FXXU1BNL9)
    download

    Credits:
    @darkera13
    6
    Can you please share how?

    Thanx in advance :)
    1) download from playstore SQLite Editor
    2) install and run, we grant root permissions
    3) find the APPS tab and go to "this" and open it
    4) press the "settings.db" and then select "system"
    5) locate the "notification_panel_active_app_list" and press it to be is highlighted in gray after which choose the pencil icon to enter the settings, see here
    6) complement entry with missing buttons below:

    Wifi;MobileData;Bluetooth;Location;AutoRotate;SilentMode;Location;NetworkBooster;Toolbox;SFinder;QuickConnect;MultiWindow;WiFiHotspot;Nfc;SBeam;AllShareCast;SmartStay;SmartPause;Sync;AirView;AirGesture;AirplaneMode;CarMode;PersonalMode;Ebook;UltraPowerSaving;PowerSaving;TouchSensitivity;DormantMode;SideKey;FloatingMessage;Flashlight;

    7) press "save" and restart the phone
    1
    AWESOME GUIDE!!! Thank you so much!!! :D

    Sent from my SM-G900F using Tapatalk
    1
    Any way to add flashlight to notification bar toogles?

    Thanks! :eek:
    Yes you can by Sqlite Editor from Google playstore
    89606.png
    1
    1) download from playstore SQLite Editor
    2) install and run, we grant root permissions
    3) find the APPS tab and go to "this" and open it
    4) press the "settings.db" and then select "system"
    5) locate the "notification_panel_active_app_list" and press it to be is highlighted in gray after which choose the pencil icon to enter the settings, see here
    6) complement entry with missing buttons below:

    Wifi;MobileData;Bluetooth;Location;AutoRotate;SilentMode;Location;NetworkBooster;Toolbox;SFinder;QuickConnect;MultiWindow;WiFiHotspot;Nfc;SBeam;AllShareCast;SmartStay;SmartPause;Sync;AirView;AirGesture;AirplaneMode;CarMode;PersonalMode;Ebook;UltraPowerSaving;PowerSaving;TouchSensitivity;DormantMode;SideKey;Flashlight;

    7) press "save" and restart the phone

    Fine, ... this works.
    But when you edit the notification list afterwards, the flashlight button disappears complete. Also gone in the database.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone