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

Commit 5b596285 authored by Gustav Sennton's avatar Gustav Sennton
Browse files

Have WebView Implementation Dev Setting use DefaultAppPickerFragment.

Make the WebView Implementation Dev Setting look like the fullscreen
settings deriving from DefaultAppPickerFragment.
Point the Activity opened through Settings.ACTION_WEBVIEW_SETTINGS to
the class WebViewAppPicker which is our new implementation of the
WebView Implementation setting.

Ensure the new setting closes if it is reached from a user that isn't an
admin of the device.

Bug: 34806477
Bug: 34966439
Test: Ensure WebView implementation Dev Setting looks ok (disabled
packages should have a text showing why they cannot be chosen).
Test: Start Intent with action Settings.ACTION_WEBVIEW_SETTINGS and
ensure the started Activity looks similar to the WebView Implementation
Dev Setting.
Test: Ensure picking a package that is no longer active, updates the
setting (so that package isn't visible anymore).
Change-Id: I08007c515193739ad61dfd735bb5130fc07bd6e6
parent 8be68620
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1979,8 +1979,9 @@
        <activity android:name=".AppPicker" android:label="@string/select_application"
                android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" />

        <activity android:name=".webview.WebViewAppPicker" android:label="@string/select_webview_provider_dialog_title"
                android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" />
        <activity android:name="Settings$WebViewAppPickerActivity"
                  android:label="@string/select_webview_provider_dialog_title">
        </activity>

        <!-- Keep compatibility with old shortcuts. -->
        <activity-alias android:name="UsbSettings"
@@ -2940,7 +2941,7 @@

        <!-- Keep compatibility with old WebView-picker implementation -->
        <activity-alias android:name=".WebViewImplementation"
                  android:targetActivity=".webview.WebViewAppPicker"
                  android:targetActivity="Settings$WebViewAppPickerActivity"
                  android:exported="true"
                  android:excludeFromRecents="true"
                  android:theme="@*android:style/Theme.DeviceDefault.Light.Dialog.Alert">
@@ -2950,6 +2951,8 @@
            </intent-filter>
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                android:value="true" />
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                android:value="com.android.settings.webview.WebViewAppPicker" />
      </activity-alias>

        <!-- activity for gesture settings -->
+2 −2
Original line number Diff line number Diff line
@@ -8163,9 +8163,9 @@
    <string name="game_storage_settings">Games</string>
    <!-- UI webview setting: WebView uninstalled-for-user explanatory text [CHAR LIMIT=30] -->
    <string name="webview_uninstalled_for_user">Uninstalled for user <xliff:g id="user" example="John Doe">%s</xliff:g>\n</string>
    <string name="webview_uninstalled_for_user">(uninstalled for user <xliff:g id="user" example="John Doe">%s</xliff:g>)</string>
    <!-- UI webview setting: WebView disabled-for-user explanatory text [CHAR LIMIT=30] -->
    <string name="webview_disabled_for_user">Disabled for user <xliff:g id="user" example="John Doe">%s</xliff:g>\n</string>
    <string name="webview_disabled_for_user">(disabled for user <xliff:g id="user" example="John Doe">%s</xliff:g>)</string>
    <!-- AutoFill strings -->
    <!-- Preference label for the auto-fill app. [CHAR LIMIT=60] -->
+2 −1
Original line number Diff line number Diff line
@@ -76,7 +76,8 @@

    <Preference android:key="select_webview_provider"
        android:title="@string/select_webview_provider_title"
        android:dialogTitle="@string/select_webview_provider_dialog_title" />
        android:dialogTitle="@string/select_webview_provider_dialog_title"
        android:fragment="com.android.settings.webview.WebViewAppPicker" />

    <SwitchPreference
        android:key="enable_webview_multiprocess"
+3 −6
Original line number Diff line number Diff line
@@ -232,7 +232,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment

    private static final int RESULT_DEBUG_APP = 1000;
    private static final int RESULT_MOCK_LOCATION_APP = 1001;
    private static final int RESULT_WEBVIEW_APP = 1002;

    private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
    private static final String FLASH_LOCKED_PROP = "ro.boot.flash.locked";
@@ -800,7 +799,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
        updateSimulateColorSpace();
        updateUSBAudioOptions();
        updateForceResizableOptions();
        mWebViewAppPrefController.updateState(null);
        Preference webViewAppPref = findPreference(mWebViewAppPrefController.getPreferenceKey());
        mWebViewAppPrefController.updateState(webViewAppPref);
        updateWebViewMultiprocessOptions();
        updateOemUnlockOptions();
        if (mColorTemperaturePreference != null) {
@@ -2311,8 +2311,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
                writeMockLocation();
                updateMockLocation();
            }
        } else if (requestCode == RESULT_WEBVIEW_APP) {
            mWebViewAppPrefController.onActivityResult(resultCode, data);
        } else if (requestCode == REQUEST_CODE_ENABLE_OEM_UNLOCK) {
            if (resultCode == Activity.RESULT_OK) {
                if (mEnableOemUnlock.isChecked()) {
@@ -2336,8 +2334,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
            return true;
        }
        if (mWebViewAppPrefController.handlePreferenceTreeClick(preference)) {
            startActivityForResult(
                    mWebViewAppPrefController.getActivityIntent(), RESULT_WEBVIEW_APP);
            return true;
        }

        if (preference == mEnableAdb) {
+1 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ public class Settings extends SettingsActivity {
    public static class WifiAPITestActivity extends SettingsActivity { /* empty */ }
    public static class WifiInfoActivity extends SettingsActivity { /* empty */ }
    public static class EnterprisePrivacySettingsActivity extends SettingsActivity { /* empty */ }
    public static class WebViewAppPickerActivity extends SettingsActivity { /* empty */ }

    // Categories.
    public static class WirelessSettings extends SettingsActivity { /* empty */ }
Loading