Merge pi-dr1-dev to aosp-master

Change-Id: Ib3a9fd64b6d49cecea33947cf2a1e3a0c100d4c7
This commit is contained in:
Bill Yi 2018-10-19 12:20:39 -07:00
commit e0b8834037
2 changed files with 16 additions and 1 deletions

View file

@ -92,7 +92,7 @@ public class Partner {
*/
public static CharSequence getText(Context context, @StringRes int id) {
final ResourceEntry entry = getResourceEntry(context, id);
return entry.resources.getText(id);
return entry.resources.getText(entry.id);
}
/**

View file

@ -16,6 +16,8 @@
package com.android.setupwizardlib.util;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@ -145,6 +147,19 @@ public class PartnerTest {
expectedPartnerColor, foundColor);
}
@Test
public void getText_shouldReturnPartnerValueIfPresent() {
final CharSequence expectedPartnerText = "partner";
doReturn(12345).when(mPartnerResources)
.getIdentifier(eq("suw_next_button_label"), eq("string"), anyString());
doReturn(expectedPartnerText).when(mPartnerResources).getText(eq(12345));
mPackageManager.addResolveInfoForIntent(
new Intent(ACTION_PARTNER_CUSTOMIZATION),
Collections.singletonList(createResolveInfo("test.partner.package", true, true)));
final CharSequence partnerText = Partner.getText(mContext, R.string.suw_next_button_label);
assertThat(partnerText).isEqualTo(expectedPartnerText);
}
@Test
public void testLoadDefaultValue() {
mPackageManager.addResolveInfoForIntent(