This repository was archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit efd0831
Showing
20 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/*/gen | ||
/*/bin |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="gen"/> | ||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> | ||
<classpathentry kind="lib" path="/XposedBridge/XposedBridgeApi.jar" sourcepath="/XposedBridge/XposedBridgeApi.jar"/> | ||
<classpathentry kind="output" path="bin/classes"/> | ||
</classpath> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>CrtOffEffect</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.ApkBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="de.robv.android.xposed.mods.crtoffeffect" | ||
android:versionCode="1" | ||
android:versionName="1.0" > | ||
|
||
<uses-sdk android:minSdkVersion="15" /> | ||
|
||
<application | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" > | ||
<meta-data | ||
android:name="xposedmodule" | ||
android:value="true" /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
de.robv.android.xposed.mods.crtoffeffect.CrtOffEffect |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system edit | ||
# "ant.properties", and override values to adapt the script to your | ||
# project structure. | ||
# | ||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt | ||
|
||
# Project target. | ||
target=android-15 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<string name="app_name">CRT off effect</string> | ||
|
||
</resources> |
38 changes: 38 additions & 0 deletions
38
CrtOffEffect/src/de/robv/android/xposed/mods/crtoffeffect/CrtOffEffect.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package de.robv.android.xposed.mods.crtoffeffect; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
import java.util.Iterator; | ||
|
||
import de.robv.android.xposed.Callback; | ||
import de.robv.android.xposed.XposedBridge; | ||
|
||
public class CrtOffEffect { | ||
private static Field fieldAnimateScreenLights; | ||
|
||
public static void init(String startClassName) { | ||
if (startClassName != null) | ||
return; | ||
|
||
try { | ||
Class<?> classPowerManagerService = Class.forName("com.android.server.PowerManagerService"); | ||
fieldAnimateScreenLights = classPowerManagerService.getDeclaredField("mAnimateScreenLights"); | ||
fieldAnimateScreenLights.setAccessible(true); | ||
Method methodInitInThread = classPowerManagerService.getDeclaredMethod("initInThread"); | ||
XposedBridge.hookMethod(methodInitInThread, CrtOffEffect.class, "handle_PowerManagerService_initInThread", Callback.PRIORITY_DEFAULT); | ||
} catch (Exception e) { | ||
XposedBridge.log(e); | ||
} | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
private static Object handle_PowerManagerService_initInThread (Iterator<Callback> iterator, Method method, Object thisObject, Object[] args) throws Throwable { | ||
Object result = XposedBridge.callNext(iterator, method, thisObject, args); | ||
try { | ||
fieldAnimateScreenLights.setBoolean(thisObject, false); | ||
} catch (Exception e) { | ||
XposedBridge.log(e); | ||
} | ||
return result; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="gen"/> | ||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> | ||
<classpathentry kind="lib" path="/XposedBridge/XposedBridgeApi.jar" sourcepath="/XposedBridge/XposedBridgeApi.jar"/> | ||
<classpathentry kind="output" path="bin/classes"/> | ||
</classpath> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>RedClock</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.ApkBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="de.robv.android.xposed.mods.redclock" | ||
android:installLocation="internalOnly" | ||
android:versionCode="1" | ||
android:versionName="1.0" > | ||
|
||
<uses-sdk android:minSdkVersion="15" /> | ||
|
||
<application | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" > | ||
<meta-data | ||
android:name="xposedmodule" | ||
android:value="true" /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
de.robv.android.xposed.mods.redclock.RedClock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system edit | ||
# "ant.properties", and override values to adapt the script to your | ||
# project structure. | ||
# | ||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt | ||
|
||
# Project target. | ||
target=android-15 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<string name="app_name">Xposed: Red clock example</string> | ||
|
||
</resources> |
80 changes: 80 additions & 0 deletions
80
RedClock/src/de/robv/android/xposed/mods/redclock/RedClock.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package de.robv.android.xposed.mods.redclock; | ||
|
||
import java.lang.reflect.Method; | ||
import java.util.Iterator; | ||
|
||
import android.graphics.Color; | ||
import android.widget.TextView; | ||
import de.robv.android.xposed.Callback; | ||
import de.robv.android.xposed.MethodSignatureGuide; | ||
import de.robv.android.xposed.XposedBridge; | ||
|
||
/** | ||
* Example module which changes the color of the clock in the statusbar to red and | ||
* also appends a smiley to it. It does so by hooking the updateClock method of the | ||
* Clock class in the systemui as soon as the com.android.systemui is being loaded. | ||
* <br/> | ||
* This demonstrates how a very central component can be modified without changing | ||
* the APKs (including deodexing, recompiling, signing etc). | ||
*/ | ||
public class RedClock { | ||
private static Method methodGetText; | ||
private static Method methodSetText; | ||
private static Method methodSetTextColor; | ||
|
||
/** | ||
* @see MethodSignatureGuide#init | ||
*/ | ||
public static void init(String startClassName) { | ||
// only load for Zygote (the system process), not for command line tools | ||
if (startClassName != null) | ||
return; | ||
|
||
try { | ||
XposedBridge.hookLoadPackage(RedClock.class, "handleLoadPackage", Callback.PRIORITY_DEFAULT); | ||
methodGetText = TextView.class.getDeclaredMethod("getText"); | ||
methodSetText = TextView.class.getDeclaredMethod("setText", CharSequence.class); | ||
methodSetTextColor = TextView.class.getDeclaredMethod("setTextColor", Integer.TYPE); | ||
} catch (Throwable t) { | ||
XposedBridge.log(t); | ||
} | ||
} | ||
|
||
/** | ||
* @see MethodSignatureGuide#handleLoadPackage | ||
*/ | ||
@SuppressWarnings("unused") | ||
private static void handleLoadPackage(String packageName, ClassLoader classLoader) { | ||
// the status bar belongs to package com.android.systemui | ||
if (!packageName.equals("com.android.systemui")) | ||
return; | ||
|
||
try { | ||
Method updateClock = | ||
Class.forName("com.android.systemui.statusbar.policy.Clock", false, classLoader) | ||
.getDeclaredMethod("updateClock"); | ||
XposedBridge.hookMethod(updateClock, RedClock.class, "handleUpdateClock", Callback.PRIORITY_DEFAULT); | ||
} catch (Exception e) { | ||
XposedBridge.log(e); | ||
} | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
private static Object handleUpdateClock(Iterator<Callback> iterator, Method method, Object thisObject, Object[] args) throws Throwable { | ||
if (XposedBridge.DEBUG) | ||
XposedBridge.log("updating the clock"); | ||
|
||
// first let the original implementation perform its work | ||
Object result = XposedBridge.callNext(iterator, method, thisObject, args); | ||
// then change text and color | ||
try { | ||
String text = (String)methodGetText.invoke(thisObject); | ||
methodSetText.invoke(thisObject, text + " :)"); | ||
methodSetTextColor.invoke(thisObject, Color.RED); | ||
} catch (Exception e) { | ||
// replacing did not work.. but no reason to crash the VM! Log the error and go on. | ||
XposedBridge.log(e); | ||
} | ||
return result; | ||
} | ||
} |