[DEV][MODDING] CRT, Airview, 4-way reboot, ink effect, phone, sms..etc [9/Dec/2013]

brolee93

Senior Member
Jan 1, 2009
1,966
522
0
36
XDA city
Thanks for your effort. It is great thanks for all very hard job thanks bro.
Eh guys can you please add tuto for add MultiWindoW?. Because I have note 1 and tab 2. But in tab in jb4.1.1 I don't have MultiWindoW and I want to add this can you explain please?
Thanks for reply bro
 

Petros_tigra

Senior Member
Feb 18, 2009
334
521
93
Great tut :)

but i need some help.
When i try to recombile with smali the classes.dex file after applying the all apps multiwindow mod i get this error

E:\path\com\android\server\am\MultiWindowManagerService.smali[5458,4] missing EOF at 'move-result'

Any advice?
 

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
It seems I am out of space to add new tutorials (no space left in post #1 and #2).. Next time I update my thread I will move it to another one with some reserved posts to continue adding more modding tutorials..

Or does anybody has better solution!!!
 

eybee1970

Senior Member
Jan 22, 2010
4,940
13,224
0
It seems I am out of space to add new tutorials (no space left in post #1 and #2).. Next time I update my thread I will move it to another one with some reserved posts to continue adding more modding tutorials..

Or does anybody has better solution!!!
post it here in link to it in OP
 
  • Like
Reactions: majdinj

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
Continue moddings!!

Change default home screen wallpaper and default lock screen wallpaper

Remember to set compression level to 0 in APK-Multi tool before proceeding in these steps
1. Decompile framework-res.apk using APK-Multi tool
2. Go to \res\drawable-xhdpi folder and change the following pics to what you want:

  • default_wallpaper (Home screen wallpaper)
  • keyguard_default_wallpaper (Lock screen wallpaper)
3. Make sure to rename your wallpaper to the exact name as the one that you will change
4. Compile framework-res.apk and push it to your phone.

Here are some pics taken from SGN2: download


Battery theming

First download my battery icon packs from here and use it as a resource (of course you can create your own!!).
1. Decompile SystemUI.apk with APK-Multi tool.
2. In Battery icon pack folder choose your desired battery theme and copy all png icons ONLY.
3. Go to \res\drawable-xhdpi folder and paste your icons there.
4. Now go back to Battery icon pack folder and in your desired battery theme folder, copy the two xml files (stat_sys_battery.xml and stat_sys_battery_charge.xml).
5. Go to \res\drawable folder and paste them there and accept changes.
These xml files are encoded with a code that make battery discharging and charging animation; so if you got enough png icons, you can create your own lines in these xml files for better animation effects
6. Recompile and push it to your phone.


4 Lockscreen shortcuts enabling

1- Decompile SecSettings.apk and go to smali/com/android/settings/lockscreenshortcut/LockScreenShortcutSettings.smali
2- Open this file with notpad++ and change the following line:
Code:
# direct methods
.method static constructor <clinit>()V
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 79
    [COLOR="Red"][B]const/4 v0, 0x4[/B][/COLOR]

    sput v0, Lcom/android/settings/lockscreenshortcut/LockScreenShortcutSettings;->MAX_SHORTCUT_ICON:I
to:
Code:
# direct methods
.method static constructor <clinit>()V
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 79
    [B][COLOR="Blue"]const/4 v0, 0x3[/COLOR][/B]

    sput v0, Lcom/android/settings/lockscreenshortcut/LockScreenShortcutSettings;->MAX_SHORTCUT_ICON:I
3- Save changes
4- (The following step is provided by tkari4; thanks man) For some region this feature is disabled like Germany :( ; So navigate to smali/com/android/settings folder and open LockscreenMenuSettings.smali and search for "ro.csc.country_code" and change the following (red to blue):
Code:
    if-nez v4, :cond_5

    const-string v4, "[B][COLOR="Red"]Germany[/COLOR][/B]"

    const-string v7, "ro.csc.country_code"

    invoke-static {v7}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String;
to:
Code:
    if-nez v4, :cond_5

    const-string v4, "[B][COLOR="Blue"]none[/COLOR][/B]"

    const-string v7, "ro.csc.country_code"

    invoke-static {v7}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String;
3- Save file and recompile and push to your phone.

Results example:



Toggle to choose AOSP lock screen

This method is originally done by Mirko_ddd, so please go to his thread and thank him
We need to do our changes to two files; android.policy.jar and SecSettings.apk

A. android.policy.jar:

1. Decompile (backsmali) android.policy.jar
2. Go to classout\com\android\internal\policy\impl and open LockPatternKeyguardView.smali
3. Search for ".method createLockScreen()Landroid/view/View;" and the following lines (the blue ones):
Code:
.method createLockScreen()Landroid/view/View;
    .registers 7

    .prologue
    .line 1351
    [B][COLOR="Blue"]iget-object v0, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;

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

    move-result-object v0

    const-string v1, "aosp_lock"

    const/4 v2, 0x0

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

    move-result v0

    if-nez v0, :cond_majdi[/COLOR][/B]
	
    new-instance v0, Lcom/android/internal/policy/impl/sec/CircleLockScreen;

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

    iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;

    iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;

    iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;

    iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;

    invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/sec/CircleLockScreen;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V

    [B][COLOR="Blue"]goto :goto_yes[/COLOR][/B]
	
    .line 1357
    [B][COLOR="Blue"]:cond_majdi
    new-instance v0, Lcom/android/internal/policy/impl/LockScreen;

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

    iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;

    iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;

    iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;

    iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;

    invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/LockScreen;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V[/COLOR][/B]

    .local v0, lockView:Landroid/view/View;
    [B][COLOR="Blue"]:goto_yes[/COLOR][/B]
    invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->initializeTransportControlView(Landroid/view/View;)V

    .line 1358
    return-object v0
.end method
4. Save changes and compile (smali) your classout folder

B. SecSettings.apk:
1. Decompile SecSettings.apk by APK-Multi-tool
2. Go to /smali/com/android/settings/ folder and open LockscreenSettings.smali
3. As Mirko_ddd did we will use an unused code with the form of (checkbox preference). Here it is "mSayCommand"
4. Since this unused code is actually hidden, so we need to un-hide it first. Search for the following lines and delete them (the red lines only):
Code:
    if-ge v9, v10, :cond_15

    iget-object v9, p0, Lcom/android/settings/LockScreenSettings;-> mSayCommand:Landroid/preference/CheckBoxPreference;

    if-eqz v9, :cond_11

    [B][COLOR="Red"]invoke-virtual {p0}, Lcom/android/settings/LockScreenSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;

    move-result-object v9

    iget-object v10, p0, Lcom/android/settings/LockScreenSettings;->mSayCommand:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v9, v10}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z[/COLOR][/B]

    :cond_11
    if-eqz v7, :cond_12
5. Now search and replace all "mSayCommand" with "mAospLock" also search and replace all "wake_up_lock_screen" with "aosp_lock"
6. Search for "say_your_wakeup" and replace it with "majdi_aosp_lock"
7. Save changes and exit.
8. Go to res\values folder and open strings.xml file and add the following strings at the end before </resource>:
Code:
    <string name="aosp_lock_screen">AOSP Lockscreen</string>
    <string name="aosp_lock_screen_description">Original Jelly Bean Lockscreen</string>
9. Go to res\xml folder and open lockscreen_settings.xml file and add the following line at the end before </PreferenceScreen> (actually you can put it in a place that you want this mod to be shown in lock screen option menu later on):
Code:
<CheckBoxPreference android:title="@string/aosp_lock_screen" android:key="majdi_aosp_lock" android:summary="@string/aosp_lock_screen_description" />
10. Save all changes and recompile. Push the modified files to your phone.

Results example:




Fixing home button lag

This method is originally done by Mirko_ddd, so please go to his thread and thank him
1. Backsmali android.policy.jar
2. G to classout\com\android\internal\policy\impl folder and open PhoneWindowManager.smali
3. Search for ".method public interceptKeyBeforeDispatching" then search for "#statusbar:Lcom/android/internal/statusbar/IStatusBarService;" and go down for the line that has the following iput-boolean … with mHomePressed:Z field and add the following line bellow it (the blue one):
Code:
    .line 3364
    .end local v38           #statusbar:Lcom/android/internal/statusbar/IStatusBarService;
    :cond_38c
    :goto_38c
    const/16 v46, 0x0

    move/from16 v0, v46

    move-object/from16 v1, p0

    [B][COLOR="Red"]iput-boolean[/COLOR][/B] v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->[B][COLOR="Red"]mHomePressed:Z[/COLOR][/B]
	
    [B][COLOR="Blue"]invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->goHome()Z[/COLOR][/B]
4. save changes and recompile (smali) the classout folder.


Permanent disabling of SMS, MMS & Email log history to be logged in call logs

1. Backsmali SecMms.apk.
2. Go to classout\com\android\mms\transaction folder and open MessagingNotification.smali file.
3. Now what you need to do is to search for any line that contains the following command "Landroid/content/ContentResolver;->insert(Landroid/net/Uri;Landroid/content/ContentValues;)Landroid/net/Uri;", there might be 3 or 4 lines, and delete them all.
Example (delete the whole red line):
Code:
    invoke-static {v6}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v6

    [COLOR="Red"]invoke-virtual {v5, v6, v7}, [B]Landroid/content/ContentResolver;->insert(Landroid/net/Uri;Landroid/content/ContentValues;)Landroid/net/Uri;[/B][/COLOR]

    .line 1348
    add-int/lit8 p2, p2, 0x1
4. save changes and recompile (smali) the classout folder.


Disabling scrolling cache across OS

1. Backsmali framework2.jar.
2. Navigate to classout\android\widget folder and open AbsListView.smali
3. Search for ".method private createScrollingCache()V" and change:
Code:
const/4 v1, 0x[B][COLOR="Red"]1[/COLOR][/B]
to:
Code:
const/4 v1, 0x[B][COLOR="Blue"]0[/COLOR][/B]
4. Search for ".method public setScrollingCacheEnabled(Z)V" and change:
Code:
.parameter "[B][COLOR="Red"]enabled[/COLOR][/B]"
to:
Code:
.parameter "[B][COLOR="Blue"]disabled[/COLOR][/B]"
5. Save changes and recompile (smali) your file and push to your phone.


Center clock in status bar

This mod was done by raubkatze and all credits go to him.
1. Decompile SystemUI.apk by Apk-Multi tool
2. Navigate to /res/layout/ folder and open tw_status_bar.xml
3. Delete all these lines:
Code:
    <LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="0.0dip" android:paddingRight="2.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:orientation="horizontal" android:id="@id/left_icons" android:paddingLeft="4.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <TextView android:textSize="15.0dip" android:gravity="center_vertical" android:id="@id/carrierLabel" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <ImageView android:id="@id/operatorLogoIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/tw_stat_notify_operator_logo" />
            <ImageView android:id="@id/doNotDisturbIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_dnd" android:alpha="0.7" android:scaleX="0.85" android:scaleY="0.85" />
            <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
            <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" />
        </LinearLayout>
        <LinearLayout android:orientation="horizontal" android:id="@id/right_icons" android:paddingRight="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true">
            <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
            <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/tw_signal_cluster_view" />
                <TextView android:textSize="12.0dip" android:textColor="#ffa6a6a6" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_network_name_separator" />
                <ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
            <com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#ff959595" android:ellipsize="none" android:gravity="left|center" android:id="@id/clock" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:includeFontPadding="false" />
        </LinearLayout>
and substitute with the following:
Code:
    <LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="1.0dip" android:paddingRight="1.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:orientation="horizontal" android:id="@id/left_icons" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
            <TextView android:textSize="15.0dip" android:gravity="center_vertical" android:id="@id/carrierLabel" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
            <ImageView android:id="@id/operatorLogoIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/tw_stat_notify_operator_logo" />
            <ImageView android:id="@id/doNotDisturbIcon" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_dnd" android:alpha="0.7" android:scaleX="0.85" android:scaleY="0.85" />
            <com.android.systemui.statusbar.StatusBarIconView android:id="@id/moreIcon" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/stat_notify_more" />
            <com.android.systemui.statusbar.phone.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" />
        </LinearLayout>
        <LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent">
            <com.android.systemui.statusbar.policy.Clock android:textSize="@dimen/status_bar_clock_text_size" android:textColor="#[B][COLOR="Red"]ffffffff[/COLOR][/B]" android:gravity="center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
        </LinearLayout>
        <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/right_icons" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentRight="true">
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
            <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
                <include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/tw_signal_cluster_view" />
                <TextView android:textSize="12.0dip" android:textColor="#ffa6a6a6" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_network_name_separator" />
                <ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
        </LinearLayout>
	</LinearLayout>
4. Save changes, recompile and push to your phone
N.B: you can put any hex color code for clock text color instead #ffffff above there
Results:

 
Last edited:

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
Continue moddings!!

SMS hack: SMS 200 recipients, stop SMS to MMS auto-converting, increase SMS hour limit, 1000 slides, group messages, scheduled messages and save/restore messages

I. SMS 200 recipients:
1) Backsmali SecMMs.apk
2) Navigate to and open classout\com\android\mms\MmsConfig.smali
3) Search for ".method public static getRecipientLimit()I" and do these changes:
Code:
.method public static getRecipientLimit()I
    .registers 1

    .prologue
    .line 656
    [B][COLOR="Red"]sget v0, Lcom/android/mms/MmsConfig;->mRecipientLimit:I[/COLOR][/B]

    return v0
.end method
to:
Code:
.method public static getRecipientLimit()I
    .registers 1

    .prologue
    .line 656
    [B][COLOR="Blue"]const/16 v0, 0xc8[/COLOR][/B]

    return v0
.end method
Save changes and recompile (smali) your apk.

II. Stop SMS to MMS auto-converting:
1) Backsmali SecMMs.apk
2) Navigate to and open classout\com\android\mms\MmsConfig.smali
3) Search for "Lcom/android/mms/MmsConfig;->mMaxImageWidthRestrictedMode:I" and do these changes:
Code:
    sput v0, Lcom/android/mms/MmsConfig;->mMaxImageWidthRestrictedMode:I

    .line 153
    [B][COLOR="Red"]sput v7, Lcom/android/mms/MmsConfig;->mRecipientLimit:I[/COLOR][/B]

    .line 154
    [B][COLOR="Red"]const/16 v0, 0xc8[/COLOR][/B]

    sput v0, Lcom/android/mms/MmsConfig;->mDefaultSMSMessagesPerThread:I
to:
Code:
    sput v0, Lcom/android/mms/MmsConfig;->mMaxImageWidthRestrictedMode:I

    .line 153
    [B][COLOR="Blue"]const/16 v0, 0x3e8
[/COLOR][/B]
    .line 154
    [B][COLOR="Blue"]sput v0, Lcom/android/mms/MmsConfig;->mRecipientLimit:I[/COLOR][/B]

    sput v0, Lcom/android/mms/MmsConfig;->mDefaultSMSMessagesPerThread:I
4) Then search for "Lcom/android/mms/MmsConfig;->mAllowAttachAudio:Z" and do these changes:
Code:
    .line 161
    sput-boolean v2, Lcom/android/mms/MmsConfig;->mAllowAttachAudio:Z

    .line 164
    [B][COLOR="Red"]const/4 v0, 0x4[/COLOR][/B]

    sput v0, Lcom/android/mms/MmsConfig;->mSmsToMmsTextThreshold:I
to:
Code:
    .line 161
    sput-boolean v2, Lcom/android/mms/MmsConfig;->mAllowAttachAudio:Z

    .line 164
    [B][COLOR="Blue"]const/16 v0, 0x3e8[/COLOR][/B]

    sput v0, Lcom/android/mms/MmsConfig;->mSmsToMmsTextThreshold:I
5) Then search for ".method public static getMaxRecipientLength()I" and do these changes:
Code:
.method public static getMaxRecipientLength()I
    .registers 1

    .prologue
    .line 2259
    [B][COLOR="Red"]sget v0, Lcom/android/mms/MmsConfig;->mMaxRecipientLength:I[/COLOR][/B]

    return v0
.end method
to:
Code:
.method public static getMaxRecipientLength()I
    .registers 1

    .prologue
    .line 2259
    [B][COLOR="Blue"]const/16 v0, 0x3e8[/COLOR][/B]

    return v0
.end method
6) Then search for ".method public static getMmsMaxRecipient()I" and do these changes:
Code:
.method public static getMmsMaxRecipient()I
    .registers 1

    .prologue
    .line 2498
    [B][COLOR="Red"]sget v0, Lcom/android/mms/MmsConfig;->mMmsRecipientLimit:I[/COLOR][/B]

    return v0
.end method
to:
Code:
.method public static getMmsMaxRecipient()I
    .registers 1

    .prologue
    .line 2498
    [B][COLOR="Blue"]const/16 v0, 0x3e8[/COLOR][/B]

    return v0
.end method
7) Then search for ".method public static getSmsToMmsTextThreshold()I" and do these changes:
Code:
.method public static getSmsToMmsTextThreshold()I
    .registers 1

    .prologue
    .line 585
    [B][COLOR="Red"]sget v0, Lcom/android/mms/MmsConfig;->mSmsToMmsTextThreshold:I[/COLOR][/B]

    return v0
.end method
to:
Code:
.method public static getSmsToMmsTextThreshold()I
    .registers 1

    .prologue
    .line 585
    [B][COLOR="Blue"]const/16 v0, 0x3e8[/COLOR][/B]

    return v0
.end method
8) Then search for "Lcom/android/mms/MmsConfig;->mMaxRecipientLength:I" and add this line above it (the blue one):
Code:
    move-result v10
	
    [B][COLOR="Blue"]const/16 v9, 0x3e8[/COLOR][/B]

    sput v10, Lcom/android/mms/MmsConfig;->mMaxRecipientLength:I

    .line 1638
    sget v10, Lcom/android/mms/MmsConfig;->mMinRecipientLength:I
9) Then search for "Lcom/android/mms/MmsConfig;->mSmsToMmsTextThreshold:I" and add this line above it (the blue one):
Code:
    move-result v1
	
    [B][COLOR="Blue"]const/16 v1, 0x3e8[/COLOR][/B]

    sput v1, Lcom/android/mms/MmsConfig;->mSmsToMmsTextThreshold:I

    .line 1817
    const-string v1, "Mms/MmsConfig"
10) Then search for "Lcom/android/mms/MmsConfig;->mRecipientLimit:I" add this line above it (the blue one):
Code:
    invoke-interface {v0, v1, v4}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v1
	
    [B][COLOR="Blue"]const/16 v1, 0x3e8[/COLOR][/B]

    sput v1, Lcom/android/mms/MmsConfig;->mRecipientLimit:I
11) Save changes and recompile (smali) your apk.. phewww wow we finished :D
After pushing your final hacked SecMms.apk to your phone, you might have this message after you wrote 14 sms pages "Message size limit reached the maximum number of characters" that is actually a limitation of your mobile company provider protocol itself.
III. Increase SMS hour limit:
1) Backsmali SecMMs.apk
2) Navigate and open classout\com\android\mms\util\RateController.smali
3) Look for this line:
Code:
.field private static final RATE_LIMIT:I = [B][COLOR="Red"]0x64[/COLOR][/B]
and change it to:
Code:
.field private static final RATE_LIMIT:I = [B][COLOR="Blue"]0x3e8[/COLOR][/B]
4) Save changes and recompile (smali) your apk
Why??
0x64 means 100 in hexadecimal format. So we put 0x3e8 which means 1000 in hexadecimal format
VI. 1000 slides for MMS:
- Baksmali SecMms.apk
- Go to classout\com\android\mms folder and open MmsConfig.smali
- Now Search for ".method public static getMaxSlideCount()I" and do the following change..
Before:
Code:
.method public static getMaxSlideCount()I
    .registers 1

    .prologue
    .line 825
    [B][COLOR="Red"]sget v0, Lcom/android/mms/MmsConfig;->mMaxSlideCount:I[/COLOR][/B]

    return v0
.end method
After:
Code:
.method public static getMaxSlideCount()I
    .registers 1

    .prologue
    .line 825
    [B][COLOR="Blue"]const/16 v0, 0x3e8[/COLOR][/B]

    return v0
.end method
Save changes and smali your SecMms.apk and push it to phone and fix permissions to rw-r--r-- (644)

V. Group messages, scheduled messages and save/restore messages:
Already a great tutorial by @jovy23 is here.



23 toggles notification panel (Lidroid way)

Special thanks to wanam who modifies Lidroid way to port the 23-toggle to JB ROMs
1. Decompile SystemUI.apk by APK-Multi-Tool.
2. Navigate to res\layout folder and open tw_status_bar_expanded.xml and do these changes (delete red lines, add blue lines, and modify the green one to be like it):
Code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@id/notification_panel" android:background="@drawable/notification_panel_bg" android:paddingTop="@dimen/notification_panel_padding_top" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="@dimen/notification_panel_margin_left"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
    <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="@dimen/tw_close_handle_underlap">
        <include android:layout_width="fill_parent" android:layout_height="@dimen/tw_notification_panel_header_height" layout="@layout/tw_status_bar_expanded_header" />
        <TextView android:gravity="center" android:id="@id/emergency_calls_only" android:paddingBottom="4.0dip" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" />
        <View android:background="#ff091a24" android:layout_width="fill_parent" android:layout_height="1.0dip" android:layout_marginTop="@dimen/tw_notification_panel_header_height" />
        [B][COLOR="Blue"]<HorizontalScrollView android:id="@id/quicksetting_scroller" android:visibility="gone" android:scrollbars="none" android:layout_width="wrap_content" android:layout_height="@dimen/quick_setting_button_height" android:layout_marginTop="@dimen/tw_notification_panel_header_height">
            <com.android.systemui.statusbar.policy.quicksetting.QuickSettingPanel android:orientation="horizontal" android:id="@id/quicksetting_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:divider="@drawable/tw_black_bg" android:showDividers="middle" />
        </HorizontalScrollView>
        <com.wanam.systemui.quickpanel.PowerWidget android:id="@id/exp_power_stat" android:layout_width="wrap_content" android:layout_height="@dimen/quick_setting_button_height" android:layout_marginTop="@dimen/tw_notification_panel_header_height" />
        <LinearLayout android:orientation="vertical" android:id="@id/brightness_controller" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="56.0dip" android:layout_marginTop="@dimen/notification_panel_quicksettingbtn_height">
            <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="55.0dip">
                <ImageView android:id="@id/brightness_icon" android:clickable="true" android:layout_width="25.0dip" android:layout_height="fill_parent" android:layout_marginLeft="13.0dip" android:src="@drawable/ic_sysbar_brightness" android:contentDescription="@string/accessibility_brightness_icon" />
                <FrameLayout android:id="@id/brightness_group" android:layout_width="fill_parent" android:layout_height="fill_parent">
                    <com.android.systemui.statusbar.policy.ToggleSlider android:id="@id/brightness" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:text="@string/status_bar_settings_auto_brightness_label" />
                    <com.android.systemui.statusbar.policy.ToggleSlider android:id="@id/auto_brightness" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:text="@string/status_bar_settings_auto_brightness_label" />
                </FrameLayout>
            </LinearLayout>
            <View android:background="#ff091a24" android:layout_width="fill_parent" android:layout_height="1.0dip" />
        </LinearLayout>[/COLOR][/B]
        [B][COLOR="SeaGreen"]<ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginTop="@dimen/notification_panel_notification_top_margin" android:overScrollMode="ifContentScrolls">[/COLOR][/B]
            <LinearLayout android:orientation="vertical" android:id="@id/scrollCart" android:layout_width="fill_parent" android:layout_height="wrap_content">
                [B][COLOR="Red"]<HorizontalScrollView android:id="@id/quicksetting_scroller" android:scrollbars="none" android:layout_width="wrap_content" android:layout_height="@dimen/quick_setting_button_height">
                    <com.android.systemui.statusbar.policy.quicksetting.QuickSettingPanel android:orientation="horizontal" android:id="@id/quicksetting_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:divider="@drawable/tw_black_bg" android:showDividers="middle" />
                </HorizontalScrollView>
                <LinearLayout android:orientation="vertical" android:id="@id/brightness_controller" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="56.0dip">
                    <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="55.0dip">
                        <ImageView android:id="@id/brightness_icon" android:clickable="true" android:layout_width="25.0dip" android:layout_height="fill_parent" android:layout_marginLeft="13.0dip" android:src="@drawable/ic_sysbar_brightness" android:contentDescription="@string/accessibility_brightness_icon" />
                        <FrameLayout android:id="@id/brightness_group" android:layout_width="fill_parent" android:layout_height="fill_parent">
                            <com.android.systemui.statusbar.policy.ToggleSlider android:id="@id/brightness" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:text="@string/status_bar_settings_auto_brightness_label" />
                            <com.android.systemui.statusbar.policy.ToggleSlider android:id="@id/auto_brightness" android:layout_width="fill_parent" android:layout_height="fill_parent" systemui:text="@string/status_bar_settings_auto_brightness_label" />
                        </FrameLayout>
                    </LinearLayout>
                    <View android:background="#ff091a24" android:layout_width="fill_parent" android:layout_height="1.0dip" />
                </LinearLayout>[/COLOR][/B]
                <LinearLayout android:orientation="vertical" android:id="@id/noNotificationsTitle" android:focusable="true" android:layout_width="fill_parent" android:layout_height="wrap_content">
                    <TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/noNotificationsText" android:paddingLeft="11.0dip" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height" android:text="@string/status_bar_no_notifications_title" />
                </LinearLayout>
                <LinearLayout android:orientation="vertical" android:id="@id/onGoingCart" android:background="#ff293945" android:focusable="true" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
                    <TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/onGoingNotificationText" android:paddingLeft="11.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/status_bar_ongoing_events_title" />
                </LinearLayout>
                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/onGoingItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
                <LinearLayout android:orientation="vertical" android:id="@id/notificationCart" android:background="#ff293945" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
                    <RelativeLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
                        <TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/latestNotificationText" android:paddingLeft="11.0dip" android:layout_width="180.0dip" android:layout_height="fill_parent" android:text="@string/status_bar_latest_events_title" android:layout_alignParentLeft="true" />
                        <TextView android:textSize="@dimen/status_bar_expanded_notification_clear_button_text_size" android:textColor="@color/tw_status_bar_clear_btn_text" android:gravity="center" android:id="@id/clear_all_button" android:background="@drawable/tw_btn_default_small" android:padding="0.100000024dip" android:focusable="true" android:clickable="true" android:layout_width="@dimen/status_bar_expanded_clear_button_width" android:layout_height="fill_parent" android:layout_marginRight="4.0dip" android:text="@string/status_bar_clear_all_button" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
                    </RelativeLayout>
                </LinearLayout>
                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/notificationItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
                <com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
            </LinearLayout>
        </ScrollView>
    </FrameLayout>
    <com.android.systemui.statusbar.phone.CloseDragHandle android:layout_gravity="bottom" android:orientation="vertical" android:id="@id/close" android:layout_width="fill_parent" android:layout_height="@dimen/tw_close_handle_height">
        <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
            <ImageView android:layout_gravity="bottom" android:layout_width="fill_parent" android:layout_height="@dimen/tw_close_handle_height" android:src="@drawable/tw_status_bar_close" android:scaleType="fitXY" />
            <TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network" android:gravity="center" android:layout_gravity="bottom" android:id="@id/carrier_label" android:layout_width="fill_parent" android:layout_height="@dimen/tw_close_handle_height" android:layout_marginBottom="10.0dip" />
        </RelativeLayout>
    </com.android.systemui.statusbar.phone.CloseDragHandle>
</FrameLayout>
To make life easy, you can simply download the modified tw_status_bar_expanded.xml file and paste it over the original one.
3. Navigate to res\values\ folder and open ids.xml and add the following line at the end before </resources> line:
Code:
    <item type="id" name="exp_power_stat">false</item>
Now you need to recompile SystemUI.apk in order to generate new ids in public.xml file for exp_power_stat. Then decompile the new SystemUI.apk (we are going to work on this one for now) and delete the old one to not cause confusion!!
4. Navigate to and open smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali file, now search for ".field mPostCollapseCleanup:Ljava/lang/Runnable;" and add this line bellow it (the blue one here):
Code:
.field mPostCollapseCleanup:Ljava/lang/Runnable;

[B][COLOR="Blue"].field mPowerWidget:Lcom/wanam/systemui/quickpanel/PowerWidget;[/COLOR][/B]

.field mQueueLock:Ljava/lang/Object;
5. Still in PhoneStatusBar.smali, search for ".method public addIcon" and add these lines (the blue ones) at the end of this method before the "return-void" line:
Code:
    invoke-virtual {v1, v0, p3, v2}, Landroid/widget/LinearLayout;->addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V

    .line 1170
    [B][COLOR="Blue"]iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/wanam/systemui/quickpanel/PowerWidget;

    invoke-virtual {v1}, Lcom/wanam/systemui/quickpanel/PowerWidget;->updateWidget()V[/COLOR][/B]

    return-void
.end method
6. Still in PhoneStatusBar.smali, search for ".method protected makeStatusBarView", then search for "Landroid/widget/ScrollView;->setVerticalScrollBarEnabled(Z)V" and add these lines (the blue ones) bellow it:
Code:
    invoke-virtual {v9, v10}, Landroid/widget/ScrollView;->setVerticalScrollBarEnabled(Z)V

    [B][COLOR="Blue"]move-object/from16 v0, p0

    iget-object v9, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

    const v10, [COLOR="Purple"]0x7fxxxxxx[/COLOR]

    invoke-virtual {v9, v10}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

    move-result-object v9

    check-cast v9, Lcom/wanam/systemui/quickpanel/PowerWidget;

    move-object/from16 v0, p0

    iput-object v9, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/wanam/systemui/quickpanel/PowerWidget;[/COLOR][/B]

    .line 714
    new-instance v9, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;
N.B: You should use the newly generated id in public.xml (in res\values folder) for "exp_power_stat" in place of 0x7fxxxxxx
7. Still in PhoneStatusBar.smali, search for "Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;" and add these lines bellow it (the blue ones):
Code:
    invoke-virtual {v1, v9, v2}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

[B][COLOR="Blue"]    move-object/from16 v0, p0

    iget-object v9, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/wanam/systemui/quickpanel/PowerWidget;

    invoke-virtual {v9}, Lcom/wanam/systemui/quickpanel/PowerWidget;->setupWidget()V[/COLOR][/B]

    .line 875
    sget-boolean v9, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->useTouchWizGUI:Z
Now save changes and close.
8. Now we need to edit the head of AndroidManifest.xml in SystemUI.apk and add system status to the main core (this is important step to make Torch and Reboot toggles work!!).
Before:
Code:
<?xml version="1.0" encoding="utf-8"?>
[B][COLOR="Red"]<manifest android:versionCode="16" android:versionName="4.1.2-N7000XXLSZ" package="com.android.systemui" coreApp="true"[/COLOR][/B]
  xmlns:android="http://schemas.android.com/apk/res/android">
After:
Code:
<?xml version="1.0" encoding="utf-8"?>
[B][COLOR="Red"]<manifest android:versionCode="16" android:versionName="4.1.2-N7000XXLSZ" package="com.android.systemui" coreApp="true" [COLOR="Blue"]android:sharedUserId="android.uid.system" android:process="system"[/COLOR][/COLOR][/B]
  xmlns:android="http://schemas.android.com/apk/res/android">
9. Download the following smalis and add them to smali folder in SystemUI.apk (there are 2 wanam folders, put the correct one inside its corresponding folder inside SystemUI.apk\smali folder).
10. Now we have finished from modifying SystemUI.apk, Recompile AND SIGN the finished project!!!.
11. Now since SystemUI.apk is signed, it will not work properly until we disable signature check on "services.jar". So backsmali services.jar file and navigate to classout\com\android\server\pm folder and open PackageManagerService.smali and search for ".method static compareSignatures" and change the entire method to:
Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
    .registers 9
    .parameter "s1"
    .parameter "s2"

    .prologue
    const/4 v6, 0x0

    const-string v3, "Wanam: PackageManager"

    const-string v4, "Skip signature check."

    invoke-static {v3, v4}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I

    return v6

.end method
Save changes and recompile (smali) services.jar file.
12. Download the following system app and resource (LidroidSettings.apk and lidroid-res.apk)
13. Push all files to your phone and... look to the results :D





N.B:
For those who want to modify Lidroid-res.apk, you need to install the following dependancies, then decompile it and edit apktool.yml file. You will find this:
Code:
isFrameworkApk: true
usesFramework:
  ids:
  - 1
sdkInfo:
  minSdkVersion: '16'
  targetSdkVersion: '16'
Add the 3 frameworks (2,3 and 4):
Code:
isFrameworkApk: true
usesFramework:
  ids:
  - 1
[B][COLOR="Blue"]  - 2
  - 3
  - 4[/COLOR][/B]
sdkInfo:
  minSdkVersion: '16'
  targetSdkVersion: '16'
Now you can make your changes and re-compile.


Notification panel lock screen and recent apps

1. Decompile SystemUI.apk by APK-Multi tool
2. Navigate to res\drawable-xhdpi folder and put these new resource images there.
3. Navigate to res\layout folder and open tw_status_bar_expanded_header.xml and add the following lines (the blue ones):
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="39.0dip" android:baselineAligned="false"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
    <com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:textColor="#ffffffff" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="4.0dip" android:layout_marginTop="-3.0dip" android:singleLine="true" systemui:ampmSmall="true" />
    <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:textColor="#ffffffff" android:ellipsize="none" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="8.0dip" android:layout_marginRight="4.0dip" android:maxLines="2" />
    <com.android.systemui.statusbar.RotationToggle android:id="@id/rotation_lock_button" android:visibility="gone" android:clickable="true" android:layout_width="32.0dip" android:layout_height="32.0dip" android:layout_margin="8.0dip" android:button="@drawable/ic_notify_rotation" android:contentDescription="@string/accessibility_rotation_lock_off" />
    <Space android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_weight="1.0" />
    [B][COLOR="Blue"]<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/recent_apps" android:paddingLeft="2.0dip" android:paddingRight="1.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:layout_toLeftOf="@id/back" android:contentDescription="@string/accessibility_recent" systemui:keyCode="187" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
    <com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:paddingLeft="2.0dip" android:paddingRight="3.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lock" android:layout_toLeftOf="@id/settings_button" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />[/COLOR][/B]
    <ImageView android:layout_width="1.0dip" android:layout_height="25.0dip" android:layout_marginTop="7.0dip" android:layout_marginBottom="7.0dip" android:src="@drawable/tw_quick_panel_plnm_setting_dv" />
    <RelativeLayout android:id="@id/settings_button" android:background="@drawable/tw_quick_panel_setting_button_bg" android:focusable="true" android:visibility="visible" android:layout_width="@dimen/status_bar_expanded_setting_width" android:layout_height="39.0dip">
        <ImageView android:id="@id/settings_button_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/tw_quickpanel_icon_settings" android:scaleType="center" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:contentDescription="@string/accessibility_settings_button" />
    </RelativeLayout>
</LinearLayout>
First blue line is for recent apps icon and the second one is for lock screen icon
4. Save changes, recompile and push to your phone.

Results:
 
Last edited:

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
Continue moddings!!

Extended Power Menu Addons (ScreenShot, Recovery, Download & Safe modes)

In this tutorial, we will modify 2 files; the framework-res.apk file and android.policy.jar file...
Here for the sake of tutorial, I will refer to ScreenShot resources by blue color lines, Recovery resources by green lines, download resources by orange lines and safe resources by pink lines.. Please download these resources first.
Smali resources credits to Robbie Hood for Screen Capture, tdunham for Download and Recovery smalis, and of course me for Safe mode smali.

A) framework-res.apk
1. Decompile framework-res.apk by APK-Multi Tool
2. Add your desired resources image to res\drawable-xhdpi folder, here they are [tw_ic_lock_screenshot.png], [tw_ic_lock_recovery.png], [tw_ic_lock_download.png] and [tw_ic_lock_safemode.png].
3. Go to res\values folder and open strings.xml file and add the following lines at the end before </resources>:
Code:
[COLOR="Blue"]    <string name="global_action_screenshot_txt">Take screenshot</string>[/COLOR]
[COLOR="Green"]    <string name="global_action_recovery_txt">Recovery Mode</string>[/COLOR]
[COLOR="DarkOrange"]    <string name="global_action_download_txt">Download mode</string>[/COLOR]
    [COLOR="Magenta"]<string name="global_action_safemode_txt">Reboot to safe mode</string>[/COLOR]
4. Now recompile your framework-res.apk THEN decompile it again; so we can have new generated ids in public.xml file in res\values folder.
5. In your new decompiled framework-res.apk, go to res\values folder and open public.xml file and locate the following lines for the added new image resources:
Code:
    [COLOR="Blue"]<public type="drawable" name="tw_ic_lock_screenshot" id="0x01080a98" />[/COLOR]
    [COLOR="Green"]<public type="drawable" name="tw_ic_lock_recovery" id="0x01080a9a" />[/COLOR]
    [COLOR="DarkOrange"]<public type="drawable" name="tw_ic_lock_download" id="0x01080a99" />[/COLOR]
    [COLOR="Magenta"]<public type="drawable" name="tw_ic_lock_safemode" id="0x01080a98" />[/COLOR]
and the following lines for the added new strings resources:
Code:
    [COLOR="Blue"]<public type="string" name="global_action_screenshot_txt" id="0x01040784" />[/COLOR]
    [COLOR="Green"]<public type="string" name="global_action_recovery_txt" id="0x01040785" />[/COLOR]
    [COLOR="DarkOrange"]<public type="string" name="global_action_download_txt" id="0x01040786" />[/COLOR]
    [COLOR="Magenta"]<public type="string" name="global_action_safemode_txt" id="0x01040785" />[/COLOR]
N.B: You might have different id values, but don't worry it will be the same principle!!
6. Leave public.xml file opened and go to the next step..

B) android.policy.jar
1. Backsmali android.policy.jar
2. Navigate to classout\com\android\internal\policy\impl folder and open GlobalActions.smali.
3. In the [# instance fields] section, add these new lines:
Code:
[COLOR="Blue"].field private mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
[/COLOR]
[COLOR="Green"].field private mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

[COLOR="DarkOrange"].field private mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

[COLOR="Magenta"].field private mSafeMode:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]
4. Search for "[Lcom/android/internal/policy/impl/GlobalActions$Action;" for power menu arrays and increase the number of arrays (the line above it) to accommodate the total number of new arrays..
Code:
    .line 418
    const/4 v1, 0x[B][COLOR="Purple"]5     <!--- You need to increase the arrays number here[/COLOR][/B]

    new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;
Keep in mind that the maximum arrays that are allowed in Power Menu are only 7 arrays (i.e, since it is 0x5 here, we could only increase it to 0x7 but for the sake of tutorial we will put it 0x9)
So the line will be:
Code:
    .line 418
    const/4 v1, 0x[B][COLOR="Purple"]9[/COLOR][/B]

    new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;
5. Now we will put listener actions for these added arrays.. so above the newly modified "const/4 v1, 0x9" add these action lines:
Code:
    new-instance [COLOR="Red"]v1[/COLOR], Lcom/android/internal/policy/impl/GlobalActions$99;

    const [COLOR="Red"]v2[/COLOR], 0x10808ad

    const [COLOR="Red"]v3[/COLOR], 0x1040193

    move-object/from16 [COLOR="Red"]v0, p0[/COLOR]

    invoke-direct {[COLOR="Red"]v1, v0, v2, v3[/COLOR]}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    move-object/from16 [COLOR="Red"]v0, p0[/COLOR]

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

    .line 416
    invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->onAirplaneModeChanged()V

    [COLOR="Blue"]new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$ScreenCap;

    const v2, 0x1080a98

    const v3, 0x1040784

    move-object/from16 v0, p0

    invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$ScreenCap;-><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;[/COLOR]
	
[COLOR="Green"]    new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Recovery;

    const v2, 0x1080a9a

    const v3, 0x1040785

    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;
[/COLOR]
[COLOR="DarkOrange"]    new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Download;

    const v2, 0x1080a99

    const v3, 0x1040786

    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;[/COLOR]

    [COLOR="Magenta"]new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$SafeMode;

    const v2, 0x1080a98

    const v3, 0x1040785

    move-object/from16 v0, p0

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

    move-object/from16 v0, p0

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

    .line 418
    const/4 v1, 0x9
As you can see here, the ids for each action are obtained from public.xml file from framework-res.apk. The first id in each action will represent the image resource and the second id will represent the string resource... See public.xml lines above and you will figure it out ;)..
- Don't forget that, to link ids from framework-res.apk, you should omit the starting 0 value (example 0x01080a98 will be 0x1080a98)
- Also pay attention to variables and parameters registers, it should be matched (the red v and p)
6. Now we need to add new arrays to show in Power Menu.. So bellow modified "const/4 v1, 0x9" add new arrays to show after the last array:
Code:
    .line 418
    const/4 v1, 0x9

    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 [COLOR="Red"]v2[/COLOR], 0x4

    move-object/from16 [COLOR="Red"]v0, p0[/COLOR]

    iget-object [COLOR="Red"]v3, v0[/COLOR], Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

    aput-object [COLOR="Red"]v3, v1, v2[/COLOR]

[COLOR="Blue"]    const/4 v2, 0x5
	
    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[/COLOR]

[COLOR="Green"]    const/4 v2, 0x6
	
    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[/COLOR]

[COLOR="DarkOrange"]    const/4 v2, 0x7
	
    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[/COLOR]

    [COLOR="Magenta"]const/4 v2, 0x8

    move-object/from16 v0, p0

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

    aput-object v3, v1, v2[/COLOR]
- Again, don't forget that the maximum allowed arrays to show are only 7 arrays starting from 0x0 to 0x6; but we put here to 0x8 for the sake of tutorial.
- Also pay attention to variables and parameters registers, it should be matched (the red v and p)
7. Now save changes and exit.
8. Copy smali resources for ScreenShot, Recovery, Download and Safe modes into classout\com\android\internal\policy\impl folder
You need to open GlobalActions$ScreenCap$1.smali, GlobalActions$Download.smali, GlobalActions$Recovery.smali and GlobalActions$SafeMode.smali and look for this line:
Code:
    invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$[B][COLOR="Red"]200[/COLOR][/B](Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
Here access$200 might differ according to ROM, you need to open GlobalActions.smali and search for "(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;" to locate the exact access$xxx
Example in my GlobalActions.smali, the access$xxx is:
Code:
.method static synthetic access$[B][COLOR="Red"]200[/COLOR][/B](Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
    .locals 1
    .parameter "x0"

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

    return-object v0
.end method
9. Smali (recompile) the finished android.policy.jar

Now push the modified framework-res.apk and android.policy.jar to your phone.. This will be enough for new Power Menu recovery, download and safe modes addons but not for ScreenShot!! You need to push extra file to bin folder in your phone which is screenshot and fix permissions to rwsr-xr-x that is 04755 in updater-script language.

Results example:



Extra Step: Adding Setting Toggle For Power Menu Addons >>>
I will assume you already add Safe Mode and Screenshot extra power menu addons..
1) android.policy.jar:

- Baksmali android.policy.jar
- Go to classout\com\android\internal\policy\impl folder
- Open GlobalActions$SafeMode.smali and change the method ".method public showConditional()Z" to:
Code:
.method public showConditional()Z
    .registers 5

    const/4 v0, 0x1

    const/4 v1, 0x0

    iget-object v2, p0, Lcom/android/internal/policy/impl/[B][COLOR="Blue"]GlobalActions$SafeMode[/COLOR][/B];->this$0:Lcom/android/internal/policy/impl/GlobalActions;

    # getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

    move-result-object v2

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

    move-result-object v2

    const-string v3, [B][COLOR="Blue"]"pm_safe_mode"[/COLOR][/B]

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

    move-result v2

    if-ne v2, v0, :cond_15

    :goto_14
    return v0

    :cond_15
    move v0, v1

    goto :goto_14
.end method

.method public showDuringKeyguard()Z
    .registers 2

    .prologue
    .line 389
    const/4 v0, 0x1

    return v0
.end method
- Also, open GlobalActions$ScreenCap.smali and change the method ".method public showConditional()Z" to:
Code:
.method public showConditional()Z
    .registers 5

    const/4 v0, 0x1

    const/4 v1, 0x0

    iget-object v2, p0, Lcom/android/internal/policy/impl/[B][COLOR="Blue"]GlobalActions$ScreenCap[/COLOR][/B];->this$0:Lcom/android/internal/policy/impl/GlobalActions;

    # getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

    move-result-object v2

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

    move-result-object v2

    const-string v3, [B][COLOR="Blue"]"pm_screenshot"[/COLOR][/B]

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

    move-result v2

    if-ne v2, v0, :cond_15

    :goto_14
    return v0

    :cond_15
    move v0, v1

    goto :goto_14
.end method
- Save changes .. and that's for android.policy.jar


2) SecSettings.apk:

- Decompile SecSettings.apk
- Go to res\values folder and open strings.xml file and add these new resources at the end before </resources>:
Code:
	<string name="PM_Glory_addons">GloryROM Power Menu Addons</string>
	<string name="pm_safe_mode_title">Safe Mode Reboot</string>
	<string name="pm_screenshot_title">Take Screenshot</string>
	<string name="pm_on">Toggle is Enabled</string>
	<string name="pm_off">Toggle is Disabled</string>
- Go to res\xml and open display_settings.xml and add these lines on the place you your addon to appear later on on the device:
Code:
	<PreferenceCategory android:title="@string/PM_Glory_addons" android:key="PM_Glory_settings" />
	<CheckBoxPreference android:title="@string/pm_safe_mode_title" android:key="pm_safe_mode" android:defaultValue="true" android:summaryOn="@string/pm_on" android:summaryOff="@string/pm_off" />
	<CheckBoxPreference android:title="@string/pm_screenshot_title" android:key="pm_screenshot" android:defaultValue="true" android:summaryOn="@string/pm_on" android:summaryOff="@string/pm_off" />
- Now for the smali source, go to classout\com\android\settings folder and open DisplaySettings.smali.. Also here, I didn't invent new codes, I used mult-windows toggle codes as reference..!! I will use Blue color for Safe Mode toggle codes and Green color for Screenshot toggle codes. Add these lines to [# instance fields] section:
Code:
[B][COLOR="Blue"].field private mSafeModePref:Landroid/preference/CheckBoxPreference;[/COLOR]

[COLOR="Green"].field private mScreenShotPref:Landroid/preference/CheckBoxPreference;[/COLOR][/B]
- In the method ".method public onCreate(Landroid/os/Bundle;)V", search for ""key_multi_window"" and add these lines:
Code:
    .line 570
    const-string v11, "key_multi_window"

    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;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    [B][COLOR="Blue"]const-string v11, "pm_safe_mode"

    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;->mSafeModePref:Landroid/preference/CheckBoxPreference;[/COLOR]

    [COLOR="Green"]const-string v11, "pm_screenshot"

    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;->mScreenShotPref:Landroid/preference/CheckBoxPreference;[/COLOR][/B]
- Now search for the method ".method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z" and search for ""multi_window_enabled"" to locate this part at the end:
Code:
    .line 1021
    :cond_15c
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, [B][COLOR="Red"]:cond_1c[/COLOR][/B]

    .line 1022
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    .line 1023
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "multi_window_enabled"

    if-eqz v0, :cond_177

    :goto_172
    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto/16 :goto_1c

    :cond_177
    move v1, v2

    goto :goto_172
.end method
Add new codes before [.end method] in the previous section, so that section will be like this:
Code:
    .line 1021
    :cond_15c
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, [B][COLOR="Blue"]:cond_SafeM[/COLOR][/B]

    .line 1022
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    .line 1023
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "multi_window_enabled"

    if-eqz v0, :cond_177

    :goto_172
    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto/16 :goto_1c

    :cond_177
    move v1, v2

    goto :goto_172
	
    [B][COLOR="Blue"]:cond_SafeM
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_ScSh

    .line 1022
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    .line 1023
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "pm_safe_mode"

    if-eqz v0, :cond_majdiSafe

    :goto_njsafe
    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto/16 :goto_1c

    :cond_majdiSafe
    move v1, v2

    goto :goto_njsafe[/COLOR]
	
    [B][COLOR="Green"]:cond_ScSh
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, [COLOR="Red"]:cond_1c[/COLOR]

    .line 1022
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    .line 1023
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "pm_screenshot"

    if-eqz v0, :cond_majdiSS

    :goto_njSS
    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto/16 :goto_1c

    :cond_majdiSS
    move v1, v2

    goto :goto_njSS[/COLOR][/B][/B]
.end method
- Pay attention to the red color condition..!!!
- Now go to the next method ".method public onResume()V" and search for ""multi_window_enabled"" and locate this part:
Code:
    :cond_9d
    sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z

    if-eqz v0, [B][COLOR="Red"]:cond_c1[/COLOR][/B]

    .line 847
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "multi_window_enabled"

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

    move-result v3

    if-ne v3, v1, :cond_de

    :goto_af
    invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    .line 848
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "multi_window_enabled"

    invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;

    invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

    line 850
    :cond_c1
    return-void

    :cond_c2
    move v0, v2
And do this modification:
Code:
    :cond_9d
    sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z

    if-eqz v0, [B][COLOR="Blue"]:cond_Safemajdi[/COLOR][/B]

    .line 847
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "multi_window_enabled"

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

    move-result v3

    if-ne v3, v1, :cond_de

    :goto_af
    invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    .line 848
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "multi_window_enabled"

    invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;

    invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

    [B][COLOR="Blue"].line 1000
    :cond_Safemajdi
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;

    if-eqz v0, :cond_NewScSh
	
    .line 1001
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "pm_safe_mode"

    const/4 v1, 0x0

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

    move-result v3

    if-eqz v3, :cond_noSafe

    const/4 v1, 0x1

    goto :goto_yesSafe

    :cond_noSafe
    const/4 v1, 0x0

    :goto_yesSafe
    invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR]

    [COLOR="Green"].line 2000
    :cond_NewScSh
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;

    if-eqz v0, [COLOR="Red"]:cond_c1[/COLOR]
	
    .line 2001
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "pm_screenshot"

    const/4 v1, 0x0

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

    move-result v3

    if-eqz v3, :cond_noShot

    const/4 v1, 0x1

    goto :goto_yesShot

    :cond_noShot
    const/4 v1, 0x0

    :goto_yesShot
    invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR][/B]

    .line 850
    :cond_c1
    return-void

    :cond_c2
    move v0, v2
- Also pay attention to the red color condition..!!!
- Save changes.. and that's all


Result example:


 
Last edited:

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
Continue moddings!!

LockScreen Torch

This mod will make you able to have torch flash light while you are on LockScreen by long pressing on the home button...!!!

Credits to:
@ Robbie Hood for the actual mod codes

- Backsmali android.policy.jar
- Navigate to classout/com/android/internal/policy/impl/ folder
- We will be working on 3 smali files:

KeyguardViewMediator$4.smali
- Search for "packed-switch" and add the blue line just above "return-void":
Code:
    .line 1255
    iget v2, p1, Landroid/os/Message;->what:I

    packed-switch v2, :pswitch_data_72

    .line 1298
    :goto_7
    [B][COLOR="Blue"]:pswitch_7[/COLOR][/B]
    return-void

    .line 1257
- Search for ":catchall" and add these lines above it:
Code:
    .line 1295
    monitor-exit v1

    goto :goto_[B][COLOR="Red"]7[/COLOR][/B]

[B][COLOR="Blue"]    :pswitch_6e
    iget-object v2, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator$4;->this$0:Lcom/android/internal/policy/impl/KeyguardViewMediator;

    iget v3, p1, Landroid/os/Message;->arg1:I

    if-eqz v3, :cond_majdi

    move v3, v0

    :goto_nj
    #calls: Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V
    invoke-static {v2, v3}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->access$2400(Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V

    goto :goto_[COLOR="Red"]7[/COLOR]

    :cond_majdi
    move v3, v1

    goto :goto_nj[/COLOR][/B]

    :catchall_7b
    move-exception v0

    monitor-exit v1
N.B: pay attention to number 7 in goto :goto_7 that could be different in your smali according to your ROM, make sure it is the same as the first one which is just above the new line ":pswitch_6e"
- Search for "nop" and another "nop" line bellow it (don't forget to leave empty line in between):
Code:
    .line 1255
    nop

    [B][COLOR="Blue"]nop[/COLOR][/B]
- Now go to the end of smali and add these switches above ".end packed-switch" line:
Code:
    :pswitch_data_72
    .packed-switch 0x1
        :pswitch_8
        :pswitch_10
        :pswitch_16
        :pswitch_1c
        :pswitch_22
        :pswitch_28
        :pswitch_2e
        :pswitch_38
        :pswitch_40
        :pswitch_4c
        :pswitch_52
        :pswitch_58
        :pswitch_64
        [B][COLOR="Blue"]:pswitch_7
        :pswitch_7
        :pswitch_7
        :pswitch_7
        :pswitch_7
        :pswitch_7
        :pswitch_6e[/COLOR][/B]
    .end packed-switch
.end method
N.B: if your smali has :pswitch_7 and :pswitch_6e by default, then use another :pswitch_value for :pswitch_7 and :pswitch_6e. If you do so, then don't forget to change :pswitch_7 and :pswitch_6e value in added codes from the beginning above as well
Save changes...

KeyguardViewMediator.smali
- Search for ".field private static final SET_HIDDEN:I = 0xc" and add this line bellow it (the blue one):
Code:
.field private static final SET_HIDDEN:I = 0xc

[B][COLOR="Blue"].field private static final SET_TORCH:I = 0x14[/COLOR][/B]

.field private static final SHOW:I = 0x2
- Search for ".field private mTelephonyManager:Landroid/telephony/TelephonyManager;" and add thses lines bellow it (the blue ones):
Code:
.field private mTelephonyManager:Landroid/telephony/TelephonyManager;

[B][COLOR="Blue"].field private mTorchEnabled:Z

.field private mTorchStateChanged:Z[/COLOR][/B]

.field private mUnlockSoundId:I
- Search for this method ".method public constructor <init>(Landroid/content/Context;Lcom/android/internal/policy/impl/PhoneWindowManager;Landroid/os/LocalPowerManager;)V" and add these lines (the blue ones):
Code:
.method public constructor <init>(Landroid/content/Context;Lcom/android/internal/policy/impl/PhoneWindowManager;Landroid/os/LocalPowerManager;)V
    .registers 15
    .parameter "context"
    .parameter "callback"
    .parameter "powerManager"

    .prologue
    .line 308
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 188
    [B][COLOR="Blue"]const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z[/COLOR][/B]

    const/4 v0, 0x1
- Search for "const-string v0, "power"" and add these lines above it (the blue lines):
Code:
    .line 311
    iput-object p3, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mRealPowerManager:Landroid/os/LocalPowerManager;

    .line 312
    [B][COLOR="Blue"]const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z[/COLOR][/B]

    const-string v0, "power"
- Search for this method ".method static synthetic access$300(Lcom/android/internal/policy/impl/KeyguardViewMediator;I)V" and add this new method above it:
Code:
.method static synthetic access$2300(Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V
    .registers 2
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 110
    invoke-direct {p0, p1}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetHidden(Z)V

    return-void
.end method

[B][COLOR="Blue"].method static synthetic access$[COLOR="Red"]2400[/COLOR](Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V
    .registers 2

    invoke-direct {p0, p1}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V

    return-void
.end method[/COLOR][/B]

.method static synthetic access$300(Lcom/android/internal/policy/impl/KeyguardViewMediator;I)V
N.B: pay attention to $2400, that is increment to the method above it
- Search for the method ".method private handleHide()V" and add this line at end of this method (the blue one) just after "monitor-exit p0":
Code:
.method private handleHide()V
..
..
..
    .line 1449
    monitor-exit p0

    [B][COLOR="Blue"]invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V[/COLOR][/B]

    goto :goto_18

    :catchall_45
    move-exception v0

    monitor-exit p0
    :try_end_47
    .catchall {:try_start_1 .. :try_end_47} :catchall_45

    throw v0
.end method

.method private handleKeyguardDone(Z)V
- Search for the method ".method private handleNotifyScreenOff()V" and add this line (the blue one) just above "return-void":
Code:
.method private handleNotifyScreenOff()V
    .registers 3

    .prologue
    .line 1597
    monitor-enter p0

    .line 1598
    :try_start_1
    const-string v0, "KeyguardViewMediator"

    const-string v1, "handleNotifyScreenOff"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 1599
    iget-object v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mKeyguardViewManager:Lcom/android/internal/policy/impl/KeyguardViewManager;

    invoke-virtual {v0}, Lcom/android/internal/policy/impl/KeyguardViewManager;->onScreenTurnedOff()V

    .line 1600
    monitor-exit p0

    .line 1601
    [B][COLOR="Blue"]invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V[/COLOR][/B]

    return-void
- Search for the method ".method private handleSetHidden(Z)V" and add this line (the blue one) above the defined condition in the method:
Code:
.method private handleSetHidden(Z)V
    .registers 3
    .parameter "isHidden"

    .prologue
    .line 688
    monitor-enter p0

    .line 689
    :try_start_1
    iget-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHidden:Z

    if-eq v0, p1, :cond_10

    .line 690
    iput-boolean p1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHidden:Z

    .line 691
    invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->updateActivityLockScreenState()V

    .line 692
    invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->adjustUserActivityLocked()V

    .line 693
    invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->adjustStatusBarLocked()V

    .line 695
    [B][COLOR="Blue"]invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V[/COLOR][/B]

    :cond_10
    monitor-exit p0
- Search for the method ".method private handleShow()V" and add the following new method above it:
Code:
[B][COLOR="Blue"].method private handleSetTorch(Z)V
    .registers 8

    const/4 v5, 0x0

    const/4 v4, 0x1

    :try_start_2
    iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z

    if-nez v1, :cond_majdi

    iput-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z

    const/4 v1, 0x1

    iput-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z

    :cond_[COLOR="Red"]b[/COLOR]
    :goto_[COLOR="Red"]b[/COLOR]
    return-void

    :cond_majdi
    iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z

    if-eq v1, p1, :cond_[COLOR="Red"]b[/COLOR]

    iput-boolean p1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z

    new-instance v0, Landroid/content/Intent;

    const-string v1, "net.cactii.flash2.TOGGLE_FLASHLIGHT"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    const-string v1, "net.cactii.flash2.EXTRA_DISABLE_NOTIFICATION"

    const/4 v2, 0x1

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

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

    invoke-virtual {v1, v0}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V
    :try_end_maj
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_maj} :catch_jdi

    goto :goto_[COLOR="Red"]b[/COLOR]

    :catch_jdi
    move-exception v1

    goto :goto_[COLOR="Red"]b[/COLOR]
.end method[/COLOR][/B]

.method private handleShow()V
N.B: pay attention to :cond_b and :goto_b that could be differ according to your ROM where b should be the exact the same first condition in this method ".method public isGlanceViewVisible()Z"
Code:
.method public isGlanceViewVisible()Z
    .registers 2

    .prologue
    .line 666
    iget-object v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mKeyguardViewManager:Lcom/android/internal/policy/impl/KeyguardViewManager;

    if-eqz v0, [B][COLOR="Red"]:cond_b[/COLOR][/B]

    .line 667
- Search for method ".method private handleShow()V", then search bellow for "Landroid/os/PowerManager$WakeLock;->release()V" and add these lines bellow it (the blue ones):
Code:
.method private handleShow()V
    .registers 3

    .prologue
    .line 1400
    monitor-enter p0

    .line 1401
    :try_start_1
    const-string v0, "KeyguardViewMediator"
...
...
...
    invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->release()V

    .line 1419
    [B][COLOR="Blue"]const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z[/COLOR][/B]

    monitor-exit p0
- Search for the method ".method private resetStateLocked()V" and add these lines (the blue ones) at the end before "return-void" line:
Code:
.method private resetStateLocked()V
    .registers 4
...
...
    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z
    
    .line 809
    [B][COLOR="Blue"]return-void
.end method

.method private resetTorchState()V
    .registers 2

    iget-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z

    if-eqz v0, :cond_[COLOR="Red"]8[/COLOR]

    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V

    :cond_[COLOR="Red"]8[/COLOR][/COLOR][/B]
    return-void
.end method
N.B: pay attention to :cond_8 that could be differ according to your ROM where 8 should be the exact the same first DEFINED condition in this method ".method private playSounds(Z)V"
Code:
.method private playSounds(Z)V
    .registers 10
    .parameter "locked"

    .prologue
    const/4 v5, 0x0

    const/4 v4, 0x1

    .line 1362
    iget-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mSuppressNextLockSound:Z

    if-eqz v0, :cond_9

    .line 1363
    iput-boolean v5, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mSuppressNextLockSound:Z

    .line 1385
    [B][COLOR="Red"]:cond_8[/COLOR][/B]
    :goto_8
    return-void
- Search for the method ".method public verifyUnlock(Landroid/view/WindowManagerPolicy$OnKeyguardExitResult;)V" and add this new method above it (the blue lines):
Code:
[B][COLOR="Blue"].method public setTorch(Z)V
    .registers 7

    const/16 v4, 0x14

    const/4 v3, 0x0

    iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mScreenOn:Z

    if-eqz v1, :cond_newa

    iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;

    invoke-virtual {v1, v4}, Landroid/os/Handler;->removeMessages(I)V

    iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;

    if-eqz p1, :cond_newb

    const/4 v2, 0x1

    :goto_[COLOR="Red"]11[/COLOR]
    invoke-virtual {v1, v4, v2, v3}, Landroid/os/Handler;->obtainMessage(III)Landroid/os/Message;

    move-result-object v0

    iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    :cond_newa
    return-void

    :cond_newb
    move v2, v3

    goto :goto_[COLOR="Red"]11[/COLOR]
.end method[/COLOR][/B]

.method public verifyUnlock(Landroid/view/WindowManagerPolicy$OnKeyguardExitResult;)V
N.B: pay attention to :goto_11 that could be differ according to your ROM where 11 should be the exact the same goto action in this method ".method public isInputRestricted()Z"
Code:
.method public isInputRestricted()Z
    .registers 2
..
..
    [B][COLOR="Red"]:goto_11[/COLOR][/B]
    return v0

    :cond_12
    const/4 v0, 0x0

    goto :goto_11
.end method
Save changes..

PhoneWindowManager.smali

All changes here, will be in this method ".method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J"; so it is better to know from which part of smali this method starts and ends in order to not touch other methods!!

- First search for the method ".method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J",
- Search for "Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomePressed:Z" and add these lines bellow it (the blue ones):
Code:
.method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J
    .registers 56
...
...
...
...
    .line 3364
    :cond_2ba
    if-nez v15, :cond_[B][COLOR="Red"]38c[/COLOR][/B]

    .line 3365
    move-object/from16 v0, p0

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

    [B][COLOR="Blue"]if-eqz v0, :cond_[COLOR="Red"]38c[/COLOR]

    const/16 v3, 0x0[/COLOR][/B]

    move/from16 v20, v0
N.B: pay attention to if-eqz v0, :cond_38c where the condition number 38c is the same as IF condition above it
- Search for this portion (you can search down for ".catch Landroid/os/RemoteException" to locate this portion) and add this line (the blue one):
Code:
    .line 3373
    invoke-interface/range {v44 .. v44}, Lcom/android/internal/statusbar/IStatusBarService;->cancelPreloadRecentApps()V
    :try_end_2dd
    .catch Landroid/os/RemoteException; {:try_start_2d4 .. :try_end_2dd} :catch_329

    .line 3381
    .end local v44           #statusbar:Lcom/android/internal/statusbar/IStatusBarService;
    :cond_2dd
    :goto_2dd
    const/4 v3, 0x0

    move-object/from16 v0, p0

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

    [B][COLOR="Blue"]invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->launchHomeFromHotKey()V[/COLOR][/B]

    .line 3382
    if-nez v36, :cond_32c
- Search down for "Lcom/android/internal/policy/impl/PhoneWindowManager$HomeKeyDoubleClickConcept;->setHomeDownEventSent()V" and add this new code after defined condition:
Code:
    .line 3470
    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeKeyDoubleClickConcept:Lcom/android/internal/policy/impl/PhoneWindowManager$HomeKeyDoubleClickConcept;

    invoke-virtual {v3}, Lcom/android/internal/policy/impl/PhoneWindowManager$HomeKeyDoubleClickConcept;->setHomeDownEventSent()V

    .line 3473
    :cond_3a6
    [B][COLOR="Blue"]new-instance v0, Ljava/io/File;

    const-string v1, "/sdcard/Android"

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v0

    if-eqz v0, :cond_majdi

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mKeyguardMediator:Lcom/android/internal/policy/impl/KeyguardViewMediator;

    move-object/from16 v3, v0

    invoke-virtual/range {v3 .. v3}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->isShowingAndNotHidden()Z

    move-result v3

    if-eqz v3, :cond_majdi

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mKeyguardMediator:Lcom/android/internal/policy/impl/KeyguardViewMediator;

    move-object/from16 v3, v0

    move-object/from16 v0, v3

    move v1, v15

    invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->setTorch(Z)V

    rem-int/lit8 v3, v41, 0xf

    if-nez v3, :cond_majdi

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mKeyguardMediator:Lcom/android/internal/policy/impl/KeyguardViewMediator;

    move-object/from16 v3, v0

    invoke-virtual/range {v3 .. v3}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->pokeWakelock()V

    :cond_majdi[/COLOR][/B]
    const-wide/16 v3, 0x0

    goto/16 :goto_8f
- Search down for "const/16 v3, 0xbb" (v3 may differ according to ROM) and do the following editing:
before:
Code:
    .line 3635
    :cond_[B][COLOR="Red"]536[/COLOR][/B]   [B][COLOR="Green"]<-- we need to copy bellow condition over it[/COLOR][/B]
    const/16 v3, 0xbb

    move/from16 v0, v32

    if-ne v0, v3, :cond_[B][COLOR="Red"]56f[/COLOR][/B]   [B][COLOR="Green"]<-- we need to define new condition[/COLOR][/B]

    .line 3637
    move-object/from16 v0, p0
after:
Code:
    .line 3635
    :cond_[B][COLOR="Blue"]56f[/COLOR][/B]
    const/16 v3, 0xbb

    move/from16 v0, v32

    if-ne v0, v3, :cond_[B][COLOR="Blue"]nj[/COLOR][/B]

    .line 3637
    move-object/from16 v0, p0
- Now we need to redefine mentioned cond_56f (it could be differ according to ROM), search UP for ".catch Landroid/content/ActivityNotFoundException;" and modify the IF-NE condition bellow it:
before:
Code:
    .catch Landroid/content/ActivityNotFoundException; {:try_start_4fd .. :try_end_506} :catch_705

    .line 3839
    .end local v43           #shortcutIntent:Landroid/content/Intent;
    :cond_506
    :goto_506
    const-wide/16 v3, -0x1

    goto/16 :goto_8f

    .line 3621
    .end local v31           #kcm:Landroid/view/KeyCharacterMap;
    :cond_50a
    const/16 v3, 0x54

    move/from16 v0, v32

    if-ne v0, v3, [B][COLOR="Red"]:cond_536[/COLOR]   [COLOR="Green"]<-- redefine this condition[/COLOR][/B]

    .line 3622
    if-eqz v15, :cond_522
after:
Code:
    .catch Landroid/content/ActivityNotFoundException; {:try_start_4fd .. :try_end_506} :catch_705

    .line 3839
    .end local v43           #shortcutIntent:Landroid/content/Intent;
    :cond_506
    :goto_506
    const-wide/16 v3, -0x1

    goto/16 :goto_8f

    .line 3621
    .end local v31           #kcm:Landroid/view/KeyCharacterMap;
    :cond_50a
    const/16 v3, 0x54

    move/from16 v0, v32

    if-ne v0, v3, [B][COLOR="Blue"]:cond_56f[/COLOR][/B]

    .line 3622
    if-eqz v15, :cond_522
- Search down for "const/16 v3, 0xdb" (v3 may differ according to ROM) and change the condition value above it to the new condition from above mentioned edited code:
before:
Code:
    .line 3654
    .end local v16           #e:Landroid/os/RemoteException;
    [B][COLOR="Red"]:cond_56f[/COLOR]   [COLOR="Green"]<-- change it to the new condition[/COLOR][/B]
    const/16 v3, 0xdb

    move/from16 v0, v32

    if-ne v0, v3, :cond_5a4
after:
Code:
    .line 3654
    .end local v16           #e:Landroid/os/RemoteException;
    [B][COLOR="Blue"]:cond_nj[/COLOR][/B]
    const/16 v3, 0xdb

    move/from16 v0, v32

    if-ne v0, v3, :cond_5a4
Save changes...

Now backsmali classsout folder to get new classes.dex file. Now Open android.policy.jar by WinRAR or 7-zip and drag and drop the new classes.dex file inside it; then push it to your device and fix permissions.
Download Torch.apk from attachment bellow and push it to your device and fix permissions as well... and viola.. lockscreen the device and do long pressing on home button to have torch flash light..:laugh:


Long press menu button to kill app

The original mod is done by maskerwsk, who modifies Mirko_ddd method
- Backsmali android.policy.jar
- Navigate to classout/com/android/internal/policy/impl/ folder and open PhoneWindowManager.smali file
- Locate the following code by tracking "mMenuLongPress" and do the following changes:
before:
Code:
    .line 1674
    new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$[B][COLOR="Red"]9[/COLOR][/B];

    invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$[B][COLOR="Red"]9[/COLOR][/B];-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

    iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mMenuLongPress:Ljava/lang/Runnable;
after:
Code:
    .line 1674
    new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$[B][COLOR="Blue"]KillConcept[/COLOR][/B];

    invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$[B][COLOR="Blue"]KillConcept[/COLOR][/B];-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

    iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mMenuLongPress:Ljava/lang/Runnable;
- Save changes.
- Now add this new file (PhoneWindowManager$KillConcept.smali) to classout/com/android/internal/policy/impl/ folder. You can download it from here.
You should make sure that the id in PhoneWindowManager$KillConcept.smali is linked to "permlab_forceBack" id in framework-res.apk public.xml
- Now recompile (smali) the classout folder and substitute classes.dex inside android.policy.jar with the new classes.dex file.. now push the modified android.policy.jar to your device and fix permissions to chmod 644.
N.B: To adjust timeout delay, see next tutorial!!
Adjust timeout delay across OS

- Backsmali framework.jar
- Navigate to classout/android/view/ folder and open ViewConfiguration.smali
- Search for this method and change RED text value:
Code:
.method public static getGlobalActionKeyTimeout()J
    .registers 2

    .prologue
    .line 669
    const-wide/16 v0, [B][COLOR="Red"]0x1f4[/COLOR][/B]

    return-wide v0
.end method
As you can see, this hex value means 500; i.e, 0.5 second.. So we will change it to which delay we want:
0xfa = 0.25 second
0x1f4 = 0.5 second (default value)
0x2ee = 0.75 second
0x3e8 = 1 second
0x4e2 = 1.25 second
0x5dc = 1.5 second
0x6d6 = 1.75 second
0x7d0 = 2 second
- Compile (smali) framework.jar and push to your device and fix permissions.
 

Attachments

Last edited:

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
Continue moddings!!

Browser Edge Zoom Enabling
<<This mod will make you able to zoom in and out in internet browser by scrolling down and up respectively from the right or left screen edge>>​
Credits to shoman94
- Baksmali framework.jar
- Navigate to classout\android\view\ folder and open ScaleGestureDetector.smali
- Search for this method ".method public onTouchEvent(Landroid/view/MotionEvent;)Z" and change the entire method to:
Code:
[B][COLOR="Blue"].method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .registers 28
    .param p1, "event"    # Landroid/view/MotionEvent;

    .prologue
    .line 207
    move-object/from16 v0, p0

    iget-object v0, v0, Landroid/view/ScaleGestureDetector;->mInputEventConsistencyVerifier:Landroid/view/InputEventConsistencyVerifier;

    move-object/from16 v24, v0

    if-eqz v24, :cond_19

    .line 208
    move-object/from16 v0, p0

    iget-object v0, v0, Landroid/view/ScaleGestureDetector;->mInputEventConsistencyVerifier:Landroid/view/InputEventConsistencyVerifier;

    move-object/from16 v24, v0

    const/16 v25, 0x0

    move-object/from16 v0, v24

    move-object/from16 v1, p1

    move/from16 v2, v25

    invoke-virtual {v0, v1, v2}, Landroid/view/InputEventConsistencyVerifier;->onTouchEvent(Landroid/view/MotionEvent;I)V


    .line 211
    :cond_19
    move-object/from16 v0, p0

    iget-boolean v0, v0, Landroid/view/ScaleGestureDetector;->mValidPackage:Z

    move/from16 v24, v0

    if-eqz v24, :cond_2a

    invoke-direct/range {p0 .. p1}, Landroid/view/ScaleGestureDetector;->onEdgeTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v24

    if-eqz v24, :cond_2a

    const/16 v24, 0x1

    .line 310
    :goto_29
    return v24

    .line 213
    :cond_2a
    invoke-virtual/range {p1 .. p1}, Landroid/view/MotionEvent;->getActionMasked()I

    move-result v3

    .line 215
    .local v3, "action":I
    const/16 v24, 0x1

    move/from16 v0, v24

    if-eq v3, v0, :cond_3a

    const/16 v24, 0x3

    move/from16 v0, v24

    if-ne v3, v0, :cond_6a

    :cond_3a
    const/16 v19, 0x1

    .line 217
    .local v19, "streamComplete":Z
    :goto_3c
    if-eqz v3, :cond_40

    if-eqz v19, :cond_6d

    .line 221
    :cond_40
    move-object/from16 v0, p0

    iget-boolean v0, v0, Landroid/view/ScaleGestureDetector;->mInProgress:Z

    move/from16 v24, v0

    if-eqz v24, :cond_65

    .line 222
    move-object/from16 v0, p0

    iget-object v0, v0, Landroid/view/ScaleGestureDetector;->mListener:Landroid/view/ScaleGestureDetector$OnScaleGestureListener;

    move-object/from16 v24, v0

    move-object/from16 v0, v24

    move-object/from16 v1, p0

    invoke-interface {v0, v1}, Landroid/view/ScaleGestureDetector$OnScaleGestureListener;->onScaleEnd(Landroid/view/ScaleGestureDetector;)V

    .line 223
    const/16 v24, 0x0

    move/from16 v0, v24

    move-object/from16 v1, p0

    iput-boolean v0, v1, Landroid/view/ScaleGestureDetector;->mInProgress:Z

    .line 224
    const/16 v24, 0x0

    move/from16 v0, v24

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mInitialSpan:F

    .line 227
    :cond_65
    if-eqz v19, :cond_6d

    .line 228
    const/16 v24, 0x1


    goto :goto_29


    .line 215
    .end local v19    # "streamComplete":Z
    :cond_6a
    const/16 v19, 0x0

    goto :goto_3c

    .line 232
    .restart local v19    # "streamComplete":Z
    :cond_6d
    const/16 v24, 0x6

    move/from16 v0, v24

    if-eq v3, v0, :cond_79

    const/16 v24, 0x5

    move/from16 v0, v24

    if-ne v3, v0, :cond_97

    :cond_79
    const/4 v4, 0x1

    .line 235
    .local v4, "configChanged":Z
    :goto_7a
    const/16 v24, 0x6

    move/from16 v0, v24

    if-ne v3, v0, :cond_99

    const/4 v14, 0x1

    .line 236
    .local v14, "pointerUp":Z
    :goto_81
    if-eqz v14, :cond_9b

    invoke-virtual/range {p1 .. p1}, Landroid/view/MotionEvent;->getActionIndex()I

    move-result v15

    .line 239
    .local v15, "skipIndex":I
    :goto_87
    const/16 v20, 0x0

    .local v20, "sumX":F
    const/16 v21, 0x0

    .line 240
    .local v21, "sumY":F
    invoke-virtual/range {p1 .. p1}, Landroid/view/MotionEvent;->getPointerCount()I

    move-result v5

    .line 241
    .local v5, "count":I
    const/4 v13, 0x0

    .local v13, "i":I
    :goto_90
    if-ge v13, v5, :cond_ae

    .line 242
    if-ne v15, v13, :cond_9d

    .line 241
    :goto_94
    add-int/lit8 v13, v13, 0x1

    goto :goto_90

    .line 232
    .end local v4    # "configChanged":Z
    .end local v5    # "count":I
    .end local v13    # "i":I
    .end local v14    # "pointerUp":Z
    .end local v15    # "skipIndex":I
    .end local v20    # "sumX":F
    .end local v21    # "sumY":F
    :cond_97
    const/4 v4, 0x0

    goto :goto_7a

    .line 235
    .restart local v4    # "configChanged":Z
    :cond_99
    const/4 v14, 0x0

    goto :goto_81

    .line 236
    .restart local v14    # "pointerUp":Z
    :cond_9b
    const/4 v15, -0x1

    goto :goto_87

    .line 243
    .restart local v5    # "count":I
    .restart local v13    # "i":I
    .restart local v15    # "skipIndex":I
    .restart local v20    # "sumX":F
    .restart local v21    # "sumY":F

    :cond_9d
    move-object/from16 v0, p1

    invoke-virtual {v0, v13}, Landroid/view/MotionEvent;->getX(I)F

    move-result v24

    add-float v20, v20, v24

    .line 244
    move-object/from16 v0, p1

    invoke-virtual {v0, v13}, Landroid/view/MotionEvent;->getY(I)F

    move-result v24

    add-float v21, v21, v24

    goto :goto_94

    .line 246

    :cond_ae
    if-eqz v14, :cond_c6

    add-int/lit8 v10, v5, -0x1

    .line 247
    .local v10, "div":I

    :goto_b2
    int-to-float v0, v10

    move/from16 v24, v0

    div-float v11, v20, v24

    .line 248
    .local v11, "focusX":F
    int-to-float v0, v10

    move/from16 v24, v0

    div-float v12, v21, v24

    .line 251
    .local v12, "focusY":F
    const/4 v6, 0x0

    .local v6, "devSumX":F
    const/4 v7, 0x0

    .line 252
    .local v7, "devSumY":F
    const/4 v13, 0x0

    :goto_bf
    if-ge v13, v5, :cond_e5

    .line 253
    if-ne v15, v13, :cond_c8

    .line 252

    :goto_c3
    add-int/lit8 v13, v13, 0x1

    goto :goto_bf

    .end local v6    # "devSumX":F
    .end local v7    # "devSumY":F
    .end local v10    # "div":I
    .end local v11    # "focusX":F
    .end local v12    # "focusY":F
    :cond_c6
    move v10, v5

    .line 246

    goto :goto_b2

    .line 254
    .restart local v6    # "devSumX":F
    .restart local v7    # "devSumY":F
    .restart local v10    # "div":I
    .restart local v11    # "focusX":F
    .restart local v12    # "focusY":F
    :cond_c8
    move-object/from16 v0, p1

    invoke-virtual {v0, v13}, Landroid/view/MotionEvent;->getX(I)F

    move-result v24

    sub-float v24, v24, v11

    invoke-static/range {v24 .. v24}, Ljava/lang/Math;->abs(F)F

    move-result v24

    add-float v6, v6, v24

    .line 255
    move-object/from16 v0, p1

    invoke-virtual {v0, v13}, Landroid/view/MotionEvent;->getY(I)F

    move-result v24

    sub-float v24, v24, v12

    invoke-static/range {v24 .. v24}, Ljava/lang/Math;->abs(F)F

    move-result v24

    add-float v7, v7, v24


    goto :goto_c3

    .line 257
    :cond_e5
    int-to-float v0, v10

    move/from16 v24, v0

    div-float v8, v6, v24

    .line 258
    .local v8, "devX":F
    int-to-float v0, v10

    move/from16 v24, v0

    div-float v9, v7, v24

    .line 263
    .local v9, "devY":F
    const/high16 v24, 0x40000000

    mul-float v17, v8, v24

    .line 264
    .local v17, "spanX":F
    const/high16 v24, 0x40000000

    mul-float v18, v9, v24

    .line 265
    .local v18, "spanY":F
    mul-float v24, v17, v17

    mul-float v25, v18, v18

    add-float v24, v24, v25

    invoke-static/range {v24 .. v24}, Landroid/util/FloatMath;->sqrt(F)F

    move-result v16

    .line 270
    .local v16, "span":F
    move-object/from16 v0, p0

    iget-boolean v0, v0, Landroid/view/ScaleGestureDetector;->mInProgress:Z

    move/from16 v23, v0

    .line 271
    .local v23, "wasInProgress":Z
    move-object/from16 v0, p0

    iput v11, v0, Landroid/view/ScaleGestureDetector;->mFocusX:F

    .line 272
    move-object/from16 v0, p0

    iput v12, v0, Landroid/view/ScaleGestureDetector;->mFocusY:F

    .line 273
    move-object/from16 v0, p0

    iget-boolean v0, v0, Landroid/view/ScaleGestureDetector;->mInProgress:Z

    move/from16 v24, v0

    if-eqz v24, :cond_13a

    const/16 v24, 0x0

    cmpl-float v24, v16, v24

    if-eqz v24, :cond_11f

    if-eqz v4, :cond_13a

    .line 274
    :cond_11f
    move-object/from16 v0, p0

    iget-object v0, v0, Landroid/view/ScaleGestureDetector;->mListener:Landroid/view/ScaleGestureDetector$OnScaleGestureListener;

    move-object/from16 v24, v0

    move-object/from16 v0, v24

    move-object/from16 v1, p0

    invoke-interface {v0, v1}, Landroid/view/ScaleGestureDetector$OnScaleGestureListener;->onScaleEnd(Landroid/view/ScaleGestureDetector;)V

    .line 275
    const/16 v24, 0x0

    move/from16 v0, v24

    move-object/from16 v1, p0

    iput-boolean v0, v1, Landroid/view/ScaleGestureDetector;->mInProgress:Z

    .line 276
    move/from16 v0, v16

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mInitialSpan:F

    .line 278
    :cond_13a
    if-eqz v4, :cond_166

    .line 279
    move/from16 v0, v17

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpanX:F

    move/from16 v0, v17

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpanX:F

    .line 280
    move/from16 v0, v18

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpanY:F

    move/from16 v0, v18

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpanY:F

    .line 281
    move/from16 v0, v16

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpan:F

    move/from16 v0, v16

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpan:F

    move/from16 v0, v16

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mInitialSpan:F

    .line 283
    :cond_166
    move-object/from16 v0, p0

    iget-boolean v0, v0, Landroid/view/ScaleGestureDetector;->mInProgress:Z

    move/from16 v24, v0

    if-nez v24, :cond_1d0

    const/16 v24, 0x0

    cmpl-float v24, v16, v24

    if-eqz v24, :cond_1d0

    if-nez v23, :cond_191

    move-object/from16 v0, p0

    iget v0, v0, Landroid/view/ScaleGestureDetector;->mInitialSpan:F

    move/from16 v24, v0

    sub-float v24, v16, v24

    invoke-static/range {v24 .. v24}, Ljava/lang/Math;->abs(F)F

    move-result v24

    move-object/from16 v0, p0

    iget v0, v0, Landroid/view/ScaleGestureDetector;->mSpanSlop:I

    move/from16 v25, v0

    move/from16 v0, v25

    int-to-float v0, v0

    move/from16 v25, v0

    cmpl-float v24, v24, v25

    if-lez v24, :cond_1d0

    .line 285
    :cond_191
    move/from16 v0, v17

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpanX:F

    move/from16 v0, v17

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpanX:F

    .line 286
    move/from16 v0, v18

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpanY:F

    move/from16 v0, v18

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpanY:F

    .line 287
    move/from16 v0, v16

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpan:F

    move/from16 v0, v16

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpan:F

    .line 288
    move-object/from16 v0, p0

    iget-object v0, v0, Landroid/view/ScaleGestureDetector;->mListener:Landroid/view/ScaleGestureDetector$OnScaleGestureListener;

    move-object/from16 v24, v0

    move-object/from16 v0, v24

    move-object/from16 v1, p0

    invoke-interface {v0, v1}, Landroid/view/ScaleGestureDetector$OnScaleGestureListener;->onScaleBegin(Landroid/view/ScaleGestureDetector;)Z

    move-result v24

    move/from16 v0, v24

    move-object/from16 v1, p0

    iput-boolean v0, v1, Landroid/view/ScaleGestureDetector;->mInProgress:Z

    .line 289
    const-string v24, "ScaleGestureDetector"

    const-string v25, "SGD"

    invoke-static/range {v24 .. v25}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 293
    :cond_1d0
    const/16 v24, 0x2

    move/from16 v0, v24

    if-ne v3, v0, :cond_226

    .line 294
    move/from16 v0, v17

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpanX:F

    .line 295
    move/from16 v0, v18

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpanY:F

    .line 296
    move/from16 v0, v16

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mCurrSpan:F

    .line 298
    const/16 v22, 0x1

    .line 299
    .local v22, "updatePrev":Z
    move-object/from16 v0, p0

    iget-boolean v0, v0, Landroid/view/ScaleGestureDetector;->mInProgress:Z

    move/from16 v24, v0

    if-eqz v24, :cond_200

    .line 300
    move-object/from16 v0, p0

    iget-object v0, v0, Landroid/view/ScaleGestureDetector;->mListener:Landroid/view/ScaleGestureDetector$OnScaleGestureListener;

    move-object/from16 v24, v0

    move-object/from16 v0, v24

    move-object/from16 v1, p0

    invoke-interface {v0, v1}, Landroid/view/ScaleGestureDetector$OnScaleGestureListener;->onScale(Landroid/view/ScaleGestureDetector;)Z

    move-result v22

    .line 303
    :cond_200
    if-eqz v22, :cond_226

    .line 304
    move-object/from16 v0, p0

    iget v0, v0, Landroid/view/ScaleGestureDetector;->mCurrSpanX:F

    move/from16 v24, v0

    move/from16 v0, v24

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpanX:F

    .line 305
    move-object/from16 v0, p0

    iget v0, v0, Landroid/view/ScaleGestureDetector;->mCurrSpanY:F

    move/from16 v24, v0

    move/from16 v0, v24

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpanY:F

    .line 306
    move-object/from16 v0, p0

    iget v0, v0, Landroid/view/ScaleGestureDetector;->mCurrSpan:F

    move/from16 v24, v0

    move/from16 v0, v24

    move-object/from16 v1, p0

    iput v0, v1, Landroid/view/ScaleGestureDetector;->mPrevSpan:F

    .line 310
    .end local v22    # "updatePrev":Z
    :cond_226
    const/16 v24, 0x1

    goto/16 :goto_29
.end method[/COLOR][/B]
- Save changes and smali your framework.jar and push it to device.



Airview Enabling + Control Panel + S Pen Gesture

[Section A] Enabling app Air view:
Part: One
1. Just add this file to /system/etc/permissions in your phone.
2. Fix permission to rw-r--r-- and reboot
This will fully fix air-view for VideoPlayer and partially for S Planner!! Continue to part two and three to fix it for Gallary and Launcher..:laugh:
Part: Two (thanks to eybee1970 and Robbie Hood)
1. Decompile SecGallary2_Galaxy.apk
2. Go to res\values folder and open bools.xml file and do these changes:
Code:
    <bool name="isEspresso">[B][COLOR="Blue"]true[/COLOR][/B]</bool>
    <bool name="isTablet">[B][COLOR="Blue"]true[/COLOR][/B]</bool>
3. Save changes, recompile and push to your phone.

Part: Three
1. Decompile SecLauncher2.apk
2. Go to res\values folder and open bools.xml file and do these changes:
Code:
    <bool name="config_FolderHovering">[B][COLOR="Blue"]true[/COLOR][/B]</bool>
[Section B] Enabling Air view Control Panel and SPen Gesture in settings menu:
Special thanks to @not-i for helping in porting pen gesture.
- Baksmali SecSettings.apk
- Navigate to classout\com\android\settings folder and open PenSettingsMenu.smali
- In the method ".method public onCreate(Landroid/os/Bundle;)V", locate this section and delete all colored text (don't delete the defined condition.!!):
Code:
    .line 198
    :cond_209

   [B][COLOR="Red"] invoke-virtual {p0}, Lcom/android/settings/PenSettingsMenu;->getPreferenceScreen()Landroid/preference/PreferenceScreen;

    move-result-object v0

    const-string v1, "pen_hover"

    invoke-virtual {p0, v1}, Lcom/android/settings/PenSettingsMenu;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z[/COLOR][/B]

    .line 199

    [B][COLOR="Blue"]invoke-virtual {p0}, Lcom/android/settings/PenSettingsMenu;->getPreferenceScreen()Landroid/preference/PreferenceScreen;

    move-result-object v0

    iget-object v1, p0, Lcom/android/settings/PenSettingsMenu;->mPenHovering:Landroid/preference/SwitchPreferenceScreen;

    invoke-virtual {v0, v1}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z[/COLOR][/B]

    .line 200

    [B][COLOR="Green"]invoke-virtual {p0}, Lcom/android/settings/PenSettingsMenu;->getPreferenceScreen()Landroid/preference/PreferenceScreen;

    move-result-object v0

    iget-object v1, p0, Lcom/android/settings/PenSettingsMenu;->mPenHoveringSound:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0, v1}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z[/COLOR][/B]

    .line 206
    [B][COLOR="DarkOrange"]invoke-virtual {p0}, Lcom/android/settings/PenSettingsMenu;->getPreferenceScreen()Landroid/preference/PreferenceScreen;

    move-result-object v0

    const-string v1, "pen_gesture_category"

    invoke-virtual {p0, v1}, Lcom/android/settings/PenSettingsMenu;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z[/COLOR][/B]

    .line 207
    [B][COLOR="Magenta"]invoke-virtual {p0}, Lcom/android/settings/PenSettingsMenu;->getPreferenceScreen()Landroid/preference/PreferenceScreen;

    move-result-object v0

    const-string v1, "pen_quick_command"

    invoke-virtual {p0, v1}, Lcom/android/settings/PenSettingsMenu;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z[/COLOR][/B]
Legend:
Deleting red codes: This will enable Air View header.
Deleting blue codes: This will enable Air View switch with control panel.
Deleting green codes: This will enable Air View haptic feedback.
Deleting orange codes: This will enable Pen gestures header.
Deleting purple codes: This will enable Quick command main action in Pen gestures category.
You can delete or keep ".line xxx" debugging; it is up to you.!!.
- Save changes.. smali SecSettings.apk, push it to your phone and fix permissions to rw-r--r-- (644).
- Push "SPenGesturePad.apk" to your phone and fix permissions to rw-r--r-- (644).
- Reboot the phone into recovery mode and flash SGNII_VODB.zip file.
N.B:
If you want to download extra languages for VODB, please see this post here.
Results:





Adding Extra About Info to Your ROM to Suit Your Ego

- Decompile SecSettings.apk
- Navigate to res\values\ folder and open strings.xml file by Notepad++ and keep it open, we will need it later.
- Navigate to res\xml\ folder and open device_info_settings.xml file by Notepad++.

Now, I will divide the tutorial into 2 sections..

Section One: Adding header category for about device menu.


- In device_info_settings.xml, at the top, do these changes (remove the red > and add blue lines):
before:
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/about_settings" android:key="about_device"
  xmlns:android="http://schemas.android.com/apk/res/android"[B][COLOR="Red"]>[/COLOR][/B]
      <PreferenceScreen android:title="@string/help_title" android:key="help" android:summary="@string/help_title_summary">
after:
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/about_settings" android:key="about_device"
  xmlns:android="http://schemas.android.com/apk/res/android"
  [B][COLOR="Blue"]xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
    <PreferenceCategory android:title="@string/about_gen" android:key="dummy_gen" />[/COLOR][/B]
    <PreferenceScreen android:title="@string/help_title" android:key="help" android:summary="@string/help_title_summary">
Explaination: we added header category with dummy key reference.
- Now we need to add strings resources, open strings.xml and add this line string resource before </resources> line:
Code:
	<string name="about_gen">[B][COLOR="Green"]General information[/COLOR][/B]</string>
You can change the green color text to whatever you want to display
- We have finished from section one.

Section Two: Adding About ROM new information.


- In device_info_settings.xml, go to the end and add these lines before </PreferenceScreen> line:
Code:
	<PreferenceCategory android:title="@string/rom_info" android:key="dummy_key">
		<Preference android:title="@string/rom_name" android:key="rom_name" android:summary="@string/rom_name_details" style="?android:preferenceInformationStyle" />
		<Preference android:title="@string/rom_ver" android:key="rom_ver" android:summary="@string/rom_ver_details" style="?android:preferenceInformationStyle" />
		<Preference android:title="@string/rom_date" android:key="rom_date" android:summary="@string/rom_date_details" style="?android:preferenceInformationStyle" />
		<Preference android:title="@string/rom_developer" android:key="rom_developer" android:summary="@string/rom_developer_name" style="?android:preferenceInformationStyle" />
		<Preference android:title="@string/dev_thanks" android:key="dev_thanks" android:summary="@string/dev_thanks_name" style="?android:preferenceInformationStyle" />
	</PreferenceCategory>
N.B: all referred android:key here are dummy ones; i.e, don't do anything and it can be anything since it has no reference. You can't delete android:key; it must be there to prevent code fragmentation.
- Now we need to add strings resources, open strings.xml and add these lines string resources before </resources> line:
Code:
	<string name="rom_info">[B][COLOR="Green"]About ROM[/COLOR][/B]</string>
	<string name="rom_name">[B][COLOR="Green"]ROM name[/COLOR][/B]</string>
	<string name="rom_name_details">[B][COLOR="Green"]GloryROM[/COLOR][/B]</string>
	<string name="rom_ver">[B][COLOR="Green"]ROM version[/COLOR][/B]</string>
	<string name="rom_ver_details">[B][COLOR="Green"]v4.5 with Multi-Languages and Multi-CSC[/COLOR][/B]</string>
	<string name="rom_date">[B][COLOR="Green"]Release date[/COLOR][/B]</string>
	<string name="rom_date_details">[B][COLOR="Green"]March 2013[/COLOR][/B]</string>
	<string name="rom_developer">[B][COLOR="Green"]ROM developer[/COLOR][/B]</string>
	<string name="rom_developer_name">[B][COLOR="Green"]majdinj - xda.developers.com[/COLOR][/B]</string>
	<string name="dev_thanks">[B][COLOR="Green"]Thanks to[/COLOR][/B]</string>
	<string name="dev_thanks_name">[B][COLOR="Green"]ThaiDai for his ML ROM base[/COLOR][/B]</string>
You can change the green color text to whatever you want to display
- We have finished from section two.
- Save changes.

Now recompile your SecSettings.apk, push it to your phone, fix permissions (644) and reboot.



Enable TW Launcher Rotation

- Decompile SecLauncher2.apk
- Go to \res\values folder and open integers.xml
- Search for this line:
Code:
<integer name="config_screenOrientation">[B][COLOR="Red"]1[/COLOR][/B]</integer>
- Change the integer number to one of actions bellow:
  • 1 = Disabled
  • 2 = Enabled when Screen Rotation is switched on (270 degree)
  • 3 = As same as 2
  • 4 = Always enabled even if Screen Rotation is switched off (270 degree)
  • 5 = Always default position
  • 6 = Always in landscape mode (to the left)
  • 7 = As same as 5
  • 8 = Always in landscape mode (to the right)
  • 9 = Upside down portrait when Screen Rotation is switched on
  • 10= As same as 4 but for all directions (360 degree)
- Save changes.. recompile, push it to your device and fix permissions to 644 and reboot.
N.B: This will delete all preset home-screens..!!
Results:



Enable LockScreen Rotation

- Decompile framework-res.apk
- Go to \res\values folder and open bools.xml
- Change false to true in this line:
Code:
<bool name="config_enableLockScreenRotation">[B][COLOR="Blue"]true[/COLOR][/B]</bool>
- Save changes.. recompile, push it to your device and fix permissions to 644 and reboot.
N.B: This will always enable LockScreen rotation even if Screen Rotation toggle is switched off..!!
Results:




We haven't finished our tutorials,,, Please go ahead to post #393 until #402 (some are reserved post in the moment..!)
 
Last edited:

deaddrg

Senior Member
Oct 5, 2012
105
4
18
not that smart alert there were motion features in 4,1,1 but now are missing
1.smart alert-vibrates when you pick up your phone if you have a missed call.
2.quick glance-if you cover your front cam it will show just a quick glance of messages and missed calls.
can we get these features in 4.2 ????????????????????
 

deaddrg

Senior Member
Oct 5, 2012
105
4
18
not that smart alert there were motion features in 4,1,1 but now are missing
1.smart alert-vibrates when you pick up your phone if you have a missed call.
2.quick glance-if you cover your front cam it will show just a quick glance of messages and missed calls.
can we get these features in 4.2 ????????????????????
 

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
not that smart alert there were motion features in 4,1,1 but now are missing
1.smart alert-vibrates when you pick up your phone if you have a missed call.
2.quick glance-if you cover your front cam it will show just a quick glance of messages and missed calls.
can we get these features in 4.2 ????????????????????
I will look for it, though I didn't have any idea about this feature before.. nice to hear bro :good:

How to remove the Sms from Call log. i just eagerly waiting to do it..
Actually I know 3 ways to approach this mod:
1. "SecContacts.apk mod": it just sets call log to view all call log by default instead of all log; so sms, mms and email log still can be logged if you want to (this is a clean way but not permanent!)..
2. "LogsProvider.apk mod": that actually disables sms, mms and email from being logged to call log permanently but it causes problem with stock Email.apk!!!!
3. The one that I like!! that uses "SecMms.apk mod" that disable the code that call for logging the history of sms, mms and email permanently (I might post this one nearby).. but my question to developer, have anybody come across this way "i.e, modding SecMms.apk" for call log and have any issue??? if not, I will post the method here within these days...

cheers :cool:
Marry Christmas to you all mate
 

ekache

Senior Member
Jan 30, 2009
343
15
0
41
Jakarta
Smart Alert

not that smart alert there were motion features in 4,1,1 but now are missing
1.smart alert-vibrates when you pick up your phone if you have a missed call.
2.quick glance-if you cover your front cam it will show just a quick glance of messages and missed calls.
can we get these features in 4.2 ????????????????????
¨¨ўūþ¨☺...that's what I meant with the "Smart Alert" not the "Smart Alarm".
it was an option in Settings-Motion-smart alert from XXLS2 (4.1.1).
 

Attachments

resac

Senior Member
Feb 9, 2011
137
119
0
Banglore
Actually I know 3 ways to approach this mod:
1. "SecContacts.apk mod": it just sets call log to view all call log by default instead of all log; so sms, mms and email log still can be logged if you want to (this is a clean way but not permanent!)..
2. "LogsProvider.apk mod": that actually disables sms, mms and email from being logged to call log permanently but it causes problem with stock Email.apk!!!!
3. The one that I like!! that uses "SecMms.apk mod" that disable the code that call for logging the history of sms, mms and email permanently (I might post this one nearby).. but my question to developer, have anybody come across this way "i.e, modding SecMms.apk" for call log and have any issue??? if not, I will post the method here within these days...


Thanks Bro.. and I m waiting to get that mod or tut to mod.. Thanks
 

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
Thanks Bro.. and I m waiting to get that mod or tut to mod.. Thanks
OK.. I think it is better to be shared between us all to test it and to report bugs regarding the functionality of SMS, MMS, Email & phone applications; so I will do the mod, and I will put it in "Galaxy Note GT-N7000 Themes and Apps" section and I will see other members feedback and if it is good, I will put [how to do this mod for DEV] here...:cool:

Edit: you can test this mod now on my thread here
 
Last edited:

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
¨¨ўūþ¨☺...that's what I meant with the "Smart Alert" not the "Smart Alarm".
it was an option in Settings-Motion-smart alert from XXLS2 (4.1.1).
I managed to make motion menu to display Smart Alert feature but how can I use it??
I made a miss call to my phone, and after a while I pick up the phone but no vibration!!
Are there any things to do to make it working or just enable the feature in motion menu and that is all!!!!