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

Commit 7d3fb048 authored by Svet Ganov's avatar Svet Ganov Committed by Svetoslav Ganov
Browse files

Report normalized package name as default key

Test: make RunSettingsRoboTests -j90

bug:36978445

Change-Id: I593de89c4fa4e9c63a86b9844736e38dce30a258
parent 43083b43
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();
    }


}