Add a config flag so OEMs can disable avatar mixin
Not all devices have account, OEMs should be able to disable this feature if they want. Bug: 117509285 Test: robotests Change-Id: I3b03a04cff6ff0ec6c31763ac1829b119531e489
This commit is contained in:
@@ -63,6 +63,7 @@
|
||||
<bool name="config_disable_uninstall_update">true</bool>
|
||||
<bool name="config_show_device_name">false</bool>
|
||||
<bool name="config_use_legacy_suggestion">false</bool>
|
||||
<bool name="config_show_avatar_in_homepage">true</bool>
|
||||
|
||||
<!-- Whether or not extra preview panels should be used for screen zoom setting. -->
|
||||
<bool name="config_enable_extra_screen_zoom_preview">false</bool>
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.accounts;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@@ -29,7 +30,6 @@ import com.android.settings.homepage.SettingsHomepageActivity;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
@@ -69,6 +69,15 @@ public class AvatarViewMixinTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onStart_configDisabled_doNothing() {
|
||||
final AvatarViewMixin mixin = spy(new AvatarViewMixin(mContext, mImageView));
|
||||
mixin.onStart();
|
||||
|
||||
verify(mixin, never()).hasAccount();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void onStart_useMockAvatarViewMixin_shouldBeExecuted() {
|
||||
final AvatarViewMixin mockAvatar = spy(new AvatarViewMixin(mContext, mImageView));
|
||||
|
||||
@@ -79,7 +88,7 @@ public class AvatarViewMixinTest {
|
||||
settingsHomepageActivity.getLifecycle().addObserver(mockAvatar);
|
||||
controller.start();
|
||||
|
||||
verify(mockAvatar).onStart();
|
||||
verify(mockAvatar).hasAccount();
|
||||
}
|
||||
|
||||
@Implements(AccountFeatureProviderImpl.class)
|
||||
|
Reference in New Issue
Block a user