-
Notifications
You must be signed in to change notification settings - Fork 461
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 #3] Optimize application list for Dual apps. #1338
[Issue #3] Optimize application list for Dual apps. #1338
Conversation
@@ -1688,7 +1688,7 @@ private static boolean packagesExistForUserUid(HashMap<Integer,String> pkgs, int | |||
public static HashMap<Integer, String> getPackagesForUser(List<Integer> userProfile) { | |||
HashMap<Integer,String> listApps = new HashMap<>(); | |||
for(Integer integer: userProfile) { | |||
Shell.Result result = Shell.cmd("pm list packages -U --user " + integer).exec(); | |||
Shell.Result result = Shell.cmd("pm list packages -u --user " + integer).exec(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-U is to list the packages with UID. Not sure why you want to remove it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting consistently an error message returned by "pm list packages -U --user" xx in one of my devices (something similar to "Error: Unknown option: -U").
I believe I was testing the scenario where root is not available (or not supported).
In any case I'd revert this change... In case the problem is due to root not being available then it probably shouldn't get this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better look at cmd package list packages
as an option for recent implementations/SDK's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting the application uids is not a problem with the PackageManager APIs, the issue is getting (only) those for a given user: The API for that was only added very recently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look in the two commits currently in the branch: Those don't solve the underlying problem but already help mitigating it.
As a bonus, those also fix the lag noticed when opening the application list or the log views.
If you don't see problems with those I'd suggest having those merged and continue fixing the rest of the problem in a continuation pull request.
3728571
to
1433e79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work as it needs UID also as output. Output is used by dual_pattern
I've noticed that, however the -U option seems to be a specific extension in some implementations. |
9897190
to
89f8a83
Compare
…ading to empty package list. Implemented the new Api.getApplicationIcon() method and replaced the calls to Api.getPackagesForUser() in the LogRecyclerViewAdapter with this one. This both works around the unsupported 'pm list packages -U' issue, and fixes the lag when opening the log view due to the overhead of running 'pm list' in a shell.
…ading to empty package list. Changed the getApps() implementation to only call getPackagesForUser() in case supportDual is enabled. This avoids the problems with the unsupported 'pm list packages -U' issue in that location in case the supportDual is not enabled, and reduces the lag when opening the application list view due to the overhead of running 'pm list' in a shell.
89f8a83
to
b3bf307
Compare
Fixed the error in the syntax of the 'pm list packages' command executed in the Api.getPackagesForUser() leading to an execution error and consequently to an empty package list getting returned.