Skip to content

Commit

Permalink
New feature: Move unmovable apps on SD card (which has installLocatio…
Browse files Browse the repository at this point in the history
…n internalOnly), decrease APK size
  • Loading branch information
pylerSM committed Nov 17, 2014
1 parent 746d067 commit c187935
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pyler.xinstaller"
android:versionCode="380"
android:versionName="3.8" >
android:versionCode="385"
android:versionName="3.85" >

<uses-sdk
android:minSdkVersion="15"
Expand Down
Binary file removed libs/android-support-v4.jar
Binary file not shown.
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<string name="current_version">Current version</string>
<string name="new_version">New version</string>
<string name="delete_apk_files_install">Deleting APK files after installing</string>
<string name="move_apps">Moving apps</string>
<string name="about">About</string>
<string name="developer">Developer</string>
<string name="version">Version</string>
Expand Down
4 changes: 4 additions & 0 deletions res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@
android:defaultValue="false"
android:key="enable_show_package_name"
android:title="@string/show_package_name" />
<CheckBoxPreference
android:defaultValue="false"
android:key="enable_move_apps"
android:title="@string/move_apps" />
</PreferenceCategory>
<PreferenceCategory
android:key="misc_disable"
Expand Down
2 changes: 2 additions & 0 deletions src/com/pyler/xinstaller/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class Common {
public static final String PREF_ENABLE_SHOW_PACKAGE_NAME = "enable_show_package_name";
public static final String PREF_ENABLE_SHOW_VERSION = "enable_show_version";
public static final String PREF_ENABLE_DELETE_APK_FILE_INSTALL = "enable_delete_apk_files_install";
public static final String PREF_ENABLE_MOVE_APP = "enable_move_apps";

// constants
public static final String PACKAGE_NAME = Common.class.getPackage()
Expand All @@ -92,6 +93,7 @@ public class Common {
public static final String INSTALLEDAPPDETAILS = "com.android.settings.applications.InstalledAppDetails";
public static final String PACKAGEINSTALLERACTIVITY = "com.android.packageinstaller.PackageInstallerActivity";
public static final String INSTALLAPPPROGRESS = "com.android.packageinstaller.InstallAppProgress";
public static final String CANBEONSDCARDCHECKER = "com.android.settings.applications.CanBeOnSdCardChecker";
public static final String UNINSTALLERACTIVITY = "com.android.packageinstaller.UninstallerActivity";
public static final String UNINSTALLAPPPROGRESS = "com.android.packageinstaller.UninstallAppProgress";
public static final String FDROIDAPPDETAILS = "org.fdroid.fdroid.AppDetails";
Expand Down
19 changes: 19 additions & 0 deletions src/com/pyler/xinstaller/XInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
Expand Down Expand Up @@ -63,6 +64,7 @@ public class XInstaller implements IXposedHookZygoteInit,
public boolean showPackageName;
public boolean showVersions;
public boolean deleteApkFiles;
public boolean moveApps;
public XC_MethodHook checkSignaturesHook;
public XC_MethodHook deletePackageHook;
public XC_MethodHook installPackageHook;
Expand All @@ -87,6 +89,7 @@ public class XInstaller implements IXposedHookZygoteInit,
public XC_MethodHook showPackageNameHook;
public XC_MethodHook scanPackageHook;
public XC_MethodHook verifySignaturesHook;
public XC_MethodHook moveAppsHook;
public boolean JB_MR2_NEWER;
public boolean JB_MR1_NEWER;
public boolean KITKAT_NEWER;
Expand Down Expand Up @@ -165,6 +168,19 @@ protected void afterHookedMethod(final MethodHookParam param)
}
};

moveAppsHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
prefs.reload();
moveApps = prefs.getBoolean(Common.PREF_ENABLE_MOVE_APP, false);
if (isModuleEnabled() && moveApps) {
param.setResult(true);
return;
}
}
};

verifySignaturesHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param)
Expand Down Expand Up @@ -863,6 +879,9 @@ public void handleLoadPackage(final LoadPackageParam lpparam)
XposedHelpers.findAndHookMethod(Common.INSTALLEDAPPDETAILS,
lpparam.classLoader, "setAppLabelAndIcon",
PackageInfo.class, showPackageNameHook);
XposedHelpers.findAndHookMethod(Common.CANBEONSDCARDCHECKER,
lpparam.classLoader, "check", ApplicationInfo.class,
moveAppsHook);
}

if (Common.FDROID_PKG.equals(lpparam.packageName)) {
Expand Down

0 comments on commit c187935

Please sign in to comment.