Merge "Tweak the way to get the enabled component" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-12-09 22:06:24 +00:00
committed by Android (Google) Code Review

View File

@@ -18,7 +18,6 @@ package com.android.settingslib.activityembedding;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ResolveInfo;
import com.android.settingslib.utils.BuildCompatUtils; import com.android.settingslib.utils.BuildCompatUtils;
@@ -37,11 +36,10 @@ public class ActivityEmbeddingUtils {
if (BuildCompatUtils.isAtLeastS()) { if (BuildCompatUtils.isAtLeastS()) {
final Intent intent = new Intent(ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY); final Intent intent = new Intent(ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY);
intent.setPackage(PACKAGE_NAME_SETTINGS); intent.setPackage(PACKAGE_NAME_SETTINGS);
final ResolveInfo resolveInfo = final boolean isEmbeddingActivityEnabled =
context.getPackageManager().resolveActivity(intent, 0 /* flags */); intent.resolveActivity(context.getPackageManager()) != null;
return resolveInfo != null
&& resolveInfo.activityInfo != null return isEmbeddingActivityEnabled;
&& resolveInfo.activityInfo.enabled;
} }
return false; return false;
} }