blob: 4e83d8834062765013b99a8a9096eecdf61b4159 [file] [log] [blame]
Gustav Sennton1c177d82016-03-29 20:43:11 +01001/*
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 android.webkit;
18
19import android.annotation.SystemApi;
20import android.os.RemoteException;
21
22/**
23 * @hide
24 */
25@SystemApi
26public final class WebViewUpdateService {
27
28 private WebViewUpdateService () {}
29
30 /**
31 * Fetch all packages that could potentially implement WebView.
32 */
33 public static WebViewProviderInfo[] getAllWebViewPackages() {
34 try {
35 return getUpdateService().getAllWebViewPackages();
36 } catch (RemoteException e) {
37 throw new RuntimeException(e);
38 }
39 }
40
41 /**
42 * Fetch all packages that could potentially implement WebView and are currently valid.
43 */
44 public static WebViewProviderInfo[] getValidWebViewPackages() {
45 try {
46 return getUpdateService().getValidWebViewPackages();
47 } catch (RemoteException e) {
48 throw new RuntimeException(e);
49 }
50 }
51
52 /**
53 * Used by DevelopmentSetting to get the name of the WebView provider currently in use.
54 */
55 public static String getCurrentWebViewPackageName() {
56 try {
57 return getUpdateService().getCurrentWebViewPackageName();
58 } catch (RemoteException e) {
59 throw new RuntimeException(e);
60 }
61 }
62
63 private static IWebViewUpdateService getUpdateService() {
64 return WebViewFactory.getUpdateService();
65 }
66}