Skip to content

Commit

Permalink
Show packagename to let user know which app is being used
Browse files Browse the repository at this point in the history
  • Loading branch information
vvb2060 committed Aug 4, 2023
1 parent a861bda commit 348f049
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,9 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.google.android.material.color.DynamicColors;

import org.lsposed.manager.BuildConfig;
import org.lsposed.manager.ConfigManager;
import org.lsposed.manager.R;
import org.lsposed.manager.ui.dialog.BlurBehindDialogBuilder;
import org.lsposed.manager.ui.dialog.FlashDialogBuilder;
import org.lsposed.manager.util.NavUtil;
import org.lsposed.manager.util.Telemetry;
import org.lsposed.manager.util.ThemeUtil;
import org.lsposed.manager.util.UpdateUtil;

import rikka.material.app.MaterialActivity;

Expand All @@ -54,23 +46,6 @@ public class BaseActivity extends MaterialActivity {
public void onCreate(@Nullable Bundle savedInstanceState) {
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
// make sure the versions are consistent
if (BuildConfig.DEBUG) return;
if (!ConfigManager.isBinderAlive()) return;
var version = ConfigManager.getXposedVersionCode();
if (BuildConfig.VERSION_CODE == version) return;
new BlurBehindDialogBuilder(this)
.setMessage(getString(R.string.version_mismatch, version, BuildConfig.VERSION_CODE))
.setPositiveButton(android.R.string.ok, (dialog, id) -> {
if (UpdateUtil.canInstall()) {
new FlashDialogBuilder(this, (d, i) -> finish()).show();
} else {
NavUtil.startURL(this, getString(R.string.install_url));
finish();
}
})
.setCancelable(false)
.show();
}

@Override
Expand Down
28 changes: 12 additions & 16 deletions app/src/main/java/org/lsposed/manager/ui/fragment/HomeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,31 +172,27 @@ private void updateStates(Activity activity, boolean binderAlive, boolean needUp
binding.apiVersion.setText(String.valueOf(ConfigManager.getXposedApiVersion()));
binding.api.setText(ConfigManager.isDexObfuscateEnabled() ? R.string.enabled : R.string.not_enabled);
binding.frameworkVersion.setText(String.format(LocaleDelegate.getDefaultLocale(), "%1$s (%2$d)", ConfigManager.getXposedVersionName(), ConfigManager.getXposedVersionCode()));
binding.managerVersion.setText(activity.getPackageName());
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.android_version_unsatisfied)));
} else switch (ConfigManager.getDex2OatWrapperCompatibility()) {
case ILSPManagerService.DEX2OAT_OK:
binding.dex2oatWrapper.setText(R.string.supported);
break;
case ILSPManagerService.DEX2OAT_CRASHED:
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.crashed)));
break;
case ILSPManagerService.DEX2OAT_MOUNT_FAILED:
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.mount_failed)));
break;
case ILSPManagerService.DEX2OAT_SELINUX_PERMISSIVE:
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.selinux_permissive)));
break;
case ILSPManagerService.DEX2OAT_SEPOLICY_INCORRECT:
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.sepolicy_incorrect)));
break;
case ILSPManagerService.DEX2OAT_OK ->
binding.dex2oatWrapper.setText(R.string.supported);
case ILSPManagerService.DEX2OAT_CRASHED ->
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.crashed)));
case ILSPManagerService.DEX2OAT_MOUNT_FAILED ->
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.mount_failed)));
case ILSPManagerService.DEX2OAT_SELINUX_PERMISSIVE ->
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.selinux_permissive)));
case ILSPManagerService.DEX2OAT_SEPOLICY_INCORRECT ->
binding.dex2oatWrapper.setText(String.format(LocaleDelegate.getDefaultLocale(), "%s (%s)", getString(R.string.unsupported), getString(R.string.sepolicy_incorrect)));
}
} else {
binding.apiVersion.setText(R.string.not_installed);
binding.api.setText(R.string.not_installed);
binding.frameworkVersion.setText(R.string.not_installed);
binding.managerVersion.setText(String.format(LocaleDelegate.getDefaultLocale(), "%1$s (%2$d)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
}
binding.managerVersion.setText(String.format(LocaleDelegate.getDefaultLocale(), "%1$s (%2$d)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));

if (Build.VERSION.PREVIEW_SDK_INT != 0) {
binding.systemVersion.setText(String.format(LocaleDelegate.getDefaultLocale(), "%1$s Preview (API %2$d)", Build.VERSION.CODENAME, Build.VERSION.SDK_INT));
Expand Down
19 changes: 7 additions & 12 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<string name="sepolicy_incorrect">SELinux policy is incorrect</string>
<string name="update_lsposed">Update LSPosed</string>
<string name="update_lsposed_msg">Confirm to update LSPosed? This device will reboot after update completion</string>
<string name="info_copied">Copied to clipboard</string>

<!-- WelcomeDialog -->
<string name="parasitic_welcome">Welcome to LSPosed</string>
Expand Down Expand Up @@ -227,13 +228,11 @@
<string name="module_release_no_more">No more release</string>
<string name="repo_load_failed">Failed to load module repo: %s</string>
<string name="sort_upgradable_first">Upgradable first</string>

<!-- CrashReportActivity -->
<string name="version_mismatch">The version of the LSPosed framework (%1$d) does not match manager (%2$d). Please reinstall LSPosed.</string>
<string name="manager_crashed">Manager crashed</string>
<string name="send_crash_info">Send crash info</string>
<string name="crash_info_copied">Crash info copied to clipboard</string>
<string name="info_copied">Copied to clipboard</string>
<string name="installed">Installed</string>
<plurals name="module_release_assets_download_count">
<item quantity="one">%d download</item>
<item quantity="other">%d downloads</item>
</plurals>

<!-- Colors -->
<string name="color_sakura">Sakura</string>
Expand All @@ -255,9 +254,5 @@
<string name="color_deep_orange">Deep orange</string>
<string name="color_brown">Brown</string>
<string name="color_blue_grey">Blue grey</string>
<string name="installed">Installed</string>
<plurals name="module_release_assets_download_count">
<item quantity="one">%d download</item>
<item quantity="other">%d downloads</item>
</plurals>

</resources>
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
android.experimental.enableNewResourceShrinker.preciseShrinking=true
android.enableAppCompileTimeRClass=true
android.useAndroidX=true
android.nonFinalResIds=false

0 comments on commit 348f049

Please sign in to comment.