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

Commit 3b3cce02 authored by Liahav Eitan's avatar Liahav Eitan Committed by Automerger Merge Worker
Browse files

Merge "TestAPI to skip user confirmation dialog when launching cross-profile...

Merge "TestAPI to skip user confirmation dialog when launching cross-profile intents" into udc-dev am: 725d9d5b am: e390d70d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22160185



Change-Id: Id962e15763eec046de4a8a480cadb6d499caa9d4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a2562317 e390d70d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -16,14 +16,17 @@

package com.android.internal.app;

import static android.Manifest.permission.INTERACT_ACROSS_USERS;
import static android.app.admin.DevicePolicyResources.Strings.Core.FORWARD_INTENT_TO_PERSONAL;
import static android.app.admin.DevicePolicyResources.Strings.Core.FORWARD_INTENT_TO_WORK;
import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;

import static com.android.internal.app.ResolverActivity.EXTRA_CALLING_USER;
import static com.android.internal.app.ResolverActivity.EXTRA_SELECTED_PROFILE;

import android.annotation.Nullable;
import android.annotation.TestApi;
import android.app.Activity;
import android.app.ActivityThread;
import android.app.AppGlobals;
@@ -79,6 +82,10 @@ public class IntentForwarderActivity extends Activity {
    public static String FORWARD_INTENT_TO_MANAGED_PROFILE
            = "com.android.internal.app.ForwardIntentToManagedProfile";

    @TestApi
    public static final String EXTRA_SKIP_USER_CONFIRMATION =
            "com.android.internal.app.EXTRA_SKIP_USER_CONFIRMATION";

    private static final Set<String> ALLOWED_TEXT_MESSAGE_SCHEMES
            = new HashSet<>(Arrays.asList("sms", "smsto", "mms", "mmsto"));

@@ -181,6 +188,15 @@ public class IntentForwarderActivity extends Activity {
            return;
        }

        if (launchIntent.getBooleanExtra(EXTRA_SKIP_USER_CONFIRMATION, /* defaultValue= */ false)
                && getCallingPackage() != null
                && PERMISSION_GRANTED == getPackageManager().checkPermission(
                        INTERACT_ACROSS_USERS, getCallingPackage())) {
            startActivityAsCaller(launchIntent, targetUserId);
            finish();
            return;
        }

        int layoutId = R.layout.miniresolver;
        setContentView(layoutId);