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 17package com.android.server.webkit; 18 19import android.content.Context; 20import android.content.pm.PackageInfo; 21import android.content.pm.PackageManager.NameNotFoundException; 22import android.database.ContentObserver; 23import android.webkit.UserPackage; 24import android.webkit.WebViewProviderInfo; 25 26import java.util.List; 27 28/** 29 * System interface for the WebViewUpdateService. 30 * This interface provides a way to test the WebView preparation mechanism - during normal use this 31 * interface is implemented using calls to the Android framework, but by providing an alternative 32 * implementation we can test the WebView preparation logic without reaching other framework code. 33 * 34 * @hide 35 */ 36public interface SystemInterface { 37 public WebViewProviderInfo[] getWebViewPackages(); 38 public int onWebViewProviderChanged(PackageInfo packageInfo); 39 public int getFactoryPackageVersion(String packageName) throws NameNotFoundException; 40 41 public String getUserChosenWebViewProvider(Context context); 42 public void updateUserSetting(Context context, String newProviderName); 43 public void killPackageDependents(String packageName); 44 45 public boolean isFallbackLogicEnabled(); 46 public void enableFallbackLogic(boolean enable); 47 48 public void uninstallAndDisablePackageForAllUsers(Context context, String packageName); 49 public void enablePackageForAllUsers(Context context, String packageName, boolean enable); 50 public void enablePackageForUser(String packageName, boolean enable, int userId); 51 52 public boolean systemIsDebuggable(); 53 public PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo) 54 throws NameNotFoundException; 55 /** 56 * Get the PackageInfos of all users for the package represented by {@param configInfo}. 57 * @return an array of UserPackages for a certain package, each UserPackage being belonging to a 58 * certain user. The returned array can contain null PackageInfos if the given package 59 * is uninstalled for some user. 60 */ 61 public List<UserPackage> getPackageInfoForProviderAllUsers(Context context, 62 WebViewProviderInfo configInfo); 63 64 public int getMultiProcessSetting(Context context); 65 public void setMultiProcessSetting(Context context, int value); 66 public void notifyZygote(boolean enableMultiProcess); 67 public boolean isMultiProcessDefaultEnabled(); 68} 69