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.Context; 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 public WebViewProviderInfo[] getWebViewPackages(); onWebViewProviderChanged(PackageInfo packageInfo)37 public int onWebViewProviderChanged(PackageInfo packageInfo); getFactoryPackageVersion(String packageName)38 public long getFactoryPackageVersion(String packageName) throws NameNotFoundException; 39 getUserChosenWebViewProvider(Context context)40 public String getUserChosenWebViewProvider(Context context); updateUserSetting(Context context, String newProviderName)41 public void updateUserSetting(Context context, String newProviderName); killPackageDependents(String packageName)42 public void killPackageDependents(String packageName); 43 enablePackageForAllUsers(Context context, String packageName, boolean enable)44 public void enablePackageForAllUsers(Context context, String packageName, boolean enable); 45 systemIsDebuggable()46 public boolean systemIsDebuggable(); getPackageInfoForProvider(WebViewProviderInfo configInfo)47 public PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo) 48 throws NameNotFoundException; 49 /** 50 * Get the PackageInfos of all users for the package represented by {@param configInfo}. 51 * @return an array of UserPackages for a certain package, each UserPackage being belonging to a 52 * certain user. The returned array can contain null PackageInfos if the given package 53 * is uninstalled for some user. 54 */ getPackageInfoForProviderAllUsers(Context context, WebViewProviderInfo configInfo)55 public List<UserPackage> getPackageInfoForProviderAllUsers(Context context, 56 WebViewProviderInfo configInfo); 57 getMultiProcessSetting(Context context)58 public int getMultiProcessSetting(Context context); setMultiProcessSetting(Context context, int value)59 public void setMultiProcessSetting(Context context, int value); notifyZygote(boolean enableMultiProcess)60 public void notifyZygote(boolean enableMultiProcess); 61 /** Start the zygote if it's not already running. */ ensureZygoteStarted()62 public void ensureZygoteStarted(); isMultiProcessDefaultEnabled()63 public boolean isMultiProcessDefaultEnabled(); 64 } 65