Hi, commit https://android.googlesource.com/platform/frameworks/base/+/6ae8d1821822296df0606c9cd1c46708cc21cb58%5E%21/core/java/android/content/ContentResolver.java has introduced very interesting code:
try { qCursor = unstableProvider.query(mPackageName, uri, projection, queryArgs, remoteCancellationSignal); } catch (DeadObjectException e) { // The remote process has died... but we only hold an unstable // reference though, so we might recover!!! Let's try!!!! // This is exciting!!1!!1!!!!1 unstableProviderDied(unstableProvider); stableProvider = acquireProvider(uri); if (stableProvider == null) { return null; } qCursor = stableProvider.query( mPackageName, uri, projection, queryArgs, remoteCancellationSignal); } my question here - why do we acquire stable provider here instead of releasing dead unstable one and trying to acquire new unstable ? So, code would look like: try { qCursor = unstableProvider.query(mPackageName, uri, projection, queryArgs, remoteCancellationSignal); } catch (DeadObjectException e) { // The remote process has died... but we only hold an unstable // reference though, so we might recover!!! Let's try!!!! // This is exciting!!1!!1!!!!1 unstableProviderDied(unstableProvider); unstableProvider = acquireUnstableProvider(uri); if (unstableProvider == null) { return null; } qCursor = unstableProvider.query( mPackageName, uri, projection, queryArgs, remoteCancellationSignal); } I understand, that it's very old code (commit was made 5 years ago) and probably only Dianne Hackborn can answer this, but it looks a bit odd (or I just don't understand something :) ) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/bc470be8-3b43-4af3-ab1b-725e70ab23b0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.