It doesn't clean the mAccountName buffer while device has no any account. And it will be put into
the Intent and pass to MeCard when user click the ghost boy avatar. It does not make sense and
modify code to fixed it.
Fixes:
129265427
Test: make RunSettingsRoboTests -j56 ROBOTEST_FILTER=com.android.settings.accounts
make RunSettingsRoboTests -j56 ROBOTEST_FILTER=com.android.settings.core
make RunSettingsRoboTests -j56 ROBOTEST_FILTER=com.android.settings.dashboard
Change-Id: Ib8cfab2cb416515018f335b21ef49a95699a1597
private final MutableLiveData<Bitmap> mAvatarImage;
private final ActivityManager mActivityManager;
- private String mAccountName;
+ @VisibleForTesting
+ String mAccountName;
public AvatarViewMixin(SettingsHomepageActivity activity, ImageView avatarView) {
mContext = activity.getApplicationContext();
if (hasAccount()) {
loadAccount();
} else {
+ mAccountName = null;
mAvatarView.setImageResource(R.drawable.ic_account_circle_24dp);
}
}
}
@Test
+ @Config(qualifiers = "mcc999")
+ public void onStart_noAccount_mAccountNameShouldBeNull() {
+ final AvatarViewMixin avatarViewMixin = new AvatarViewMixin(mActivity, mImageView);
+ avatarViewMixin.mAccountName = DUMMY_ACCOUNT;
+
+ avatarViewMixin.onStart();
+
+ assertThat(avatarViewMixin.mAccountName).isNull();
+ }
+
+ @Test
public void queryProviderAuthority_useShadowPackagteManager_returnNull() {
final AvatarViewMixin avatarViewMixin = new AvatarViewMixin(mActivity, mImageView);