1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.webkit; 18 19 import android.content.pm.ApplicationInfo; 20 import android.content.pm.PackageInfo; 21 import android.content.pm.PackageManager.NameNotFoundException; 22 import android.webkit.UserPackage; 23 import android.webkit.WebViewProviderInfo; 24 25 import java.util.List; 26 27 /** 28 * System interface for the WebViewUpdateService. 29 * This interface provides a way to test the WebView preparation mechanism - during normal use this 30 * interface is implemented using calls to the Android framework, but by providing an alternative 31 * implementation we can test the WebView preparation logic without reaching other framework code. 32 * 33 * @hide 34 */ 35 public interface SystemInterface { getWebViewPackages()36 WebViewProviderInfo[] getWebViewPackages(); onWebViewProviderChanged(PackageInfo packageInfo)37 int onWebViewProviderChanged(PackageInfo packageInfo); getFactoryPackageVersion(String packageName)38 long getFactoryPackageVersion(String packageName) throws NameNotFoundException; 39 getUserChosenWebViewProvider()40 String getUserChosenWebViewProvider(); updateUserSetting(String newProviderName)41 void updateUserSetting(String newProviderName); killPackageDependents(String packageName)42 void killPackageDependents(String packageName); 43 enablePackageForAllUsers(String packageName, boolean enable)44 void enablePackageForAllUsers(String packageName, boolean enable); installExistingPackageForAllUsers(String packageName)45 void installExistingPackageForAllUsers(String packageName); 46 systemIsDebuggable()47 boolean systemIsDebuggable(); getPackageInfoForProvider(WebViewProviderInfo configInfo)48 PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo) 49 throws NameNotFoundException; 50 /** Check if the given package is a compatible WebView implementation for the OS. */ isCompatibleImplementationPackage(PackageInfo packageInfo)51 boolean isCompatibleImplementationPackage(PackageInfo packageInfo); 52 53 /** 54 * Get the PackageInfos of all users for the package represented by {@param configInfo}. 55 * @return an array of UserPackages for a certain package, each UserPackage being belonging to a 56 * certain user. The returned array can contain null PackageInfos if the given package 57 * is uninstalled for some user. 58 */ getPackageInfoForProviderAllUsers(WebViewProviderInfo configInfo)59 List<UserPackage> getPackageInfoForProviderAllUsers(WebViewProviderInfo configInfo); 60 61 /** Start the zygote if it's not already running. */ ensureZygoteStarted()62 void ensureZygoteStarted(); 63 pinWebviewIfRequired(ApplicationInfo appInfo)64 void pinWebviewIfRequired(ApplicationInfo appInfo); 65 } 66