-
-
Save Dzakus/0d30b566fa4ab5041649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="pl.com.android.translucent.recent" | |
android:versionCode="4" | |
android:versionName="0.2.2" > | |
<uses-sdk | |
android:minSdkVersion="19" | |
android:targetSdkVersion="19" /> | |
<application | |
android:allowBackup="true" | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" > | |
<meta-data | |
android:name="xposedmodule" | |
android:value="true" /> | |
<meta-data | |
android:name="xposeddescription" | |
android:value="Allways show translucent decor on recents panel" /> | |
<meta-data | |
android:name="xposedminversion" | |
android:value="54" /> | |
</application> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pl.com.android.translucent.recent; | |
import static de.robv.android.xposed.XposedBridge.log; | |
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod; | |
import static de.robv.android.xposed.XposedHelpers.getIntField; | |
import static de.robv.android.xposed.XposedHelpers.getStaticIntField; | |
import java.lang.reflect.Method; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.view.Window; | |
import android.view.WindowManager; | |
import android.view.WindowManager.LayoutParams; | |
import de.robv.android.xposed.IXposedHookLoadPackage; | |
import de.robv.android.xposed.XC_MethodHook; | |
import de.robv.android.xposed.XposedBridge; | |
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam; | |
public class MainXposed implements IXposedHookLoadPackage { | |
public static final String PACKAGE_SYSTEM_UI = "com.android.systemui"; | |
private static final String CLASS_RECENTS_ACTIVITY = "com.android.systemui.recent.RecentsActivity"; | |
private static final String FIELD_PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = "PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR"; | |
private static int sPrivateFlagInheritTranslucentDecor; | |
private static Method mMethodSetPrivateFlags; | |
@Override | |
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable { | |
if (!PACKAGE_SYSTEM_UI.equals(lpparam.packageName)) | |
return; | |
try { | |
sPrivateFlagInheritTranslucentDecor = getStaticIntField( | |
WindowManager.LayoutParams.class, | |
FIELD_PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR); | |
log("sPrivateFlagInheritTranslucentDecor: " | |
+ sPrivateFlagInheritTranslucentDecor); | |
mMethodSetPrivateFlags = Window.class.getDeclaredMethod( | |
"setPrivateFlags", int.class, int.class); | |
mMethodSetPrivateFlags.setAccessible(true); | |
} catch (Throwable t) { | |
XposedBridge.log(t); | |
return; | |
} | |
findAndHookMethod(CLASS_RECENTS_ACTIVITY, lpparam.classLoader, | |
"onCreate", Bundle.class, new XC_MethodHook() { | |
@Override | |
protected void afterHookedMethod(MethodHookParam param) | |
throws Throwable { | |
Activity activity = (Activity) param.thisObject; | |
Window window = activity.getWindow(); | |
dumpFlags(window); | |
int flag = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; | |
flag |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION; | |
flag |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN; | |
window.addFlags(flag); | |
clearPrivateFlags(window, | |
sPrivateFlagInheritTranslucentDecor); | |
dumpFlags(window); | |
} | |
}); | |
} | |
private static void dumpFlags(Window window) { | |
LayoutParams attr = window.getAttributes(); | |
log("privateFlags: " | |
+ Integer.toHexString(getIntField(attr, "privateFlags"))); | |
log("flags: " + Integer.toHexString(getIntField(attr, "flags"))); | |
} | |
private static void clearPrivateFlags(Window window, int flags) { | |
try { | |
mMethodSetPrivateFlags.invoke(window, 0, flags); | |
} catch (Throwable t) { | |
log(t); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<string name="app_name">[KK] Translucent Recent</string> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pl.com.android.translucent.recent.MainXposed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment