Fixing permission handling + ui flow - #40
Merged
Merged
Conversation
* 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'
…afazaa-org#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.
* 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 .
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.
KvRae
added a commit
that referenced
this pull request
Dec 17, 2025
* Update README.md * update protection dialog. * fix app not blocking. * get vpn permission if it's revoked * add script to block "background apps dialog". * fix crash of starting screenshot overlay. * fix app update screen blocked. * fix our app is in the blocking list. * add manufacturer to log ui screen. * fix our app is in the blocking list. * add more details to log ui tree. upgrade version. * fix dialog small button. * fix screen shot isn't delaying. * convert ui tree logging to json. * feat: Add GitHub Action for Firebase App Distribution - 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. * feat: Make gradlew executable in firebase-dist workflow Updates the `firebase-dist.yml` workflow: - Adds a step to make `./gradlew` executable. - Bumps the `gradle/actions/setup-gradle` action to v5. * feat: Decode google-services.json from base64 The `firebase-dist.yml` workflow is updated to decode the `google-services.json` secret from base64. * ci: exclude lintVitalRelease from release build This will avoid potential CI build failures. * feat: Use wildcard to find release APK 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`. * feat: Use specific APK path for Firebase Distribution 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. * feat: Improve APK path reference in Firebase distribution workflow 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. * feat: Improve APK path reference in Firebase distribution workflow 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. * Enhancement/UI enhancement (#31) * 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`. * add more details to log ui tree. upgrade version. * fix dialog small button. * fix screen shot isn't delaying. * convert ui tree logging to json. * fix error with arabic letters in the log file. * Fix(CI): Use `testers` instead of `groups` in Firebase distribution workflow * feat: Use tester groups in Firebase Distribution workflow Update the Firebase Distribution GitHub workflow to use `groups` instead of individual `testers`. This allows for easier management of QA testers directly within the Firebase App Distribution console. * add more scripts. uninstall screen realme uninstall screen samsung * feat: Build and upload Debug APK to Firebase This commit modifies the `firebase-dist.yml` workflow to build and upload the `debug` variant of the application instead of `release`. Key changes include: - Updating the workflow name to specify "Debug". - Changing the build task from `assembleRelease` to `assembleDebug`. - Adjusting the APK search path from `release` to `debug`. * feat: Update firebase-dist.yml trigger Change the workflow trigger from push on `feature/gh-action` to pull_request on `test`. * Update README.md * feat: Run firebase-dist workflow on gh-action branch The GitHub Action workflow for Firebase App Distribution will now be triggered on pushes and pull requests to the `gh-action` branch, in addition to the existing `test` branch. * feat: Build and upload release APK to Firebase Distribution The workflow now builds the `release` variant instead of `debug`. This includes updating the Gradle task to `assembleRelease`, modifying the search path for the APK, and updating the job and step names to reflect the change. * ci: Update firebase-dist workflow branches The `firebase-dist.yml` workflow is updated to trigger on pushes and pull requests to the `feature/gh-action` branch instead of `gh-action`. * ci: Update firebase-dist workflow branches The `firebase-dist.yml` workflow is updated to trigger on pushes and pull requests to the `feature/gh-action` branch instead of `gh-action`. * ci: Build and distribute APK instead of AAB with code version 11 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. * chore: Update Firebase distribution workflow to use debug build with new code version please make sure to uninstall existing apk * Update branch triggers in Firebase workflow * Adding Admin permission / Report for validation features (#38) * 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> * Update branch triggers in firebase-dist.yml Changing branch trigger * Update Firebase App Distribution badge link Updated pip link from kvrae repo to mafazaa org repo * Replace Firebase App Distribution badge with Test Build Updated badge for Firebase Test Build in README. * Fixing permission handling + ui flow (#40) * 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> * add more scripts. + restart th vpn when revoked. * fixing merge issues. * cleanup * Update Firebase App Distribution badge link * v0.0.19 --------- Co-authored-by: Karam Mannai <58667227+KvRae@users.noreply.github.com> Co-authored-by: KvRae <karamelmannai@gmail.com> Co-authored-by: Ammar Yasser <ammaryasser.allaithy+gh@gmail.com>
KvRae
added a commit
that referenced
this pull request
Dec 17, 2025
* Update README.md * update protection dialog. * fix app not blocking. * get vpn permission if it's revoked * add script to block "background apps dialog". * fix crash of starting screenshot overlay. * fix app update screen blocked. * fix our app is in the blocking list. * add manufacturer to log ui screen. * fix our app is in the blocking list. * add more details to log ui tree. upgrade version. * fix dialog small button. * fix screen shot isn't delaying. * convert ui tree logging to json. * feat: Add GitHub Action for Firebase App Distribution - 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. * feat: Make gradlew executable in firebase-dist workflow Updates the `firebase-dist.yml` workflow: - Adds a step to make `./gradlew` executable. - Bumps the `gradle/actions/setup-gradle` action to v5. * feat: Decode google-services.json from base64 The `firebase-dist.yml` workflow is updated to decode the `google-services.json` secret from base64. * ci: exclude lintVitalRelease from release build This will avoid potential CI build failures. * feat: Use wildcard to find release APK 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`. * feat: Use specific APK path for Firebase Distribution 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. * feat: Improve APK path reference in Firebase distribution workflow 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. * feat: Improve APK path reference in Firebase distribution workflow 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. * Enhancement/UI enhancement (#31) * 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`. * add more details to log ui tree. upgrade version. * fix dialog small button. * fix screen shot isn't delaying. * convert ui tree logging to json. * fix error with arabic letters in the log file. * Fix(CI): Use `testers` instead of `groups` in Firebase distribution workflow * feat: Use tester groups in Firebase Distribution workflow Update the Firebase Distribution GitHub workflow to use `groups` instead of individual `testers`. This allows for easier management of QA testers directly within the Firebase App Distribution console. * add more scripts. uninstall screen realme uninstall screen samsung * feat: Build and upload Debug APK to Firebase This commit modifies the `firebase-dist.yml` workflow to build and upload the `debug` variant of the application instead of `release`. Key changes include: - Updating the workflow name to specify "Debug". - Changing the build task from `assembleRelease` to `assembleDebug`. - Adjusting the APK search path from `release` to `debug`. * feat: Update firebase-dist.yml trigger Change the workflow trigger from push on `feature/gh-action` to pull_request on `test`. * Update README.md * feat: Run firebase-dist workflow on gh-action branch The GitHub Action workflow for Firebase App Distribution will now be triggered on pushes and pull requests to the `gh-action` branch, in addition to the existing `test` branch. * feat: Build and upload release APK to Firebase Distribution The workflow now builds the `release` variant instead of `debug`. This includes updating the Gradle task to `assembleRelease`, modifying the search path for the APK, and updating the job and step names to reflect the change. * ci: Update firebase-dist workflow branches The `firebase-dist.yml` workflow is updated to trigger on pushes and pull requests to the `feature/gh-action` branch instead of `gh-action`. * ci: Update firebase-dist workflow branches The `firebase-dist.yml` workflow is updated to trigger on pushes and pull requests to the `feature/gh-action` branch instead of `gh-action`. * ci: Build and distribute APK instead of AAB with code version 11 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. * chore: Update Firebase distribution workflow to use debug build with new code version please make sure to uninstall existing apk * Update branch triggers in Firebase workflow * Adding Admin permission / Report for validation features (#38) * 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> * Update branch triggers in firebase-dist.yml Changing branch trigger * Update Firebase App Distribution badge link Updated pip link from kvrae repo to mafazaa org repo * Replace Firebase App Distribution badge with Test Build Updated badge for Firebase Test Build in README. * Fixing permission handling + ui flow (#40) * 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> * add more scripts. + restart th vpn when revoked. * fixing merge issues. * cleanup * Update Firebase App Distribution badge link * v0.0.19 --------- Co-authored-by: khaled <khaledhawwas11@gmail.com> Co-authored-by: Ammar Yasser <ammaryasser.allaithy+gh@gmail.com>
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.
No description provided.