• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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.launcher3.util;
18 
19 import android.content.Context;
20 import android.content.pm.ApplicationInfo;
21 import android.content.pm.PackageManager;
22 import android.util.Log;
23 
24 import com.android.launcher3.AppInfo;
25 import com.android.launcher3.R;
26 import com.android.launcher3.Utilities;
27 
28 import java.util.Collections;
29 import java.util.List;
30 
31 /**
32  * A wrapper class to access instant app related APIs.
33  */
34 public class InstantAppResolver {
35 
newInstance(Context context)36     public static InstantAppResolver newInstance(Context context) {
37         return Utilities.getOverrideObject(
38                 InstantAppResolver.class, context, R.string.instant_app_resolver_class);
39     }
40 
isInstantApp(ApplicationInfo info)41     public boolean isInstantApp(ApplicationInfo info) {
42         return false;
43     }
44 
isInstantApp(AppInfo info)45     public boolean isInstantApp(AppInfo info) {
46         return false;
47     }
48 
isInstantApp(Context context, String packageName)49     public boolean isInstantApp(Context context, String packageName) {
50         PackageManager packageManager = context.getPackageManager();
51         try {
52             return isInstantApp(packageManager.getPackageInfo(packageName, 0).applicationInfo);
53         } catch (PackageManager.NameNotFoundException e) {
54             Log.e("InstantAppResolver", "Failed to determine whether package is instant app "
55                     + packageName, e);
56         }
57         return false;
58     }
59 
getInstantApps()60     public List<ApplicationInfo> getInstantApps() {
61         return Collections.emptyList();
62     }
63 }
64