[Sony Cross-Device Development Themes and Apps] venkat kamesh:
hello guys

Here go i come with new tut today

which i got from awesome cataclysm rom and cyanogenmod

So i dont want to kill all your time

i will explain you very simple way

For MM version of Tut Click here

All you need is

android.policy.jar ( deodexed )

settings.apk (deodexed )

1. Decompile android.policy.jar

2. open com/android/internal/policy/impl/PhoneWindowManager.smali

3. look for this method

.method public updateSettings()V

completely replace with this method

.method public updateSettings()V
.locals 24

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

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

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

move-result-object v10

.line 1924
.local v10, "resolver":Landroid/content/ContentResolver;
const/4 v11, 0x0

.line 1925
.local v11, "updateRotation":Z
move-object/from16 v0, p0

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

move-object/from16 v16, v0

monitor-enter v16

.line 1926
:try_start_0
const-string v15, "end_button_behavior"

const/16 v17, 0x2

const/16 v18, -0x2

move/from16 v0, v17

move/from16 v1, v18

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

move-result v15

move-object/from16 v0, p0

iput v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mEndcallBehavior:I

.line 1553
const-string v15, "incall_power_button_behavior"

const/16 v17, 0x1

const/16 v18, -0x2

move/from16 v0, v17

move/from16 v1, v18

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

move-result v15

move-object/from16 v0, p0

iput v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIncallPowerBehavior:I

move-object/from16 v0, p0

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

invoke-virtual {v15}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v15

const v17, 0x1050012

move/from16 v0, v17

invoke-virtual {v15, v0}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

move-result v4

.line 1936
.local v4, "navBarDefaultHeight":I
move-object/from16 v0, p0

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

invoke-virtual {v15}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v15

const v17, 0x1050014

move/from16 v0, v17

invoke-virtual {v15, v0}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

move-result v5

.local v5, "navBarDefaultWidth":I
move-object/from16 v0, p0

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

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

move-result-object v15

const-string v17, "navigation_bar_height"

const/16 v18, 0x64

move-object/from16 v0, v17

move/from16 v1, v18

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

move-result v15

mul-int/2addr v15, v4

div-int/lit8 v6, v15, 0x64

.local v6, "navBarHeight":I
sub-int v15, v4, v5

sub-int v7, v6, v15

.local v7, "navBarWidth":I
move-object/from16 v0, p0

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

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

move-result-object v15

const-string v17, "resize_only_portrait"

const/16 v18, 0x0

move-object/from16 v0, v17

move/from16 v1, v18

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

move-result v15

const/16 v17, 0x1

move/from16 v0, v17

if-ne v15, v0, :cond_7

const/4 v9, 0x1

.line 1939
.local v9, "resizeOnlyPortrait":Z
:goto_0
move-object/from16 v0, p0

iget-object v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBarHeightForRotation:[I

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mPortraitRotation:I

move/from16 v17, v0

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBarHeightForRotation:[I

move-object/from16 v18, v0

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mUpsideDownRotation:I

move/from16 v19, v0

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBarHeightForRotation:[I

move-object/from16 v20, v0

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLandscapeRotation:I

move/from16 v21, v0

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBarHeightForRotation:[I

move-object/from16 v22, v0

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSeascapeRotation:I

move/from16 v23, v0

aput v6, v22, v23

aput v6, v20, v21

aput v6, v18, v19

aput v6, v15, v17

move-object/from16 v0, p0

iget-object v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBarWidthForRotation:[I

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mPortraitRotation:I

move/from16 v17, v0

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBarWidthForRotation:[I

move-object/from16 v18, v0

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mUpsideDownRotation:I

move/from16 v19, v0

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBarWidthForRotation:[I

move-object/from16 v20, v0

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLandscapeRotation:I

move/from16 v21, v0

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBarWidthForRotation:[I

move-object/from16 v22, v0

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSeascapeRotation:I

move/from16 v23, v0

if-eqz v9, :cond_8

.end local v5 # "navBarDefaultWidth":I
:goto_1
aput v5, v22, v23

aput v5, v20, v21

aput v5, v18, v19

aput v5, v15, v17

.line 1588
const-string v15, "wake_gesture_enabled"

const/16 v17, 0x0

const/16 v18, -0x2

move/from16 v0, v17

move/from16 v1, v18

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

move-result v15

if-eqz v15, :cond_b

const/4 v14, 0x1

.line 1591
.local v14, "wakeGestureEnabledSetting":Z
:goto_2
move-object/from16 v0, p0

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

if-eq v15, v14, :cond_0

.line 1940
move-object/from16 v0, p0

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

.line 1941
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->updateWakeGestureListenerLp()V

.line 1945
:cond_0
move-object/from16 v0, p0

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

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

move-result-object v17

const-string v15, "user_rotation"

const/16 v17, 0x0

const/16 v18, -0x2

move/from16 v0, v17

move/from16 v1, v18

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

move-result v12

.line 1948
.local v12, "userRotation":I
move-object/from16 v0, p0

iget v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mUserRotation:I

if-eq v15, v12, :cond_1

.line 1949
move-object/from16 v0, p0

iput v12, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mUserRotation:I

.line 1950
const/4 v11, 0x1

.line 1952
:cond_1
const-string v15, "accelerometer_rotation"

const/16 v17, 0x0

const/16 v18, -0x2

move/from16 v0, v17

move/from16 v1, v18

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

move-result v15

if-eqz v15, :cond_e

const/4 v13, 0x0

.line 1956
.local v13, "userRotationMode":I
:goto_3
move-object/from16 v0, p0

iget v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mUserRotationMode:I

if-eq v15, v13, :cond_2

.line 1957
move-object/from16 v0, p0

iput v13, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mUserRotationMode:I

.line 1958
const/4 v11, 0x1

.line 1959
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->updateOrientationListenerLp()V

.line 1962
:cond_2
move-object/from16 v0, p0

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

if-eqz v15, :cond_3

.line 1963
const-string v15, "pointer_location"

const/16 v17, 0x0

const/16 v18, -0x2

move/from16 v0, v17

move/from16 v1, v18

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

move-result v8

.line 1965
.local v8, "pointerLocation":I
move-object/from16 v0, p0

iget v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mPointerLocationMode:I

if-eq v15, v8, :cond_3

.line 1966
move-object/from16 v0, p0

iput v8, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mPointerLocationMode:I

.line 1967
move-object/from16 v0, p0

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

move-object/from16 v17, v0

if-eqz v8, :cond_f

const/4 v15, 0x1

:goto_4
move-object/from16 v0, v17

invoke-virtual {v0, v15}, Landroid/os/Handler;->sendEmptyMessage(I)Z

.end local v8 # "pointerLocation":I
:cond_3
const-string v15, "screen_off_timeout"

const/16 v17, 0x0

const/16 v18, -0x2

move/from16 v0, v17

move/from16 v1, v18

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

move-result v15

move-object/from16 v0, p0

iput v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLockScreenTimeout:I

.line 1974
const-string v15, "default_input_method"

const/16 v17, -0x2

move/from16 v0, v17

invoke-static {v10, v15, v0}, Landroid/provider/Settings$Secure;->getStringForUser(Landroid/content/ContentResolver;Ljava/lang/String;I)Ljava/lang/String;

move-result-object v3

.line 1976
.local v3, "imId":Ljava/lang/String;
if-eqz v3, :cond_10

invoke-virtual {v3}, Ljava/lang/String;->length()I

move-result v15

if-lez v15, :cond_10

const/4 v2, 0x1

.line 1977
.local v2, "hasSoftInput":Z
:goto_5
move-object/from16 v0, p0

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

if-eq v15, v2, :cond_4

.line 1978
move-object/from16 v0, p0

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

.line 1979
const/4 v11, 0x1

.line 1981
:cond_4
move-object/from16 v0, p0

iget-object v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mImmersiveModeConfirmation:Lcom/android/internal/policy/impl/ImmersiveModeConfirmation;

if-eqz v15, :cond_5

.line 1982
move-object/from16 v0, p0

iget-object v15, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mImmersiveModeConfirmation:Lcom/android/internal/policy/impl/ImmersiveModeConfirmation;

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mCurrentUserId:I

move/from16 v17, v0

move/from16 v0, v17

invoke-virtual {v15, v0}, Lcom/android/internal/policy/impl/ImmersiveModeConfirmation;->loadSetting(I)V

.line 1984
:cond_5
move-object/from16 v0, p0

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

invoke-static {v15}, Lcom/android/internal/policy/impl/PolicyControl;->reloadFromSetting(Landroid/content/Context;)V

.line 1985
monitor-exit v16
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0

.line 1986
if-eqz v11, :cond_6

.line 1987
const/4 v15, 0x1

move-object/from16 v0, p0

invoke-virtual {v0, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager;->updateRotation(Z)V

.line 1989
:cond_6
return-void

.line 1565
.end local v2 # "hasSoftInput":Z
.end local v3 # "imId":Ljava/lang/String;
.end local v9 # "resizeOnlyPortrait":Z
.end local v12 # "userRotation":I
.end local v13 # "userRotationMode":I
.end local v14 # "wakeGestureEnabledSetting":Z
.restart local v5 # "navBarDefaultWidth":I
:cond_7
const/4 v9, 0x0

goto/16 :goto_0

.restart local v9 # "resizeOnlyPortrait":Z
:cond_8
move v5, v7

.line 1573
goto/16 :goto_1

.line 1581
.end local v5 # "navBarDefaultWidth":I

.line 1952
:cond_b
const/4 v14, 0x0

goto/16 :goto_2

.line 1596
.restart local v14 # "wakeGestureEnabledSetting":Z
.line 1608
.restart local v12 # "userRotation":I
:cond_e
const/4 v13, 0x1

goto/16 :goto_3

.line 1623
.restart local v8 # "pointerLocation":I
.restart local v13 # "userRotationMode":I
:cond_f
const/4 v15, 0x2

goto :goto_4

.line 1632
.end local v8 # "pointerLocation":I
.restart local v3 # "imId":Ljava/lang/String;
:cond_10
const/4 v2, 0x0

goto :goto_5

.line 1641
.end local v3 # "imId":Ljava/lang/String;
.end local v4 # "navBarDefaultHeight":I
.end local v6 # "navBarHeight":I
.end local v7 # "navBarWidth":I
.end local v9 # "resizeOnlyPortrait":Z
.end local v12 # "userRotation":I
.end local v13 # "userRotationMode":I
.end local v14 # "wakeGestureEnabledSetting":Z
:catchall_0
move-exception v15

:try_start_1
monitor-exit v16
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0

throw v15
.end method

3. open android.policy.jar/smali/com/android/internal/policy/impl/PhoneWindowManager$SettingsObserver

look for this method

.method observe()V

in this method

after look for this

const-string v1, "pointer_location"

Before that

add these lines

.line 874
const-string v1, "navigation_bar_height"

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

move-result-object v1

invoke-virtual [COLOR="Red"]{v0, v1, v3, p0, v2}[/COLOR], Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

.line 875
const-string v1, "resize_only_portrait"

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

move-result-object v1

invoke-virtual [COLOR="Red"]{v0, v1, v3, p0, v2}[/COLOR], Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

the above red codes should match the one in smali

example

my code look like this

const-string v1, "wake_gesture_enabled"

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

move-result-object v1

invoke-virtual [COLOR="red"]{v0, v1, v3, p0, v2}[/COLOR], Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

so here my red line code matched the above ( this is must part )

done and compile

For settings look for the