Merge "Fix (still-disabled) sharesheet "token flow.""
This commit is contained in:
@@ -1163,7 +1163,9 @@ public class ChooserActivity extends ResolverActivity implements
|
||||
-1);
|
||||
// Action bar is user-independent, always start as primary
|
||||
safelyStartActivityAsUser(ti, getPersonalProfileUserHandle());
|
||||
finish();
|
||||
if (!mAwaitingDelegateResponse) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
);
|
||||
b.setId(R.id.chooser_nearby_button);
|
||||
@@ -1185,7 +1187,9 @@ public class ChooserActivity extends ResolverActivity implements
|
||||
-1);
|
||||
// Action bar is user-independent, always start as primary
|
||||
safelyStartActivityAsUser(ti, getPersonalProfileUserHandle());
|
||||
finish();
|
||||
if (!mAwaitingDelegateResponse) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
);
|
||||
b.setId(R.id.chooser_edit_button);
|
||||
@@ -2212,7 +2216,9 @@ public class ChooserActivity extends ResolverActivity implements
|
||||
TargetInfo clonedTarget = selectedTarget.cloneFilledIn(matchingIntent, 0);
|
||||
if (super.onTargetSelected(clonedTarget, false)) {
|
||||
updateModelAndChooserCounts(clonedTarget);
|
||||
finish();
|
||||
if (!mAwaitingDelegateResponse) {
|
||||
finish();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,8 @@ public class ResolverActivity extends Activity implements
|
||||
/** See {@link #setRetainInOnStop}. */
|
||||
private boolean mRetainInOnStop;
|
||||
|
||||
private static final int REQUEST_CODE_RETURN_FROM_DELEGATE_CHOOSER = 20;
|
||||
|
||||
private static final String EXTRA_SHOW_FRAGMENT_ARGS = ":settings:show_fragment_args";
|
||||
private static final String EXTRA_FRAGMENT_ARG_KEY = ":settings:fragment_args_key";
|
||||
private static final String OPEN_LINKS_COMPONENT_KEY = "app_link_state";
|
||||
@@ -203,6 +205,8 @@ public class ResolverActivity extends Activity implements
|
||||
|
||||
private UserHandle mWorkProfileUserHandle;
|
||||
|
||||
protected boolean mAwaitingDelegateResponse;
|
||||
|
||||
/**
|
||||
* Get the string resource to be used as a label for the link to the resolver activity for an
|
||||
* action.
|
||||
@@ -584,7 +588,9 @@ public class ResolverActivity extends Activity implements
|
||||
mProfileSwitchMessageId = -1;
|
||||
|
||||
onTargetSelected(dri, false);
|
||||
finish();
|
||||
if (!mAwaitingDelegateResponse) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1026,7 +1032,9 @@ public class ResolverActivity extends Activity implements
|
||||
mMultiProfilePagerAdapter.getActiveListAdapter().hasFilteredItem()
|
||||
? MetricsProto.MetricsEvent.ACTION_HIDE_APP_DISAMBIG_APP_FEATURED
|
||||
: MetricsProto.MetricsEvent.ACTION_HIDE_APP_DISAMBIG_NONE_FEATURED);
|
||||
finish();
|
||||
if (!mAwaitingDelegateResponse) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1354,15 +1362,31 @@ public class ResolverActivity extends Activity implements
|
||||
chooserIntent.putExtra(ActivityTaskManager.EXTRA_IGNORE_TARGET_SECURITY,
|
||||
ignoreTargetSecurity);
|
||||
chooserIntent.putExtra(Intent.EXTRA_USER_ID, userId);
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT
|
||||
| Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
|
||||
startActivity(chooserIntent);
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
|
||||
|
||||
// Don't close until the delegate finishes, or the token will be invalidated.
|
||||
mAwaitingDelegateResponse = true;
|
||||
|
||||
startActivityForResult(chooserIntent, REQUEST_CODE_RETURN_FROM_DELEGATE_CHOOSER);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, e.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_RETURN_FROM_DELEGATE_CHOOSER:
|
||||
// Repeat the delegate's result as our own.
|
||||
setResult(resultCode, data);
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
public void onActivityStarted(TargetInfo cti) {
|
||||
// Do nothing
|
||||
}
|
||||
@@ -2152,7 +2176,9 @@ public class ResolverActivity extends Activity implements
|
||||
.getItem(selections[0].getIndex());
|
||||
if (ra.onTargetSelected(ti, false)) {
|
||||
ra.mPickOptionRequest = null;
|
||||
ra.finish();
|
||||
if (!ra.mAwaitingDelegateResponse) {
|
||||
ra.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user