Skip to content

Commit 7b5dd87

Browse files
author
Jim Miller
committed
Fix 5466793: Fix memory leak in system process when face lock is enabled.
Previously, the code was not unregistering the callback when we unlocked the device, which kept a reference to LockPatternKeyguardView indirectly by a reference to mFaceLockCallback. It now correcly removes the callback when we unlock the device. Change-Id: Ie592d007a1dfc2416b9e8956aba2c34e3d0120ee
1 parent e6b6803 commit 7b5dd87

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

core/java/com/android/internal/policy/IFaceLockInterface.aidl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ interface IFaceLockInterface {
2323
void startUi(IBinder containingWindowToken, int x, int y, int width, int height);
2424
void stopUi();
2525
void registerCallback(IFaceLockCallback cb);
26+
void unregisterCallback(IFaceLockCallback cb);
2627
}

policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,15 @@ public void cleanUp() {
782782
mUnlockScreen = null;
783783
}
784784
mUpdateMonitor.removeCallback(this);
785+
if (mFaceLockService != null) {
786+
try {
787+
mFaceLockService.unregisterCallback(mFaceLockCallback);
788+
} catch (RemoteException e) {
789+
// Not much we can do
790+
}
791+
stopFaceLock();
792+
mFaceLockService = null;
793+
}
785794
}
786795

787796
private boolean isSecure() {
@@ -1206,6 +1215,13 @@ public void stopAndUnbindFromFaceLock() {
12061215

12071216
if (mBoundToFaceLockService) {
12081217
if (DEBUG) Log.d(TAG, "before unbind from FaceLock service");
1218+
if (mFaceLockService != null) {
1219+
try {
1220+
mFaceLockService.unregisterCallback(mFaceLockCallback);
1221+
} catch (RemoteException e) {
1222+
// Not much we can do
1223+
}
1224+
}
12091225
mContext.unbindService(mFaceLockConnection);
12101226
if (DEBUG) Log.d(TAG, "after unbind from FaceLock service");
12111227
mBoundToFaceLockService = false;

0 commit comments

Comments
 (0)