diff options
| author | Joshua Trask <joshtrask@google.com> | 2022-02-23 10:06:49 -0500 |
|---|---|---|
| committer | Matt Casey <mrcasey@google.com> | 2022-02-23 19:21:09 +0000 |
| commit | 0c82ed90fa4589ae87510d79c363c07beefc3c0d (patch) | |
| tree | 4de79c6a54636d9818ece20ca7a1335095e25f7c /core/java/com | |
| parent | efc2678c5083c9857ce1531e1f3eacd2a3dffce0 (diff) | |
Remove system call to "headless" unbundled chooser
The behavior of proxying through a headless implementation of
the unbundled component was left over from an earlier stage of
the migration ("phase 2" of go/sharesheet-unbundling-phases).
This headless use is no longer supported in the unbundled
component, and it seems that some users are triggering this
code path even when unbundling is disabled -- resulting in
displaying both the "legacy" (system-side) UI and then, when
a share target is selected, the new unbundled UI (which is
no longer "headless").
Bug: 213348070
Change-Id: I146b42e9624d795cfa6689b6a417778ae912d8b5
Test: manual verification of crash fix, atest ChooserActivityTest
Diffstat (limited to 'core/java/com')
| -rw-r--r-- | core/java/com/android/internal/app/ResolverActivity.java | 36 | ||||
| -rw-r--r-- | core/java/com/android/internal/app/chooser/DisplayResolveInfo.java | 16 |
2 files changed, 6 insertions, 46 deletions
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index cdb69e546b8f..e336e96d577e 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -33,7 +33,6 @@ import android.annotation.StringRes; import android.annotation.UiThread; import android.app.Activity; import android.app.ActivityManager; -import android.app.ActivityTaskManager; import android.app.ActivityThread; import android.app.VoiceInteractor.PickOptionRequest; import android.app.VoiceInteractor.PickOptionRequest.Option; @@ -54,13 +53,11 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.content.res.Configuration; -import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Insets; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.IBinder; import android.os.PatternMatcher; import android.os.RemoteException; import android.os.StrictMode; @@ -1464,36 +1461,9 @@ public class ResolverActivity extends Activity implements public boolean startAsCallerImpl(Intent intent, Bundle options, boolean ignoreTargetSecurity, int userId) { - // Pass intent to delegate chooser activity with permission token. - // TODO: This should move to a trampoline Activity in the system when the ChooserActivity - // moves into systemui - try { - // TODO: Once this is a small springboard activity, it can move off the UI process - // and we can move the request method to ActivityManagerInternal. - final Intent chooserIntent = new Intent(); - final ComponentName delegateActivity = ComponentName.unflattenFromString( - Resources.getSystem().getString(R.string.config_chooserActivity)); - IBinder permissionToken = ActivityTaskManager.getService() - .requestStartActivityPermissionToken(delegateActivity); - chooserIntent.setClassName(delegateActivity.getPackageName(), - delegateActivity.getClassName()); - chooserIntent.putExtra(ActivityTaskManager.EXTRA_PERMISSION_TOKEN, permissionToken); - - // TODO: These extras will change as chooser activity moves into systemui - chooserIntent.putExtra(Intent.EXTRA_INTENT, intent); - chooserIntent.putExtra(ActivityTaskManager.EXTRA_OPTIONS, options); - chooserIntent.putExtra(ActivityTaskManager.EXTRA_IGNORE_TARGET_SECURITY, - ignoreTargetSecurity); - chooserIntent.putExtra(Intent.EXTRA_USER_ID, userId); - 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()); - } + // Note: this method will be overridden in the delegate implementation to use the passed-in + // permission token. + startActivityAsCaller(intent, options, null, false, userId); return true; } diff --git a/core/java/com/android/internal/app/chooser/DisplayResolveInfo.java b/core/java/com/android/internal/app/chooser/DisplayResolveInfo.java index 301de2d3529e..dc53e77466ad 100644 --- a/core/java/com/android/internal/app/chooser/DisplayResolveInfo.java +++ b/core/java/com/android/internal/app/chooser/DisplayResolveInfo.java @@ -30,11 +30,9 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; -import android.provider.DeviceConfig; import com.android.internal.app.ResolverActivity; import com.android.internal.app.ResolverListAdapter.ResolveInfoPresentationGetter; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import java.util.ArrayList; import java.util.Arrays; @@ -45,11 +43,6 @@ import java.util.List; * resolve it to an activity. */ public class DisplayResolveInfo implements TargetInfo, Parcelable { - private final boolean mEnableChooserDelegate = - DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.USE_DELEGATE_CHOOSER, - false); - private final ResolveInfo mResolveInfo; private CharSequence mDisplayLabel; private Drawable mDisplayIcon; @@ -180,12 +173,9 @@ public class DisplayResolveInfo implements TargetInfo, Parcelable { @Override public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) { - if (mEnableChooserDelegate) { - return activity.startAsCallerImpl(mResolvedIntent, options, false, userId); - } else { - activity.startActivityAsCaller(mResolvedIntent, options, null, false, userId); - return true; - } + // TODO: if the start-as-caller API no longer requires a permission token, this can go back + // to inlining the real activity-start call, and we can remove startAsCallerImpl. + return activity.startAsCallerImpl(mResolvedIntent, options, false, userId); } @Override |
