Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 242ff568 authored by Ivan Podogov's avatar Ivan Podogov
Browse files

Fix Settings crash when trying to show work policy info

This fixes an exception in startActivity() call:

"android.util.AndroidRuntimeException: Calling startActivity() from outside of
an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really
what you want?"

Bug: 132904820
Test: manual
Change-Id: I0c687ea76068778554b072b6cc8274352de6fa28
parent 753215ff
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -279,7 +279,8 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
        // Only search for the required action in the Device Owner's package
        final Intent intent =
                new Intent(mResources.getString(R.string.config_work_policy_info_intent_action))
                        .setPackage(ownerComponent.getPackageName());
                        .setPackage(ownerComponent.getPackageName())
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        final List<ResolveInfo> activities = mPm.queryIntentActivities(intent, 0);
        if (activities.size() != 0) {
            return intent;
@@ -302,7 +303,8 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
        // Only search for the required action in the Profile Owner's package
        final Intent intent =
                new Intent(mResources.getString(R.string.config_work_policy_info_intent_action))
                        .setPackage(ownerComponent.getPackageName());
                        .setPackage(ownerComponent.getPackageName())
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        final List<ResolveInfo> activities = mPm.queryIntentActivitiesAsUser(intent, 0, userId);
        if (activities.size() != 0) {
            return intent;