Explicitly ask for option menu in Fragments
If a Fragment needs option menu, it has to ask for it explicitly by calling setHasOptionsMenu(true). If a preference screen contains help URL, this method is called automatically in the base class. However, if a preference screen doesn't have help URL, this method will not be called. So any other extra option menu will not be added correctly. Typically we won't be able to see this bug. Because on standard Nexus builds, all settings screen have their own help URL. But on AOSP build, as help URL is empty by default, if the vendor doesn't modify the resource to provide their own help URL, we'll end up missing some of the option menus. Bug: 24241310 Change-Id: Iaabc91a1d102e21254b518ec23459025efbdcc84
This commit is contained in:
@@ -117,6 +117,7 @@ public class LocationSettings extends LocationSettingsBase
|
||||
final SettingsActivity activity = (SettingsActivity) getActivity();
|
||||
mUm = (UserManager) activity.getSystemService(Context.USER_SERVICE);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
mSwitchBar = activity.getSwitchBar();
|
||||
mSwitch = mSwitchBar.getSwitch();
|
||||
mSwitchBar.show();
|
||||
|
Reference in New Issue
Block a user