Skip to content

Commit 9a212ad

Browse files
author
Suchi Amalapurapu
committed
Fix 2641875
Initialize the cache path only if the container exists. This did exist before but was somehow removed. Fix a known test failure as well. Change-Id: I63219369b0e7abca4919fbde2a04035a0fea9e35
1 parent 5f1d100 commit 9a212ad

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

core/tests/coretests/src/android/content/pm/PackageManagerTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ public void testMoveAppForwardLocked() {
14441444
int result = PackageManager.MOVE_FAILED_FORWARD_LOCKED;
14451445
sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
14461446
}
1447-
//TODO: To be reenabled after investigation
1447+
@MediumTest
14481448
public void testMoveAppFailInternalToExternalDelete() {
14491449
int installFlags = 0;
14501450
int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
@@ -1461,7 +1461,8 @@ public void testMoveAppFailInternalToExternalDelete() {
14611461
ip = installFromRawResource("install.apk", R.raw.install, installFlags, false,
14621462
false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
14631463
// Delete the package now retaining data.
1464-
pm.deletePackage(ip.pkg.packageName, null, PackageManager.DONT_DELETE_DATA);
1464+
GenericReceiver receiver = new DeleteReceiver(ip.pkg.packageName);
1465+
invokeDeletePackage(ip.pkg.packageName, PackageManager.DONT_DELETE_DATA, receiver);
14651466
assertTrue(invokeMovePackageFail(ip.pkg.packageName, moveFlags, result));
14661467
} catch (Exception e) {
14671468
failStr(e);

services/java/com/android/server/PackageManagerService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5057,7 +5057,8 @@ private InstallArgs createInstallArgs(int flags, String fullCodePath, String ful
50575057
}
50585058
}
50595059

5060-
private InstallArgs createInstallArgs(Uri packageURI, int flags, String pkgName) {
5060+
private InstallArgs createInstallArgs(Uri packageURI, int flags,
5061+
String pkgName) {
50615062
if (installOnSd(flags)) {
50625063
String cid = getNextCodePath(null, pkgName, "/" + SdInstallArgs.RES_FILE_NAME);
50635064
return new SdInstallArgs(packageURI, cid);
@@ -5317,6 +5318,7 @@ class SdInstallArgs extends InstallArgs {
53175318
SdInstallArgs(String cid) {
53185319
super(null, null, PackageManager.INSTALL_EXTERNAL, null);
53195320
this.cid = cid;
5321+
cachePath = PackageHelper.getSdDir(cid);
53205322
}
53215323

53225324
SdInstallArgs(Uri packageURI, String cid) {

0 commit comments

Comments
 (0)