Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f5c7007 authored by Amith Yamasani's avatar Amith Yamasani Committed by android-build-merger
Browse files

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

am: fbd2c21f

Change-Id: I228f8389c0459c6b1a3e7a211aae2ce4cbd9014a
parents eb96adaa fbd2c21f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);

+6 −1
Original line number Diff line number Diff line
@@ -907,9 +907,14 @@ 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
                        continue;
                    }
                    mAccountManagerInternal.requestAccountAccess(account.account,
                            packageName, userId,
                            new RemoteCallback((Bundle result) -> {