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

Commit 0281bcc9 authored by Zim's avatar Zim
Browse files

Handle Context#unbindService exception

Unbinding a service for a user that is already stopped will throw
a java.lang.IllegalArgumentException: Service not registered:
com.android.server.storage.StorageUserConnection$ActiveConnection$1@370cd2c

We now handle this to avoid crashing the system

Test: m
Bug: 152299941
Change-Id: I8a76f760f67716f3cafc320a52bdcdad7bdc5d23
parent 33696c1c
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -242,7 +242,13 @@ public final class StorageUserConnection {
            }

            if (oldConnection != null) {
                try {
                    mContext.unbindService(oldConnection);
                } catch (Exception e) {
                    // Handle IllegalArgumentException that may be thrown if the user is already
                    // stopped when we try to unbind
                    Slog.w(TAG, "Failed to unbind service", e);
                }
            }
        }