Skip to content

Commit

Permalink
1.09
Browse files Browse the repository at this point in the history
Signed-off-by: RC1844 <1844766234@qq.com>
  • Loading branch information
RC1844 committed Apr 25, 2021
1 parent ea34bae commit 884f216
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ Xposed API Version >= 93

## 更新日志

v1.09

无实质更新
加了个try

v1.08

删除一个hook函数,解决重复hook
Expand Down
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.xposed.miuiime"
minSdkVersion 28
targetSdkVersion 30
versionCode 8
versionName '1.08'
versionCode 9
versionName '1.09'

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -34,6 +34,8 @@ android {
}

dependencies {
implementation 'org.jetbrains:annotations:15.0'


// implementation 'androidx.appcompat:appcompat:1.2.0'
// implementation 'com.google.android.material:material:1.3.0'
Expand Down
23 changes: 17 additions & 6 deletions app/src/main/java/com/xposed/miuiime/MainHook.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xposed.miuiime;

import android.annotation.TargetApi;
import android.os.Build;
import android.view.inputmethod.InputMethodManager;

Expand Down Expand Up @@ -46,7 +47,7 @@ public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
lpparam.classLoader, "setNavigationBarColor",
int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
protected void afterHookedMethod(MethodHookParam param) {
// 0xff747474, 0x66747474
int color = 0xFFFFFFFF - (int) param.args[0];
XposedHelpers.callStaticMethod(clazz, "customizeBottomViewColor",
Expand All @@ -68,7 +69,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
ClassLoader.class, String.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
protected void afterHookedMethod(MethodHookParam param) {
final Class<?> clazz = findClass("com.miui.inputmethod.InputMethodBottomManager",
(ClassLoader) param.args[0]);
if (isNonCustomize) {
Expand All @@ -79,8 +80,9 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
//针对A11的修复切换输入法列表
findAndHookMethod(clazz, "getSupportIme",
new XC_MethodReplacement() {
@TargetApi(Build.VERSION_CODES.CUPCAKE)
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
protected Object replaceHookedMethod(MethodHookParam param) {
return ((InputMethodManager) getObjectField(
getStaticObjectField(clazz, "sBottomViewHelper"),
"mImm")).getEnabledInputMethodList();
Expand All @@ -98,7 +100,11 @@ protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
* @param clazz 声明或继承字段的类
*/
private void hookSIsImeSupport(Class<?> clazz) {
XposedHelpers.setStaticIntField(clazz, "sIsImeSupport", 1);
try {
XposedHelpers.setStaticIntField(clazz, "sIsImeSupport", 1);
} catch (Exception e) {
XposedBridge.log(e);
}
}

/**
Expand All @@ -107,13 +113,18 @@ private void hookSIsImeSupport(Class<?> clazz) {
* @param clazz 声明或继承方法的类
*/
private void hookIsXiaoAiEnable(Class<?> clazz) {
findAndHookMethod(clazz, "isXiaoAiEnable",
XC_MethodReplacement.returnConstant(false));
try {
findAndHookMethod(clazz, "isXiaoAiEnable",
XC_MethodReplacement.returnConstant(false));
} catch (Exception e) {
XposedBridge.log(e);
}
}

/**
* 检查Android版本
*/
@TargetApi(Build.VERSION_CODES.DONUT)
public void checkVersion() {
switch (Build.VERSION.SDK_INT) {
case 30:
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/com/xposed/miuiime/PropertyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

import java.lang.reflect.Method;

import de.robv.android.xposed.XposedBridge;

public class PropertyUtils {

private static volatile Method get = null;

@SuppressLint("PrivateApi")
public static String get(String prop, String defaultvalue) {
String value = defaultvalue;
try {
Expand All @@ -20,8 +23,8 @@ public static String get(String prop, String defaultvalue) {
}
}
value = (String) (get.invoke(null, new Object[]{prop, defaultvalue}));
} catch (Throwable e) {
e.printStackTrace();
} catch (Exception e) {
XposedBridge.log(e);
}
return value;
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta06'
classpath 'com.android.tools.build:gradle:4.2.0-rc01'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit 884f216

Please sign in to comment.