1. Just fire disabled signature verification and integrity (thx @ploik)
core-libart.jar
Ljava / security / Signature
we find methods
.method public final verify ([B) Z and .method public final verify ([BII) Z
them to return v0 insert const / 4 v0, 0x1
Ljava / security / MessageDigest
find method .method public static isEqual ([B [B) Z
change at the beginning of the method const / 4 v2, 0x0 on const / 4 v2, 0x1Not required
2. Edit the settings.apk
Settings \ res \ values ​​\ arrays
Add to the end of one or the other of the array a new action
<string-array name = "screen_key_long_press_action">
<item>None</ item>
<item>Show recent apps</ item>
<item>Launch Assistant</ item>
<item>Launch Google Now</ item>
<item>Close current app</ item>
<item>Launch quick search</ item>
<item>Show menu</ item>
<item>Previous application</ item>
</ string-array>
<string-array name = "screen_key_long_press_action_value">
<item>none</ item>
<item>recent_panel</ item>
<item>voice_assistant</ item>
<item>google_now</ item>
<item>close_app</ item>
<item>quick_search</ item>
<item>show_menu</ item>
<item>prev_app</ item>
</ string-array>
Respectively, but Russification in values-ru folder need to add something like
<item>Start previous application</ item>
an array screen_key_long_press_action
3. Edit the services.jar
com / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable.smali
looking .method private launchRecentPanel () Z
before it is inserted
.method private launchPA (Landroid / content / Context;) Z
.locals 3
.param p1, "mContext" # Landroid / content / Context;
.prologue
.line 1
iget-object v0, p0, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable; ->the this $ 0: Lcom / android / server / policy / BaseMiuiPhoneWindowManager;
iget-object v0, v0, Lcom / android / server / policy / BaseMiuiPhoneWindowManager; ->mHandler: Landroid / os / Handler;
if-nez v0,: cond_0
: goto_0
const / 4 v2, 0x1
return v2
: cond_0
new-instance v1, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable $ 1;
invoke-direct {v1, p1}, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable $ 1; -><init>(Landroid / content / Context;) V
invoke-virtual {v0, v1}, Landroid / os / Handler; ->post (Ljava / lang / Runnable;) Z
goto: goto_0
.end method
We are looking for a similar piece of code containing "recent_panel"
: cond_9
const-string v7, "recent_panel"
invoke-virtual {v7, v0}, Ljava / lang / String; ->equals (Ljava / lang / Object;) Z
move-result v7
if-eqz v7,: cond_a
invoke-direct {p0}, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable; ->launchRecentPanel () Z
move-result v4
const-string v1, "screen_button_recent_task"
goto: goto_2
: cond_a
change it so
: cond_9
const-string v7, "recent_panel"
invoke-virtual {v7, v0}, Ljava / lang / String; ->equals (Ljava / lang / Object;) Z
move-result v7
if-eqz v7,: cond_new#change
invoke-direct {p0}, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable; ->launchRecentPanel () Z
move-result v4
const-string v1, "screen_button_recent_task"
goto: goto_2
### new lines
: cond_new
const-string v7, "prev_app"
invoke-virtual {v7, v0}, Ljava / lang / String; ->equals (Ljava / lang / Object;) Z
move-result v7
if-eqz v7,: cond_a
iget-object v7, p0, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable; ->the this $ 0: Lcom / android / server / policy / BaseMiuiPhoneWindowManager;
iget-object v7, v7, Lcom / android / server / policy / BaseMiuiPhoneWindowManager; ->mContext: Landroid / content / Context;
invoke-direct {p0, v7}, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable; ->launchPA (Landroid / content / Context;) Z
move-result v4
goto: goto_2
###
: cond_a
the new code has the added label cond_a and, as you can see, it should be named the same as the label in the old code, in front of which we insert the new code (marked in red)
Create the path com / android / server / policy / file BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable $ 1.smali with the following contents
.class Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable $ 1;
.super ljava / lang / Object;
.source "BaseMiuiPhoneWindowManager.java"
# interfaces
.implements Ljava / lang / Runnable;
# annotations
.annotation system Ldalvik / annotation / EnclosingMethod;
value = Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable; ->launchPA (Landroid / content / Context;) Z
.end annotation
.annotation system Ldalvik / annotation / InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field private final synthetic val $ mContext: Landroid / content / Context;
# direct methods
.method constructor<init>(Landroid / content / Context;) V
.locals 0
.prologue
.line 1
iput-object p1, p0, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable $ 1 ->val $ mContext: Landroid / content / Context;
.line 21
invoke-direct {p0}, Ljava / lang / Object; -><init>() V
return-void
.end method
# virtual methods
.method public run () V
.locals 9
const / 4 v5, 0x0
const / 4 v3, 0x1
new-instance v2, Landroid / content / Intent;
const-string v0, "android.intent.action.MAIN"
invoke-direct {v2, v0}, Landroid / content / Intent; -><init>(Ljava / lang / String;) V
iget-object v8, p0, Lcom / android / server / policy / BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable $ 1 ->val $ mContext: Landroid / content / Context;
const-string v1, "activity"
invoke-virtual {v8, v1}, Landroid / content / Context; ->getSystemService (Ljava / lang / String;) Ljava / lang / Object;
move-result-object v0
check-cast v0, Landroid / app / ActivityManager;
const-string v1, "com.android.launcher"
const-string v4, "android.intent.category.HOME"
invoke-virtual {v2, v4}, Landroid / content / Intent; ->addCategory (Ljava / lang / String;) Landroid / content / Intent;
invoke-virtual {v8}, Landroid / content / Context; ->getPackageManager () Landroid / content / pm / PackageManager;
move-result-object v4
invoke-virtual {v4, v2, v5}, Landroid / content / pm / PackageManager; ->resolveActivity (Landroid / content / Intent; I) Landroid / content / pm / ResolveInfo;
move-result-object v2
iget-object v4, v2, Landroid / content / pm / ResolveInfo; ->activityInfo: Landroid / content / pm / ActivityInfo;
if-eqz v4,: cond_3
iget-object v4, v2, Landroid / content / pm / ResolveInfo; ->activityInfo: Landroid / content / pm / ActivityInfo;
iget-object v4, v4, Landroid / content / pm / ActivityInfo; ->packageName: Ljava / lang / String;
const-string v6, "android"
invoke-virtual {v4, v6}, Ljava / lang / String; ->equals (Ljava / lang / Object;) Z
move-result v4
if-nez v4,: cond_3
iget-object v1, v2, Landroid / content / pm / ResolveInfo; ->activityInfo: Landroid / content / pm / ActivityInfo;
iget-object v1, v1, Landroid / content / pm / ActivityInfo; ->packageName: Ljava / lang / String;
move-object v2, v1
: goto_0
const / 4 v1,0x5
invoke-virtual {v0, v1}, Landroid / app / ActivityManager; ->getRunningTasks (I) Ljava / util / List;
move-result-object v6
move v4, v3
move v3, v5
: goto_1
if-nez v3,: cond_0
invoke-interface {v6}, Ljava / util / List; ->size () I
move-result v1
if-ge v4, v1,: cond_0
invoke-interface {v6, v4}, Ljava / util / List; ->get (I) Ljava / lang / Object;
move-result-object v1
check-cast v1, Landroid / app / ActivityManager $ RunningTaskInfo;
iget-object v1, v1, Landroid / app / ActivityManager $ RunningTaskInfo; ->topActivity: Landroid / content / ComponentName;
invoke-virtual {v1}, Landroid / content / ComponentName; ->getPackageName () Ljava / lang / String;
move-result-object v1
invoke-virtual {v1, v2}, Ljava / lang / String; ->equals (Ljava / lang / Object;) Z
move-result v7
if-nez v7,: cond_2
const-string v7, "com.android.systemui"
invoke-virtual {v1, v7}, Ljava / lang / String; ->equals (Ljava / lang / Object;) Z
move-result v1
if-nez v1,: cond_2
invoke-interface {v6, v4}, Ljava / util / List; ->get (I) Ljava / lang / Object;
move-result-object v1
check-cast v1, Landroid / app / ActivityManager $ RunningTaskInfo;
iget v1, v1, Landroid / app / ActivityManager $ RunningTaskInfo; ->id: I
: goto_2
add-int / lit8 v3, v4, 0x1
move v4, v3
move v3, v1
goto: goto_1
: cond_0
if-eqz v3,: cond_1
const / 4 v1,0x2
invoke-virtual {v0, v3, v1}, Landroid / app / ActivityManager; ->moveTaskToFront (II) V
: goto_3
return-void
: cond_1
const-string v0, "There's no previous application"
invoke-static {v8, v0, v5}, Landroid / widget / Toast; ->makeText (Landroid / content / Context; Ljava / lang / CharSequence; I) Landroid / widget / Toast;
move-result-object v0
invoke-virtual {v0}, Landroid / widget / Toast; ->show () V
goto: goto_3
: cond_2
move v1, v3
goto: goto_2
: cond_3
move-object v2, v1
goto: goto_0
.end method
The original and modified files for comparison here:
files.zip(12.67 KB)
P.s in the absence of recent application to run, the English system will write a line of There's no previous application. For the Russification of this, you can open the file BaseMiuiPhoneWindowManager $ ScreenKeyLongPressRunnable $ 1.smali
and replace the const-string v0, "There's no previous application"
on const-string v0, "\ u041D \ u0435 \ u0447 \ u0435 \ u0433 \ u043E \ u0437 \ u0430 \ u043F \ u0443 \ u0441 \ u043A \ u0430 \ u0442 \ u044C"
and it will be written, "There is nothing to run." For his phrases yuzayte Converter
https://r12a.github.io/apps/conversion/