[Issue #3] Optimize application list for Dual apps.#1338
Conversation
| 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.
-U is to list the packages with UID. Not sure why you want to remove it ?
There was a problem hiding this comment.
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.
better look at cmd package list packages as an option for recent implementations/SDK's
There was a problem hiding this comment.
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.
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
ukanth
left a comment
There was a problem hiding this comment.
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.