Refresh the App Info option menu after unintalling app updates.
When we are done uninstalling app updates, invalidate the options menu so that it will be rebuilt and the correct available menu items will be shown. Change-Id: I485fe9ff129ac0b2d75094c3b899bf6553e54c74 Fix: 36407258 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -526,6 +526,9 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
switch (requestCode) {
|
||||
case REQUEST_UNINSTALL:
|
||||
// Refresh option menu
|
||||
getActivity().invalidateOptionsMenu();
|
||||
|
||||
if (mDisableAfterUninstall) {
|
||||
mDisableAfterUninstall = false;
|
||||
new DisableChanger(this, mAppEntry.info,
|
||||
|
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.when;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -378,4 +379,13 @@ public final class InstalledAppDetailsTest {
|
||||
verify(mockPreferenceScreen, times(1))
|
||||
.removePreference(mockAppDomainsPref);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onActivityResult_uninstalledUpdates_shouldInvalidateOptionsMenu() {
|
||||
doReturn(true).when(mAppDetail).refreshUi();
|
||||
|
||||
mAppDetail.onActivityResult(InstalledAppDetails.REQUEST_UNINSTALL, 0, mock(Intent.class));
|
||||
|
||||
verify(mActivity).invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user