Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 260 #270

Merged
Merged

Conversation

PatDyn
Copy link
Contributor

@PatDyn PatDyn commented May 2, 2023

This should somewhat mitigate or even solve Issue #260 and #264.
It may even improve first startup performance a little bit.

What changed:

  • Add a sequence diagram of the old architecture in doc
  • Reduce amount of calls to the PackageManager
  • Move the calculation of the packageName to view time
    • calculate the name without a regex
  • Refactor ExodusUpdateService and PackageManagerModule (PMM)
    • add a ExodusPackageRepository
    • move most of functionality from PMM to there
    • move most of the list operations off the main thread
    • only generate the validPackages list on the main thread
      • as this is immediately needed for the apps operation
  • Implement tests accordingly

@Jean-BaptisteC
Copy link
Contributor

Jean-BaptisteC commented May 2, 2023

Permissions is not order by alphabetically
I have ANR on app after consult permissions about Services Google Play (323 permissions)
Edit:
ANR is not reproduced with apk without network local config

@Jean-BaptisteC
Copy link
Contributor

Wrong regex on short permission:
Full permission:

  • com.android.vending.p2p.APP_INSTALL_API
    Short permission:
  • 2p.APP_INSTALL_API
    Full permission:
  • com.x8bit.bitwarden.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
    Short permission:
  • 8bit.bitwarden.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
    Full permission:
  • Com.google.restricted_assist_gesture.permission.RESTRICTED_ASSIST_GESTURE_PROVIDER
    Short permission:
  • _assist_gesture.permission.RESTRICTED_ASSIST_GESTURE_PROVIDER

@PatDyn
Copy link
Contributor Author

PatDyn commented May 3, 2023

Permissions is not order by alphabetically I have ANR on app after consult permissions about Services Google Play (323 permissions) Edit: ANR is not reproduced with apk without network local config

I guess the ANR was actually caused by computing the name on view time. My bad.
I moved it back to the PackageRepository and added a shortName and longName property to the permission data class. So we do not use as many resources, when navigating the app.

Edit: Also the sorting is fixed now.

@PatDyn
Copy link
Contributor Author

PatDyn commented May 3, 2023

Wrong regex on short permission: Full permission:

* com.android.vending.p2p.APP_INSTALL_API
  Short permission:

* 2p.APP_INSTALL_API
  Full permission:

* com.x8bit.bitwarden.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
  Short permission:

* 8bit.bitwarden.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
  Full permission:

* Com.google.restricted_assist_gesture.permission.RESTRICTED_ASSIST_GESTURE_PROVIDER
  Short permission:

* _assist_gesture.permission.RESTRICTED_ASSIST_GESTURE_PROVIDER

This is fixed now - turns out the regex can not be fully avoided. But the complicated regex will now only be used in special cases.

Copy link
Contributor

@Jean-BaptisteC Jean-BaptisteC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Pixel 6 - Android 13
Order permissions ✅
Regex ✅

Please rebase branch

@PatDyn
Copy link
Contributor Author

PatDyn commented May 3, 2023

white_check_mark Pixel 6 - Android 13 Order permissions white_check_mark Regex white_check_mark

Please rebase branch

Rebase is done.

@Jean-BaptisteC Jean-BaptisteC merged commit 3e2faf6 into Exodus-Privacy:master May 3, 2023
Jean-BaptisteC added a commit that referenced this pull request May 16, 2023
* Update Github actions to remove network config (#269)

* Issue 260 (#270)

* Update Github actions to remove network config (#269)

* Add sequence diagram of PackageManagerModule

* Move calls to PackageManager outside of nested loop

We do not call the PackageManager from inside a nested for loop anymore.
Instead the generation of the Permission instances list was lifted out.
Also the number of times we do callbacks to the packageManager is
reduced. This should reduce the occurrence of Issue #260 and Issue #264.

* Calculate short name on view time

* Add test for identity

* Linting

* Rewrite test for more accuracy

* Avoid regex

* Readd sorting of permissions list

* Refactor to repository pattern

* Update tests accordingly

* Linting

* Fix typo

* Refactor Permission Data Class

Now uses longName for identification and short name for display.

* Correct sorting of permissions

* Fix name computing

---------

Co-authored-by: Jean-Baptiste <87148630+Jean-BaptisteC@users.noreply.github.com>

* Update to API 33

* Improve config build

* Add new permission and enable locales config

* Add themed icon

* Fix format

* Fix resConfig

* Bump dependencies

* Add sequence diagram

* WIP Implement logic to store notification permission info

* WIP Use notification permission info in VM

* WIP Implementing the permission request logic

* WIP Implement permission request

* Implement onRequestPermissionsResult

* Use single key for saving perm info

* Use single key for saving perm info

* Check for permission before showing notification

* Refactor request and check to own funcs

* Add logging

* Add ToDo

* Move the DataStoreModule

* Add A DataStoreRepo and a Storage Interface

* Adapt DataStoreModule

* Refactor for new architecture

* Remove dataStoreModule from Service

* Collect only the first elem

* Cache config

* Inject networkManager in constructor

* Reorder functions

* Load config as LiveData

* Move init to DialogFragment

* Use MainActivityViewModel, implement init

DialogFragment VM is currently redundant as it would again use
identical functionality when saving app data. Also due to init happening
in the Fragment now, we need to access functionality from the MAVM.

* Don't use flow in insert

* Add logging

* Start only when permission was asked

* Save appAppSetup state

* Make compatible with lower API levels

* Refactor to exodus names

* Implement tests for DataStoreRepo

* Make DSModule Object, implement data class for name

* Linting

* Remove unused var

* Remove redundant view model

* Check for network connection on startup

* Implement explicit saving of app setup status

* Save app setup status when done

* Only ask permission on API Level 33 and up

* Remove saving app setup status

* Catch case where no wifi settings are available

* Add refresh snackbar when applist is empty

* Add refresh snackbar to TrackersFragment as well

* Test for correct insertion of app setup state

* Make new datastores for each test

* Add swipeRefreshLayout when list is null to allow refresh

* Remove Snackbar

As the swipeRefreshLayout is visible, a button might not be needed.

* Remove redundant method calls

* Remove unused function

* Linting

* Fix broken test

* Create notification channel unconditionally

According to https://developer.android.com/develop/ui/views/notifications/channels#CreateChannel
No operation will be performed, when the channel already exists.

* Remove unused import

* Remove foreground service specific method

* Update onDestroy

* Split notification build and setup

* Add timeout to notification

* Refactor stopService

* Linting

---------

Co-authored-by: Jean-Baptiste <87148630+Jean-BaptisteC@users.noreply.github.com>
Co-authored-by: Jean-Baptiste CHARRON <jeanbaptiste.charron@outlook.fr>
Jean-BaptisteC added a commit that referenced this pull request May 25, 2023
* Update to API 33

* Improve config build

* Add new permission and enable locales config

* Add themed icon

* Fix format

* Fix resConfig

* Bump dependencies

* Api 33 (#273)

* Update Github actions to remove network config (#269)

* Issue 260 (#270)

* Update Github actions to remove network config (#269)

* Add sequence diagram of PackageManagerModule

* Move calls to PackageManager outside of nested loop

We do not call the PackageManager from inside a nested for loop anymore.
Instead the generation of the Permission instances list was lifted out.
Also the number of times we do callbacks to the packageManager is
reduced. This should reduce the occurrence of Issue #260 and Issue #264.

* Calculate short name on view time

* Add test for identity

* Linting

* Rewrite test for more accuracy

* Avoid regex

* Readd sorting of permissions list

* Refactor to repository pattern

* Update tests accordingly

* Linting

* Fix typo

* Refactor Permission Data Class

Now uses longName for identification and short name for display.

* Correct sorting of permissions

* Fix name computing

---------

Co-authored-by: Jean-Baptiste <87148630+Jean-BaptisteC@users.noreply.github.com>

* Update to API 33

* Improve config build

* Add new permission and enable locales config

* Add themed icon

* Fix format

* Fix resConfig

* Bump dependencies

* Add sequence diagram

* WIP Implement logic to store notification permission info

* WIP Use notification permission info in VM

* WIP Implementing the permission request logic

* WIP Implement permission request

* Implement onRequestPermissionsResult

* Use single key for saving perm info

* Use single key for saving perm info

* Check for permission before showing notification

* Refactor request and check to own funcs

* Add logging

* Add ToDo

* Move the DataStoreModule

* Add A DataStoreRepo and a Storage Interface

* Adapt DataStoreModule

* Refactor for new architecture

* Remove dataStoreModule from Service

* Collect only the first elem

* Cache config

* Inject networkManager in constructor

* Reorder functions

* Load config as LiveData

* Move init to DialogFragment

* Use MainActivityViewModel, implement init

DialogFragment VM is currently redundant as it would again use
identical functionality when saving app data. Also due to init happening
in the Fragment now, we need to access functionality from the MAVM.

* Don't use flow in insert

* Add logging

* Start only when permission was asked

* Save appAppSetup state

* Make compatible with lower API levels

* Refactor to exodus names

* Implement tests for DataStoreRepo

* Make DSModule Object, implement data class for name

* Linting

* Remove unused var

* Remove redundant view model

* Check for network connection on startup

* Implement explicit saving of app setup status

* Save app setup status when done

* Only ask permission on API Level 33 and up

* Remove saving app setup status

* Catch case where no wifi settings are available

* Add refresh snackbar when applist is empty

* Add refresh snackbar to TrackersFragment as well

* Test for correct insertion of app setup state

* Make new datastores for each test

* Add swipeRefreshLayout when list is null to allow refresh

* Remove Snackbar

As the swipeRefreshLayout is visible, a button might not be needed.

* Remove redundant method calls

* Remove unused function

* Linting

* Fix broken test

* Create notification channel unconditionally

According to https://developer.android.com/develop/ui/views/notifications/channels#CreateChannel
No operation will be performed, when the channel already exists.

* Remove unused import

* Remove foreground service specific method

* Update onDestroy

* Split notification build and setup

* Add timeout to notification

* Refactor stopService

* Linting

---------

Co-authored-by: Jean-Baptiste <87148630+Jean-BaptisteC@users.noreply.github.com>
Co-authored-by: Jean-Baptiste CHARRON <jeanbaptiste.charron@outlook.fr>

* Bump dependencies

* Lint

* Bump com.google.dagget.hilt to 2.46.1

* Migrate to non-transitiveRClass

* Bump androidx.room to 2.5.1

* Api 33 (#277)

* Bump coroutines to 1.7.1

* Fix apr repo test
* Cleanup of opt ins to experimental test coroutines

* Clean up

* Remove unsused extension fun
* Remove opt ins

* Expand test coverage

* Add an additional test for retrieving a list of trackers
* Remove opt ins
* Improve format

* Clean up

* Remove unused test rules
* Remove opt ins

* Clean Up

* Remove opt ins
* Remove unused vals

* Bump kotlinx:kotlinx-coroutines-test to 1.7.1

* Bump com.google.android.material to 1.9.0

Fixes broken sub fragments.

* Update Compile options for kotlin

* Bump gradle to 8.0.1

* Update operators

* Remove redundant test

* Bump JDK version (#280)

* Fix deprecations (#281)

* Implement extension fun for getting pkgs

* Implement extension fun for app source

* Move getInstalledPackagesList to common

Implement getSource in common

* Import extension funs in PackageRepository

* Adapt PackageRepositoryTest

* cleanup
* use extension fun
* fix deprecations

* Linting

* remove unnecessary comment

* Fix crash when device has not mail app or app store

* Api 33 (#291)

* Set white chip icon color in dark mode

* Use themed text and icon colors in chip

@color/m3_chip_text_color was marked private in material 1.9.0.
So a default color was used, which broke the style of the chip.
Add light/dark theme specific colors for chip text color and icon.

---------

Co-authored-by: PatDyn <37243484+PatDyn@users.noreply.github.com>
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