Skip to content
Commit 2b8bf40f authored by felipeal's avatar felipeal Committed by Felipe Leme
Browse files

Fixed how com.android.server.pm.Settings handle pre-created users.

Its getAllUsers() method was not returning pre-created users, so
packages installed for a "regular" user were not marked as
"installed=false" for the pre-created users. Hence, when the
pre-created was "promoted" to a full user, it contained such
packages.

Here's how to reproduce the issue:

$ m -j ApiDemos

$ adb shell pm create-user --pre-create-only
Success: created user id 10

$ adb install --user cur $OUT/testcases/ApiDemos/arm64/ApiDemos.apk
Performing Streamed Install
Success

$ adb shell pm list packages --user cur | grep com.example.android.apis || echo
package:com.example.android.apis

$ adb shell pm list packages --user 10 | grep com.example.android.apis || echo "NOT FOUND"
package:com.example.android.apis # Should return "NOT FOUND"

$ adb shell pm create-user FullUserIAm
Success: created user id 10

$ adb shell pm list packages --user 10 | grep com.example.android.apis || echo "NOT FOUND"
package:com.example.android.apis # Should return "NOT FOUND"

With this fix, it returns "NOT FOUND" in the expected steps.

Fixes: 160252062
Fixes: 162847145
Test: see above

Merged-In: I6cd17ac588a4d95bf0ea704dd18387e19eeab374
Change-Id: I6cd17ac588a4d95bf0ea704dd18387e19eeab374
(cherry picked from commit 00175974ba24d982ecfe760ee78a1a17bb326d04)
parent 429b59c8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment