Merge "Always invoke callback" into oc-mr1-dev

am: 71b304f6ff

Change-Id: Id70e129c930cf7f21feebc8d22649cee779e37b6
This commit is contained in:
Todd Kennedy
2017-08-14 22:06:30 +00:00
committed by android-build-merger

View File

@@ -20228,10 +20228,8 @@ public class PackageManagerService extends IPackageManager.Stub
true /* requireFullPermission */, false /* checkShell */, "clear application data"); true /* requireFullPermission */, false /* checkShell */, "clear application data");
final PackageSetting ps = mSettings.getPackageLPr(packageName); final PackageSetting ps = mSettings.getPackageLPr(packageName);
if (ps != null && filterAppAccessLPr(ps, callingUid, userId)) { final boolean filterApp = (ps != null && filterAppAccessLPr(ps, callingUid, userId));
return; if (!filterApp && mProtectedPackages.isPackageDataProtected(userId, packageName)) {
}
if (mProtectedPackages.isPackageDataProtected(userId, packageName)) {
throw new SecurityException("Cannot clear data for a protected package: " throw new SecurityException("Cannot clear data for a protected package: "
+ packageName); + packageName);
} }
@@ -20240,26 +20238,30 @@ public class PackageManagerService extends IPackageManager.Stub
public void run() { public void run() {
mHandler.removeCallbacks(this); mHandler.removeCallbacks(this);
final boolean succeeded; final boolean succeeded;
try (PackageFreezer freezer = freezePackage(packageName, if (!filterApp) {
"clearApplicationUserData")) { try (PackageFreezer freezer = freezePackage(packageName,
synchronized (mInstallLock) { "clearApplicationUserData")) {
succeeded = clearApplicationUserDataLIF(packageName, userId); synchronized (mInstallLock) {
succeeded = clearApplicationUserDataLIF(packageName, userId);
}
clearExternalStorageDataSync(packageName, userId, true);
synchronized (mPackages) {
mInstantAppRegistry.deleteInstantApplicationMetadataLPw(
packageName, userId);
}
} }
clearExternalStorageDataSync(packageName, userId, true); if (succeeded) {
synchronized (mPackages) { // invoke DeviceStorageMonitor's update method to clear any notifications
mInstantAppRegistry.deleteInstantApplicationMetadataLPw( DeviceStorageMonitorInternal dsm = LocalServices
packageName, userId); .getService(DeviceStorageMonitorInternal.class);
if (dsm != null) {
dsm.checkMemory();
}
} }
} else {
succeeded = false;
} }
if (succeeded) { if (observer != null) {
// invoke DeviceStorageMonitor's update method to clear any notifications
DeviceStorageMonitorInternal dsm = LocalServices
.getService(DeviceStorageMonitorInternal.class);
if (dsm != null) {
dsm.checkMemory();
}
}
if(observer != null) {
try { try {
observer.onRemoveCompleted(packageName, succeeded); observer.onRemoveCompleted(packageName, succeeded);
} catch (RemoteException e) { } catch (RemoteException e) {