1 /*
2  * Copyright (C) 2018 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.quickstep;
18 
19 import android.content.ComponentName;
20 import android.content.Context;
21 import android.content.pm.ApplicationInfo;
22 import android.content.pm.PackageManager;
23 
24 import com.android.launcher3.model.data.AppInfo;
25 import com.android.launcher3.util.InstantAppResolver;
26 
27 /**
28  * Implementation of InstantAppResolver using platform APIs
29  */
30 @SuppressWarnings("unused")
31 public class InstantAppResolverImpl extends InstantAppResolver {
32 
33     private static final String TAG = "InstantAppResolverImpl";
34     public static final String COMPONENT_CLASS_MARKER = "@instantapp";
35 
36     private final PackageManager mPM;
37 
InstantAppResolverImpl(Context context)38     public InstantAppResolverImpl(Context context) {
39         mPM = context.getPackageManager();
40     }
41 
42     @Override
isInstantApp(ApplicationInfo info)43     public boolean isInstantApp(ApplicationInfo info) {
44         return info.isInstantApp();
45     }
46 
47     @Override
isInstantApp(AppInfo info)48     public boolean isInstantApp(AppInfo info) {
49         ComponentName cn = info.getTargetComponent();
50         return cn != null && cn.getClassName().equals(COMPONENT_CLASS_MARKER);
51     }
52 }
53