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

[FIX] speculative fixes for performance on Android 14+ #723

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rksh
Copy link
Contributor

@rksh rksh commented Jan 10, 2025

code changes attempting to get background scanning working properly in Android 14 (redux)
not yet working

@@ -302,7 +302,7 @@
<service
android:name=".WigleService"
android:enabled="true"
android:foregroundServiceType="location"
android:foregroundServiceType="location|dataSync"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding data sync to properties of background service thread, since database writes are a file operation

Logging.info("service startForeground version R+");
startForeground(NOTIFICATION_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION | ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

special case to fix priority for startForeground for Android R+

private static final int MAX_QUEUE = 512;
private static final int MAX_DRAIN = 512; // seems to work fine slurping the whole darn thing
private static final int MAX_QUEUE = Build.VERSION_CODES.R >= Build.VERSION.SDK_INT ? 768 : 512;
private static final int MAX_DRAIN = MAX_QUEUE;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

leaving more queue depth in R+

@@ -282,7 +282,7 @@ else if ( newOK && NETWORK_PROVIDER.equals( newLocation.getProvider() ) ) {
} else if (prevLocation == null || prevLocation.getTime() < currentLocation.getTime()) {
// initialize previous location
prevLocation = currentLocation;
} else if (prevLocation != null){
} else if (prevLocation != null) {
if (currentLocation.getTime() != prevLocation.getTime()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

log message improvement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants