Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f513aa2 authored by Andrey Epin's avatar Andrey Epin
Browse files

Destroy all profile list adapters

Fix: 346671041
Test: launch media projection selection activity on a device with
multiple profiles; check that the activity is leaking before the fid and
is not leaking after the fix.
Flag: android.service.chooser.fix_resolver_memory_leak

Change-Id: I5055957464d905c2d8a638743658461d9680230c
parent b94acf5e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -32,3 +32,14 @@ flag {
  description: "Provides additional callbacks with information about user actions in ChooserResult"
  bug: "263474465"
}

flag {
  name: "fix_resolver_memory_leak"
  is_exported: true
  namespace: "intentresolver"
  description: "ResolverActivity memory leak (through the AppPredictor callback) fix"
  bug: "346671041"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+13 −3
Original line number Diff line number Diff line
@@ -1209,9 +1209,19 @@ public class ResolverActivity extends Activity implements
        if (!isChangingConfigurations() && mPickOptionRequest != null) {
            mPickOptionRequest.cancel();
        }
        if (mMultiProfilePagerAdapter != null
                && mMultiProfilePagerAdapter.getActiveListAdapter() != null) {
            mMultiProfilePagerAdapter.getActiveListAdapter().onDestroy();
        if (mMultiProfilePagerAdapter != null) {
            ResolverListAdapter activeAdapter =
                    mMultiProfilePagerAdapter.getActiveListAdapter();
            if (activeAdapter != null) {
                activeAdapter.onDestroy();
            }
            if (android.service.chooser.Flags.fixResolverMemoryLeak()) {
                ResolverListAdapter inactiveAdapter =
                        mMultiProfilePagerAdapter.getInactiveListAdapter();
                if (inactiveAdapter != null) {
                    inactiveAdapter.onDestroy();
                }
            }
        }
    }