diff --git a/XposedLibrary/XposedBridgeApi.jar b/XposedLibrary/XposedBridgeApi.jar index 73f0dbd..a87ddb4 100644 Binary files a/XposedLibrary/XposedBridgeApi.jar and b/XposedLibrary/XposedBridgeApi.jar differ diff --git a/XposedTweakbox/AndroidManifest.xml b/XposedTweakbox/AndroidManifest.xml index 97d37d5..3e63909 100644 --- a/XposedTweakbox/AndroidManifest.xml +++ b/XposedTweakbox/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="7" + android:versionName="1.3.2" > @@ -24,7 +24,7 @@ android:value="true" /> + android:value="2.1*" /> diff --git a/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/AppSpecificConfiguration.java b/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/AppSpecificConfiguration.java index 85b6a00..c75436d 100644 --- a/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/AppSpecificConfiguration.java +++ b/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/AppSpecificConfiguration.java @@ -6,7 +6,6 @@ import java.util.Locale; import android.app.AndroidAppHelper; -import android.content.SharedPreferences; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.content.res.Resources; @@ -14,13 +13,14 @@ import android.util.DisplayMetrics; import android.view.Display; import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XSharedPreferences; import de.robv.android.xposed.XposedBridge; class AppSpecificConfiguration { - private static SharedPreferences pref; + private static XSharedPreferences pref; private AppSpecificConfiguration() {} - public static void initZygote(final SharedPreferences pref) { + public static void initZygote(final XSharedPreferences pref) { AppSpecificConfiguration.pref = pref; // density / resource configuration manipulation @@ -28,7 +28,7 @@ public static void initZygote(final SharedPreferences pref) { findAndHookMethod(Display.class, "init", int.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { - AndroidAppHelper.reloadSharedPreferencesIfNeeded(pref); + pref.reload(); String packageName = AndroidAppHelper.currentPackageName(); int packageDensity = pref.getInt("dpioverride/" + packageName + "/density", pref.getInt("dpioverride/default/density", 0)); @@ -45,7 +45,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { if (config != null && param.thisObject instanceof XResources) { String packageName = ((XResources) param.thisObject).getPackageName(); if (packageName != null) { - AndroidAppHelper.reloadSharedPreferencesIfNeeded(pref); + pref.reload(); int swdp = pref.getInt("dpioverride/" + packageName + "/swdp", pref.getInt("dpioverride/default/swdp", 0)); int wdp = pref.getInt("dpioverride/" + packageName + "/wdp", pref.getInt("dpioverride/default/wdp", 0)); diff --git a/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/CrtEffect.java b/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/CrtEffect.java index ec1513f..8fbc20d 100644 --- a/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/CrtEffect.java +++ b/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/CrtEffect.java @@ -9,11 +9,10 @@ import java.lang.reflect.Method; -import android.app.AndroidAppHelper; -import android.content.SharedPreferences; import android.os.SystemProperties; import android.view.WindowManagerPolicy; import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XSharedPreferences; import de.robv.android.xposed.XposedBridge; import de.robv.android.xposed.XposedHelpers; @@ -41,7 +40,7 @@ private CrtEffect() { } * Hook the methods related with the screen off event in order to use the active CRT On/Off preferences. * Handles the missing call to "nativeStartSurfaceFlingerAnimation" on I9300. */ - public static void loadPackage(final SharedPreferences pref, ClassLoader classLoader) throws Exception { + public static void loadPackage(final XSharedPreferences pref, ClassLoader classLoader) throws Exception { final ThreadLocal nestingStatus = new ThreadLocal(); @@ -52,7 +51,7 @@ public static void loadPackage(final SharedPreferences pref, ClassLoader classLo @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { // About to turn off screen - AndroidAppHelper.reloadSharedPreferencesIfNeeded(pref); + pref.reload(); Object powerManagerService = getSurroundingThis(param.thisObject); int animationSetting; animationSetting = (pref.getBoolean("crt_off_effect", false)) ? ANIM_SETTING_OFF : 0; @@ -102,7 +101,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { protected void beforeHookedMethod(MethodHookParam param) throws Throwable { int rotation = (Integer) param.args[0]; if (rotation >= 0) { - AndroidAppHelper.reloadSharedPreferencesIfNeeded(pref); + pref.reload(); if (pref.getBoolean("crt_effect_orientation", false)) { SystemProperties.set("runtime.xposed.orientation", String.valueOf(rotation)); } else { diff --git a/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/PhoneTweaks.java b/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/PhoneTweaks.java index 78f8ed4..4bdc048 100644 --- a/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/PhoneTweaks.java +++ b/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/PhoneTweaks.java @@ -7,7 +7,6 @@ import java.util.Map; import android.app.AlertDialog; -import android.app.AndroidAppHelper; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.FeatureInfo; @@ -21,6 +20,7 @@ import com.android.internal.telephony.gsm.SuppServiceNotification; import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XSharedPreferences; import de.robv.android.xposed.XposedBridge; import de.robv.android.xposed.XposedHelpers; @@ -51,7 +51,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { } catch (Throwable t) { XposedBridge.log(t); } } - public static void loadPackage(final SharedPreferences pref, ClassLoader classLoader) { + public static void loadPackage(final XSharedPreferences pref, ClassLoader classLoader) { // Handle vibrate on Call Wait try { findAndHookMethod("com.android.phone.PhoneUtils", classLoader, "displaySSInfo", @@ -63,7 +63,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { // Waiting for target party if (notificationType == 0 && code == 3) { - AndroidAppHelper.reloadSharedPreferencesIfNeeded(pref); + pref.reload(); if (pref.getBoolean("phone_vibrate_waiting", false)) { Context context = (Context) param.args[1]; @@ -98,7 +98,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { protected void beforeHookedMethod(MethodHookParam param) throws Throwable { if (insideRingerHandler.get() != null) { // Within execution of handleMessage() - AndroidAppHelper.reloadSharedPreferencesIfNeeded(pref); + pref.reload(); if (!pref.getBoolean("phone_increasing_ringer", true)) { // No increasing ringer; skip changing the ringer volume param.setResult(null); diff --git a/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/XposedTweakbox.java b/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/XposedTweakbox.java index 1767f33..fc3b042 100644 --- a/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/XposedTweakbox.java +++ b/XposedTweakbox/src/de/robv/android/xposed/mods/tweakbox/XposedTweakbox.java @@ -5,12 +5,11 @@ import java.lang.reflect.Constructor; import java.util.Locale; -import android.app.AndroidAppHelper; -import android.content.SharedPreferences; import android.content.res.XResources; import android.graphics.Color; import android.graphics.PixelFormat; import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; import android.preference.Preference; import android.telephony.SignalStrength; import android.view.View; @@ -22,6 +21,7 @@ import de.robv.android.xposed.IXposedHookZygoteInit; import de.robv.android.xposed.XC_MethodHook; import de.robv.android.xposed.XC_MethodReplacement; +import de.robv.android.xposed.XSharedPreferences; import de.robv.android.xposed.XposedBridge; import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam; import de.robv.android.xposed.callbacks.XC_LayoutInflated; @@ -32,12 +32,12 @@ public class XposedTweakbox implements IXposedHookZygoteInit, IXposedHookInitPackageResources, IXposedHookLoadPackage { public static final String TAG = "Tweakbox"; public static final String MY_PACKAGE_NAME = XposedTweakbox.class.getPackage().getName(); - private static SharedPreferences pref; + private static XSharedPreferences pref; private static int signalStrengthBars = 4; @Override public void initZygote(StartupParam startupParam) { - pref = AndroidAppHelper.getDefaultSharedPreferencesForPackage(MY_PACKAGE_NAME); + pref = new XSharedPreferences(MY_PACKAGE_NAME); // this is not really necessary if no effects are wanted, but it speeds up turning off the screen XResources.setSystemWideReplacement("android", "bool", "config_animateScreenLights", false); @@ -72,7 +72,7 @@ public void initZygote(StartupParam startupParam) { @Override public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable { - AndroidAppHelper.reloadSharedPreferencesIfNeeded(pref); + pref.reload(); Locale packageLocale = AppSpecificConfiguration.getPackageSpecificLocale(lpparam.packageName); if (packageLocale != null) @@ -142,7 +142,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { @Override public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable { - AndroidAppHelper.reloadSharedPreferencesIfNeeded(pref); + pref.reload(); if (resparam.packageName.equals("com.android.systemui")) { try { @@ -152,8 +152,13 @@ public void handleInitPackageResources(InitPackageResourcesParam resparam) throw if (pref.getBoolean("statusbar_color_enabled", false)) { try { - int statusbarColor = pref.getInt("statusbar_color", Color.BLACK); - resparam.res.setReplacement("com.android.systemui", "drawable", "status_bar_background", new ColorDrawable(statusbarColor)); + final int statusbarColor = pref.getInt("statusbar_color", Color.BLACK); + resparam.res.setReplacement("com.android.systemui", "drawable", "status_bar_background", new XResources.DrawableLoader() { + @Override + public Drawable newDrawable(XResources res, int id) throws Throwable { + return new ColorDrawable(statusbarColor)); + } + }); } catch (Throwable t) { XposedBridge.log(t); } }