Merge "Catch IllegalArgumentException to avoid SyncManager crash" into oc-dev

This commit is contained in:
TreeHugger Robot
2017-03-28 18:15:40 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 1 deletions

View File

@@ -172,6 +172,7 @@ public abstract class PackageManagerInternal {
* @param packageName The package name.
* @param userId The user for which to check.
* @return Whether was launched.
* @throws IllegalArgumentException if the package is not found
*/
public abstract boolean wasPackageEverLaunched(String packageName, int userId);

View File

@@ -907,7 +907,12 @@ public class SyncManager {
Bundle finalExtras = new Bundle(extras);
String packageName = syncAdapterInfo.componentName.getPackageName();
// If the app did not run and has no account access, done
if (!mPackageManagerInternal.wasPackageEverLaunched(packageName, userId)) {
try {
if (!mPackageManagerInternal.wasPackageEverLaunched(packageName, userId)) {
continue;
}
} catch (IllegalArgumentException e) {
// Package not found, race with an uninstall
continue;
}
mAccountManagerInternal.requestAccountAccess(account.account,