[Sony Cross-Device Development Themes and Apps] venkat kamesh:
part 2

In the same file

4. continue

Look for this method

.method private adjustExtraKeyGravity(Landroid/view/View;Z)V

Above that method

add these methods

.method static synthetic access$200(Lcom/android/systemui/statusbar/phone/NavigationBarView;)Landroid/content/Context;
.locals 1
.param p0, "x0" # Lcom/android/systemui/statusbar/phone/NavigationBarView;

.prologue
.line 64
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mContext:Landroid/content/Context;

return-object v0
.end method

.method static synthetic access$300(Lcom/android/systemui/statusbar/phone/NavigationBarView;)Landroid/content/Context;
.locals 1
.param p0, "x0" # Lcom/android/systemui/statusbar/phone/NavigationBarView;

.prologue
.line 64
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mContext:Landroid/content/Context;

return-object v0
.end method

5. Look for this method

.method private notifyVerticalChangedListener(Z)V

Above that method add these code

.method private mySwipeDetector(FFJFFJ)V
.locals 11
.param p1, "e1X" # F
.param p2, "e1Y" # F
.param p3, "e1Time" # J
.param p5, "e2X" # F
.param p6, "e2Y" # F
.param p7, "e2Time" # J

.prologue
.line 276
iget-object v6, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mContext:Landroid/content/Context;

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

move-result-object v6

invoke-virtual {v6}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

move-result-object v6

iget v6, v6, Landroid/content/res/Configuration;->orientation:I

const/4 v7, 0x1

if-ne v6, v7, :cond_1

const/4 v2, 0x1

.line 277
.local v2, "isPortrait":Z
:goto_0
sub-float v0, p5, p1

.line 278
.local v0, "distanceX":F
sub-float v1, p6, p2

.line 279
.local v1, "distanceY":F
sub-long v6, p7, p3

long-to-float v6, v6

div-float v6, v0, v6

const/high16 v7, 0x447a0000 # 1000.0f

mul-float v4, v6, v7

.line 280
.local v4, "velocityX":F
sub-long v6, p7, p3

long-to-float v6, v6

div-float v6, v1, v6

const/high16 v7, 0x447a0000 # 1000.0f

mul-float v5, v6, v7

.line 281
.local v5, "velocityY":F
const-string v3, ""

.line 282
.local v3, "summary":Ljava/lang/String;
if-eqz v2, :cond_2

.line 283
invoke-static {v0}, Ljava/lang/Math;->abs(F)F

move-result v6

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

move-result v7

cmpl-float v6, v6, v7

if-lez v6, :cond_0

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

move-result v6

const/high16 v7, 0x43960000 # 300.0f

cmpl-float v6, v6, v7

if-lez v6, :cond_0

const/high16 v6, -0x3db80000 # -50.0f

cmpl-float v6, p6, v6

if-lez v6, :cond_0

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

move-result v6

const/high16 v7, 0x447a0000 # 1000.0f

cmpl-float v6, v6, v7

if-lez v6, :cond_0

.line 285
iget-object v6, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mPowerManager:Landroid/os/PowerManager;

invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

move-result-wide v8

invoke-virtual {v6, v8, v9}, Landroid/os/PowerManager;->goToSleep(J)V

.line 303
:cond_0
:goto_1
return-void

.line 276
.end local v0 # "distanceX":F
.end local v1 # "distanceY":F
.end local v2 # "isPortrait":Z
.end local v3 # "summary":Ljava/lang/String;
.end local v4 # "velocityX":F
.end local v5 # "velocityY":F
:cond_1
const/4 v2, 0x0

goto :goto_0

.line 298
.restart local v0 # "distanceX":F
.restart local v1 # "distanceY":F
.restart local v2 # "isPortrait":Z
.restart local v3 # "summary":Ljava/lang/String;
.restart local v4 # "velocityX":F
.restart local v5 # "velocityY":F
:cond_2
invoke-static {v1}, Ljava/lang/Math;->abs(F)F

move-result v6

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

move-result v7

cmpl-float v6, v6, v7

if-lez v6, :cond_0

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

move-result v6

const/high16 v7, 0x43960000 # 300.0f

cmpl-float v6, v6, v7

if-lez v6, :cond_0

const/high16 v6, -0x3db80000 # -50.0f

cmpl-float v6, p5, v6

if-lez v6, :cond_0

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

move-result v6

const/high16 v7, 0x447a0000 # 1000.0f

cmpl-float v6, v6, v7

if-lez v6, :cond_0

.line 300
iget-object v6, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mPowerManager:Landroid/os/PowerManager;

invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

move-result-wide v8

invoke-virtual {v6, v8, v9}, Landroid/os/PowerManager;->goToSleep(J)V

goto :goto_1
.end method

6. Now Find this

# virtual methods

Below that add this code

.method public dp2Px(F)I
.locals 3
.param p1, "dp" # F

.prologue
.line 544
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mContext:Landroid/content/Context;

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

move-result-object v1

invoke-virtual {v1}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

move-result-object v1

iget v0, v1, Landroid/util/DisplayMetrics;->density:F

.line 545
.local v0, "scale":F
mul-float v1, p1, v0

const/high16 v2, 0x3f000000 # 0.5f

add-float/2addr v1, v2

float-to-int v1, v1

return v1
.end method

7. Look for this method

.method public onInterceptTouchEvent(Landroid/view/MotionEvent;)Z

In this code Change .locals 3 to .locals 4

Look for this

.local v1, "intercept":Z
if-nez v1, :cond_[COLOR="Red"]0[/COLOR]

Change to

.local v1, "intercept":Z
if-nez v1, :cond_[COLOR="red"]1[/COLOR]

Look for this line

iget-boolean v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDelegateIntercepted:Z

Below that add this code

iget-boolean v2, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mSwipe2SleepActive:Z

if-eqz v2, :cond_0

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

move-result v2

if-nez v2, :cond_0

.line 318
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

move-result-wide v2

iput-wide v2, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDownTime:J

.line 319
invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

move-result v2

iput v2, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDownX:F

.line 320
invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

move-result v2

iput v2, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDownY:F

.line 321
const/4 v2, 0x1

iput-boolean v2, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mIsDown:Z

.line 329
:cond_0

After adding this, just below 2 lines you will find this

After return v1 you will find this

:cond_0 to :cond_1

8. Now look for this method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z

Replace complete method from the below method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
.locals 11
.param p1, "event" # Landroid/view/MotionEvent;

.prologue
const/4 v10, 0x1

.line 248
iget-boolean v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mSwipe2SleepActive:Z

if-eqz v1, :cond_0

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

move-result v1

if-ne v1, v10, :cond_0

iget-boolean v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mIsDown:Z

if-eqz v1, :cond_0

.line 249
const/4 v1, 0x0

iput-boolean v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mIsDown:Z

.line 250
iget v2, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDownX:F

iget v3, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDownY:F

iget-wide v4, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDownTime:J

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

move-result v6

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

move-result v7

invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

move-result-wide v8

move-object v1, p0

invoke-direct/range {v1 .. v9}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mySwipeDetector(FFJFFJ)V

.line 252
:cond_0
invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->initDownStates(Landroid/view/MotionEvent;)V

.line 217
iget-boolean v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDelegateIntercepted:Z

if-nez v1, :cond_1

iget-object v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mTaskSwitchHelper:Lcom/android/systemui/statusbar/phone/NavigationBarViewTaskSwitchHelper;

invoke-virtual {v1, p1}, Lcom/android/systemui/statusbar/phone/NavigationBarViewTaskSwitchHelper;->onTouchEvent(Landroid/view/MotionEvent;)Z

move-result v1

if-eqz v1, :cond_1

move v1, v10
.line 227
:goto_0
return v1

.line 220
:cond_1
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDeadZone:Lcom/android/systemui/statusbar/policy/DeadZone;

if-eqz v1, :cond_2

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

move-result v1

const/4 v2, 0x4

if-ne v1, v2, :cond_2

.line 221
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDeadZone:Lcom/android/systemui/statusbar/policy/DeadZone;

invoke-virtual {v1, p1}, Lcom/android/systemui/statusbar/policy/DeadZone;->poke(Landroid/view/MotionEvent;)V

.line 223
:cond_2
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDelegateHelper:Lcom/android/systemui/statusbar/DelegateViewHelper;

if-eqz v1, :cond_3

iget-boolean v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDelegateIntercepted:Z

if-eqz v1, :cond_3

.line 224
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mDelegateHelper:Lcom/android/systemui/statusbar/DelegateViewHelper;

invoke-virtual {v1, p1}, Lcom/android/systemui/statusbar/DelegateViewHelper;->onInterceptTouchEvent(Landroid/view/MotionEvent;)Z

move-result v0

.line 225
.local v0, "ret":Z
if-eqz v0, :cond_3

move v1, v10

goto :goto_0

.line 227
.end local v0 # "ret":Z
:cond_3
invoke-super {p0, p1}, Landroid/widget/LinearLayout;->onTouchEvent(Landroid/view/MotionEvent;)Z

move-result v1

goto :goto_0
.end method

9. Finally save and compile/sign and replace the systemui.apk

10. Now time to add switch from setting

Look for the below 3rd post