Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0560127e authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Report normalized package name as default key" into oc-dev

parents 3f303d5f 7d3fb048
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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
+3 −4
Original line number Diff line number Diff line
@@ -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();
    }


}