Skip to content

Commit

Permalink
Disable SDK version check
Browse files Browse the repository at this point in the history
  • Loading branch information
pylerSM committed Nov 24, 2014
1 parent 6c1bd4f commit 7845d42
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 25 deletions.
5 changes: 3 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pyler.xinstaller"
android:versionCode="385"
android:versionName="3.85" >
android:versionCode="389"
android:versionName="3.89" >

<uses-sdk
android:maxSdkVersion="19"
android:minSdkVersion="15"
android:targetSdkVersion="19" />

Expand Down
Binary file modified api/XInstallerLib.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions res/values-bn/translator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>

<string name="app_translator">Muhammad Rokonuzzaman (time2shine)</string>

</resources>
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<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="sdk_version_check">Checking SDK version</string>
<string name="about">About</string>
<string name="developer">Developer</string>
<string name="version">Version</string>
Expand Down
30 changes: 20 additions & 10 deletions res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
android:defaultValue="false"
android:key="disable_verify_apps"
android:title="@string/verify_apps" />
<CheckBoxPreference
android:defaultValue="false"
android:key="disable_sdk_version_check"
android:title="@string/sdk_version_check" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen
Expand Down Expand Up @@ -160,16 +164,22 @@
android:title="@string/verify_signatures" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:title="@string/backup_and_restore" >
<Preference
android:key="backup_preferences"
android:title="@string/backup" />
<Preference
android:key="restore_preferences"
android:title="@string/restore" />
<Preference
android:key="reset_preferences"
android:title="@string/reset" />
<PreferenceScreen
android:key="backup_restore_preferences"
android:title="@string/backup_and_restore" >
<PreferenceCategory
android:key="backup_restore"
android:title="@string/app" >
<Preference
android:key="backup_preferences"
android:title="@string/backup" />
<Preference
android:key="restore_preferences"
android:title="@string/restore" />
<Preference
android:key="reset_preferences"
android:title="@string/reset" />
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory
Expand Down
4 changes: 4 additions & 0 deletions src/com/pyler/xinstaller/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class Common {
public static final String ACTION_RUN_XINSTALLER = "xinstaller.intent.action.RUN_XINSTALLER";
public static final String ACTION_REMOVE_TASK = "xinstaller.intent.action.REMOVE_TASK";
public static final String ACTION_SET_INSTALL_LOCATION = "xinstaller.intent.action.SET_INSTALL_LOCATION";
public static final String ACTION_DISABLE_SDK_VERSION_CHECK = "xinstaller.intent.action.DISABLE_SDK_VERSION_CHECK";
public static final String ACTION_ENABLE_SDK_VERSION_CHECK = "xinstaller.intent.action.ENABLE_SDK_VERSION_CHECK";

public static final String FILE = "file";
public static final String FLAGS = "flags";
Expand Down Expand Up @@ -67,6 +69,7 @@ public class Common {
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";
public static final String PREF_DISABLE_SDK_VERSION_CHECK = "disable_sdk_version_check";

// constants
public static final String PACKAGE_NAME = Common.class.getPackage()
Expand All @@ -82,6 +85,7 @@ public class Common {
public static final File PACKAGE_DIR = new File(APP_DIR);
public static final File PREFERENCES_BACKUP_FILE = new File(APP_DIR
+ File.separator + PACKAGE_TAG + ".backup");
public static final int LATEST_ANDROID_RELEASE = 21;
public static final String PACKAGEINSTALLER_PKG = "com.android.packageinstaller";
public static final String SETTINGS_PKG = "com.android.settings";
public static final String FDROID_PKG = "org.fdroid.fdroid";
Expand Down
2 changes: 2 additions & 0 deletions src/com/pyler/xinstaller/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void onCreate(Bundle savedInstanceState) {

Preference installUnsignedApps = (Preference) findPreference("enable_install_unsigned_apps");
Preference installOnExternal = (Preference) findPreference("enable_install_external_storage");
Preference checkSdkVersion = (Preference) findPreference("disable_sdk_version_check");
Preference debuggingApps = (Preference) findPreference("enable_apps_debugging");
Preference permissionsCheck = (Preference) findPreference("disable_permissions_check");
Preference verifyJar = (Preference) findPreference("disable_verify_jar");
Expand All @@ -74,6 +75,7 @@ public void onCreate(Bundle savedInstanceState) {
if (!isExpertModeEnabled) {
installationsEnable.removePreference(installUnsignedApps);
installationsEnable.removePreference(installOnExternal);
installationsEnable.removePreference(checkSdkVersion);
miscEnable.removePreference(debuggingApps);
miscDisable.removePreference(permissionsCheck);
miscDisable.removePreference(verifyJar);
Expand Down
90 changes: 77 additions & 13 deletions src/com/pyler/xinstaller/XInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import android.app.ActivityManager;
import android.app.AndroidAppHelper;
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
Expand All @@ -17,13 +19,15 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.os.Process;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
Expand Down Expand Up @@ -65,6 +69,7 @@ public class XInstaller implements IXposedHookZygoteInit,
public boolean showVersions;
public boolean deleteApkFiles;
public boolean moveApps;
public boolean checkSdkVersion;
public XC_MethodHook checkSignaturesHook;
public XC_MethodHook deletePackageHook;
public XC_MethodHook installPackageHook;
Expand All @@ -90,8 +95,9 @@ public class XInstaller implements IXposedHookZygoteInit,
public XC_MethodHook scanPackageHook;
public XC_MethodHook verifySignaturesHook;
public XC_MethodHook moveAppsHook;
public boolean JB_MR2_NEWER;
public XC_MethodHook checkSdkVersionHook;
public boolean JB_MR1_NEWER;
public boolean JB_MR2_NEWER;
public boolean KITKAT_NEWER;
public boolean APIEnabled;
public boolean signatureCheckOff;
Expand Down Expand Up @@ -161,13 +167,31 @@ protected void afterHookedMethod(final MethodHookParam param)
systemApi.addAction(Common.ACTION_RUN_XINSTALLER);
systemApi.addAction(Common.ACTION_REMOVE_TASK);
systemApi.addAction(Common.ACTION_SET_INSTALL_LOCATION);
systemApi
.addAction(Common.ACTION_ENABLE_SDK_VERSION_CHECK);
systemApi
.addAction(Common.ACTION_DISABLE_SDK_VERSION_CHECK);
mContext.registerReceiver(systemAPI, systemApi);
APIEnabled = true;
}
}
}
};

checkSdkVersionHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
prefs.reload();
checkSdkVersion = prefs.getBoolean(
Common.PREF_DISABLE_SDK_VERSION_CHECK, false);
if (isModuleEnabled() && checkSdkVersion) {
XposedHelpers.setObjectField(param.thisObject,
"SDK_VERSION", Common.LATEST_ANDROID_RELEASE);
}
}
};

moveAppsHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param)
Expand Down Expand Up @@ -216,13 +240,24 @@ protected void afterHookedMethod(MethodHookParam param)
prefs.reload();
showPackageName = prefs.getBoolean(
Common.PREF_ENABLE_SHOW_PACKAGE_NAME, false);
mContext = AndroidAppHelper.currentApplication();
PackageInfo pkgInfo = (PackageInfo) param.args[0];
TextView appVersion = (TextView) XposedHelpers.getObjectField(
param.thisObject, "mAppVersion");
String version = appVersion.getText().toString();
final String packageName = pkgInfo.packageName;
if (isModuleEnabled() && showPackageName) {
appVersion.setText(packageName + "\n" + version);
appVersion.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) mContext
.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("text",
packageName);
clipboard.setPrimaryClip(clip);
}
});
}

}
Expand Down Expand Up @@ -733,11 +768,32 @@ public void onReceive(Context context, Intent intent) {
KITKAT_NEWER = (SDK >= Build.VERSION_CODES.KITKAT) ? true : false;

// enablers
XposedHelpers
.findAndHookMethod(packageManagerClass, "scanPackageLI",
"android.content.pm.PackageParser$Package", int.class,
int.class, long.class, "android.os.UserHandle",
scanPackageHook);
try {
XposedHelpers.findAndHookMethod(packageParserClass, "parsePackage",
Resources.class, XmlResourceParser.class, int.class,
String[].class, checkSdkVersionHook);
} catch (NoSuchMethodError nsm) {
try {
XposedHelpers.findAndHookMethod(packageParserClass,
"parsePackage", Resources.class,
XmlResourceParser.class, int.class, boolean.class,
String[].class, checkSdkVersionHook);
} catch (NoSuchMethodError nsm2) {
}
}

if (JB_MR1_NEWER) {
XposedHelpers.findAndHookMethod(packageManagerClass,
"scanPackageLI",
"android.content.pm.PackageParser$Package", int.class,
int.class, long.class, "android.os.UserHandle",
scanPackageHook);
} else {
XposedHelpers.findAndHookMethod(packageManagerClass,
"scanPackageLI",
"android.content.pm.PackageParser$Package", int.class,
int.class, long.class, scanPackageHook);
}

XposedHelpers.findAndHookMethod(packageManagerClass,
"verifySignaturesLP", "com.android.server.pm.PackageSetting",
Expand All @@ -751,11 +807,14 @@ public void onReceive(Context context, Intent intent) {
int[].class, int.class, int.class, int.class,
String.class, String[].class, appsDebuggingHook);
} catch (NoSuchMethodError nsm) {
XposedHelpers.findAndHookMethod(Process.class, "start",
String.class, String.class, int.class, int.class,
int[].class, int.class, int.class, int.class,
String.class, boolean.class, String[].class,
appsDebuggingHook);
try {
XposedHelpers.findAndHookMethod(Process.class, "start",
String.class, String.class, int.class, int.class,
int[].class, int.class, int.class, int.class,
String.class, boolean.class, String[].class,
appsDebuggingHook);
} catch (NoSuchMethodError nsm2) {
}
}
}

Expand All @@ -766,8 +825,13 @@ public void onReceive(Context context, Intent intent) {
"onFilterTouchEventForSecurity", MotionEvent.class,
showButtonsHook);

XposedHelpers.findAndHookMethod(packageManagerClass,
"isVerificationEnabled", int.class, verifyAppsHook);
if (JB_MR1_NEWER) {
XposedHelpers.findAndHookMethod(packageManagerClass,
"isVerificationEnabled", int.class, verifyAppsHook);
} else {
XposedHelpers.findAndHookMethod(packageManagerClass,
"isVerificationEnabled", verifyAppsHook);
}

XposedHelpers.findAndHookMethod(signatureClass, "verify", byte[].class,
int.class, int.class, verifySignatureHook);
Expand Down

0 comments on commit 7845d42

Please sign in to comment.