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

Commit 379d52be authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Avoid restart when inserting/ejecting adopted.

When rapidly inserting/ejecting an adopted storage device, we might
still be trying to prepare the storage device.  Catch the exception
to avoid a runtime restart, and keep rolling forward, since we'll
probably be handling the ejected event in a few moments to clean up
any packages.

Bug: 28467146
Change-Id: Ib923663ae6d63259c1b5792b68dfe760612ab838
parent b9f7541d
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -18818,10 +18818,15 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                continue;
            }
            try {
                sm.prepareUserStorage(volumeUuid, user.id, user.serialNumber, flags);
                synchronized (mInstallLock) {
                    reconcileAppsDataLI(volumeUuid, user.id, flags);
                }
            } catch (IllegalStateException e) {
                // Device was probably ejected, and we'll process that event momentarily
                Slog.w(TAG, "Failed to prepare storage: " + e);
            }
        }
        synchronized (mPackages) {