|
21 | 21 | import android.app.Activity;
|
22 | 22 | import android.content.Context;
|
23 | 23 | import android.content.Intent;
|
24 |
| -import android.content.pm.ResolveInfo; |
25 | 24 | import android.net.Uri;
|
26 | 25 | import androidx.annotation.NonNull;
|
27 | 26 | import androidx.annotation.VisibleForTesting;
|
| 27 | +import androidx.browser.customtabs.CustomTabsClient; |
28 | 28 | import androidx.browser.customtabs.CustomTabsIntent;
|
29 | 29 | import com.google.android.gms.tasks.OnFailureListener;
|
30 | 30 | import com.google.android.gms.tasks.Task;
|
|
36 | 36 | import com.google.firebase.appdistribution.FirebaseAppDistributionException.Status;
|
37 | 37 | import com.google.firebase.inject.Provider;
|
38 | 38 | import com.google.firebase.installations.FirebaseInstallationsApi;
|
39 |
| -import java.util.List; |
| 39 | +import java.util.Collections; |
40 | 40 | import java.util.concurrent.Executor;
|
41 | 41 | import javax.inject.Inject;
|
42 | 42 | import javax.inject.Singleton;
|
@@ -212,10 +212,7 @@ private void openSignInFlowInBrowser(String fid, Activity activity) {
|
212 | 212 | }
|
213 | 213 |
|
214 | 214 | private boolean supportsCustomTabs(Context context) {
|
215 |
| - Intent customTabIntent = new Intent("android.support.customtabs.action.CustomTabsService"); |
216 |
| - customTabIntent.setPackage("com.android.chrome"); |
217 |
| - List<ResolveInfo> resolveInfos = |
218 |
| - context.getPackageManager().queryIntentServices(customTabIntent, 0); |
219 |
| - return resolveInfos != null && !resolveInfos.isEmpty(); |
| 215 | + String packageName = CustomTabsClient.getPackageName(context, Collections.emptyList()); |
| 216 | + return packageName != null; |
220 | 217 | }
|
221 | 218 | }
|
0 commit comments