108cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)/*
208cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * Copyright (C) 2014 The Android Open Source Project
308cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) *
408cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * Licensed under the Apache License, Version 2.0 (the "License");
508cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * you may not use this file except in compliance with the License.
608cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * You may obtain a copy of the License at
708cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) *
808cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) *      http://www.apache.org/licenses/LICENSE-2.0
908cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) *
1008cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * Unless required by applicable law or agreed to in writing, software
1108cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * distributed under the License is distributed on an "AS IS" BASIS,
1208cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1308cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * See the License for the specific language governing permissions and
1408cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * limitations under the License.
1508cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) */
1608cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)
1708cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)package android.webkit;
1808cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)
196258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Senntonimport android.content.pm.PackageInfo;
206258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Senntonimport android.webkit.WebViewProviderInfo;
216258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Senntonimport android.webkit.WebViewProviderResponse;
226258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton
2308cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)/**
2408cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * Private service to wait for the updatable WebView to be ready for use.
2508cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) * @hide
2608cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles) */
2708cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)interface IWebViewUpdateService {
2808cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)
2908cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)    /**
3008cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)     * Used by the relro file creator to notify the service that it's done.
3108cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)     */
326258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton    void notifyRelroCreationCompleted();
3308cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)
3408cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)    /**
3508cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)     * Used by WebViewFactory to block loading of WebView code until
366258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton     * preparations are complete. Returns the package used as WebView provider.
3708cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)     */
386258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton    WebViewProviderResponse waitForAndGetProvider();
3908cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)
406258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton    /**
41c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * DevelopmentSettings uses this to notify WebViewUpdateService that a new provider has been
42c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * selected by the user. Returns the provider we end up switching to, this could be different to
43c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * the one passed as argument to this method since the Dev Setting calling this method could be
44c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * stale. I.e. the Dev setting could be letting the user choose uninstalled/disabled packages,
45c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * it would then try to update the provider to such a package while in reality the update
46c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * service would switch to another one.
476258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton     */
48c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton    String changeProviderAndSetting(String newProvider);
496258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton
506258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton    /**
516258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton     * DevelopmentSettings uses this to get the current available WebView
526258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton     * providers (to display as choices to the user).
536258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton     */
546258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton    WebViewProviderInfo[] getValidWebViewPackages();
556258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton
566258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton    /**
578b17926a78cc686504739730516c9b057d0672daGustav Sennton     * Fetch all packages that could potentially implement WebView.
588b17926a78cc686504739730516c9b057d0672daGustav Sennton     */
598b17926a78cc686504739730516c9b057d0672daGustav Sennton    WebViewProviderInfo[] getAllWebViewPackages();
608b17926a78cc686504739730516c9b057d0672daGustav Sennton
618b17926a78cc686504739730516c9b057d0672daGustav Sennton    /**
626258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton     * Used by DevelopmentSetting to get the name of the WebView provider currently in use.
636258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton     */
646258dcd7ea5450726bc7bcb1fbd50e99f62f38fbGustav Sennton    String getCurrentWebViewPackageName();
65c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton
66c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton    /**
67c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * Used by Settings to determine whether a certain package can be enabled/disabled by the user -
68c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * the package should not be modifiable in this way if it is a fallback package.
69c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     */
70c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton    boolean isFallbackPackage(String packageName);
71c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton
72c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton    /**
73c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     * Enable or disable the WebView package fallback mechanism.
74c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton     */
75c83e3fa35a5736a1778d241abd18dffa5953f416Gustav Sennton    void enableFallbackLogic(boolean enable);
7608cfaf672604422dd355d6703aec78f3aa5ee74eTorne (Richard Coles)}
77