Conversation
upgrade version.
- Creates a new workflow `firebase-dist.yml` to automate building and uploading release APKs. - The workflow is triggered on push to `feature/gh-action` or manually via `workflow_dispatch`. - Steps include checking out code, setting up JDK 17, caching Gradle, creating `google-services.json`, building the release APK, and uploading it to Firebase App Distribution.
Updates the `firebase-dist.yml` workflow: - Adds a step to make `./gradlew` executable. - Bumps the `gradle/actions/setup-gradle` action to v5.
The `firebase-dist.yml` workflow is updated to decode the `google-services.json` secret from base64.
This will avoid potential CI build failures.
The GitHub workflow for Firebase distribution is updated to use a wildcard path (`"**/*.apk"`) to locate the release APK. This makes the process more flexible by removing the hardcoded path to `app/build/outputs/apk/release/app-release.apk`.
Finds the specific release APK path and sets it as an output. The Firebase App Distribution step is updated to use this specific path instead of a glob pattern.
The commit adds a comment to clarify that the `file` parameter in the Firebase distribution step uses the APK path found by a previous step.
The commit adds a comment to clarify that the `file` parameter in the Firebase distribution step uses the APK path found by a previous step.
* Update README.md * Feat: Ui Enhancement: - Added splash screen to the app using the new splashscreen api - Added dark theme support - Enhanced SupportScreen.kt topbar navigation button - Worked on code clean ups (moved hardcoded strings to strings.xml) - replaced gradle dependencies imports using the new version catalog style - fixed the items color on status bar text on light mode using the edge to edge feature * - Removed the AppViewModelTest.kt implementation since its not working yet * refactor: use string resources for localization * feat: force Arabic locale and add backup rules - Add `locales_config.xml` and `data_extraction_rules.xml`. - Implement `LocaleHelper` to force the app's language to Arabic. - Update `AppActivity` to use the new locale helper. - Correct a constant name from `vpnAddress` to `VPN_ADDRESS`. * style(support): add padding to support screen * feat: internationalize EnableProtectionDialog - Replaced hardcoded strings in `EnableProtectionDialog.kt` with string resources. - Added English and Arabic translations for the new strings. * refactor: implement dark theme and RTL support - Update theme colors for better dark mode appearance. - Apply MaterialTheme colors and typography across various UI components (`AppBlockDialog`, `EnableProtectionDialog`, `LockScreenOverlay`, `ScreenshotOverlay`). - Change the app name in `strings.xml` to Arabic script. - Force Right-to-Left (RTL) layout and Arabic locale for the `LockScreenOverlay`.
upgrade version.
The `firebase-dist.yml` workflow is updated to trigger on pushes and pull requests to the `feature/gh-action` branch instead of `gh-action`.
The `firebase-dist.yml` workflow is updated to trigger on pushes and pull requests to the `feature/gh-action` branch instead of `gh-action`.
The Firebase distribution workflow has been updated to build and upload a release APK instead of an AAB. This involves changing the Gradle task from `bundleRelease` to `assembleRelease` and updating the subsequent steps to find and upload the generated `.apk` file.
…new code version please make sure to uninstall existing apk
Feature: Automate Debug APK build and distribution via GitHub Actions and firebase app distribution
* Report Form Validation Rules (#35) * report form validation: update strings * report form validation: add component LabelledTextField * report form validation: add validation rules (regex) * report form validation: rename strings keys * report form validation: refine regex rules * report form validation: validate user inputs against the rules * report form validation: add space between button and report statement * report form validation: fix: prevent numbers in name field * string res: change 'impossible' to 'hard' * Feature:Integrate Device Admin Permission and Refine Permission Flow (#33) * Update README.md * Feat: Ui Enhancement: - Added splash screen to the app using the new splashscreen api - Added dark theme support - Enhanced SupportScreen.kt topbar navigation button - Worked on code clean ups (moved hardcoded strings to strings.xml) - replaced gradle dependencies imports using the new version catalog style - fixed the items color on status bar text on light mode using the edge to edge feature * - Removed the AppViewModelTest.kt implementation since its not working yet * refactor: use string resources for localization * feat: force Arabic locale and add backup rules - Add `locales_config.xml` and `data_extraction_rules.xml`. - Implement `LocaleHelper` to force the app's language to Arabic. - Update `AppActivity` to use the new locale helper. - Correct a constant name from `vpnAddress` to `VPN_ADDRESS`. * style(support): add padding to support screen * feat: internationalize EnableProtectionDialog - Replaced hardcoded strings in `EnableProtectionDialog.kt` with string resources. - Added English and Arabic translations for the new strings. * refactor: implement dark theme and RTL support - Update theme colors for better dark mode appearance. - Apply MaterialTheme colors and typography across various UI components (`AppBlockDialog`, `EnableProtectionDialog`, `LockScreenOverlay`, `ScreenshotOverlay`). - Change the app name in `strings.xml` to Arabic script. - Force Right-to-Left (RTL) layout and Arabic locale for the `LockScreenOverlay`. * feat: Force light theme Force the light theme by disabling the dark theme logic. The app will now use `dynamicLightColorScheme` on supported devices or default to `LightColorScheme`. * feat: Add Device Admin permission for app blocking This commit introduces the Device Admin permission to enhance the app blocking functionality. - Adds `AppDeviceAdminReceiver` and necessary XML configurations to register the app as a device administrator. - Implements utility functions (`hasAdminPermission`, `requestAdminPermission`) to check for and request Device Admin privileges on startup. - Includes a new string resource for the admin permission explanation. - Refactors UI logic by moving it from `AppActivity` into a new `MainScreen.kt` composable. - Updates the accessibility service configuration to target the settings app and be an accessibility tool. * feat: Implement sequential permission requests Refactors the permission handling logic to request permissions sequentially. After the user confirms enabling protection, the app now iterates through a predefined chain of required permissions (Usage Stats, Overlay, Accessibility, etc.) and prompts the user for each one that is missing. Once all necessary permissions are granted, protection is automatically activated, and a confirmation message is displayed. This streamlines the onboarding process for the user. * feat: Add Device Admin permission check - Add Device Admin to the permission request flow. - Remove UsageStats from the initial permission chain. - Update UI strings for the new administrative permission dialog in English and Arabic. * feat: Make accessibility service persistent - Run `MyAccessibilityService` as a foreground service with a persistent notification to prevent the system from killing it. - Implement a mechanism to automatically restart the service if it's terminated. - Refactor string resources for better maintainability. - Fix text color issues on the support screen. * refactor: remove MainScreen.kt The `MainScreen.kt` file, which contained the main UI composable and navigation logic, has been deleted. * Refactor: Change permission request order and clean up admin policies * feat: Add watchdog to ensure service persistence Introduces a `WatchdogReceiver` to ensure the `MyAccessibilityService` remains active. - The service now schedules a repeating alarm (`scheduleWatchdog`) when it starts. This alarm triggers the `WatchdogReceiver` periodically. - The `WatchdogReceiver` checks if the service is running and restarts it if it's not. - The alarm is canceled when the service is stopped (`cancelWatchdog`). - The `BootReceiver` is updated to explicitly start the accessibility service on device boot. * chore: Remove redundant comment Removes an unnecessary comment from `AndroidManifest.xml`. * feat: Increase watchdog interval and clean up service creation Increased the watchdog interval from 30 seconds to 15 minutes. Removed redundant `LockOverlayManager` initialization in `MyAccessibilityService`'s `onCreate` method and added a log message for service creation. * refactor: Start accessibility service on boot and inject LockOverlayManager Starts MyAccessibilityService on device boot using `startForegroundService` in BootReceiver. This ensures the service starts correctly on newer Android versions. Injects `LockOverlayManager` in MyAccessibilityService's `onCreate` method. Adds the `LOCKED_BOOT_COMPLETED` action to the BootReceiver's intent filter in the manifest to handle direct boot scenarios. --------- Co-authored-by: Ammar Yasser <ammaryasser.allaithy+gh@gmail.com>
Changing branch trigger
Updated pip link from kvrae repo to mafazaa org repo
Updated badge for Firebase Test Build in README.
* Report Form Validation Rules (#35) * report form validation: update strings * report form validation: add component LabelledTextField * report form validation: add validation rules (regex) * report form validation: rename strings keys * report form validation: refine regex rules * report form validation: validate user inputs against the rules * report form validation: add space between button and report statement * report form validation: fix: prevent numbers in name field * string res: change 'impossible' to 'hard' * Feature:Integrate Device Admin Permission and Refine Permission Flow (#33) * Update README.md * Feat: Ui Enhancement: - Added splash screen to the app using the new splashscreen api - Added dark theme support - Enhanced SupportScreen.kt topbar navigation button - Worked on code clean ups (moved hardcoded strings to strings.xml) - replaced gradle dependencies imports using the new version catalog style - fixed the items color on status bar text on light mode using the edge to edge feature * - Removed the AppViewModelTest.kt implementation since its not working yet * refactor: use string resources for localization * feat: force Arabic locale and add backup rules - Add `locales_config.xml` and `data_extraction_rules.xml`. - Implement `LocaleHelper` to force the app's language to Arabic. - Update `AppActivity` to use the new locale helper. - Correct a constant name from `vpnAddress` to `VPN_ADDRESS`. * style(support): add padding to support screen * feat: internationalize EnableProtectionDialog - Replaced hardcoded strings in `EnableProtectionDialog.kt` with string resources. - Added English and Arabic translations for the new strings. * refactor: implement dark theme and RTL support - Update theme colors for better dark mode appearance. - Apply MaterialTheme colors and typography across various UI components (`AppBlockDialog`, `EnableProtectionDialog`, `LockScreenOverlay`, `ScreenshotOverlay`). - Change the app name in `strings.xml` to Arabic script. - Force Right-to-Left (RTL) layout and Arabic locale for the `LockScreenOverlay`. * feat: Force light theme Force the light theme by disabling the dark theme logic. The app will now use `dynamicLightColorScheme` on supported devices or default to `LightColorScheme`. * feat: Add Device Admin permission for app blocking This commit introduces the Device Admin permission to enhance the app blocking functionality. - Adds `AppDeviceAdminReceiver` and necessary XML configurations to register the app as a device administrator. - Implements utility functions (`hasAdminPermission`, `requestAdminPermission`) to check for and request Device Admin privileges on startup. - Includes a new string resource for the admin permission explanation. - Refactors UI logic by moving it from `AppActivity` into a new `MainScreen.kt` composable. - Updates the accessibility service configuration to target the settings app and be an accessibility tool. * feat: Implement sequential permission requests Refactors the permission handling logic to request permissions sequentially. After the user confirms enabling protection, the app now iterates through a predefined chain of required permissions (Usage Stats, Overlay, Accessibility, etc.) and prompts the user for each one that is missing. Once all necessary permissions are granted, protection is automatically activated, and a confirmation message is displayed. This streamlines the onboarding process for the user. * feat: Add Device Admin permission check - Add Device Admin to the permission request flow. - Remove UsageStats from the initial permission chain. - Update UI strings for the new administrative permission dialog in English and Arabic. * feat: Make accessibility service persistent - Run `MyAccessibilityService` as a foreground service with a persistent notification to prevent the system from killing it. - Implement a mechanism to automatically restart the service if it's terminated. - Refactor string resources for better maintainability. - Fix text color issues on the support screen. * refactor: remove MainScreen.kt The `MainScreen.kt` file, which contained the main UI composable and navigation logic, has been deleted. * Refactor: Change permission request order and clean up admin policies * feat: Add watchdog to ensure service persistence Introduces a `WatchdogReceiver` to ensure the `MyAccessibilityService` remains active. - The service now schedules a repeating alarm (`scheduleWatchdog`) when it starts. This alarm triggers the `WatchdogReceiver` periodically. - The `WatchdogReceiver` checks if the service is running and restarts it if it's not. - The alarm is canceled when the service is stopped (`cancelWatchdog`). - The `BootReceiver` is updated to explicitly start the accessibility service on device boot. * chore: Remove redundant comment Removes an unnecessary comment from `AndroidManifest.xml`. * feat: Increase watchdog interval and clean up service creation Increased the watchdog interval from 30 seconds to 15 minutes. Removed redundant `LockOverlayManager` initialization in `MyAccessibilityService`'s `onCreate` method and added a log message for service creation. * refactor: Start accessibility service on boot and inject LockOverlayManager Starts MyAccessibilityService on device boot using `startForegroundService` in BootReceiver. This ensures the service starts correctly on newer Android versions. Injects `LockOverlayManager` in MyAccessibilityService's `onCreate` method. Adds the `LOCKED_BOOT_COMPLETED` action to the BootReceiver's intent filter in the manifest to handle direct boot scenarios. * Feature: prevent revoking permissions (#37) * Update README.md * Add Firebase App Distribution badge to README * refactor: Move accessibility service logic to extension functions This commit refactors `MyAccessibilityService` by extracting helper functions into a new `MyAcceessibilityExtenstions.kt` file. This improves code organization and readability. Key changes: - Created extension functions for scheduling/canceling the watchdog, blocking apps, creating notifications, and checking for blocked apps. - Introduced `RestartReceiver` to handle restarting the accessibility service when it's terminated. - Updated `MyAccessibilityService` to use the new receiver for restarts upon task removal, replacing the previous `PendingIntent` logic. - Cleaned up the `AndroidManifest.xml` and removed the unused `force-lock` policy from the device admin configuration. * feat: Improve accessibility service abuse detection - Block access to the accessibility settings screen to prevent service termination. - Enhance screen analysis to detect attempts to disable the service. - Use Koin for WorkManager dependency injection. - Update Ktor's `readBytes` to `readRawBytes`. * feat: Add DeviceUtils to dynamically find settings package A new singleton object, `DeviceUtils`, is introduced to hold device-specific information. It includes a function to programmatically query the system for the default settings application package name, making it more reliable than hardcoded values. The result is cached for efficiency using a lazy property. * Refactor(WorkManager): Remove custom WorkManager configuration Removes the `Configuration.Provider` implementation and custom `workManagerConfiguration`. This simplifies the WorkManager setup by relying on the default initialization. The `KoinWorkerFactory` is also removed as it's no longer necessary. * refactor: Improve service lifecycle and reliability This commit refactors the service management logic for better reliability and stability. Key changes include: - Replaced the `isRunning` boolean flag in `MyAccessibilityService` and `MyVpnService` with a robust `isServiceRunning()` utility function. This provides a more accurate state of the services. - Refactored `MyAccessibilityService` to start foreground immediately in `onCreate`, simplifying its lifecycle management. - Moved the notification creation logic to a shared `ContextUtils.kt` extension for reuse. - Improved the `WatchdogReceiver` to use the new `isServiceRunning()` check, making service restart logic more reliable. - Enhanced `MyVpnService` with an alarm-based restart mechanism (`scheduleRestart`) to ensure it comes back up if terminated. - Centralized VPN start/stop logic into a new `MyVpnExtensions.kt` file for better code organization. - Added `USE_EXACT_ALARM` permission to support the new reliable service restart mechanism. * refactor: Improve service startup and reliability This commit refactors the startup process for the Accessibility and VPN services to improve reliability and foreground management. Key changes include: - Introduced a action for both and to explicitly start them in the foreground. - Modified service startup calls in to use the new action, ensuring services are immediately promoted. - Implemented and functions for to handle service restarts more reliably when the task is removed. - Refined the notification content for better clarity. - Corrected a typo in a string resource name from to . --------- Co-authored-by: Ammar Yasser <ammaryasser.allaithy+gh@gmail.com>
+ restart th vpn when revoked.
…into my-new-branch # Conflicts: # README.md # app/src/main/java/com/mafazaa/ainaa/AppActivity.kt # app/src/main/java/com/mafazaa/ainaa/domain/models/ScreenAnalysis.kt # app/src/main/java/com/mafazaa/ainaa/service/MyAccessibilityService.kt # app/src/main/java/com/mafazaa/ainaa/service/MyVpnService.kt # app/src/main/java/com/mafazaa/ainaa/ui/dialog/EnableProtectionDialog.kt # app/src/main/java/com/mafazaa/ainaa/ui/dialog/PermissionDialog.kt # app/src/main/java/com/mafazaa/ainaa/ui/dialog/ReportProblemDialog.kt # app/src/main/java/com/mafazaa/ainaa/ui/support/SupportScreen.kt # app/src/main/java/com/mafazaa/ainaa/utils/Constants.kt # app/src/main/java/com/mafazaa/ainaa/utils/MyLog.kt # app/src/main/res/values-ar/strings.xml # app/src/main/res/values/strings.xml
# Conflicts: # app/build.gradle.kts # app/src/main/java/com/mafazaa/ainaa/utils/MyLog.kt # versionCode
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to restart VPN after revocation and introduces new device-specific uninstall detection scripts along with enhanced logging capabilities.
- Version bumped from v0.0.4 (code 10) to v0.0.15 (code 15)
- Added JSON-based structured logging with metadata (version, manufacturer, model, timestamp)
- Implemented VPN auto-restart logic after service destruction with 5-second delay
- Added three new JavaScript detection scripts for Samsung and Realme uninstall screens
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| versionCode | Updated version code from 10 to 11 (inconsistent with build.gradle.kts) |
| app/build.gradle.kts | Bumped versionCode to 15 and versionName to v0.0.15 |
| app/src/main/java/com/mafazaa/ainaa/utils/MyLog.kt | Added JSON logging format with metadata and BuildConfig integration |
| app/src/main/java/com/mafazaa/ainaa/service/MyVpnService.kt | Refactored VPN service with auto-restart logic in onDestroy(), removed ACTION_START_FOREGROUND |
| app/src/main/java/com/mafazaa/ainaa/utils/ContextUtils.kt | Simplified VPN service start logic by removing ACTION_START_FOREGROUND references |
| app/src/main/java/com/mafazaa/ainaa/utils/Constants.kt | Added three new device-specific uninstall detection scripts and updated existing script logic |
| app/src/main/java/com/mafazaa/ainaa/ui/dialog/EnableProtectionDialog.kt | Improved dialog UX with scrollable content, fixed button layout, and reduced timer to 3 seconds |
| app/src/main/java/com/mafazaa/ainaa/service/MyAccessibilityService.kt | Added isRunning state tracking and validation checks |
| app/src/main/java/com/mafazaa/ainaa/helpers/ScreenshotOverlayManager.kt | Added delay parameter to screenshot action |
| app/src/main/java/com/mafazaa/ainaa/helpers/ScreenAnalyser.kt | Removed unused allTexts collection |
| app/src/main/java/com/mafazaa/ainaa/domain/models/ScreenAnalysis.kt | Added toJson() method using Gson and removed allTexts field |
| app/src/main/java/com/mafazaa/ainaa/data/local/RealFileRepo.kt | Explicitly specified UTF-8 charset for log file operations |
| .github/workflows/firebase-dist.yml | Added new CI workflow for Firebase App Distribution on test/dev branches |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| super.onRevoke()//todo | ||
| isRunning = false | ||
| MyLog.d(TAG, "VPN revoked") | ||
| serviceScope.launch { | ||
|
|
||
| } |
There was a problem hiding this comment.
Empty launch block serves no purpose. Either implement the restart logic here or remove this empty block. The onRevoke() method should handle VPN permission revocation properly.
| super.onRevoke()//todo | |
| isRunning = false | |
| MyLog.d(TAG, "VPN revoked") | |
| serviceScope.launch { | |
| } | |
| super.onRevoke() | |
| MyLog.d(TAG, "VPN revoked") | |
| stopVpn() |
| MyLog.d(TAG, "VPN service destroyed") | ||
| serviceScope.launch { | ||
| delay(5000) | ||
| if (MyAccessibilityService.isRunning&&this@MyVpnService.hasVpnPermission()) { |
There was a problem hiding this comment.
The condition check has a spacing issue (&& without space after it), which affects code readability. Should be isRunning && this@MyVpnService.hasVpnPermission().
| if (MyAccessibilityService.isRunning&&this@MyVpnService.hasVpnPermission()) { | |
| if (MyAccessibilityService.isRunning && this@MyVpnService.hasVpnPermission()) { |
| if (MyAccessibilityService.isRunning&&this@MyVpnService.hasVpnPermission()) { | ||
| Log.d(TAG, "Restarting VPN service after revocation") | ||
| this@MyVpnService.startVpn(sharedPrefs.dnsProtectionLevel) | ||
| } | ||
|
|
There was a problem hiding this comment.
The restart logic after VPN revocation is problematic. Calling startVpn() from onDestroy() while the service is being destroyed will likely fail. VPN restart should be initiated through proper service restart mechanisms (e.g., using a new Intent to restart the service), not by calling instance methods during teardown.
| if (MyAccessibilityService.isRunning&&this@MyVpnService.hasVpnPermission()) { | |
| Log.d(TAG, "Restarting VPN service after revocation") | |
| this@MyVpnService.startVpn(sharedPrefs.dnsProtectionLevel) | |
| } | |
| if (MyAccessibilityService.isRunning && this@MyVpnService.hasVpnPermission()) { | |
| Log.d(TAG, "Restarting VPN service after revocation") | |
| val intent = Intent(applicationContext, MyVpnService::class.java).apply { | |
| action = ACTION_START | |
| } | |
| applicationContext.startService(intent) | |
| } |
| versionCode = 15 | ||
| versionName = "v0.0.15" |
There was a problem hiding this comment.
[nitpick] The version number format is inconsistent. The versionCode is 15 but versionName is "v0.0.15", suggesting a direct mapping. However, previously versionCode was 10 with versionName "v0.0.4", which indicates version codes don't directly correspond to version names. Consider using semantic versioning consistently.
| versionCode = 15 | |
| versionName = "v0.0.15" | |
| // versionCode = major * 10000 + minor * 100 + patch | |
| versionCode = 15 | |
| versionName = "0.0.15" |
| if (!screen.hasAppName) return false; | ||
| if (screen.isSettingsScreen) return false; | ||
| if (!containsText(screen.root, "Do you want to uninstall this app?")) return false; | ||
| const hasTitle = containsText(screen.root, "عَيْنًا سَلْسَبِيلًا") || containsText(screen.root, "alertTitle") || !!findById(screen.root, "android:id/alertTitle"); |
There was a problem hiding this comment.
The text "عَيْنًا سَلْسَبِيلًا" appears to be hardcoded in a script that's checking for an alert title. This seems incorrect as it's an Arabic phrase (not a typical Android UI element identifier) and doesn't match the pattern of checking for system UI elements like "alertTitle" or resource IDs. This will likely cause false negatives when detecting uninstall dialogs.
| const hasTitle = containsText(screen.root, "عَيْنًا سَلْسَبِيلًا") || containsText(screen.root, "alertTitle") || !!findById(screen.root, "android:id/alertTitle"); | |
| const hasTitle = containsText(screen.root, "alertTitle") || !!findById(screen.root, "android:id/alertTitle"); |
|
|
||
| const val ACTION_START_FOREGROUND = "START_VPN_FOREGROUND" | ||
| const val ACTION_STOP = "STOP_VPN" | ||
| var isRunning = false//todo remove |
There was a problem hiding this comment.
Using isRunning static flag for managing service state is unreliable in a multi-process or service lifecycle context. The flag should be removed as indicated by the "todo remove" comment, and proper service lifecycle methods should be used instead.
| internal val sharedPrefs: SharedPrefs by inject(SharedPrefs::class.java) | ||
| var vpnInterface: ParcelFileDescriptor? = null | ||
| private val sharedPrefs: SharedPrefs by inject(SharedPrefs::class.java) | ||
| private val serviceScope = CoroutineScope(Dispatchers.Default + Job()) |
There was a problem hiding this comment.
The serviceScope coroutine scope is never cancelled in this service. This can lead to memory leaks and coroutines running after the service is destroyed. Add serviceScope.cancel() in the onDestroy() method.
| text = stringResource(R.string.unistall_feature_message), | ||
| fontSize = 13.sp, | ||
| color = MaterialTheme.colorScheme.onSurfaceVariant, | ||
| modifier = Modifier.padding(bottom = 8.dp) | ||
| ) | ||
| Text( | ||
| text = stringResource(R.string.classic_unistall_text), | ||
| style = MaterialTheme.typography.titleSmall, | ||
| color = MaterialTheme.colorScheme.primary, | ||
| modifier = Modifier.padding(bottom = 8.dp) | ||
| ) | ||
| Text( | ||
| text = stringResource(R.string.classic_unistall_message), |
There was a problem hiding this comment.
Typo in resource string key: "unistall" should be "uninstall" (missing 'n'). This appears in multiple places and should be corrected for consistency.
| class MyVpnService : VpnService() { | ||
| internal var vpnInterface: ParcelFileDescriptor? = null | ||
| internal val sharedPrefs: SharedPrefs by inject(SharedPrefs::class.java) | ||
| var vpnInterface: ParcelFileDescriptor? = null |
There was a problem hiding this comment.
[nitpick] Inconsistent visibility modifier. The vpnInterface property changed from internal to public (no modifier), making it accessible outside the module. If this is intentional for testing or external access, consider making it internal or private with a public getter for better encapsulation.
| var vpnInterface: ParcelFileDescriptor? = null | |
| private var vpnInterface: ParcelFileDescriptor? = null |
| this.action = if ( | ||
| action == MyVpnService.ACTION_START_FOREGROUND | ||
| action == MyVpnService.ACTION_START | ||
| ) { | ||
| MyVpnService.ACTION_START_FOREGROUND | ||
| MyVpnService.ACTION_START | ||
| } else { | ||
| MyVpnService.ACTION_START | ||
| } |
There was a problem hiding this comment.
The logic in lines 77-82 is redundant. The condition checks if action == MyVpnService.ACTION_START, and both the true and false branches execute MyVpnService.ACTION_START. This entire if-else block can be simplified to just set the action to ACTION_START.
No description provided.