-->

[Guide][How-to][MOD] New Power Menu with Screenshot TW 4.3

[Guide][How-to][MOD] New Power Menu with Screenshot TW 4.3 - Hallo sobat Jogja Android Blog, Pada Artikel yang sobat baca kali ini dengan judul [Guide][How-to][MOD] New Power Menu with Screenshot TW 4.3, kami telah mempersiapkan artikel ini dengan baik untuk sobat baca dan ambil informasi didalamnya. Mudah-mudahan isi postingan [Guide][How-to][MOD] New Power Menu with Screenshot TW 4.3 yang kami tulis ini dapat sobat Jogja Android Blog pahami. Baiklah, selamat membaca sambil menikmati kopi.

[Guide How-to/MOD] New Power Menu with Screenshot TW 4.3[Guide How-to/MOD] New Power Menu with Screenshot TW 4.3[Guide How-to/MOD] New Power Menu with Screenshot TW 4.3
























This will allow you to have Recovery and Bootloader (download mode) right in the Power Menu selections. I grew tired of the extended restart menu so I wrote this.

This is not a flashable mod, it is a guide only.
The attached zip file are support files only that are necessary to create this modification.

Power Menu Guide

[CODE]Framework-res.apk changes:

Add these lines to res/values/strings.xml

Code:
    <string name="download">Bootloader</string>
<string name="recovery">Recovery</string>
Add the two png files in the attachment to:
res/drawable-hdpi

Recompile framework-res.apk.
Decompile the new framework-res.apk and open res/values/public.xml.
We need to write down these values because we need them later. Yours will probably be different. Leave off the leading zero:

Code:
    <public type="drawable" name="tw_ic_download" id="0x01080ad6" />
<public type="drawable" name="tw_ic_recovery" id="0x01080ad7" />
<public type="string" name="download" id="0x01040843" />
<public type="string" name="recovery" id="0x01040844" />
Android.policy.jar changes:
Add the two smali files in the attachment to com\android\internal\policy\impl

Smali edit:
com\android\internal\policy\impl\GlobalActions.sma li

New line before:

Code:
.field private mDialog:Landroid/app/AlertDialog;

.field private mHandler:Landroid/os/Handler;
After:

Code:
.field private mDialog:Landroid/app/AlertDialog;

.field private mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.field private mHandler:Landroid/os/Handler;


New line before:

Code:
.field private mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.field private mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
After:

Code:
.field private mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.field private mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.field private mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
Find around line 1075:

Code:
    .line 372
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$4;

const v2, 0x10808ee

const v3, 0x1040192

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.line 399
Add new lines after this section:
***NOTE THE LINES IN BLUE, THESE MUST MATCH THE VALUES WE GOT FROM FRAMEWORK (without the leading zero)***

Code:
    .line 372
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$4;

const v2, 0x10808ee

const v3, 0x1040192

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.line 399
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Download;

const v2, 0x1080ad6

const v3, 0x1040843

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.line 400
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Recovery;

const v2, 0x1080ad7

const v3, 0x1040844

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.line 401
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$5;
Now we are going to expand the existing array to include 2 more entries.

Around line 1138:

Before:

Code:
    .line 428
const/4 v1, 0x5
After:

Code:
    .line 428
const/4 v1, 0x7
Find around line 1137:

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

aput-object v3, v1, v2

const/4 v2, 0x4

move-object/from16 v0, p0

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

aput-object v3, v1, v2

invoke-static {v1}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;
Replace with:

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

aput-object v3, v1, v2

const/4 v2, 0x4

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x5

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x6

move-object/from16 v0, p0


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

aput-object v3, v1, v2

invoke-static {v1}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;



How to remove menu items:

Smali edit:
com\android\internal\policy\impl\GlobalActions.sma li


We need to reconfigure the array that displays the options.

Before:

Code:
.line 428
const/4 v1, 0x7

new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;

const/4 v2, 0x0

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x1

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x2

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x3

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x4

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x5

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x6

move-object/from16 v0, p0

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

aput-object v3, v1, v2

invoke-static {v1}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;

move-result-object v1

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
We need to split up the array so that we can easily see the different sections.
It will make it easier to modify the line you want to remove.

Code:
    .line 428
const/4 v1, 0x7

new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;

#

const/4 v2, 0x0

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x1

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x2

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x3

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x4

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x5

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x6

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

invoke-static {v1}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;

move-result-object v1

move-object/from16 v0, p0

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

Now we will remove the Data Network Mode and Airplane Mode choices from the menu. We need to shrink the array by 2 and also renumber the remaining options. Please note the changes in red.

Code:
    .line 428
const/4 v1, 0x5

new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;

#

const/4 v2, 0x0

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x1

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

# const/4 v2, 0x2

# move-object/from16 v0, p0

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

# aput-object v3, v1, v2

#

# const/4 v2, 0x3

# move-object/from16 v0, p0

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

# aput-object v3, v1, v2


#

const/4 v2, 0x2

move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x3
move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

const/4 v2, 0x4
move-object/from16 v0, p0

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

aput-object v3, v1, v2

#

invoke-static {v1}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;

move-result-object v1

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
Note: Use of the # symbol is not necessary. I use it simply for clarification and to separate out the sections for easier viewing while editing. Additionally, any lines edited with the # symbol will be ignored when recompiling.


Addendum - Adding Screenshot to Power Menu(This is an addon to the original Power Menu Guide posted above).
Framework-res.apk changes:

Add these lines to res/values/strings.xml

Code:
    <string name="global_action_screenshot_txt">Screenshot</string>
Add png file in the screenshot attachment to:
res/drawable-hdpi

Recompile framework-res.apk.
Decompile the new framework-res.apk and open res/values/public.xml.
We need to write down these values because we need them later. Yours will probably be different. Leave off the leading zero:

Code:
<public type="string" name="global_action_screenshot_txt" id="0x01040845" />
<public type="drawable" name="tw_ic_screenshot" id="0x01080ad8" />
Android.policy.jar changes:
Add the two smali files in the attachment to com\android\internal\policy\impl

Smali edit:
com\android\internal\policy\impl\GlobalActions.sma li

New line before:
Code:
.field private mRingerModeReceiver:Landroid/content/BroadcastReceiver;

.field private mSilentModeAction:Lcom/android/internal/policy/impl/GlobalActions$SilentModeAction;
After:
Code:
.field private mRingerModeReceiver:Landroid/content/BroadcastReceiver;

.field private mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.field private mSilentModeAction:Lcom/android/internal/policy/impl/GlobalActions$SilentModeAction;
New Section Before:
Code:
    .line 372
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$4;

const v2, 0x10808ee

const v3, 0x1040192

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.line 399
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Download;

const v2, 0x1080ad6

const v3, 0x1040843

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
After:
***NOTE THE LINES IN BLUE, THESE MUST MATCH THE VALUES WE GOT FROM FRAMEWORK (without the leading zero)***
Code:
    .line 372
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$4;

const v2, 0x10808ee

const v3, 0x1040192

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.line 388
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$16;

const v2, 0x1080ad8

const v3, 0x1040845

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.line 399
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Download;

const v2, 0x1080ad6

const v3, 0x1040843

move-object/from16 v0, p0

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

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

Now to edit the array and add ScreenShot
NOTE: FYI, here we are removing replacing DataToggle with Airplane Mode to keep menu from overlapping the screen.
Find around line 1180:
Code:
    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mDataModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

aput-object v3, v1, v2

const/4 v2, 0x3

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x4

move-object/from16 v0, p0
Replace with:
Code:
    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;    
aput-object v3, v1, v2

const/4 v2, 0x3

move-object/from16 v0, p0

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

aput-object v3, v1, v2

const/4 v2, 0x4

move-object/from16 v0, p0


If porting this to another phone
Important update info for Screenshot mod
:

You may have to possibly change this value in GlobalActions$16$1.smali which is one of the addon files to match your code.
Code:
invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
Here is my access$200 in GlobalActions.smali, just search for the line in red. If it is different access$xxx in your smali, also change access$xxx to match in GlobalActions$16$1.smali:
Code:
.method static synthetic access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
.registers 2
.parameter "x0"

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

return-object v0
.end method


Credits to Mirko DDD for the ScreenShot method!!!

Attachement :

1.  New Power Menu.zip
2.  ScreenShot_Files.zip

http://forum.xda-developers.com/showthread.php?t=2125196 

Demikian Artikel dengan judul [Guide][How-to][MOD] New Power Menu with Screenshot TW 4.3

Mudah-mudahan bisa memberi manfaat untuk sobat Jogja Android Blog semua. Baiklah, sampai jumpa di postingan artikel lainnya.
Sobat Jogja Android Blog sekarang membaca artikel [Guide][How-to][MOD] New Power Menu with Screenshot TW 4.3 dengan alamat link https://jogjandroidz.blogspot.com/2014/11/guidehow-tomod-new-power-menu-with.html

0 Response to "[Guide][How-to][MOD] New Power Menu with Screenshot TW 4.3"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Artikel Terkait