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 #4] Bug in the implementation of Api.GetApps() leading to users with id 0 getting ignored. #1339

Conversation

amaa-99
Copy link

@amaa-99 amaa-99 commented Jul 25, 2023

Fixed a bug in the implementation of Api.getApps() leading to users with id 0 getting ignored and subsequently to the returned apps list being empty.

@@ -1422,7 +1422,7 @@ public static List<PackageInfoData> getApps(Context ctx, GetAppList appList) {
Matcher m = p.matcher(user.toString());
if (m.find() && m.groupCount() > 0) {
int id = Integer.parseInt(m.group(1));
if (id > 0) {
if (id >= 0) {
Copy link
Owner

Choose a reason for hiding this comment

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

uid 0 is root . That's handled separately. We don't need to add it here.

Copy link
Author

@amaa-99 amaa-99 Jul 28, 2023

Choose a reason for hiding this comment

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

I got the issue that at least in one of my (rooted) dev devices (I believe the one running LineageOS 18.1 (i.e. Android 11)) the only user reported at that point is the one with id 0...
If the user with id 0 is intended to be handled elsewhere, then probably the problem lies there.
Could you point me in that direction?

Copy link
Author

Choose a reason for hiding this comment

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

p.s. I've dropped the other commits (there are individual pulls for each of those).

Copy link
Owner

@ukanth ukanth Aug 1, 2023

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

On the affected devices the listOfUids will always be empty, and therefore the packagesForUser list will empty too:

            if(G.supportDual()) {
                packagesForUser  = getPackagesForUser(listOfUids);
            }

…ers with id 0 getting ignored.

Fixed a bug in the implementation of Api.getApps() leading to users with id 0 getting ignored and subsequently to the returned apps list being empty.
@amaa-99 amaa-99 force-pushed the 4-bug-in-the-implementation-of-apigetapps-leading-to-users-with-id-0-getting-ignored branch from 3fc3b49 to 6b97d84 Compare July 28, 2023 20:18
@ukanth ukanth closed this Aug 14, 2023
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