Merge "DeviceConfig flag to guard delegate chooser flow."

This commit is contained in:
TreeHugger Robot
2021-11-09 20:40:51 +00:00
committed by Android (Google) Code Review
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 -->