Report normalized package name as default key
Test: make RunSettingsRoboTests -j90 bug:36978445 Change-Id: I593de89c4fa4e9c63a86b9844736e38dce30a258
This commit is contained in:
committed by
Svetoslav Ganov
parent
43083b4332
commit
7d3fb0481d
@@ -181,7 +181,14 @@ public class DefaultAutofillPicker extends DefaultAppPickerFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getDefaultKey(Context context) {
|
public static String getDefaultKey(Context context) {
|
||||||
return Settings.Secure.getString(context.getContentResolver(), SETTING);
|
String setting = Settings.Secure.getString(context.getContentResolver(), SETTING);
|
||||||
|
if (setting != null) {
|
||||||
|
ComponentName componentName = ComponentName.unflattenFromString(setting);
|
||||||
|
if (componentName != null) {
|
||||||
|
return componentName.flattenToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.spy;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
|
||||||
@@ -41,12 +42,12 @@ import org.robolectric.RuntimeEnvironment;
|
|||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
import org.robolectric.util.ReflectionHelpers;
|
import org.robolectric.util.ReflectionHelpers;
|
||||||
|
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
public class DefaultAutofillPickerTest {
|
public class DefaultAutofillPickerTest {
|
||||||
|
|
||||||
private static final String TEST_APP_KEY = "123";
|
private static final String TEST_APP_KEY = new ComponentName("foo.bar",
|
||||||
|
"foo.bar.Baz").flattenToString();
|
||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
private Activity mActivity;
|
private Activity mActivity;
|
||||||
@@ -81,6 +82,4 @@ public class DefaultAutofillPickerTest {
|
|||||||
when(info.loadLabel()).thenReturn("test_app_name");
|
when(info.loadLabel()).thenReturn("test_app_name");
|
||||||
assertThat(mPicker.getConfirmationMessage(info)).isNotNull();
|
assertThat(mPicker.getConfirmationMessage(info)).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user