FORUMS

[GUIDE] [TUT] GUIDE Omni Switch

100 posts
Thanks Meter: 164
 
Post Reply Email Thread
GUIDE Omni Switch
Work and Tested - CM 12.1 & LP Based

1. Decompile settings.apk
At the files:
Settings\res\xml\Display_Settings.xml
Looking for:
Add this line

Quote:

<PreferenceScreen android:title="@string/omniswitch_settings_title" android:fragment="com.android.settings.ahmednhk.Re centsPanel.OmniSwitch" />

ADD ALL THIS LINES.
Settings\res\values\strings.xml

Quote:

<string name="omniswitch_settings_title">OmniSwitch</string>
<string name="recents_use_omniswitch_title">Use for recents</string>
<string name="recents_use_omniswitch_summary">Use OmniSwitch instead of default recents view</string>
<string name="omniswitch_start_settings_title">Settings</string>
<string name="omniswitch_start_settings_summary">Open OmniSwitch settings</string>
<string name="omniswitch_first_time_title">Information</string>
<string name="omniswitch_first_time_message">Make sure you have enabled OmniSwitch. You can do this by using "Settings" below</string>

*compile and decompile again to assign the ID to a file*
PHP Code:
Settings\smali\com\android\settings\ahmednhk\RecentsPanel\OmniSwitch.smali
    
<public type="string" name="omniswitch_first_time_title"
        
LINE 73
        
        
<public type="string" name="omniswitch_first_time_message"
        
LINE 87
        
        0x104000a
        LINE 97
        
        
<public type="xml" name="ahmednhk_recents_omniswitch"
        
LINE 126
*Compile Settings.apk DONE*

2. Decompile framework.jar in files u will download i make misatke and forget this part
framework.jar.out\smali\android\provider\Settings$ System.smali

PHP Code:
Looking for:
.
field public static final RECENTS_SHOW_SEARCH_BAR:Ljava/lang/String; = "recents_show_search_bar"
following inserted :
.
field public static final RECENTS_USE_OMNISWITCH:Ljava/lang/String; = "recents_use_omniswitch" 
** Now proceed to complex of instructions **

3. Decompile SystemUI.apk
SystemUI\smali\com\android\systemui\statusbar\Base StatusBar.smali


PHP Code:
Looking for:
.
method static sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V

following inserted 
:
.
method private isOmniSwitchEnabled()Z
    
.locals 6

    
.prologue
    
const/4 v10x1

    
const/4 v20x0

    
.line 1196
    iget
-object v3p0Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;

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

    
move-result-object v3

    
const-string v4"recents_use_omniswitch"

    
const/4 v5, -0x2

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

    move
-result v0

    
.line 1199
    
.local v0"settingsValue":I
    
if-ne v0v1, :cond_0

    
:goto_0
    
return v1

    
:cond_0
    move v1
v2

    
goto :goto_0
.end method
----------------------------------------------------------------
Looking for:
.
method protected cancelPreloadingRecents()V

Changing it completely with
:
.
method protected cancelPreloadingRecents()V
    
.locals 1

    
.prologue
    
.line 1246
    invoke
-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z

    move
-result v0

    
if-nez v0, :cond_0

    
.line 1247
    iget
-object v0p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    if-
eqz v0, :cond_0

    
.line 1248
    iget
-object v0p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    
invoke-interface {v0}, Lcom/android/systemui/RecentsComponent;->cancelPreloadingRecents()V

    
.line 1251
    
:cond_0
    
return-void
.end method
----------------------------------------------------------------
Looking for:
.
method protected hideRecents(ZZ)V

Changing it completely with
:
.
method protected hideRecents(ZZ)V
    
.locals 3
    
.param p1"triggeredFromAltTab"    # Z
    
.param p2"triggeredFromHomeKey"    # Z

    
.prologue
    
.line 1215
    invoke
-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z

    move
-result v1

    
if-eqz v1, :cond_1

    
.line 1216
    
new-instance v0Landroid/content/Intent;

    const-
string v1"org.omnirom.omniswitch.ACTION_HIDE_OVERLAY"

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

    
.line 1217
    
.local v0"showIntent":Landroid/content/Intent;
    
iget-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;

    
sget-object v2Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;

    
invoke-virtual {v1v0v2}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V

    
.line 1223
    
.end local v0    # "showIntent":Landroid/content/Intent;
    
:cond_0
    
:goto_0
    
return-void

    
.line 1219
    
:cond_1
    iget
-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    if-
eqz v1, :cond_0

    
.line 1220
    iget
-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    
invoke-interface {v1p1p2}, Lcom/android/systemui/RecentsComponent;->hideRecents(ZZ)V

    
goto :goto_0
.end method
----------------------------------------------------------------
Looking for:
.
method protected preloadRecents()V

Changing it completely with
:
.
method protected preloadRecents()V
    
.locals 1

    
.prologue
    
.line 1238
    invoke
-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z

    move
-result v0

    
if-nez v0, :cond_0

    
.line 1239
    iget
-object v0p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    if-
eqz v0, :cond_0

    
.line 1240
    iget
-object v0p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    
invoke-interface {v0}, Lcom/android/systemui/RecentsComponent;->preloadRecents()V

    
.line 1243
    
:cond_0
    
return-void
.end method
----------------------------------------------------------------
Looking for:
.
method protected showRecents(Z)V

Changing it completely with
:
.
method protected showRecents(Z)V
    
.locals 3
    
.param p1"triggeredFromAltTab"    # Z

    
.prologue
    
.line 1203
    invoke
-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z

    move
-result v1

    
if-eqz v1, :cond_1

    
.line 1204
    
new-instance v0Landroid/content/Intent;

    const-
string v1"org.omnirom.omniswitch.ACTION_SHOW_OVERLAY"

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

    
.line 1205
    
.local v0"showIntent":Landroid/content/Intent;
    
iget-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;

    
sget-object v2Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;

    
invoke-virtual {v1v0v2}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V

    
.line 1212
    
.end local v0    # "showIntent":Landroid/content/Intent;
    
:cond_0
    
:goto_0
    
return-void

    
.line 1207
    
:cond_1
    iget
-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    if-
eqz v1, :cond_0

    
.line 1208
    iget
-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;

    const-
string v2"recentapps"

    
invoke-static {v1v2}, Lcom/android/systemui/statusbar/BaseStatusBar;->sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V

    
.line 1209
    iget
-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    
invoke-virtual {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->getStatusBarView()Landroid/view/View;

    
move-result-object v2

    invoke
-interface {v1p1v2}, Lcom/android/systemui/RecentsComponent;->showRecents(ZLandroid/view/View;)V

    
goto :goto_0
.end method
----------------------------------------------------------------
Looking for:
.
method protected showRecentsNextAffiliatedTask()V

Changing it completely with
:
.
method protected showRecentsNextAffiliatedTask()V
    
.locals 1

    
.prologue
    
.line 1254
    invoke
-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z

    move
-result v0

    
if-nez v0, :cond_0

    
.line 1255
    iget
-object v0p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    if-
eqz v0, :cond_0

    
.line 1256
    iget
-object v0p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    
invoke-interface {v0}, Lcom/android/systemui/RecentsComponent;->showNextAffiliatedTask()V

    
.line 1259
    
:cond_0
    
return-void
.end method
----------------------------------------------------------------
Looking for:
.
method protected showRecentsPreviousAffiliatedTask()V

Changing it completely with
:
.
method protected showRecentsPreviousAffiliatedTask()V
    
.locals 1

    
.prologue
    
.line 1262
    invoke
-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z

    move
-result v0

    
if-nez v0, :cond_0

    
.line 1263
    iget
-object v0p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    if-
eqz v0, :cond_0

    
.line 1264
    iget
-object v0p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    
invoke-interface {v0}, Lcom/android/systemui/RecentsComponent;->showPrevAffiliatedTask()V

    
.line 1267
    
:cond_0
    
return-void
.end method
----------------------------------------------------------------
Looking for:
.
method protected toggleRecents()V

Changing it completely with
:
.
method protected toggleRecents()V
    
.locals 5

    
.prologue
    
.line 1226
    invoke
-direct {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->isOmniSwitchEnabled()Z

    move
-result v1

    
if-eqz v1, :cond_1

    
.line 1227
    
new-instance v0Landroid/content/Intent;

    const-
string v1"org.omnirom.omniswitch.ACTION_TOGGLE_OVERLAY"

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

    
.line 1228
    
.local v0"showIntent":Landroid/content/Intent;
    
iget-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;

    
sget-object v2Landroid/os/UserHandle;->CURRENT:Landroid/os/UserHandle;

    
invoke-virtual {v1v0v2}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V

    
.line 1235
    
.end local v0    # "showIntent":Landroid/content/Intent;
    
:cond_0
    
:goto_0
    
return-void

    
.line 1230
    
:cond_1
    iget
-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    if-
eqz v1, :cond_0

    
.line 1231
    iget
-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mContext:Landroid/content/Context;

    const-
string v2"recentapps"

    
invoke-static {v1v2}, Lcom/android/systemui/statusbar/BaseStatusBar;->sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V

    
.line 1232
    iget
-object v1p0Lcom/android/systemui/statusbar/BaseStatusBar;->mRecents:Lcom/android/systemui/RecentsComponent;

    
iget-object v2p0Lcom/android/systemui/statusbar/BaseStatusBar;->mDisplay:Landroid/view/Display;

    
iget v3p0Lcom/android/systemui/statusbar/BaseStatusBar;->mLayoutDirection:I

    invoke
-virtual {p0}, Lcom/android/systemui/statusbar/BaseStatusBar;->getStatusBarView()Landroid/view/View;

    
move-result-object v4

    invoke
-interface {v1v2v3v4}, Lcom/android/systemui/RecentsComponent;->toggleRecents(Landroid/view/Display;ILandroid/view/View;)V

    
goto :goto_0
.end method 
*Compile framework.jar DONE*
DON'T FORGET TO DRAG THE APK FILE GIVING U IN FOLDER SYSTEM.
DON'T FORGET TO TRANSFER ALL FILES (framework.jar).


Files and Compare Press Me
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2016-12-19-08-27-01.png
Views:	226
Size:	99.4 KB
ID:	4018544   Click image for larger version

Name:	Screenshot_2016-12-19-08-27-06.png
Views:	216
Size:	38.7 KB
ID:	4018545   Click image for larger version

Name:	Screenshot_2016-12-19-08-27-12.png
Views:	212
Size:	91.2 KB
ID:	4018546   Click image for larger version

Name:	Screenshot_2016-12-19-08-27-20.png
Views:	202
Size:	216.3 KB
ID:	4018547   Click image for larger version

Name:	Screenshot_2016-12-19-08-27-24.png
Views:	214
Size:	114.5 KB
ID:	4018548  
The Following User Says Thank You to ahmed.nasser.hk For This Useful Post: [ View ] Gift ahmed.nasser.hk Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes