Seamless Legacy Network Switching (Android 7-11) & UI Cleanup - #21
Merged
Conversation
LEGACY MODE VALUES - 5G Only: 23 - Preferred 5G: 33 - 4G Only: 11 - Preferred 4G: 9 - Preferred 3G: 0 - 2G Only: 1
…lers - Added explicit null handling for the active subscription list - Exposes the existing apllication context get context
- Routed Android 7 to 11 mode changes through the legacy backend - Kept Android 12+ mode changes the existing allowed-network-types backend
- Added a dedicated legacy network mode backend. - Added transactional mode writes and cellular modem restart. - Added airplane mode radio-list preservation and restoration. - Added clean up traps and post operation verification.
- Removed all legacy shell scripts that relied on settings put global and Airplane Mode toggling to force network changes. - Added dynamic path resolution (context.getApplicationInfo().sourceDir) to locate the app's base APK at runtime. - Refactored the apply() method to format and execute an app_process shell command using the APK as the CLASSPATH and targeting NetworkModePayload. - Simplified the legacy execution flow and error handling, relying on the Java payload's internal success/failure outputs.
…hing - Created a headless Java class with a main method designed to run natively via app_process outside the standard app lifecycle. - Implemented Java Reflection to securely hook into the hidden android.os.ServiceManager and retrieve the phone service binder. - Added logic to invoke ITelephony.setPreferredNetworkType(subId, mode) directly, bypassing standard Android permission restrictions. - Added @keep annotations to the class and main method to ensure R8/ProGuard does not strip or obfuscate the payload during release builds.
- Removed the unused segmented_selected color hex value. - Removed the unused segmented_text_selected color hex value. - Removed the unused accent_green color hex value. - Removed the unused cycle_badge_bg color hex value to resolve Android Lint warnings and clean up the resource file.
- Removed the unused segmented_selected color hex value. - Removed the unused segmented_text_selected color hex value. - Removed the unused accent_green color hex value. - Removed the unused cycle_badge_bg color hex value to maintain parity with the light theme cleanup and resolve Lint warnings.
Deleted the unused XML color state list selector (color_segmented_text.xml) identified during the Android Lint analysis to reduce APK size.
- Removed the ic_menu_book.xml Material Design vector drawable that was no longer referenced by any UI layouts.
- Removed the obsolete section_outline_bg.xml shape drawable to eliminate dead code and shrink the resource bundle.
- Deleted the unused selector_segmented_tab.xml background state selector based on the Lint dead-code analysis.
- Deleted the unused rectangular variant of the segmented tab background selector (selector_segmented_tab_rect.xml) to keep the codebase clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
This Pull Request introduces full, seamless network mode switching support for older Android devices (Android 7 to 11). Since the
cmd phoneutility used for Android 12+ is unavailable on older versions, this PR implements a robust "Pro" fallback mechanism using a headless Java payload executed viaapp_process. It also includes housekeeping to remove unused resources flagged by Android Lint, reducing overall APK size.🚀 Key Changes
1. Legacy Java Payload Implementation (Seamless Switching)
NetworkModePayload) with amainmethod designed to run natively viaapp_processoutside the standard app lifecycle.android.os.ServiceManager, retrieve thephoneservice binder, and invokeITelephony.setPreferredNetworkType(subId, mode)directly.apply()method to dynamically resolve the app's base APK path (context.getApplicationInfo().sourceDir) to use as theCLASSPATHforapp_processexecution.@Keepannotations to the payload class and main method to ensure they are not stripped or obfuscated during release builds.settings put globaland Airplane Mode toggles.2. Architecture & Routing Dispatch
allowed-network-typesbackend.NetworkModeenum:5G Only: 23Preferred 5G: 334G Only: 11Preferred 4G: 9Preferred 3G: 02G Only: 13. Housekeeping & Dead Code Removal
Cleaned up unused XML files and resources to shrink the APK size and resolve Lint warnings:
segmented_selected,segmented_text_selected,accent_green,cycle_badge_bg) from both Light and Dark themecolors.xmlfiles.color_segmented_text.xml).ic_menu_book.xml,section_outline_bg.xml).selector_segmented_tab.xml,selector_segmented_tab_rect.xml).