am 37548994: Merge "StorageManager: fix issue that GREF has increased to 2011 in system server with intel stress test."
* commit '37548994e69292932e9e2fafb7cba6c53e3a2bcd': StorageManager: fix issue that GREF has increased to 2011 in system server with intel stress test.
This commit is contained in:
committed by
Android Git Automerger
commit
cb80cb700d
@@ -56,7 +56,7 @@ public class StorageManager
|
||||
/*
|
||||
* Our internal MountService binder reference
|
||||
*/
|
||||
private IMountService mMountService;
|
||||
final private IMountService mMountService;
|
||||
|
||||
/*
|
||||
* The looper target for callbacks
|
||||
@@ -304,8 +304,6 @@ public class StorageManager
|
||||
return;
|
||||
}
|
||||
mTgtLooper = tgtLooper;
|
||||
mBinderListener = new MountServiceBinderListener();
|
||||
mMountService.registerListener(mBinderListener);
|
||||
}
|
||||
|
||||
|
||||
@@ -322,6 +320,15 @@ public class StorageManager
|
||||
}
|
||||
|
||||
synchronized (mListeners) {
|
||||
if (mBinderListener == null ) {
|
||||
try {
|
||||
mBinderListener = new MountServiceBinderListener();
|
||||
mMountService.registerListener(mBinderListener);
|
||||
} catch (RemoteException rex) {
|
||||
Log.e(TAG, "Register mBinderListener failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
mListeners.add(new ListenerDelegate(listener));
|
||||
}
|
||||
}
|
||||
@@ -347,7 +354,15 @@ public class StorageManager
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mListeners.size() == 0 && mBinderListener != null) {
|
||||
try {
|
||||
mMountService.unregisterListener(mBinderListener);
|
||||
} catch (RemoteException rex) {
|
||||
Log.e(TAG, "Unregister mBinderListener failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user