Fix two small thumbnail leaks

- Even though the object wrapper is used within the same process, the
  call to start the fallback recents activity means that the system
  still ends up holding a reference to a copy of the intent and its
  extras, including the reference to the wrapper and the thumbnail it
  references, until the activity is destroyed (or next restarted).
  We need to clear the actual object strong ref after it's used when
  handling the new intent.
- The running task can have an associated thumbnail, so we should also
  clear the tmp running task ref when we leave overview.

Change-Id: Icdc0b1989b13927d112949797752615014856970
This commit is contained in:
Winson Chung
2019-11-15 11:30:15 -08:00
parent 88267345d8
commit 9b5f4aa48d
3 changed files with 15 additions and 2 deletions
@@ -25,7 +25,7 @@ import android.os.IBinder;
*/
public class ObjectWrapper<T> extends Binder {
private final T mObject;
private T mObject;
public ObjectWrapper(T object) {
mObject = object;
@@ -35,6 +35,10 @@ public class ObjectWrapper<T> extends Binder {
return mObject;
}
public void clear() {
mObject = null;
}
public static IBinder wrap(Object obj) {
return new ObjectWrapper<>(obj);
}