Skip to content

Test to dev - #44

Merged
KvRae merged 60 commits into
devfrom
test
Dec 17, 2025
Merged

Test to dev #44
KvRae merged 60 commits into
devfrom
test

Conversation

@KvRae

@KvRae KvRae commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

Fixing protection on multiple devices

KvRae and others added 30 commits October 8, 2025 13:49
- 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`.
KvRae and others added 29 commits October 28, 2025 16:51
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.
uninstall screen realme
uninstall screen samsung
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`.
Change the workflow trigger from push on `feature/gh-action` to pull_request on `test`.
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.
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.
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>
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
@KvRae
KvRae merged commit 64101e4 into dev Dec 17, 2025
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants