Introduce LogPersistPreferenceControllerV2

- Create new LogPersistPreferenceControllerV2
 - Deprecate LogPersistPreferenceController
 - Add DisableLogPersistWarningDialog
 - Create controller inside the DashboardFragment
 - Port logic from DevelopmentSettings into the controller

Bug: 34203528
Test: make RunSettingsRoboTests -j40
Change-Id: I8ff49ec4ece15cad2d0c60bd21488e3f5d55ee98
This commit is contained in:
jeffreyhuang
2017-10-09 16:22:40 -07:00
parent cafce68bc2
commit 60ab063ea3
8 changed files with 333 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.development;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -220,6 +221,28 @@ public class DevelopmentSettingsDashboardFragmentTest {
verify(controller).onClearAdbKeysConfirmed();
}
@Test
public void onDisableLogPersistDialogConfirmed_shouldCallControllerDialogConfirmed() {
final LogPersistPreferenceControllerV2 controller = mock(
LogPersistPreferenceControllerV2.class);
doReturn(controller).when(mDashboard).getDevelopmentOptionsController(
LogPersistPreferenceControllerV2.class);
mDashboard.onDisableLogPersistDialogConfirmed();
verify(controller).onDisableLogPersistDialogConfirmed();
}
@Test
public void onDisableLogPersistDialogRejected_shouldCallControllerDialogRejected() {
final LogPersistPreferenceControllerV2 controller = mock(
LogPersistPreferenceControllerV2.class);
doReturn(controller).when(mDashboard).getDevelopmentOptionsController(
LogPersistPreferenceControllerV2.class);
mDashboard.onDisableLogPersistDialogRejected();
verify(controller).onDisableLogPersistDialogRejected();
}
@Implements(EnableDevelopmentSettingWarningDialog.class)
public static class ShadowEnableDevelopmentSettingWarningDialog {