summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/content/SyncManager.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index d06e78514a5c..f4d20b332e2f 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -1014,12 +1014,7 @@ 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
- try {
- if (!mPackageManagerInternal.wasPackageEverLaunched(packageName, userId)) {
- continue;
- }
- } catch (IllegalArgumentException e) {
- // Package not found, race with an uninstall
+ if (!wasPackageEverLaunched(packageName, userId)) {
continue;
}
mAccountManagerInternal.requestAccountAccess(account.account,
@@ -3352,7 +3347,7 @@ public class SyncManager {
String packageName = op.owningPackage;
final int userId = UserHandle.getUserId(op.owningUid);
// If the app did not run and has no account access, done
- if (!mPackageManagerInternal.wasPackageEverLaunched(packageName, userId)) {
+ if (!wasPackageEverLaunched(packageName, userId)) {
return;
}
mAccountManagerInternal.requestAccountAccess(op.target.account,
@@ -4059,4 +4054,12 @@ public class SyncManager {
public void resetTodayStats() {
mSyncStorageEngine.resetTodayStats(/*force=*/ true);
}
+
+ private boolean wasPackageEverLaunched(String packageName, int userId) {
+ try {
+ return mPackageManagerInternal.wasPackageEverLaunched(packageName, userId);
+ } catch (IllegalArgumentException e) {
+ return false; // Package has been removed.
+ }
+ }
}