OSDN Git Service

old paths contains all entries when updating
authorTodd Kennedy <toddke@google.com>
Wed, 2 May 2018 09:59:45 +0000 (10:59 +0100)
committerTodd Kennedy <toddke@google.com>
Thu, 3 May 2018 10:02:30 +0000 (11:02 +0100)
In certains circumstances, only the base and split APKs were included in
the "old paths" list when updating the application info. Instead, this
list should contain _all_ elements, including any additional libraries
that may be added to the overall classpath.

Bug: 77342775
Test: Manual. Install a package. Install a split with --dont_kill. See that the path doesn't contain duplicate entries
Change-Id: Id9739cce215ab07bff1b17966583c0cf51a0b34a

core/java/android/app/ActivityThread.java
core/java/android/content/pm/IPackageManager.aidl
services/core/java/com/android/server/pm/PackageManagerService.java

index 037a87b..5947c51 100644 (file)
@@ -5333,8 +5333,8 @@ public final class ActivityThread extends ClientTransactionHandler {
                                         }
                                     }
                                 }
-                                final List<String> oldPaths =
-                                        sPackageManager.getPreviousCodePaths(packageName);
+                                final ArrayList<String> oldPaths = new ArrayList<>();
+                                LoadedApk.makePaths(this, pkgInfo.getApplicationInfo(), oldPaths);
                                 pkgInfo.updateApplicationInfo(aInfo, oldPaths);
                             } catch (RemoteException e) {
                             }
index 2be33e9..c988fa9 100644 (file)
@@ -644,8 +644,6 @@ interface IPackageManager {
 
     boolean isPackageDeviceAdminOnAnyUser(String packageName);
 
-    List<String> getPreviousCodePaths(in String packageName);
-
     int getInstallReason(String packageName, int userId);
 
     ParceledListSlice getSharedLibraries(in String packageName, int flags, int userId);
index bb1f5c0..05b3809 100644 (file)
@@ -16403,22 +16403,6 @@ public class PackageManagerService extends IPackageManager.Stub
         }
     }
 
-    @Override
-    public List<String> getPreviousCodePaths(String packageName) {
-        final int callingUid = Binder.getCallingUid();
-        final List<String> result = new ArrayList<>();
-        if (getInstantAppPackageName(callingUid) != null) {
-            return result;
-        }
-        final PackageSetting ps = mSettings.mPackages.get(packageName);
-        if (ps != null
-                && ps.oldCodePaths != null
-                && !filterAppAccessLPr(ps, callingUid, UserHandle.getUserId(callingUid))) {
-            result.addAll(ps.oldCodePaths);
-        }
-        return result;
-    }
-
     private void replaceNonSystemPackageLIF(PackageParser.Package deletedPackage,
             PackageParser.Package pkg, final @ParseFlags int parseFlags,
             final @ScanFlags int scanFlags, UserHandle user, int[] allUsers,