Skip to content

Commit 286e9da

Browse files
committed
修复bug
1 parent 7990c04 commit 286e9da

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "com.lanyus.blocksecureflag"
88
minSdkVersion 15
99
targetSdkVersion 24
10-
versionCode 3
11-
versionName "1.2"
10+
versionCode 4
11+
versionName "1.3"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1313
}
1414
buildTypes {

app/src/main/java/com/lanyus/blocksecureflag/XposedMain.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.lanyus.blocksecureflag;
22

3+
import android.os.Build;
34
import android.view.WindowManager;
45

56
import com.alibaba.fastjson.JSON;
@@ -37,13 +38,21 @@ public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) thr
3738
}
3839
XposedBridge.log("com.lanyus.blocksecureflag Loaded app: " + lpparam.packageName);
3940

40-
XposedHelpers.findAndHookMethod("android.view.Window", lpparam.classLoader, "addFlags", int.class, new XC_MethodHook() {
41+
XposedHelpers.findAndHookMethod("android.view.Window", lpparam.classLoader, "setFlags", int.class, int.class, new XC_MethodHook() {
4142
@Override
4243
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
43-
if ((int) param.args[0] == WindowManager.LayoutParams.FLAG_SECURE) {
44-
param.args[0] = 0;
45-
}
44+
Integer flags = (Integer) param.args[0];
45+
flags &= ~WindowManager.LayoutParams.FLAG_SECURE;
46+
param.args[0] = flags;
4647
}
4748
});
49+
if (Build.VERSION.SDK_INT >= 17) {
50+
XposedHelpers.findAndHookMethod("android.view.SurfaceView", lpparam.classLoader, "setSecure", boolean.class, new XC_MethodHook() {
51+
@Override
52+
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
53+
param.args[0] = false;
54+
}
55+
});
56+
}
4857
}
4958
}

0 commit comments

Comments
 (0)