Skip to content

Commit

Permalink
V3.9 - disable (un)installations in the background
Browse files Browse the repository at this point in the history
  • Loading branch information
pylerSM committed Nov 28, 2014
1 parent 53f3179 commit ba5266c
Show file tree
Hide file tree
Showing 20 changed files with 142 additions and 18 deletions.
6 changes: 3 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pyler.xinstaller"
android:versionCode="389"
android:versionName="3.89" >
android:versionCode="390"
android:versionName="3.9" >

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

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Expand Down
2 changes: 1 addition & 1 deletion project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-19
target=android-21
Binary file removed releases/XInstaller 3.8.apk
Binary file not shown.
Binary file added releases/XInstaller 3.9.apk
Binary file not shown.
57 changes: 57 additions & 0 deletions res/values-bn/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.com-->
<resources>
<string name="app_description">প্যাকেজ ইনস্টলারের জন্য বিভিন্ন tweaks</string>
<string name="app">এপ্লিকেশন</string>
<string name="module">মডিউল</string>
<string name="app_icon">Launcher এর আইকন</string>
<string name="expert_mode">দক্ষ অবস্থা</string>
<string name="app_settings">সেটিংস</string>
<string name="installations">ইনস্টলেশন</string>
<string name="uninstallations">আনইনস্টলেশন</string>
<string name="misc">বিবিধ</string>
<string name="backup_and_restore">সংরক্ষণ এবং পুনরূদ্ধার</string>
<string name="backup">সংরক্ষণ</string>
<string name="restore">পুনরুদ্ধার</string>
<string name="reset">পুনরায় ধার্য করুন</string>
<string name="enable">সক্রিয়</string>
<string name="disable">নিষ্ক্রিয়</string>
<string name="signatures_check">স্বাক্ষর পরীক্ষা করা হবে</string>
<string name="keep_apps_data">অ্যাপের ডাটা রাখা হবে</string>
<string name="downgrade_apps">ডাউনগ্রেড অ্যাপ করা হবে</string>
<string name="forward_lock">অগ্রবর্তী তালাবদ্ধ করা হবে</string>
<string name="install_unknown_apps">ইনস্টলিং অজানা অ্যাপ</string>
<string name="verify_apps">অ্যাপ Verify করা হবে</string>
<string name="install_external_storage">External Storage এ অ্যাপ ইনস্টল হবে</string>
<string name="disable_system_apps">সিস্টেম অ্যাপ অক্ষম হবে</string>
<string name="uninstall_device_admins">Device Administrator আনইনস্টল করা যাবে</string>
<string name="signatures_check_fdroid">স্বাক্ষর পরীক্ষা করা হবে (F-Droid)</string>
<string name="auto_install">স্বয়ংক্রিয় ভাবে ইনস্টল করা হবে</string>
<string name="auto_uninstall">স্বয়ংক্রিয় ভাবে আনইনস্টল হবে</string>
<string name="auto_close_install">স্বয়ংক্রিয় ভাবে ইনস্টলের পর বন্ধ হবে</string>
<string name="auto_close_uninstall">স্বয়ংক্রিয় ভাবে আনইনস্টলের পর বন্ধ হবে</string>
<string name="auto_launch_install">স্বয়ংক্রিয় ভাবে ইনস্টলের পর সচল হবে</string>
<string name="permissions_check">অনুমতিগুলি চেক করা হবে</string>
<string name="backup_apk_files">APK ফাইলসমূহ সংরক্ষিত হবে</string>
<string name="install_unsigned_apps">Unsigned অ্যাপ ইনস্টল হবে</string>
<string name="verify_jar">JAR যাচাই করা হবে</string>
<string name="verify_signatures">স্বাক্ষর যাচাই করা হবে</string>
<string name="show_buttons">বোতাম দেখাবে যখন অনির্দিষ্ট</string>
<string name="apps_debugging">অ্যাপ ডিবাগ হবে</string>
<string name="auto_backup">স্বয়ংক্রিয় ভাবে সংরক্ষণ হবে</string>
<string name="show_package_name">প্যাকেজের নাম দেখাবে</string>
<string name="show_version">সংস্করণের তথ্য দেখাবে</string>
<string name="current_version">বর্তমান সংস্করণ</string>
<string name="new_version">নতুন সংস্করণ</string>
<string name="delete_apk_files_install">APK ফাইল ইনস্টল করার পর মুছে ফেলবে</string>
<string name="move_apps">অ্যাপ সরানো হচ্ছে</string>
<string name="sdk_version_check">SDK সংস্করণ চেক করা হচ্ছে</string>
<string name="about">সম্পর্কে</string>
<string name="developer">ডেভেলপার</string>
<string name="version">সংস্করণ</string>
<string name="translator">অনুবাদক</string>
<string name="no_backup_file">কোন সংরক্ষিত ফাইল নাই</string>
<string name="preferences_backed_up">সফলভাবে সংরক্ষিত হয়েছে</string>
<string name="preferences_restored">সফলভাবে পুনরূদ্ধার করা হয়েছে</string>
<string name="preferences_reset">সফলভাবে পুনঃবিন্যাস করা হয়েছে</string>
</resources>
4 changes: 4 additions & 0 deletions res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">Aktuální verze</string>
<string name="new_version">Nová verze</string>
<string name="delete_apk_files_install">Vymazání APK souborů po nainstalování</string>
<string name="move_apps">Přesouvání aplikací</string>
<string name="sdk_version_check">Kontrolování verze SDK</string>
<string name="install_background">Instalování na pozadí</string>
<string name="uninstall_background">Odinstalování na pozadí</string>
<string name="about">O aplikaci</string>
<string name="developer">Vývojář</string>
<string name="version">Verze</string>
Expand Down
4 changes: 4 additions & 0 deletions res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">Version actuelle</string>
<string name="new_version">Nouvelle version</string>
<string name="delete_apk_files_install">Suppression des fichiers APK après installation</string>
<string name="move_apps">Déplacement d\'applis</string>
<string name="sdk_version_check">Contrôle de la version du SDK</string>
<string name="install_background">Installation en arrière-plan</string>
<string name="uninstall_background">Désinstallation en arrière-plan</string>
<string name="about">À propos</string>
<string name="developer">Développeur</string>
<string name="version">Version</string>
Expand Down
4 changes: 4 additions & 0 deletions res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">Aktuális verzió</string>
<string name="new_version">Új verzió</string>
<string name="delete_apk_files_install">APK fájl törlése telepítés után</string>
<string name="move_apps">Mozgó alkalmazások</string>
<string name="sdk_version_check">SDK verzió ellenőrzése</string>
<string name="install_background">Telepítés a háttérben</string>
<string name="uninstall_background">Eltávolítás a háttérben</string>
<string name="about">Névjegy</string>
<string name="developer">Fejlesztő</string>
<string name="version">Verzió</string>
Expand Down
4 changes: 4 additions & 0 deletions res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">現在のバージョン</string>
<string name="new_version">新しいバージョン</string>
<string name="delete_apk_files_install">インストールした後にAPKファイルを削除する</string>
<string name="move_apps">アプリの移動</string>
<string name="sdk_version_check">SDKバージョンの確認</string>
<string name="install_background">バックグラウンドでインストール</string>
<string name="uninstall_background">バックグラウンドでアンインストール</string>
<string name="about">アプリ情報</string>
<string name="developer">開発者</string>
<string name="version">バージョン</string>
Expand Down
4 changes: 4 additions & 0 deletions res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">Versão atual</string>
<string name="new_version">Nova versão</string>
<string name="delete_apk_files_install">Eliminar APK após instalação</string>
<string name="move_apps">Mover aplicações</string>
<string name="sdk_version_check">A verificar a versão do SDK</string>
<string name="install_background">A instalar em segundo plano</string>
<string name="uninstall_background">A desinstalar em segundo plano</string>
<string name="about">Sobre</string>
<string name="developer">Desenvolvedor</string>
<string name="version">Versão</string>
Expand Down
4 changes: 4 additions & 0 deletions res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">Текущая версия</string>
<string name="new_version">Новая версия</string>
<string name="delete_apk_files_install">Удаление APK файлов после установки</string>
<string name="move_apps">Перемещение приложения</string>
<string name="sdk_version_check">Проверка версии SDK</string>
<string name="install_background">Установка в фоновом режиме</string>
<string name="uninstall_background">Удаление в фоновом режиме</string>
<string name="about">О программе</string>
<string name="developer">Разработчик</string>
<string name="version">Версия</string>
Expand Down
4 changes: 4 additions & 0 deletions res/values-sk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">Aktuálna verzia</string>
<string name="new_version">Nová verzia</string>
<string name="delete_apk_files_install">Vymazanie APK súborov po nainštalovaní</string>
<string name="move_apps">Presúvanie aplikácií</string>
<string name="sdk_version_check">Kontrolovanie verzie SDK</string>
<string name="install_background">Inštalovanie na pozadí</string>
<string name="uninstall_background">Odinštalovanie na pozadí</string>
<string name="about">O aplikácii</string>
<string name="developer">Vývojár</string>
<string name="version">Verzia</string>
Expand Down
4 changes: 4 additions & 0 deletions res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">Şimdiki versiyon</string>
<string name="new_version">Yeni versiyon</string>
<string name="delete_apk_files_install">APK dosyalarını yükledikten sonra silme</string>
<string name="move_apps">Uygulamaları taşıma</string>
<string name="sdk_version_check">SDK versiyonunu kontrol etme</string>
<string name="install_background">Arkaplanda yükleme</string>
<string name="uninstall_background">Arkaplanda kaldırma</string>
<string name="about">Hakkında</string>
<string name="developer">Geliştirici</string>
<string name="version">Versiyon</string>
Expand Down
4 changes: 4 additions & 0 deletions res/values-zh-rCN/strings.xml → res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<string name="current_version">当前版本</string>
<string name="new_version">新版本</string>
<string name="delete_apk_files_install">安装后删除 APK 文件</string>
<string name="move_apps">移动应用</string>
<string name="sdk_version_check">检查 SDK 版本</string>
<string name="install_background">后台安装</string>
<string name="uninstall_background">后台卸载</string>
<string name="about">关于</string>
<string name="developer">开发者</string>
<string name="version">版本</string>
Expand Down
File renamed without changes.
7 changes: 0 additions & 7 deletions res/values/dimens.xml

This file was deleted.

2 changes: 2 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
<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="install_background">Installing in background</string>
<string name="uninstall_background">Uninstalling in background</string>
<string name="about">About</string>
<string name="developer">Developer</string>
<string name="version">Version</string>
Expand Down
18 changes: 15 additions & 3 deletions res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
android:defaultValue="false"
android:key="disable_sdk_version_check"
android:title="@string/sdk_version_check" />
<CheckBoxPreference
android:defaultValue="false"
android:key="disable_install_background"
android:title="@string/install_background" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen
Expand All @@ -115,6 +119,14 @@
android:key="enable_auto_close_uninstall"
android:title="@string/auto_close_uninstall" />
</PreferenceCategory>
<PreferenceCategory
android:key="uninstallations_disable"
android:title="@string/disable" >
<CheckBoxPreference
android:defaultValue="false"
android:key="disable_uninstall_background"
android:title="@string/uninstall_background" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen
android:key="misc"
Expand Down Expand Up @@ -188,13 +200,13 @@
<Preference
android:summary="@string/app_developer"
android:title="@string/developer" />
<Preference
android:key="app_version"
android:title="@string/version" />
<Preference
android:key="app_translator"
android:summary="@string/app_translator"
android:title="@string/translator" />
<Preference
android:key="app_version"
android:title="@string/version" />
</PreferenceCategory>

</PreferenceScreen>
6 changes: 5 additions & 1 deletion src/com/pyler/xinstaller/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.File;

import android.os.Build;
import android.os.Environment;

public class Common {
Expand Down Expand Up @@ -70,6 +71,8 @@ public class Common {
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";
public static final String PREF_DISABLE_INSTALL_BACKGROUND = "disable_install_background";
public static final String PREF_DISABLE_UNINSTALL_BACKGROUND = "disable_uninstall_background";

// constants
public static final String PACKAGE_NAME = Common.class.getPackage()
Expand All @@ -85,7 +88,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 int LATEST_ANDROID_RELEASE = Build.VERSION_CODES.LOLLIPOP;
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 Expand Up @@ -115,4 +118,5 @@ public class Common {
public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
public static final int REMOVE_TASK_KILL_PROCESS = 0x0001;
public static final int DEBUG_ENABLE_DEBUGGER = 0x1;
public static final int ROOT_UID = 0;
}
26 changes: 23 additions & 3 deletions src/com/pyler/xinstaller/XInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
Expand Down Expand Up @@ -70,6 +71,8 @@ public class XInstaller implements IXposedHookZygoteInit,
public boolean deleteApkFiles;
public boolean moveApps;
public boolean checkSdkVersion;
public boolean installBackground;
public boolean uninstallBackground;
public XC_MethodHook checkSignaturesHook;
public XC_MethodHook deletePackageHook;
public XC_MethodHook installPackageHook;
Expand All @@ -96,6 +99,8 @@ public class XInstaller implements IXposedHookZygoteInit,
public XC_MethodHook verifySignaturesHook;
public XC_MethodHook moveAppsHook;
public XC_MethodHook checkSdkVersionHook;
public XC_MethodHook installBackgroundHook;
public XC_MethodHook uninstallBackgroundHook;
public boolean JB_MR1_NEWER;
public boolean JB_MR2_NEWER;
public boolean KITKAT_NEWER;
Expand Down Expand Up @@ -410,6 +415,8 @@ protected void beforeHookedMethod(MethodHookParam param)
Common.PREF_ENABLE_INSTALL_EXTERNAL_STORAGE, false);
backupApkFiles = prefs.getBoolean(
Common.PREF_ENABLE_BACKUP_APK_FILE, false);
installBackground = prefs.getBoolean(
Common.PREF_DISABLE_INSTALL_BACKGROUND, false);
int ID = JB_MR1_NEWER ? 2 : 1;
int flags = (Integer) param.args[ID];
if (isModuleEnabled()
Expand All @@ -436,6 +443,12 @@ protected void beforeHookedMethod(MethodHookParam param)
String apkFile = packageUri.getPath();
backupApkFile(apkFile);
}

if (isModuleEnabled() && installBackground) {
if (Binder.getCallingUid() == Common.ROOT_UID) {
param.setResult(null);
}
}
}

};
Expand All @@ -447,6 +460,8 @@ protected void beforeHookedMethod(MethodHookParam param)
prefs.reload();
keepAppsData = prefs.getBoolean(
Common.PREF_ENABLE_KEEP_APP_DATA, false);
uninstallBackground = prefs.getBoolean(
Common.PREF_DISABLE_UNINSTALL_BACKGROUND, false);
int ID = JB_MR2_NEWER ? 3 : 2;
int flags = (Integer) param.args[ID];
if (isModuleEnabled() && (flags & Common.DELETE_KEEP_DATA) == 0
Expand All @@ -455,6 +470,12 @@ protected void beforeHookedMethod(MethodHookParam param)
flags |= Common.DELETE_KEEP_DATA;
}
param.args[ID] = flags;

if (isModuleEnabled() && uninstallBackground) {
if (Binder.getCallingUid() == Common.ROOT_UID) {
param.setResult(null);
}
}
}

};
Expand Down Expand Up @@ -962,7 +983,6 @@ public void handleLoadPackage(final LoadPackageParam lpparam)
}

// system API

public void forceStopPackage(String packageName) {
XposedHelpers.callMethod(activityManagerObj, "forceStopPackage",
packageName);
Expand Down Expand Up @@ -1065,12 +1085,12 @@ public void enableModule(boolean enabled) {
}

public Context getXInstallerContext() {
Context XInstallerContext;
Context XInstallerContext = null;
;
try {
XInstallerContext = mContext.createPackageContext(
Common.PACKAGE_NAME, 0);
} catch (NameNotFoundException e) {
XInstallerContext = null;
}
return XInstallerContext;
}
Expand Down

0 comments on commit ba5266c

Please sign in to comment.