Merge "Report normalized package name as default key" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0560127e9d
@@ -181,7 +181,14 @@ public class DefaultAutofillPicker extends DefaultAppPickerFragment {
|
||||
}
|
||||
|
||||
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
|
||||
|
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.UserManager;
|
||||
|
||||
@@ -41,12 +42,12 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
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)
|
||||
private Activity mActivity;
|
||||
@@ -81,6 +82,4 @@ public class DefaultAutofillPickerTest {
|
||||
when(info.loadLabel()).thenReturn("test_app_name");
|
||||
assertThat(mPicker.getConfirmationMessage(info)).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user