Change close guard logged messages
Unless we are looking at stack traces (e.g. from strict mode) it's not possible to identify which type of object is not being closed (most methods are 'close' or 'release). Change the logged text to clarify. Change-Id: Ib90eac716f43c2c2caf8d8c6fb64a7bd90562da9 Test: manual
This commit is contained in:
@@ -105,7 +105,7 @@ public final class AppPredictor {
|
||||
e.rethrowAsRuntimeException();
|
||||
}
|
||||
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("AppPredictor.close");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ public final class SearchSession implements AutoCloseable{
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("SearchSession.close");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,7 @@ public final class SmartspaceSession implements AutoCloseable {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("SmartspaceSession.close");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ContentProviderClient implements ContentInterface, AutoCloseable {
|
||||
mAuthority = authority;
|
||||
mStable = stable;
|
||||
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("ContentProviderClient.close");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -695,7 +695,7 @@ public class ContentProviderClient implements ContentInterface, AutoCloseable {
|
||||
|
||||
CursorWrapperInner(Cursor cursor) {
|
||||
super(cursor);
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("CursorWrapperInner.close");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3858,7 +3858,7 @@ public abstract class ContentResolver implements ContentInterface {
|
||||
CursorWrapperInner(Cursor cursor, IContentProvider contentProvider) {
|
||||
super(cursor);
|
||||
mContentProvider = contentProvider;
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("CursorWrapperInner.close");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -224,7 +224,7 @@ public abstract class AbstractCursor implements CrossProcessCursor {
|
||||
/* Implementation */
|
||||
public AbstractCursor() {
|
||||
mPos = -1;
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("AbstractCursor.close");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -142,7 +142,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
|
||||
if (mWindowPtr == 0) {
|
||||
throw new AssertionError(); // Not possible, the native code won't return it.
|
||||
}
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("CursorWindow.close");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +170,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
|
||||
throw new AssertionError(); // Not possible, the native code won't return it.
|
||||
}
|
||||
mName = nativeGetName(mWindowPtr);
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("CursorWindow.close");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -179,7 +179,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen
|
||||
mIsReadOnlyConnection = mConfiguration.isReadOnlyDatabase();
|
||||
mPreparedStatementCache = new PreparedStatementCache(
|
||||
mConfiguration.maxSqlCacheSize);
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("SQLiteConnection.close");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -218,7 +218,7 @@ public final class SQLiteConnectionPool implements Closeable {
|
||||
|
||||
// Mark the pool as being open for business.
|
||||
mIsOpen = true;
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("SQLiteConnectionPool.close");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -253,7 +253,7 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
|
||||
NativeAllocationRegistry registry = new NativeAllocationRegistry(
|
||||
loader, nGetNativeFinalizer(), bufferSize);
|
||||
mCleaner = registry.registerNativeAllocation(this, mNativeObject);
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("HardwareBuffer.close");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -687,7 +687,7 @@ public class SystemSensorManager extends SensorManager {
|
||||
new WeakReference<>(this), looper.getQueue(),
|
||||
packageName, mode, manager.mContext.getOpPackageName(),
|
||||
manager.mContext.getAttributionTag());
|
||||
mCloseGuard.open("dispose");
|
||||
mCloseGuard.open("BaseEventQueue.dispose");
|
||||
mManager = manager;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class InputDeviceLightsManager extends LightsManager {
|
||||
* Instantiated by {@link LightsManager#openSession()}.
|
||||
*/
|
||||
private InputDeviceLightsSession() {
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("InputDeviceLightsSession.close");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -145,7 +145,7 @@ public final class SystemLightsManager extends LightsManager {
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.CONTROL_DEVICE_LIGHTS)
|
||||
private SystemLightsSession() {
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("SystemLightsSession.close");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ContextHubClient implements Closeable {
|
||||
mCloseGuard = null;
|
||||
} else {
|
||||
mCloseGuard = CloseGuard.get();
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("ContextHubClient.close");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class UsbDeviceConnection {
|
||||
boolean wasOpened = native_open(name, pfd.getFileDescriptor());
|
||||
|
||||
if (wasOpened) {
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("UsbDeviceConnection.close");
|
||||
}
|
||||
|
||||
return wasOpened;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class UsbRequest {
|
||||
endpoint.getAttributes(), endpoint.getMaxPacketSize(), endpoint.getInterval());
|
||||
|
||||
if (wasInitialized) {
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("UsbRequest.close");
|
||||
}
|
||||
|
||||
return wasInitialized;
|
||||
|
||||
@@ -75,7 +75,7 @@ public final class MemoryIntArray implements Parcelable, Closeable {
|
||||
final String name = UUID.randomUUID().toString();
|
||||
mFd = nativeCreate(name, size);
|
||||
mMemoryAddr = nativeOpen(mFd, mIsOwner);
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("MemoryIntArray.close");
|
||||
}
|
||||
|
||||
private MemoryIntArray(Parcel parcel) throws IOException {
|
||||
@@ -86,7 +86,7 @@ public final class MemoryIntArray implements Parcelable, Closeable {
|
||||
}
|
||||
mFd = pfd.detachFd();
|
||||
mMemoryAddr = nativeOpen(mFd, mIsOwner);
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("MemoryIntArray.close");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class InputEventReceiver {
|
||||
mReceiverPtr = nativeInit(new WeakReference<InputEventReceiver>(this),
|
||||
inputChannel, mMessageQueue);
|
||||
|
||||
mCloseGuard.open("dispose");
|
||||
mCloseGuard.open("InputEventReceiver.dispose");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract class InputEventSender {
|
||||
mSenderPtr = nativeInit(new WeakReference<InputEventSender>(this),
|
||||
inputChannel, mMessageQueue);
|
||||
|
||||
mCloseGuard.open("dispose");
|
||||
mCloseGuard.open("InputEventSender.dispose");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class InputQueue {
|
||||
public InputQueue() {
|
||||
mPtr = nativeInit(new WeakReference<InputQueue>(this), Looper.myQueue());
|
||||
|
||||
mCloseGuard.open("dispose");
|
||||
mCloseGuard.open("InputQueue.dispose");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ScrollCaptureConnection extends IScrollCaptureConnection.Stub imple
|
||||
@Override
|
||||
public ICancellationSignal startCapture(@NonNull Surface surface,
|
||||
@NonNull IScrollCaptureCallbacks remote) throws RemoteException {
|
||||
mCloseGuard.open("close");
|
||||
mCloseGuard.open("ScrollCaptureConnection.close");
|
||||
|
||||
if (!surface.isValid()) {
|
||||
throw new RemoteException(new IllegalArgumentException("surface must be valid"));
|
||||
|
||||
@@ -755,7 +755,7 @@ public class Surface implements Parcelable {
|
||||
private void setNativeObjectLocked(long ptr) {
|
||||
if (mNativeObject != ptr) {
|
||||
if (mNativeObject == 0 && ptr != 0) {
|
||||
mCloseGuard.open("release");
|
||||
mCloseGuard.open("Surface.release");
|
||||
} else if (mNativeObject != 0 && ptr == 0) {
|
||||
mCloseGuard.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user