mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Merge "Don't throw exception for SafeCloseable objects" into udc-dev am: a6e7a4b574
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23247739 Change-Id: Ieb1b419b8504f92700e1438956a780aa5eafd683 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -136,16 +136,19 @@ public class MainThreadInitializedObject<T> {
|
||||
if (mDestroyed) {
|
||||
Log.e(TAG, "Static object access with a destroyed context");
|
||||
}
|
||||
if (!mAllowedObjects.contains(object)) {
|
||||
throw new IllegalStateException(
|
||||
"Leaking unknown objects " + object + " " + provider);
|
||||
}
|
||||
|
||||
T t = (T) mObjectMap.get(object);
|
||||
if (t != null) {
|
||||
return t;
|
||||
}
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||
t = createObject(provider);
|
||||
// Check if we've explicitly allowed the object or if it's a SafeCloseable,
|
||||
// it will get destroyed in onDestroy()
|
||||
if (!mAllowedObjects.contains(object) && !(t instanceof SafeCloseable)) {
|
||||
throw new IllegalStateException(
|
||||
"Leaking unknown objects " + object + " " + provider + " " + t);
|
||||
}
|
||||
mObjectMap.put(object, t);
|
||||
mOrderedObjects.add(t);
|
||||
return t;
|
||||
|
||||
Reference in New Issue
Block a user