Block the user from enabling or disabling webview fallback packages.

Now that we support webview fallback packages - packages that should be
enabled if and only if no other webview packages are available - we need
to ensure that the Settings UI consistently shows that these packages
cannot be enabled or disabled (e.g. the 'Enable' and 'Disable' buttons
for enabling/disabling them are greyed out).

Also, remove the Dialog that lets a user enable a disabled webview
package from the webview implementation Dev Setting. Instead show a
Toast if the user has chosen an invalid package.

Bug: 26375524, 26375860

Change-Id: I949083d3f7c83cd2e049dd2c5c15ec5ab880fe07
This commit is contained in:
Gustav Sennton
2016-02-18 12:28:36 +00:00
parent 0b485bb523
commit a4e32a24c4
3 changed files with 35 additions and 56 deletions

View File

@@ -61,6 +61,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.IWebViewUpdateService;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
@@ -254,6 +255,16 @@ public class InstalledAppDetails extends AppInfoBase
enabled = false;
}
try {
IWebViewUpdateService webviewUpdateService =
IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
if (webviewUpdateService.isFallbackPackage(mAppEntry.info.packageName)) {
enabled = false;
}
} catch (RemoteException e) {
throw new RuntimeException(e);
}
mUninstallButton.setEnabled(enabled);
if (enabled) {
// Register listener