Files
Lawnchair/src/com/android/launcher3/util/ObjectWrapper.java
T
Winson Chung 9b5f4aa48d 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
2019-11-15 11:31:15 -08:00

46 lines
1.2 KiB
Java

/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher3.util;
import android.os.Binder;
import android.os.IBinder;
/**
* Utility class to pass non-parcealable objects within same process using parcealable payload.
*
* It wraps the object in a binder as binders are singleton within a process
*/
public class ObjectWrapper<T> extends Binder {
private T mObject;
public ObjectWrapper(T object) {
mObject = object;
}
public T get() {
return mObject;
}
public void clear() {
mObject = null;
}
public static IBinder wrap(Object obj) {
return new ObjectWrapper<>(obj);
}
}