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 TelemetryUtils.obtainApplicationState() method. #559

Merged
merged 2 commits into from
Jan 21, 2022

Conversation

tarigo
Copy link
Contributor

@tarigo tarigo commented Jan 20, 2022

Fixes #557.

@tarigo tarigo self-assigned this Jan 20, 2022
@tarigo tarigo force-pushed the tarigo/telemetry_utils_get_tasks_fix branch from 652db43 to 4785722 Compare January 20, 2022 14:12
@tarigo tarigo requested a review from a team January 20, 2022 14:14
Copy link

@kiryldz kiryldz left a comment

Choose a reason for hiding this comment

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

We need to remove GET_TASKS permission from manifest file as well

@tarigo tarigo requested review from pengdev and kiryldz January 20, 2022 14:53
@tarigo
Copy link
Contributor Author

tarigo commented Jan 20, 2022

We need to remove GET_TASKS permission from manifest file as well

Yep, done.

if (appProcesses == null) {
return NO_STATE;
String state = NO_STATE;
switch (AppStateUtils.getAppStateFromActivityManager(context)) {
Copy link

Choose a reason for hiding this comment

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

I may not see full picture but couldn't we actually expose and use AppStateUtils.getAppStateFromActivityManager(context) instead of obtainApplicationState? This mapping here seems to be actually almost 1 to 1 (at least looking at the diff here).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Historical reasons. :) We can expose AppStateUtils.getAppStateFromActivityManager(context) but I would avoid removing obtainApplicationState cause it's a breaking change.

Copy link

Choose a reason for hiding this comment

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

Couldn't we do something like

public static String obtainApplicationState(Context context) {
  return appStateUtils.getAppStateFromActivityManager(context);
}

if I get the mapping correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, NO_STATE is an empty string, but others are one-to-one, simplified.

@tarigo tarigo force-pushed the tarigo/telemetry_utils_get_tasks_fix branch from b5c83c7 to a77169a Compare January 20, 2022 17:21
@tarigo tarigo requested a review from kiryldz January 20, 2022 17:26
Copy link

@kiryldz kiryldz left a comment

Choose a reason for hiding this comment

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

Thanks @tarigo, looks good to me now 👍

@tarigo tarigo merged commit 329c10b into main Jan 21, 2022
@tarigo tarigo deleted the tarigo/telemetry_utils_get_tasks_fix branch January 21, 2022 06:46
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.

Android SDK triggers privacy warnings due to Permissions.GET_TASKS
3 participants