Merge "Fix bug in IntentForwarderActivity" into rvc-dev am: d4d2427c01 am: 41aa6e32ae am: d46572b1b6

Change-Id: I4bfae28c2ea9f3b0f8209d41a450abb3ba61e0fd
This commit is contained in:
Kholoud Mohamed
2020-05-05 14:07:36 +00:00
committed by Automerger Merge Worker
2 changed files with 17 additions and 10 deletions

View File

@@ -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;
}
finish();
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();
}
}

View File

@@ -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"