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

Skip to content
Commit f6eaca08 authored by Adnan Begovic's avatar Adnan Begovic Committed by Roman Birg
Browse files

Settings: Fix inflate exception on search. Dynamically replace nested fragment.

   When PrivacyGuard is opened, the parent fragment would inflate the layout
   which contained a nested fragment. This is bad behavior. Since we couldn't
   keep track of the fragments lifecycle, the fragment we instantiated during
   inflation would cause an inflate exception if and when we toggled the search
   view within the current context.

   Mitigate the crash by programmatically replacing the fragment after instantiating it once.

   AndroidRuntime
          E  FATAL EXCEPTION: main
          E  Process: com.android.settings, PID: 12372
          E  android.view.InflateException: Binary XML file line #21: Error inflating class fragment
          E      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
          E      at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
          E      at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
           ...
          E  Caused by: java.lang.IllegalArgumentException: Binary XML file line #21: Duplicate id 0x7f1001a2, tag nul
             l, or parent id 0xffffffff with another fragment for com.android.settings.privacyguard.PrivacyGuardPrefs
          E      at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2120)
          E      at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:177)
          E      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
          E      ... 25 more

Change-Id: I6820ad7d35814f150eedf91140e21c0b8e23322b
parent 88abf89b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment