Misc fixes for User page and my device info page

- Rename UserAndAccountDashboard* to AccountDashboard*
- Move emergency info from account to device info page

- Move auto sync data toggles (4 of them) from Account page to user page
   - Move the controllers too. UserSettings is a not a DashboardFragment
     so I had to manually call each controller method.
     TODO: refactor UserSettings to a DashboardFragment

- Move legal information/regulatory info above advance button within device info page.

Fixes: 72523158
Bug: 71871075
Test: robotests
Change-Id: I1b8af8af61e49d17926f984978a09a974b6c62e1
This commit is contained in:
Fan Zhang
2018-01-26 10:15:56 -08:00
parent c24930aaf2
commit 881d579620
26 changed files with 243 additions and 178 deletions

View File

@@ -44,19 +44,19 @@ import static org.mockito.Mockito.when;
@RunWith(RobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class UserAndAccountDashboardFragmentTest {
public class AccountDashboardFragmentTest {
private static final String METADATA_CATEGORY = "com.android.settings.category";
private static final String METADATA_ACCOUNT_TYPE = "com.android.settings.ia.account";
@Mock
private UserManager mUserManager;
private UserAndAccountDashboardFragment mFragment;
private AccountDashboardFragment mFragment;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mFragment = new UserAndAccountDashboardFragment();
mFragment = new AccountDashboardFragment();
}
@Test
@@ -85,7 +85,7 @@ public class UserAndAccountDashboardFragmentTest {
@Test
public void testSearchIndexProvider_shouldIndexResource() {
final List<SearchIndexableResource> indexRes =
UserAndAccountDashboardFragment.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
AccountDashboardFragment.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
ShadowApplication.getInstance().getApplicationContext(),
true /* enabled */);

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.accounts;
package com.android.settings.users;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.arch.lifecycle.LifecycleOwner;
import android.content.Context;
import android.content.pm.UserInfo;
import android.os.UserManager;
@@ -31,6 +32,7 @@ import android.support.v7.preference.PreferenceScreen;
import com.android.settings.TestConfig;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
import org.junit.Test;
@@ -51,6 +53,8 @@ public class AddUserWhenLockedPreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
private UserManager mUserManager;
private LifecycleOwner mLifecycleOwner;
private Lifecycle mLifecycle;
private Context mContext;
private AddUserWhenLockedPreferenceController mController;
@@ -60,7 +64,9 @@ public class AddUserWhenLockedPreferenceControllerTest {
ShadowApplication shadowContext = ShadowApplication.getInstance();
shadowContext.setSystemService(Context.USER_SERVICE, mUserManager);
mContext = shadowContext.getApplicationContext();
mController = new AddUserWhenLockedPreferenceController(mContext, "fake_key");
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mController = new AddUserWhenLockedPreferenceController(mContext, "fake_key", mLifecycle);
}
@Test

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.accounts;
package com.android.settings.users;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Answers.RETURNS_DEEP_STUBS;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.accounts;
package com.android.settings.users;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Answers.RETURNS_DEEP_STUBS;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 The Android Open Source Project
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.settings.accounts;
package com.android.settings.users;
import static com.google.common.truth.Truth.assertThat;
@@ -28,8 +28,8 @@ import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.os.UserManager;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;