From ea3064a586decfe308d8252f1c2f3545c0fa9829 Mon Sep 17 00:00:00 2001 From: Kenji Sugimoto Date: Thu, 19 Feb 2015 15:03:30 +0900 Subject: [PATCH] Set installed flag of all users if system app is installed later If an application(in /data) that other user installed it initially is appended as system app later, owner user can not use the system app. The reason this issue occurs is that the owner user's installed flag is set false when the application was installed by other user and the installed flag is not updated when the application is appended as system app later. So, we fix like as setting the installed flag to true when the application is appended as system app. Bug: 28183865 Change-Id: I0b4da5e0bb77fb3baf86d0453e6637a230b104ba --- .../core/java/com/android/server/pm/Settings.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 7debf9b5b7fba..f20a36e1f3c02 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -718,6 +718,21 @@ final class Settings { // let's log a message about it. Slog.i(PackageManagerService.TAG, "Package " + name + " codePath changed from " + p.codePath + " to " + codePath + "; Retaining data and using new"); + + // The owner user's installed flag is set false + // when the application was installed by other user + // and the installed flag is not updated + // when the application is appended as system app later. + if ((pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0 && + getDisabledSystemPkgLPr(name) == null) { + List allUserInfos = getAllUsers(); + if (allUserInfos != null) { + for (UserInfo userInfo : allUserInfos) { + p.setInstalled(true, userInfo.id); + } + } + } + /* * Since we've changed paths, we need to prefer the new * native library path over the one stored in the