Fix a bug where options menu was not showing.

There were two issues that stopped the options menu from
showing properly. First, the SettingsPreferenceFragment did
not call its super class, causing the Lifecycle methods to
never be called. Second, the options menu was not being
invalidated which also stopped the Lifecycle methods from
being called.

Change-Id: I29f2fc105c7ecae7adaccb2e4643e48646398d8d
Fixes: 37255835
Test: Robotest
This commit is contained in:
Daniel Nishi
2017-04-14 14:12:35 -07:00
parent 190b560c9a
commit e6740f740e
3 changed files with 28 additions and 6 deletions

View File

@@ -18,6 +18,10 @@ package com.android.settings.deviceinfo;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import android.app.Activity;
import android.os.storage.StorageManager;
import android.provider.SearchIndexableResource;
@@ -55,6 +59,15 @@ public class StorageDashboardFragmentTest {
assertThat(mFragment.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_STORAGE);
}
@Test
public void test_initializeOptionsMenuInvalidatesExistingMenu() {
Activity activity = mock(Activity.class);
mFragment.initializeOptionsMenu(activity);
verify(activity).invalidateOptionsMenu();
}
@Test
public void testSearchIndexProvider_shouldIndexResource() {
final List<SearchIndexableResource> indexRes =