[Sony Cross-Device General] sandy7:
hello everyone

iam here to make a tutorial thread to teach u guys to port and add various mods by urself...

All these tut will work or might work for JB+ fws

so lets start

REBOOT OPTIONS KK 4.4.2

USE THE RESOURCES ATTACHED BELOW (IF U HAVE ANY PROBLEMS DE/RECOMPILING ANDROID.POLICY.JAR USE THE smali.jar and backsmali.jar attached in the below resources)

framework-res.apk

-----------------

1 - Add to strings.xml:

<string name="reboot">@string/factorytest_reboot</string>
<string name="reboot_normal">@string/factorytest_reboot</string>
<string name="reboot_recovery">Recovery</string>
<string name="reboot_bootloader">Bootloader</string>

2 - Add to arrays.xml:

<string-array name="reboot_options">
<item>@string/reboot_normal</item>
<item>@string/reboot_recovery</item>
<item>@string/reboot_bootloader</item>
</string-array>
<string-array name="reboot_actions">
<item>now</item>
<item>recovery</item>
<item>bootloader</item>
</string-array>

3 - Add under \res\drawable-xxhdpi\ folder:

ic_lock_reboot.png

4 - Compile framework-res.apk

android.policy.jar

------------------

1 - Edit:

\com\android\internal\policy\impl\GlobalActions.smali

...LOOK FOR...

.line 252
.local v9, "quickbootEnabled":Z
:goto_3d
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$2;

const v2, 0x1080030

const v3, 0x10400cb

invoke-direct {v1, p0, v2, v3, v9}, Lcom/android/internal/policy/impl/GlobalActions$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions;IIZ)V

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

[COLOR="Red"]
.line 282
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$12;

const v2, 0x108094c ----- HEX ID OF ic_lock_reboot.png ( make sure to change the hex id comparing ur Public xml )
const v3, 0x10407e8 ----- HEX ID OF reboot STRING ( make sure to change the hex id comparing ur Public xml )

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

invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z[/COLOR]

.line 283
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

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

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

2 - Add these three new files:

GlobalActions$12$1.smali

GlobalActions$12$2.smali

GlobalActions$12.smali

3 - Done !!

BACK TO KILL APPS
​

framework-res.apk

-----------------

1 - Add to strings.xml:

<string name="back_longpress_kill_app_message">Application killed !!</string>

2 - Compile framework-res.apk

android.policy.jar

------------------

1 - Edit:

\com\android\internal\policy\impl\PhoneWindowManager.smali

...ADD...

# instance fields

.field mBackLongPressKillApp:Ljava/lang/Runnable;

...ADD... the red marked lines at the end of the method

.method public constructor <init>()V

.registers 7

.

.

.

.

.line 4986

new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$28;

invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$28;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPressKillApp:Ljava/lang/Runnable;

return-void

.end method

navigate to ---

.method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J

.

.

.

.

...LOOK FOR SOMETHING LIKE THIS IN THE METHOD

iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownKeyConsumedByScreenshotChord:Z

.line 1909

:cond_6e

const-wide/16 v32, -0x1

goto :goto_51

.line 1917

:cond_71

const/16 v32, 0x3

move/from16 v0, v18

move/from16 v1, v32

if-ne v0, v1, :cond_17e

.line 1921

if-nez v9, :cond_e9

.line 1922

move-object/from16 v0, p0

iget-boolean v13, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeLongPressed:Z

...AND ADD SPACE and Insert the red marked lines (SEE SPACES)...

iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownKeyConsumedByScreenshotChord:Z

.line 1909
:cond_6e
const-wide/16 v32, -0x1

goto :goto_51

.line 1917
:cond_71

[COLOR=Red]const/16 v32, 0x4

move/from16 v0, v32

move/from16 v1, v18 # <<< PAY ATTENTION HERE, IF YOU LOOK AT UPWARDS, v18 IS = .local v18, keyCode:I

if-ne v1, v0, :cond_7e

if-nez v9, :cond_7e

.line 157
move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

move-object/from16 v32, v0

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPressKillApp:Ljava/lang/Runnable;

move-object/from16 v33, v0

invoke-virtual/range {v32 .. v33}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

.line 158
:cond_7e
[/COLOR]

const/16 v32, 0x3

move/from16 v0, v18

move/from16 v1, v32

if-ne v0, v1, :cond_17e

.line 1921
if-nez v9, :cond_e9

.line 1922
move-object/from16 v0, p0

iget-boolean v13, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeLongPressed:Z

ONCE DONE REMOVE THE SPACES

...LOOK FOR SOMETHING...

invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->showOrHideRecentAppsDialog(I)V

.line 2048

:cond_210

const-wide/16 v32, -0x1

goto/16 :goto_51

.line 2049

:cond_214

const/16 v32, 0xdb

move/from16 v0, v18

move/from16 v1, v32

if-ne v0, v1, :cond_259

.line 2050

if-eqz v9, :cond_242

.line 2051

if-nez v23, :cond_22c

.line 2052

const/16 v32, 0x0

move/from16 v0, v32

move-object/from16 v1, p0

iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mAssistKeyLongPressed:Z

...AND ADD SPACE and Insert the red marked lines (SEE SPACES)...

invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->showOrHideRecentAppsDialog(I)V

.line 2048
:cond_210
const-wide/16 v32, -0x1

goto/16 :goto_51

.line 2049
:cond_214

[COLOR=Red]const/16 v32, 0x4

move/from16 v0, v32

move/from16 v1, v18 # <<< PAY ATTENTION HERE, IF YOU LOOK AT UPWARDS, v18 IS = .local v18, keyCode:I

if-ne v1, v0, :cond_1f0

if-eqz v9, :cond_1f0 # <<< PAY ATTENTION HERE, IF YOU LOOK AT UPWARDS, v9 IS = .local v9, down:Z

if-nez v23, :cond_1f0 # <<< PAY ATTENTION HERE, IF YOU LOOK AT UPWARDS, v23 IS = .local v23, repeatCount:I

.line 169
move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

move-object/from16 v32, v0

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPressKillApp:Ljava/lang/Runnable;

move-object/from16 v33, v0

invoke-static {}, Landroid/view/ViewConfiguration;->getGlobalActionKeyTimeout()J

move-result-wide v34

invoke-virtual/range {v32 .. v35}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

.line 170
:cond_1f0[/COLOR]

const/16 v32, 0xdb

move/from16 v0, v18

move/from16 v1, v32

if-ne v0, v1, :cond_259

.line 2050
if-eqz v9, :cond_242

.line 2051
if-nez v23, :cond_22c

.line 2052
const/16 v32, 0x0

move/from16 v0, v32

move-object/from16 v1, p0

iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mAssistKeyLongPressed:Z
.
.
.
.
.end method

ONCE DONE REMOVE THE SPACES

2 - Add these new file: in smali\com\android\internal\policy\impl (see attachment)

PhoneWindowManager$28.smali

3 - Done !!

Thank u...More guides will be ADDED ASAP

if u like my works consider donating me to buy some beers..:good: