Fix PremiumSmsAccess memory leak
[Cause of Defect] PremiumSmsAccess forget to invoke Session and AppStateSmsPremBridge release method in the onDestroy callback. And that would lead to the leak of activity context. Test: 1. Settings - Apps - Advanced - Special access - Premium SMS access 2. adb shell dumpsys meminfo com.android.settings 3. observe activity object number 4. back to the last page 5. use AS trigger Settings gc several times 6. adb shell dumpsys meminfo com.android.settings 7. observe activity object number to check if the activity number decrease Change-Id: I359900c16fa866fba94d187a61cf6bebbdd1ed0b Signed-off-by: daqi <daqi@xiaomi.com>
This commit is contained in:
@@ -75,6 +75,13 @@ public class PremiumSmsAccess extends EmptyTextSettings implements Callback, Cal
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mSmsBackend.release();
|
||||
mSession.release();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.PREMIUM_SMS_ACCESS;
|
||||
|
Reference in New Issue
Block a user