Skip to content
This repository has been archived by the owner on May 7, 2019. It is now read-only.

Commit

Permalink
Add a debugging switch to enable instant modules loading
Browse files Browse the repository at this point in the history
  • Loading branch information
solohsu committed Jan 29, 2019
1 parent f89b711 commit b271631
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.solohsu.android.edxp.manager"
minSdkVersion 23
targetSdkVersion 28
versionCode 2
versionName "1.0.1"
versionCode 3
versionName "1.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class AppHelper {
private static final String COMPAT_LIST_PATH = BASE_PATH + "compatlist/";
private static final String WHITE_LIST_MODE = BASE_PATH + "usewhitelist";
private static final String FORCE_GLOBAL_MODE = BASE_PATH + "forceglobal";
private static final String DYNAMIC_MODULES = BASE_PATH + "dynamicmodules";

private static final List<String> FORCE_WHITE_LIST = Arrays.asList("de.robv.android.xposed.installer");

Expand Down Expand Up @@ -117,6 +118,10 @@ public static boolean setForceGlobalMode(boolean isForceGlobal) {
return checkRetCode(Shell.su((isForceGlobal ? "touch " : "rm ") + FORCE_GLOBAL_MODE).exec().getCode());
}

public static boolean setDynamicModules(boolean isDynamicModules) {
return checkRetCode(Shell.su((isDynamicModules ? "touch " : "rm ") + DYNAMIC_MODULES).exec().getCode());
}

@SuppressLint("RestrictedApi")
public static void showMenu(@NonNull Context context,
@NonNull FragmentManager fragmentManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.solohsu.android.edxp.manager.R;

import static com.solohsu.android.edxp.manager.adapter.AppHelper.setDynamicModules;
import static com.solohsu.android.edxp.manager.adapter.AppHelper.setForceGlobalMode;

public class SettingFragment extends PreferenceFragmentCompat {
Expand All @@ -28,6 +29,8 @@ public void onCreatePreferences(Bundle bundle, String s) {
addPreferencesFromResource(R.xml.pref_settings);
findPreference("force_global_mode").setOnPreferenceChangeListener(
(preference, newValue) -> setForceGlobalMode((Boolean) newValue));
findPreference("is_dynamic_modules").setOnPreferenceChangeListener(
(preference, newValue) -> setDynamicModules((Boolean) newValue));
}

}
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_sync.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,4L12,1L8,5l4,4L12,6c3.31,0 6,2.69 6,6 0,1.01 -0.25,1.97 -0.7,2.8l1.46,1.46C19.54,15.03 20,13.57 20,12c0,-4.42 -3.58,-8 -8,-8zM12,18c-3.31,0 -6,-2.69 -6,-6 0,-1.01 0.25,-1.97 0.7,-2.8L5.24,7.74C4.46,8.97 4,10.43 4,12c0,4.42 3.58,8 8,8v3l4,-4 -4,-4v3z"/>
</vector>
10 changes: 6 additions & 4 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<string name="nav_title_black_list">黑/白名单</string>
<string name="nav_title_settings">设置</string>
<string name="white_list_mode_title">白名单模式</string>
<string name="nav_title_compat_list">兼容名单</string>
<string name="nav_title_compat_list">兼容模式</string>
<string name="title_white_list">白名单</string>
<string name="title_black_list">黑名单</string>
<string name="add_package_failed">修改失败,请检查 Root 权限</string>
Expand All @@ -16,8 +16,10 @@
<string name="app_source_code_title">App 源代码</string>
<string name="edxp_source_code_title">EdXposed 源代码</string>
<string name="open_link_failed_toast">无法找到可以打开链接的应用</string>
<string name="pref_title_force_global">强制全局模式</string>
<string name="pref_force_global_summary">(重启生效) 启用后,忽略黑名单和白名单设置,仅在系统启动时加载一次模块列表</string>
<string name="title_compat_list">兼容名单</string>
<string name="pref_title_force_global">全局模式</string>
<string name="pref_title_dynamic_modules">即时模块列表</string>
<string name="pref_force_global_summary">(重启后生效) 启用后,忽略所有黑名单和白名单设置</string>
<string name="pref_dynamic_modules_summary">(重启后生效) 启用后,每个APP进程启动时重新加载最新的模块列表</string>
<string name="title_compat_list">兼容模式</string>
<string name="menu_title_compat_mode">关于兼容模式</string>
</resources>
8 changes: 5 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
<string name="app_source_code_title">App source code</string>
<string name="edxp_source_code_title">EdXposed source code</string>
<string name="open_link_failed_toast">No application found to open the link.</string>
<string name="pref_title_force_global">Force global mode</string>
<string name="pref_force_global_summary">(Reboot needed) When turned on, ignore black list and white list and load modules only once on boot</string>
<string name="title_compat_list">Compat List</string>
<string name="pref_title_force_global">Global mode</string>
<string name="pref_title_dynamic_modules">Instant module list</string>
<string name="pref_force_global_summary">(Reboot needed) When turned on, ignore both black list and white list</string>
<string name="pref_dynamic_modules_summary">(Reboot needed) When turned on, load latest activated module list on each app process started</string>
<string name="title_compat_list">Compat mode</string>
<string name="menu_title_compat_mode">About Compat mode</string>
</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/xml/pref_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@
android:key="force_global_mode"
android:summary="@string/pref_force_global_summary"
android:title="@string/pref_title_force_global" />
<SwitchPreference
android:defaultValue="false"
android:icon="@drawable/ic_sync"
android:key="is_dynamic_modules"
android:summary="@string/pref_dynamic_modules_summary"
android:title="@string/pref_title_dynamic_modules" />
</PreferenceScreen>

0 comments on commit b271631

Please sign in to comment.