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

Commit 795db636 authored by Kholoud Mohamed's avatar Kholoud Mohamed Committed by Automerger Merge Worker
Browse files

Merge "Fix bug in IntentForwarderActivity" into rvc-dev am: d4d2427c

Change-Id: Id34681f4c3033f643aa8251147280b817236f5aa
parents 2049c6b5 d4d2427c
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -79,6 +79,12 @@ public class IntentForwarderActivity extends Activity {
    private MetricsLogger mMetricsLogger;
    protected ExecutorService mExecutorService;

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mExecutorService.shutdown();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -121,16 +127,19 @@ public class IntentForwarderActivity extends Activity {
        final int callingUserId = getUserId();
        final Intent newIntent = canForward(intentReceived, getUserId(), targetUserId,
                mInjector.getIPackageManager(), getContentResolver());
        if (newIntent != null) {
            newIntent.prepareToLeaveUser(callingUserId);
            maybeShowDisclosureAsync(intentReceived, newIntent, targetUserId, userMessageId);
            CompletableFuture.runAsync(() -> startActivityAsCaller(
                    newIntent, targetUserId), mExecutorService);
        } else {

        if (newIntent == null) {
            Slog.wtf(TAG, "the intent: " + intentReceived + " cannot be forwarded from user "
                    + callingUserId + " to user " + targetUserId);
        }
            finish();
            return;
        }

        newIntent.prepareToLeaveUser(callingUserId);
        maybeShowDisclosureAsync(intentReceived, newIntent, targetUserId, userMessageId);
        CompletableFuture.runAsync(() ->
                        startActivityAsCaller(newIntent, targetUserId), mExecutorService)
                .thenAcceptAsync(result -> finish(), getApplicationContext().getMainExecutor());
    }

    private void maybeShowDisclosureAsync(
@@ -166,8 +175,6 @@ public class IntentForwarderActivity extends Activity {
            Slog.wtf(TAG, "Unable to launch as UID " + launchedFromUid + " package "
                    + launchedFromPackage + ", while running in "
                    + ActivityThread.currentProcessName(), e);
        } finally {
            mExecutorService.shutdown();
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -5099,7 +5099,7 @@
        </activity>
        <activity android:name="com.android.internal.app.IntentForwarderActivity"
                android:finishOnCloseSystemDialogs="true"
                android:theme="@style/Theme.NoDisplay"
                android:theme="@style/Theme.Translucent.NoTitleBar"
                android:excludeFromRecents="true"
                android:label="@string/user_owner_label"
                android:exported="true"