18b17926a78cc686504739730516c9b057d0672daGustav Sennton/*
28b17926a78cc686504739730516c9b057d0672daGustav Sennton * Copyright (C) 2016 The Android Open Source Project
38b17926a78cc686504739730516c9b057d0672daGustav Sennton *
48b17926a78cc686504739730516c9b057d0672daGustav Sennton * Licensed under the Apache License, Version 2.0 (the "License");
58b17926a78cc686504739730516c9b057d0672daGustav Sennton * you may not use this file except in compliance with the License.
68b17926a78cc686504739730516c9b057d0672daGustav Sennton * You may obtain a copy of the License at
78b17926a78cc686504739730516c9b057d0672daGustav Sennton *
88b17926a78cc686504739730516c9b057d0672daGustav Sennton *      http://www.apache.org/licenses/LICENSE-2.0
98b17926a78cc686504739730516c9b057d0672daGustav Sennton *
108b17926a78cc686504739730516c9b057d0672daGustav Sennton * Unless required by applicable law or agreed to in writing, software
118b17926a78cc686504739730516c9b057d0672daGustav Sennton * distributed under the License is distributed on an "AS IS" BASIS,
128b17926a78cc686504739730516c9b057d0672daGustav Sennton * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138b17926a78cc686504739730516c9b057d0672daGustav Sennton * See the License for the specific language governing permissions and
148b17926a78cc686504739730516c9b057d0672daGustav Sennton * limitations under the License.
158b17926a78cc686504739730516c9b057d0672daGustav Sennton */
168b17926a78cc686504739730516c9b057d0672daGustav Sennton
178b17926a78cc686504739730516c9b057d0672daGustav Senntonpackage com.android.server.webkit;
188b17926a78cc686504739730516c9b057d0672daGustav Sennton
198b17926a78cc686504739730516c9b057d0672daGustav Senntonimport android.content.Context;
208b17926a78cc686504739730516c9b057d0672daGustav Senntonimport android.content.pm.PackageInfo;
21065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Senntonimport android.content.pm.PackageManager.NameNotFoundException;
2286f7bbe134a274a4936b73e2fc2287482ac0157eGustav Senntonimport android.database.ContentObserver;
23364e16029017a4e16ed727a5e501f70363d04e5aGustav Senntonimport android.webkit.UserPackage;
24065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Senntonimport android.webkit.WebViewProviderInfo;
258b17926a78cc686504739730516c9b057d0672daGustav Sennton
26364e16029017a4e16ed727a5e501f70363d04e5aGustav Senntonimport java.util.List;
27364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton
288b17926a78cc686504739730516c9b057d0672daGustav Sennton/**
29065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton * System interface for the WebViewUpdateService.
308b17926a78cc686504739730516c9b057d0672daGustav Sennton * This interface provides a way to test the WebView preparation mechanism - during normal use this
318b17926a78cc686504739730516c9b057d0672daGustav Sennton * interface is implemented using calls to the Android framework, but by providing an alternative
328b17926a78cc686504739730516c9b057d0672daGustav Sennton * implementation we can test the WebView preparation logic without reaching other framework code.
33065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton *
348b17926a78cc686504739730516c9b057d0672daGustav Sennton * @hide
358b17926a78cc686504739730516c9b057d0672daGustav Sennton */
36065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Senntonpublic interface SystemInterface {
378b17926a78cc686504739730516c9b057d0672daGustav Sennton    public WebViewProviderInfo[] getWebViewPackages();
388b17926a78cc686504739730516c9b057d0672daGustav Sennton    public int onWebViewProviderChanged(PackageInfo packageInfo);
399e8c0584faae06ad903b8b859c5a5e5b11d63257Hui Shu    public int getFactoryPackageVersion(String packageName) throws NameNotFoundException;
408b17926a78cc686504739730516c9b057d0672daGustav Sennton
418b17926a78cc686504739730516c9b057d0672daGustav Sennton    public String getUserChosenWebViewProvider(Context context);
428b17926a78cc686504739730516c9b057d0672daGustav Sennton    public void updateUserSetting(Context context, String newProviderName);
438b17926a78cc686504739730516c9b057d0672daGustav Sennton    public void killPackageDependents(String packageName);
44065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton
45065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton    public boolean isFallbackLogicEnabled();
46065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton    public void enableFallbackLogic(boolean enable);
47065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton
48065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton    public void uninstallAndDisablePackageForAllUsers(Context context, String packageName);
49065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton    public void enablePackageForAllUsers(Context context, String packageName, boolean enable);
50065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton    public void enablePackageForUser(String packageName, boolean enable, int userId);
51065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton
52065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton    public boolean systemIsDebuggable();
53065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton    public PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo)
54065b7e6ef588a11c82cee22012706e6c0e66d0a3Gustav Sennton            throws NameNotFoundException;
55364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton    /**
56364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton     * Get the PackageInfos of all users for the package represented by {@param configInfo}.
57364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton     * @return an array of UserPackages for a certain package, each UserPackage being belonging to a
58364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton     *         certain user. The returned array can contain null PackageInfos if the given package
59364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton     *         is uninstalled for some user.
60364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton     */
61364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton    public List<UserPackage> getPackageInfoForProviderAllUsers(Context context,
62364e16029017a4e16ed727a5e501f70363d04e5aGustav Sennton            WebViewProviderInfo configInfo);
63ded209843616a98e6f97db0d1784f6d630cbd5e9Robert Sesek
641a4c4e35397adb964fb53695f66e1ac1ace39ff1Torne (Richard Coles)    public int getMultiProcessSetting(Context context);
651a4c4e35397adb964fb53695f66e1ac1ace39ff1Torne (Richard Coles)    public void setMultiProcessSetting(Context context, int value);
661a4c4e35397adb964fb53695f66e1ac1ace39ff1Torne (Richard Coles)    public void notifyZygote(boolean enableMultiProcess);
67dc375072c4fc95d612ccd3c60ff0519eb75b804cTorne (Richard Coles)    public boolean isMultiProcessDefaultEnabled();
688b17926a78cc686504739730516c9b057d0672daGustav Sennton}
69