summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/webview/WebViewAppPicker.java
diff options
context:
space:
mode:
authorGustav Sennton <gsennton@google.com>2017-02-23 18:32:20 +0000
committerGustav Sennton <gsennton@google.com>2017-03-07 19:30:10 +0000
commit3c89d8e2cfe5bc338f3e285945b6836cd2f69b05 (patch)
tree1fb4d6bedb72d6c70849842dc715a1a09ce3e97c /src/com/android/settings/webview/WebViewAppPicker.java
parent01b721ee1182ddb3959c8cf25d40829cbc09cace (diff)
downloadpackages_apps_Settings-3c89d8e2cfe5bc338f3e285945b6836cd2f69b05.tar.gz
packages_apps_Settings-3c89d8e2cfe5bc338f3e285945b6836cd2f69b05.tar.bz2
packages_apps_Settings-3c89d8e2cfe5bc338f3e285945b6836cd2f69b05.zip
Fix disabled WebView packages being shown as enabled in Dev Setting.
WebView packages that cannot be chosen as WebView implementation should be shown as disabled in the 'WebView Implementation' Dev Setting. Simplify the logic in DefaultAppInfo a little bit to avoid special-casing for the WebView Dev setting. Also add tests to ensure we are correctly disabling WebView packages in the Dev setting and showing their disabled-reasons. Bug: 35707106 Test: 'make RunSettingsRoboTests' Test: Ensure disabled WebView packages show up as being disabled in the 'WebView Implementation' Dev Setting. Change-Id: Ic2f5265c3451b6396e55b7bc29689c3d889ddb5e
Diffstat (limited to 'src/com/android/settings/webview/WebViewAppPicker.java')
-rw-r--r--src/com/android/settings/webview/WebViewAppPicker.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/com/android/settings/webview/WebViewAppPicker.java b/src/com/android/settings/webview/WebViewAppPicker.java
index aa229ac05a..586ee36a6c 100644
--- a/src/com/android/settings/webview/WebViewAppPicker.java
+++ b/src/com/android/settings/webview/WebViewAppPicker.java
@@ -24,6 +24,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.Context;
import android.support.annotation.VisibleForTesting;
+import android.text.TextUtils;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
@@ -58,7 +59,7 @@ public class WebViewAppPicker extends DefaultAppPickerFragment {
List<ApplicationInfo> pkgs =
getWebViewUpdateServiceWrapper().getValidWebViewApplicationInfos(getContext());
for (ApplicationInfo ai : pkgs) {
- packageInfoList.add(new DefaultAppInfo(ai,
+ packageInfoList.add(createDefaultAppInfo(ai,
getDisabledReason(getWebViewUpdateServiceWrapper(),
getContext(), ai.packageName)));
}
@@ -92,7 +93,6 @@ public class WebViewAppPicker extends DefaultAppPickerFragment {
}
}
-
private WebViewUpdateServiceWrapper createDefaultWebViewUpdateServiceWrapper() {
return new WebViewUpdateServiceWrapper();
}
@@ -107,6 +107,13 @@ public class WebViewAppPicker extends DefaultAppPickerFragment {
return MetricsEvent.WEBVIEW_IMPLEMENTATION;
}
+ @VisibleForTesting
+ DefaultAppInfo createDefaultAppInfo(
+ ApplicationInfo applicationInfo, String disabledReason) {
+ return new DefaultAppInfo(applicationInfo, disabledReason,
+ TextUtils.isEmpty(disabledReason) /* enabled */);
+ }
+
/**
* Returns the reason why a package cannot be used as WebView implementation.
* This is either because of it being disabled, uninstalled, or hidden for any user.