DeviceConfig flag to guard delegate chooser flow.

This replaces the ad-hoc hard-coded flag that previously
guarded the delegation flow, and updates the config to
point to the new delegate component. Note this is still
the Phase 2 ("Delegation Trials") architecture from
go/sharesheet-unbundling-phases which delegates to the
new component only for the final step of dispatching the
user's selected target. When the new component takes
responsibility for displaying the Sharesheet UI (Phase 3)
we'll use the same DeviceConfig flag to guard the new
logic to delegate out from earlier on in the system
activity lifecycle.

I was able to test this manually (once I eventually
figured out how to get the new unbundled APK installed),
by going through Sharesheet and confirming that the
delegate activity (at the new path) is only invoked after
overriding the flag by:

adb shell device_config put systemui use_delegate_chooser true

An upcoming CL will add the server-side config that we
can use to control this experiment.

Bug: 202166034
Test: manual (as described above)
Change-Id: Ie3eb5bca6b768383156293cddbf6932df2cd3a64
This commit is contained in:
Joshua Trask
2021-11-09 12:00:17 -05:00
parent eda8dd1d0b
commit 237b8372b7
3 changed files with 13 additions and 6 deletions

View File

@@ -30,9 +30,11 @@ 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;
@@ -43,10 +45,10 @@ import java.util.List;
* resolve it to an activity.
*/
public class DisplayResolveInfo implements TargetInfo, Parcelable {
// Temporary flag for new chooser delegate behavior. There are occassional token
// permission errors from bouncing through the delegate. Watch out before reenabling:
// b/157272342 is one example but this issue has been reported many times
private static final boolean ENABLE_CHOOSER_DELEGATE = false;
private final boolean mEnableChooserDelegate =
DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.USE_DELEGATE_CHOOSER,
false);
private final ResolveInfo mResolveInfo;
private CharSequence mDisplayLabel;
@@ -178,7 +180,7 @@ public class DisplayResolveInfo implements TargetInfo, Parcelable {
@Override
public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
if (ENABLE_CHOOSER_DELEGATE) {
if (mEnableChooserDelegate) {
return activity.startAsCallerImpl(mResolvedIntent, options, false, userId);
} else {
activity.startActivityAsCaller(mResolvedIntent, options, null, false, userId);

View File

@@ -501,6 +501,11 @@ public final class SystemUiDeviceConfigFlags {
public static final String IS_NEARBY_SHARE_FIRST_TARGET_IN_RANKED_APP =
"is_nearby_share_first_target_in_ranked_app";
/**
* (boolean) Whether to enable the new unbundled "delegate chooser" implementation.
*/
public static final String USE_DELEGATE_CHOOSER = "use_delegate_chooser";
private SystemUiDeviceConfigFlags() {
}
}

View File

@@ -2723,7 +2723,7 @@
<!-- Name of the activity that will handle requests to the system to choose an activity for
the purposes of resolving an intent. -->
<string name="config_chooserActivity" translatable="false"
>com.android.systemui/com.android.systemui.chooser.ChooserActivity</string>
>com.android.intentresolver/.ChooserActivity</string>
<!-- Component name of a custom ResolverActivity (Intent resolver) to be used instead of
the default framework version. If left empty, then the framework version will be used.
Example: com.google.android.myapp/.resolver.MyResolverActivity -->