Update WebView implementation Dev Setting - new looks + descriptions.

Now that we are changing the WebView package mechanism so that a package
can only be used as WebView implementation if that package is enabled
for all users of the device we need to tell the user why a package can't
be chosen as WebView implementation.
With this CL we do so in the 'Set WebView Implementation' Developer
Setting.

We code for the WebView implementation Developer Setting is now based on
the same code as that of the Debug App Developer Setting.

Bug: 32894154
Test: Ensure WebView Implementation setting shows correct packages.
Test: Ensure WebView Implementation setting shows correct descriptions
for why a package is not usable - including the case where packages are
disabled/uninstalled for a second user.
Test: Ensure the summary for the WebView Implmentation setting is
updated after changing WebView package.
Test: Ensure the WebView package Activity
(Settings.ACTION_WEBVIEW_SETTINGS) is similar to the Dev Setting.
Test: ensure non-admin user cannot start WV-picker activity through
'adb shell am start -n com.android.settings/.WebViewImplementation'

Change-Id: Ia6e6e9e12ce8f8f45ec539807cd0c6479acb8ecb
This commit is contained in:
Gustav Sennton
2016-12-13 19:16:48 +00:00
parent d9d463be8b
commit 4d3334c50b
16 changed files with 922 additions and 188 deletions

View File

@@ -44,6 +44,8 @@ public class SettingsInitialize extends BroadcastReceiver {
private static final String TAG = "Settings";
private static final String PRIMARY_PROFILE_SETTING =
"com.android.settings.PRIMARY_PROFILE_CONTROLLED";
private static final String SETTINGS_PACKAGE = "com.android.settings";
private static final String WEBVIEW_IMPLEMENTATION_ACTIVITY = ".WebViewImplementation";
@Override
public void onReceive(Context context, Intent broadcast) {
@@ -100,7 +102,7 @@ public class SettingsInitialize extends BroadcastReceiver {
return;
}
ComponentName settingsComponentName =
new ComponentName(context, WebViewImplementation.class);
new ComponentName(SETTINGS_PACKAGE, SETTINGS_PACKAGE + WEBVIEW_IMPLEMENTATION_ACTIVITY);
pm.setComponentEnabledSetting(settingsComponentName,
userInfo.isAdmin() ?
PackageManager.COMPONENT_ENABLED_STATE_ENABLED :