Clean up AppButtonsPreferenceController

mDisableAfterUninstall and mUpdatedSysApp is always false.
And appChanged is always true.

Bug: 236346018
Test: Manual with Settings App
Change-Id: Icfb9fbea92d5c728cbef9d76569d59d5085a51e6
This commit is contained in:
Chaohui Wang
2022-09-22 10:02:44 +08:00
parent d8bba54a42
commit d21f5916d2
4 changed files with 12 additions and 73 deletions

View File

@@ -85,10 +85,8 @@ import java.util.Set;
public class AppButtonsPreferenceControllerTest {
private static final String PACKAGE_NAME = "com.android.settings";
private static final String RRO_PACKAGE_NAME = "com.android.settings.overlay";
private static final String RESOURCE_STRING = "string";
private static final boolean ALL_USERS = false;
private static final boolean DISABLE_AFTER_INSTALL = true;
private static final int REQUEST_UNINSTALL = 0;
private static final int REQUEST_REMOVE_DEVICE_ADMIN = 1;
private static final OverlayInfo OVERLAY_DISABLED = createFakeOverlay("overlay", false, 1);
@@ -401,14 +399,13 @@ public class AppButtonsPreferenceControllerTest {
@Test
public void uninstallPkg_intentSent() {
mController.uninstallPkg(PACKAGE_NAME, ALL_USERS, DISABLE_AFTER_INSTALL);
mController.uninstallPkg(PACKAGE_NAME, ALL_USERS);
verify(mFragment).startActivityForResult(any(), eq(REQUEST_UNINSTALL));
assertThat(
mUninstallIntent.getBooleanExtra(Intent.EXTRA_UNINSTALL_ALL_USERS, true))
.isEqualTo(ALL_USERS);
assertThat(mUninstallIntent.getAction()).isEqualTo(Intent.ACTION_UNINSTALL_PACKAGE);
assertThat(mController.mDisableAfterUninstall).isEqualTo(DISABLE_AFTER_INSTALL);
}
@Test

View File

@@ -50,8 +50,6 @@ public class ButtonActionDialogFragmentTest {
private static final int FORCE_STOP_ID = ButtonActionDialogFragment.DialogType.FORCE_STOP;
private static final int DISABLE_ID = ButtonActionDialogFragment.DialogType.DISABLE;
private static final int SPECIAL_DISABLE_ID =
ButtonActionDialogFragment.DialogType.SPECIAL_DISABLE;
@Mock
private TestFragment mTargetFragment;
private ButtonActionDialogFragment mFragment;
@@ -129,26 +127,6 @@ public class ButtonActionDialogFragmentTest {
mShadowContext.getString(R.string.dlg_cancel));
}
@Test
public void testOnCreateDialog_specialDisableDialog() {
ButtonActionDialogFragment fragment =
ButtonActionDialogFragment.newInstance(SPECIAL_DISABLE_ID);
FragmentController.setupFragment(fragment, FragmentActivity.class, 0 /* containerViewId */,
null /* bundle */);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNotNull();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(
mShadowContext.getString(R.string.app_disable_dlg_text));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(
mShadowContext.getString(R.string.app_disable_dlg_positive));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(
mShadowContext.getString(R.string.dlg_cancel));
}
/**
* Test fragment that used as the target fragment, it must implement the
* {@link ButtonActionDialogFragment.AppButtonsDialogListener}