Clean up unused fields from EntityHeaderController

Bug: 295260929
Test: manual - on pages with header
Test: robo test
Change-Id: Icebd63dbb5d3d44b4b46d3bececb8b65b30b4883
This commit is contained in:
Chaohui Wang
2023-08-21 13:51:07 +08:00
parent 6bb80b42bf
commit cc2133ba8e
31 changed files with 44 additions and 136 deletions

View File

@@ -95,6 +95,6 @@ public class AccountHeaderPreferenceController extends AbstractPreferenceControl
.newInstance(mActivity, mHost, mHeaderPreference.findViewById(R.id.entity_header)) .newInstance(mActivity, mHost, mHeaderPreference.findViewById(R.id.entity_header))
.setLabel(mAccount.name) .setLabel(mAccount.name)
.setIcon(helper.getDrawableForType(mContext, mAccount.type)) .setIcon(helper.getDrawableForType(mContext, mAccount.type))
.done(mActivity, true /* rebindButtons */); .done(true /* rebindButtons */);
} }
} }

View File

@@ -140,11 +140,10 @@ public class AccountSyncSettings extends AccountPreferenceBase {
final Activity activity = getActivity(); final Activity activity = getActivity();
final Preference pref = EntityHeaderController final Preference pref = EntityHeaderController
.newInstance(activity, this, null /* header */) .newInstance(activity, this, null /* header */)
.setRecyclerView(getListView(), getSettingsLifecycle())
.setIcon(getDrawableForType(mAccount.type)) .setIcon(getDrawableForType(mAccount.type))
.setLabel(mAccount.name) .setLabel(mAccount.name)
.setSummary(getLabelForType(mAccount.type)) .setSummary(getLabelForType(mAccount.type))
.done(activity, getPrefContext()); .done(getPrefContext());
pref.setOrder(0); pref.setOrder(0);
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
if (savedInstanceState != null && savedInstanceState.containsKey(UID_REQUEST_KEY)) { if (savedInstanceState != null && savedInstanceState.containsKey(UID_REQUEST_KEY)) {

View File

@@ -46,7 +46,6 @@ public abstract class AppInfoWithHeader extends AppInfoBase {
final Activity activity = getActivity(); final Activity activity = getActivity();
final Preference pref = EntityHeaderController final Preference pref = EntityHeaderController
.newInstance(activity, this, null /* header */) .newInstance(activity, this, null /* header */)
.setRecyclerView(getListView(), getSettingsLifecycle())
.setIcon(Utils.getBadgedIcon(getContext(), mPackageInfo.applicationInfo)) .setIcon(Utils.getBadgedIcon(getContext(), mPackageInfo.applicationInfo))
.setLabel(mPackageInfo.applicationInfo.loadLabel(mPm)) .setLabel(mPackageInfo.applicationInfo.loadLabel(mPm))
.setSummary(mPackageInfo) .setSummary(mPackageInfo)
@@ -55,7 +54,7 @@ public abstract class AppInfoWithHeader extends AppInfoBase {
.setUid(mPackageInfo.applicationInfo.uid) .setUid(mPackageInfo.applicationInfo.uid)
.setHasAppInfoLink(true) .setHasAppInfoLink(true)
.setButtonActions(ActionType.ACTION_NONE, ActionType.ACTION_NONE) .setButtonActions(ActionType.ACTION_NONE, ActionType.ACTION_NONE)
.done(activity, getPrefContext()); .done(getPrefContext());
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
} }
} }

View File

@@ -129,7 +129,6 @@ public class ProcessStatsDetail extends SettingsPreferenceFragment {
final Activity activity = getActivity(); final Activity activity = getActivity();
final Preference pref = EntityHeaderController final Preference pref = EntityHeaderController
.newInstance(activity, this, null /* appHeader */) .newInstance(activity, this, null /* appHeader */)
.setRecyclerView(getListView(), getSettingsLifecycle())
.setIcon(mApp.mUiTargetApp != null .setIcon(mApp.mUiTargetApp != null
? IconDrawableFactory.newInstance(activity).getBadgedIcon(mApp.mUiTargetApp) ? IconDrawableFactory.newInstance(activity).getBadgedIcon(mApp.mUiTargetApp)
: new ColorDrawable(0)) : new ColorDrawable(0))
@@ -140,7 +139,7 @@ public class ProcessStatsDetail extends SettingsPreferenceFragment {
: UserHandle.USER_NULL) : UserHandle.USER_NULL)
.setHasAppInfoLink(true) .setHasAppInfoLink(true)
.setButtonActions(ActionType.ACTION_NONE, ActionType.ACTION_NONE) .setButtonActions(ActionType.ACTION_NONE, ActionType.ACTION_NONE)
.done(activity, getPrefContext()); .done(getPrefContext());
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
} }

View File

@@ -66,7 +66,6 @@ public class AppHeaderViewPreferenceController extends BasePreferenceController
final Activity activity = mParent.getActivity(); final Activity activity = mParent.getActivity();
mEntityHeaderController = EntityHeaderController mEntityHeaderController = EntityHeaderController
.newInstance(activity, mParent, mHeader.findViewById(R.id.entity_header)) .newInstance(activity, mParent, mHeader.findViewById(R.id.entity_header))
.setRecyclerView(mParent.getListView(), mLifecycle)
.setPackageName(mPackageName) .setPackageName(mPackageName)
.setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE,
EntityHeaderController.ActionType.ACTION_NONE) EntityHeaderController.ActionType.ACTION_NONE)
@@ -86,6 +85,6 @@ public class AppHeaderViewPreferenceController extends BasePreferenceController
.setLabel(appEntry) .setLabel(appEntry)
.setIcon(appEntry) .setIcon(appEntry)
.setIsInstantApp(isInstantApp) .setIsInstantApp(isInstantApp)
.done(activity, false /* rebindActions */); .done(false /* rebindActions */);
} }
} }

View File

@@ -137,7 +137,6 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
final Activity activity = getActivity(); final Activity activity = getActivity();
final Preference pref = EntityHeaderController final Preference pref = EntityHeaderController
.newInstance(activity, this, null /* header */) .newInstance(activity, this, null /* header */)
.setRecyclerView(getListView(), getSettingsLifecycle())
.setIcon(Utils.getBadgedIcon(getContext(), mApplicationInfo)) .setIcon(Utils.getBadgedIcon(getContext(), mApplicationInfo))
.setLabel(mApplicationInfo.loadLabel(getContext().getPackageManager())) .setLabel(mApplicationInfo.loadLabel(getContext().getPackageManager()))
.setIsInstantApp(AppUtils.isInstant(mApplicationInfo)) .setIsInstantApp(AppUtils.isInstant(mApplicationInfo))
@@ -146,7 +145,7 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
.setHasAppInfoLink(true) .setHasAppInfoLink(true)
.setButtonActions(ActionType.ACTION_NONE, ActionType.ACTION_NONE) .setButtonActions(ActionType.ACTION_NONE, ActionType.ACTION_NONE)
.setOrder(10) .setOrder(10)
.done(activity, getPrefContext()); .done(getPrefContext());
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
} }

View File

@@ -200,7 +200,6 @@ public class AppLaunchSettings extends AppInfoBase implements
final String summary = activity.getString(R.string.app_launch_top_intro_message); final String summary = activity.getString(R.string.app_launch_top_intro_message);
final Preference pref = EntityHeaderController final Preference pref = EntityHeaderController
.newInstance(activity, this, null /* header */) .newInstance(activity, this, null /* header */)
.setRecyclerView(getListView(), getSettingsLifecycle())
.setIcon(Utils.getBadgedIcon(mContext, mPackageInfo.applicationInfo)) .setIcon(Utils.getBadgedIcon(mContext, mPackageInfo.applicationInfo))
.setLabel(mPackageInfo.applicationInfo.loadLabel(mPm)) .setLabel(mPackageInfo.applicationInfo.loadLabel(mPm))
.setSummary(summary) // add intro text .setSummary(summary) // add intro text
@@ -210,7 +209,7 @@ public class AppLaunchSettings extends AppInfoBase implements
.setHasAppInfoLink(true) .setHasAppInfoLink(true)
.setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE,
EntityHeaderController.ActionType.ACTION_NONE) EntityHeaderController.ActionType.ACTION_NONE)
.done(activity, getPrefContext()); .done(getPrefContext());
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
} }

View File

@@ -109,7 +109,6 @@ public class HeaderPreferenceController extends BasePreferenceController
mHeaderController = EntityHeaderController.newInstance( mHeaderController = EntityHeaderController.newInstance(
mFragment.getActivity(), mFragment, pref.findViewById(R.id.entity_header)); mFragment.getActivity(), mFragment, pref.findViewById(R.id.entity_header));
pref = mHeaderController pref = mHeaderController
.setRecyclerView(mFragment.getListView(), mFragment.getSettingsLifecycle())
.setIcon(IconDrawableFactory.newInstance(mFragment.getActivity()) .setIcon(IconDrawableFactory.newInstance(mFragment.getActivity())
.getBadgedIcon(mPackageInfo.applicationInfo)) .getBadgedIcon(mPackageInfo.applicationInfo))
.setLabel(mPackageInfo.applicationInfo.loadLabel(mPm)) .setLabel(mPackageInfo.applicationInfo.loadLabel(mPm))
@@ -122,7 +121,7 @@ public class HeaderPreferenceController extends BasePreferenceController
.setHasAppInfoLink(true) .setHasAppInfoLink(true)
.setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE,
EntityHeaderController.ActionType.ACTION_NONE) EntityHeaderController.ActionType.ACTION_NONE)
.done(mFragment.getActivity(), mContext); .done(mContext);
pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE); pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE);
} }
} }

View File

@@ -29,8 +29,6 @@ import com.android.settings.R;
import com.android.settings.widget.EntityHeaderController; import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.bluetooth.BluetoothUtils; import com.android.settingslib.bluetooth.BluetoothUtils;
import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.LayoutPreference; import com.android.settingslib.widget.LayoutPreference;
@@ -41,15 +39,10 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController
private static final String KEY_DEVICE_HEADER = "bluetooth_device_header"; private static final String KEY_DEVICE_HEADER = "bluetooth_device_header";
private EntityHeaderController mHeaderController; private EntityHeaderController mHeaderController;
private LocalBluetoothManager mLocalManager;
private CachedBluetoothDeviceManager mDeviceManager;
public BluetoothDetailsHeaderController(Context context, PreferenceFragmentCompat fragment, public BluetoothDetailsHeaderController(Context context, PreferenceFragmentCompat fragment,
CachedBluetoothDevice device, Lifecycle lifecycle, CachedBluetoothDevice device, Lifecycle lifecycle) {
LocalBluetoothManager bluetoothManager) {
super(context, fragment, device, lifecycle); super(context, fragment, device, lifecycle);
mLocalManager = bluetoothManager;
mDeviceManager = mLocalManager.getCachedDeviceManager();
} }
@Override @Override
@@ -87,7 +80,7 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController
protected void refresh() { protected void refresh() {
if (isAvailable()) { if (isAvailable()) {
setHeaderProperties(); setHeaderProperties();
mHeaderController.done(mFragment.getActivity(), true /* rebindActions */); mHeaderController.done(true /* rebindActions */);
} }
} }

View File

@@ -295,7 +295,7 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
if (mCachedDevice != null) { if (mCachedDevice != null) {
Lifecycle lifecycle = getSettingsLifecycle(); Lifecycle lifecycle = getSettingsLifecycle();
controllers.add(new BluetoothDetailsHeaderController(context, this, mCachedDevice, controllers.add(new BluetoothDetailsHeaderController(context, this, mCachedDevice,
lifecycle, mManager)); lifecycle));
controllers.add(new BluetoothDetailsButtonsController(context, this, mCachedDevice, controllers.add(new BluetoothDetailsButtonsController(context, this, mCachedDevice,
lifecycle)); lifecycle));
controllers.add(new BluetoothDetailsCompanionAppsController(context, this, controllers.add(new BluetoothDetailsCompanionAppsController(context, this,

View File

@@ -50,7 +50,7 @@ public class UsbDetailsHeaderController extends UsbDetailsController {
protected void refresh(boolean connected, long functions, int powerRole, int dataRole) { protected void refresh(boolean connected, long functions, int powerRole, int dataRole) {
mHeaderController.setLabel(mContext.getString(R.string.usb_pref)); mHeaderController.setLabel(mContext.getString(R.string.usb_pref));
mHeaderController.setIcon(mContext.getDrawable(R.drawable.ic_usb)); mHeaderController.setIcon(mContext.getDrawable(R.drawable.ic_usb));
mHeaderController.done(mFragment.getActivity(), true /* rebindActions */); mHeaderController.done(true /* rebindActions */);
} }
@Override @Override

View File

@@ -417,7 +417,6 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
final Activity activity = getActivity(); final Activity activity = getActivity();
final Preference pref = EntityHeaderController final Preference pref = EntityHeaderController
.newInstance(activity, this, null /* header */) .newInstance(activity, this, null /* header */)
.setRecyclerView(getListView(), getSettingsLifecycle())
.setUid(uid) .setUid(uid)
.setHasAppInfoLink(showInfoButton) .setHasAppInfoLink(showInfoButton)
.setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE,
@@ -425,7 +424,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
.setIcon(mIcon) .setIcon(mIcon)
.setLabel(mLabel) .setLabel(mLabel)
.setPackageName(pkg) .setPackageName(pkg)
.done(activity, getPrefContext()); .done(getPrefContext());
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
} }

View File

@@ -33,7 +33,6 @@ import android.util.RecurrenceRule;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.util.CollectionUtils; import com.android.internal.util.CollectionUtils;
import com.android.settings.R; import com.android.settings.R;
@@ -162,8 +161,6 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
mEntityHeaderController = mEntityHeaderController =
EntityHeaderController.newInstance((Activity) mContext, mFragment, null); EntityHeaderController.newInstance((Activity) mContext, mFragment, null);
} }
RecyclerView view = mFragment.getListView();
mEntityHeaderController.setRecyclerView(view, mLifecycle);
} }
@VisibleForTesting @VisibleForTesting

View File

@@ -82,7 +82,7 @@ public class AdbDeviceDetailsHeaderController extends AbstractPreferenceControll
mEntityHeaderController mEntityHeaderController
.setIcon(mContext.getDrawable(com.android.internal.R.drawable.ic_bt_laptop)) .setIcon(mContext.getDrawable(com.android.internal.R.drawable.ic_bt_laptop))
.setLabel(mPairedDevice.name) .setLabel(mPairedDevice.name)
.done(mFragment.getActivity(), true); .done(true);
} }
} }

View File

@@ -183,7 +183,6 @@ public class MyDeviceInfoFragment extends DashboardFragment
final Bundle bundle = getArguments(); final Bundle bundle = getArguments();
final EntityHeaderController controller = EntityHeaderController final EntityHeaderController controller = EntityHeaderController
.newInstance(context, this, headerView) .newInstance(context, this, headerView)
.setRecyclerView(getListView(), getSettingsLifecycle())
.setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE,
EntityHeaderController.ActionType.ACTION_NONE); EntityHeaderController.ActionType.ACTION_NONE);
@@ -199,7 +198,7 @@ public class MyDeviceInfoFragment extends DashboardFragment
com.android.settingslib.Utils.getUserIcon(getActivity(), userManager, info)); com.android.settingslib.Utils.getUserIcon(getActivity(), userManager, info));
} }
controller.done(context, true /* rebindActions */); controller.done(true /* rebindActions */);
} }
@Override @Override

View File

@@ -316,7 +316,6 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
final Bundle bundle = getArguments(); final Bundle bundle = getArguments();
EntityHeaderController controller = EntityHeaderController EntityHeaderController controller = EntityHeaderController
.newInstance(context, this, appSnippet) .newInstance(context, this, appSnippet)
.setRecyclerView(getListView(), getSettingsLifecycle())
.setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE,
EntityHeaderController.ActionType.ACTION_NONE); EntityHeaderController.ActionType.ACTION_NONE);
@@ -337,7 +336,7 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
} }
controller.setSummary(getHeaderSummary(bundle)); controller.setSummary(getHeaderSummary(bundle));
controller.done(context, true /* rebindActions */); controller.done(true /* rebindActions */);
} }
@VisibleForTesting @VisibleForTesting

View File

@@ -35,7 +35,6 @@ import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.EntityHeaderController; import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.Utils; import com.android.settingslib.Utils;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart; import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.widget.UsageProgressBarPreference; import com.android.settingslib.widget.UsageProgressBarPreference;
@@ -59,7 +58,6 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
private Activity mActivity; private Activity mActivity;
private PreferenceFragmentCompat mHost; private PreferenceFragmentCompat mHost;
private Lifecycle mLifecycle;
private BatteryTip mBatteryTip; private BatteryTip mBatteryTip;
private final PowerManager mPowerManager; private final PowerManager mPowerManager;
@@ -78,10 +76,6 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
mHost = fragment; mHost = fragment;
} }
public void setLifecycle(Lifecycle lifecycle) {
mLifecycle = lifecycle;
}
@Override @Override
public void displayPreference(PreferenceScreen screen) { public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen); super.displayPreference(screen);
@@ -104,8 +98,7 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
@Override @Override
public void onStart() { public void onStart() {
EntityHeaderController.newInstance(mActivity, mHost, null /* header view */) EntityHeaderController.newInstance(mActivity, mHost, null /* header view */);
.setRecyclerView(mHost.getListView(), mLifecycle);
} }
private CharSequence generateLabel(BatteryInfo info) { private CharSequence generateLabel(BatteryInfo info) {

View File

@@ -142,7 +142,6 @@ public class PowerUsageSummary extends PowerUsageBase implements
mBatteryHeaderPreferenceController = use(BatteryHeaderPreferenceController.class); mBatteryHeaderPreferenceController = use(BatteryHeaderPreferenceController.class);
mBatteryHeaderPreferenceController.setActivity(activity); mBatteryHeaderPreferenceController.setActivity(activity);
mBatteryHeaderPreferenceController.setFragment(this); mBatteryHeaderPreferenceController.setFragment(this);
mBatteryHeaderPreferenceController.setLifecycle(getSettingsLifecycle());
mBatteryTipPreferenceController = use(BatteryTipPreferenceController.class); mBatteryTipPreferenceController = use(BatteryTipPreferenceController.class);
mBatteryTipPreferenceController.setActivity(activity); mBatteryTipPreferenceController.setActivity(activity);

View File

@@ -89,8 +89,7 @@ public class ConversationHeaderPreferenceController extends NotificationPreferen
.setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE,
EntityHeaderController.ActionType.ACTION_NONE) EntityHeaderController.ActionType.ACTION_NONE)
.setHasAppInfoLink(true) .setHasAppInfoLink(true)
.setRecyclerView(mFragment.getListView(), mFragment.getSettingsLifecycle()) .done(mContext);
.done(activity, mContext);
pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE); pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE);
pref.findViewById(R.id.entity_header).setBackground(null); pref.findViewById(R.id.entity_header).setBackground(null);

View File

@@ -25,7 +25,6 @@ import android.text.SpannableStringBuilder;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent; import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.Preference; import androidx.preference.Preference;
@@ -90,8 +89,7 @@ public class HeaderPreferenceController extends NotificationPreferenceController
.setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE,
EntityHeaderController.ActionType.ACTION_NONE) EntityHeaderController.ActionType.ACTION_NONE)
.setHasAppInfoLink(true) .setHasAppInfoLink(true)
.setRecyclerView(mFragment.getListView(), mFragment.getSettingsLifecycle()) .done(mContext);
.done(activity, mContext);
pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE); pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE);
pref.findViewById(R.id.entity_header).setBackground(null); pref.findViewById(R.id.entity_header).setBackground(null);
} }

View File

@@ -76,7 +76,7 @@ public class ZenAutomaticRuleHeaderPreferenceController extends AbstractZenModeP
mController.setIcon(getIcon()) mController.setIcon(getIcon())
.setLabel(mRule.getName()) .setLabel(mRule.getName())
.done(mFragment.getActivity(), false /* rebindActions */); .done(false /* rebindActions */);
} }
private Drawable getIcon() { private Drawable getIcon() {

View File

@@ -38,13 +38,11 @@ import android.widget.TextView;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.applications.ApplicationsState; import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.LayoutPreference; import com.android.settingslib.widget.LayoutPreference;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
@@ -67,12 +65,9 @@ public class EntityHeaderController {
private static final String TAG = "AppDetailFeature"; private static final String TAG = "AppDetailFeature";
private final Context mAppContext; private final Context mAppContext;
private final Activity mActivity;
private final Fragment mFragment; private final Fragment mFragment;
private final int mMetricsCategory; private final int mMetricsCategory;
private final View mHeader; private final View mHeader;
private Lifecycle mLifecycle;
private RecyclerView mRecyclerView;
private Drawable mIcon; private Drawable mIcon;
private int mPrefOrder = -1000; private int mPrefOrder = -1000;
private String mIconContentDescription; private String mIconContentDescription;
@@ -107,7 +102,6 @@ public class EntityHeaderController {
} }
private EntityHeaderController(Activity activity, Fragment fragment, View header) { private EntityHeaderController(Activity activity, Fragment fragment, View header) {
mActivity = activity;
mAppContext = activity.getApplicationContext(); mAppContext = activity.getApplicationContext();
mFragment = fragment; mFragment = fragment;
mMetricsCategory = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider() mMetricsCategory = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider()
@@ -121,12 +115,6 @@ public class EntityHeaderController {
} }
} }
public EntityHeaderController setRecyclerView(RecyclerView recyclerView, Lifecycle lifecycle) {
mRecyclerView = recyclerView;
mLifecycle = lifecycle;
return this;
}
/** /**
* Set the icon in the header. Callers should also consider calling setIconContentDescription * Set the icon in the header. Callers should also consider calling setIconContentDescription
* to provide a description of this icon for accessibility purposes. * to provide a description of this icon for accessibility purposes.
@@ -181,13 +169,6 @@ public class EntityHeaderController {
return this; return this;
} }
public EntityHeaderController setSecondSummary(PackageInfo packageInfo) {
if (packageInfo != null) {
mSummary = packageInfo.versionName;
}
return this;
}
public EntityHeaderController setHasAppInfoLink(boolean hasAppInfoLink) { public EntityHeaderController setHasAppInfoLink(boolean hasAppInfoLink) {
mHasAppInfoLink = hasAppInfoLink; mHasAppInfoLink = hasAppInfoLink;
return this; return this;
@@ -234,8 +215,8 @@ public class EntityHeaderController {
/** /**
* Done mutating entity header, rebinds everything and return a new {@link LayoutPreference}. * Done mutating entity header, rebinds everything and return a new {@link LayoutPreference}.
*/ */
public LayoutPreference done(Activity activity, Context uiContext) { public LayoutPreference done(Context uiContext) {
final LayoutPreference pref = new LayoutPreference(uiContext, done(activity)); final LayoutPreference pref = new LayoutPreference(uiContext, done());
// Makes sure it's the first preference onscreen. // Makes sure it's the first preference onscreen.
pref.setOrder(mPrefOrder); pref.setOrder(mPrefOrder);
pref.setSelectable(false); pref.setSelectable(false);
@@ -247,7 +228,7 @@ public class EntityHeaderController {
/** /**
* Done mutating entity header, rebinds everything (optionally skip rebinding buttons). * Done mutating entity header, rebinds everything (optionally skip rebinding buttons).
*/ */
public View done(Activity activity, boolean rebindActions) { public View done(boolean rebindActions) {
ImageView iconView = mHeader.findViewById(R.id.entity_header_icon); ImageView iconView = mHeader.findViewById(R.id.entity_header_icon);
if (iconView != null) { if (iconView != null) {
iconView.setImageDrawable(mIcon); iconView.setImageDrawable(mIcon);
@@ -303,8 +284,8 @@ public class EntityHeaderController {
* Done mutating entity header, rebinds everything. * Done mutating entity header, rebinds everything.
*/ */
@VisibleForTesting @VisibleForTesting
View done(Activity activity) { View done() {
return done(activity, true /* rebindActions */); return done(true /* rebindActions */);
} }
private void bindButton(ImageButton button, @ActionType int action) { private void bindButton(ImageButton button, @ActionType int action) {

View File

@@ -489,8 +489,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
mEntityHeaderController mEntityHeaderController
.setSummary(mWifiEntry.getSummary()) .setSummary(mWifiEntry.getSummary())
.setSecondSummary(getExpiryTimeSummary()) .setSecondSummary(getExpiryTimeSummary())
.setRecyclerView(mFragment.getListView(), mLifecycle) .done(true /* rebind */);
.done(mFragment.getActivity(), true /* rebind */);
} }
} }
@@ -583,9 +582,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
Drawable wifiIcon = mIconInjector.getIcon(mShowX, mRssiSignalLevel); Drawable wifiIcon = mIconInjector.getIcon(mShowX, mRssiSignalLevel);
if (mEntityHeaderController != null) { if (mEntityHeaderController != null) {
mEntityHeaderController mEntityHeaderController.setIcon(redrawIconForHeader(wifiIcon)).done(true /* rebind */);
.setIcon(redrawIconForHeader(wifiIcon)).done(mFragment.getActivity(),
true /* rebind */);
} }
Drawable wifiIconDark = wifiIcon.getConstantState().newDrawable().mutate(); Drawable wifiIconDark = wifiIcon.getConstantState().newDrawable().mutate();

View File

@@ -70,8 +70,7 @@ public class BluetoothDetailsHeaderControllerTest extends BluetoothDetailsContro
when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager); when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager);
when(mCachedDeviceManager.getSubDeviceSummary(mCachedDevice)).thenReturn("abc"); when(mCachedDeviceManager.getSubDeviceSummary(mCachedDevice)).thenReturn("abc");
mController = mController =
new BluetoothDetailsHeaderController(mContext, mFragment, mCachedDevice, mLifecycle, new BluetoothDetailsHeaderController(mContext, mFragment, mCachedDevice, mLifecycle);
mBluetoothManager);
mPreference = new LayoutPreference( mPreference = new LayoutPreference(
mContext, com.android.settingslib.widget.R.layout.settings_entity_header); mContext, com.android.settingslib.widget.R.layout.settings_entity_header);
mPreference.setKey(mController.getPreferenceKey()); mPreference.setKey(mController.getPreferenceKey());
@@ -104,7 +103,7 @@ public class BluetoothDetailsHeaderControllerTest extends BluetoothDetailsContro
verify(mHeaderController).setIconContentDescription(any(String.class)); verify(mHeaderController).setIconContentDescription(any(String.class));
verify(mHeaderController).setSummary(any(String.class)); verify(mHeaderController).setSummary(any(String.class));
verify(mHeaderController).setSecondSummary(any(String.class)); verify(mHeaderController).setSecondSummary(any(String.class));
verify(mHeaderController).done(mActivity, true); verify(mHeaderController).done(true);
} }
@Test @Test

View File

@@ -114,6 +114,6 @@ public class UsbDetailsHeaderControllerTest {
DrawableTestHelper.assertDrawableResId(t, R.drawable.ic_usb); DrawableTestHelper.assertDrawableResId(t, R.drawable.ic_usb);
return true; return true;
})); }));
verify(mHeaderController).done(mActivity, true); verify(mHeaderController).done(true);
} }
} }

View File

@@ -100,7 +100,6 @@ public class AppDataUsageTest {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
ShadowEntityHeaderController.setUseMock(mHeaderController); ShadowEntityHeaderController.setUseMock(mHeaderController);
when(mHeaderController.setRecyclerView(any(), any())).thenReturn(mHeaderController);
when(mHeaderController.setUid(anyInt())).thenReturn(mHeaderController); when(mHeaderController.setUid(anyInt())).thenReturn(mHeaderController);
} }

View File

@@ -40,14 +40,11 @@ import android.telephony.TelephonyManager;
import android.util.RecurrenceRule; import android.util.RecurrenceRule;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.preference.PreferenceFragmentCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.shadow.ShadowEntityHeaderController; import com.android.settings.testutils.shadow.ShadowEntityHeaderController;
import com.android.settings.widget.EntityHeaderController; import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.net.DataUsageController; import com.android.settingslib.net.DataUsageController;
import org.junit.After; import org.junit.After;
@@ -91,13 +88,9 @@ public class DataUsageSummaryPreferenceControllerTest {
private SubscriptionInfo mSubscriptionInfo; private SubscriptionInfo mSubscriptionInfo;
@Mock @Mock
private SubscriptionPlan mSubscriptionPlan; private SubscriptionPlan mSubscriptionPlan;
@Mock
private Lifecycle mLifecycle;
@Mock(answer = Answers.RETURNS_DEEP_STUBS) @Mock(answer = Answers.RETURNS_DEEP_STUBS)
private EntityHeaderController mHeaderController; private EntityHeaderController mHeaderController;
@Mock @Mock
private PreferenceFragmentCompat mPreferenceFragment;
@Mock
private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager;
@Mock @Mock
private PackageManager mPm; private PackageManager mPm;
@@ -360,25 +353,6 @@ public class DataUsageSummaryPreferenceControllerTest {
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE); assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
} }
@Test
public void testMobileData_entityHeaderSet() {
final RecyclerView recyclerView = new RecyclerView(mActivity);
mController = spy(new DataUsageSummaryPreferenceController(
mDataUsageController,
mDataInfoController,
mNetworkTemplate,
mActivity, mLifecycle, mHeaderController, mPreferenceFragment,
mDefaultSubscriptionId));
when(mPreferenceFragment.getListView()).thenReturn(recyclerView);
mController.onStart();
verify(mHeaderController)
.setRecyclerView(any(RecyclerView.class), any(Lifecycle.class));
}
private DataUsageController.DataUsageInfo createTestDataUsageInfo(long now) { private DataUsageController.DataUsageInfo createTestDataUsageInfo(long now) {
DataUsageController.DataUsageInfo info = new DataUsageController.DataUsageInfo(); DataUsageController.DataUsageInfo info = new DataUsageController.DataUsageInfo();
info.carrier = CARRIER_NAME; info.carrier = CARRIER_NAME;

View File

@@ -47,7 +47,6 @@ import android.os.UserHandle;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.loader.app.LoaderManager; import androidx.loader.app.LoaderManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.SettingsActivity; import com.android.settings.SettingsActivity;
@@ -60,7 +59,6 @@ import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState; import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.instantapps.InstantAppDataProvider; import com.android.settingslib.applications.instantapps.InstantAppDataProvider;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.FooterPreference; import com.android.settingslib.widget.FooterPreference;
import com.android.settingslib.widget.LayoutPreference; import com.android.settingslib.widget.LayoutPreference;
import com.android.settingslib.widget.SelectorWithWidgetPreference; import com.android.settingslib.widget.SelectorWithWidgetPreference;
@@ -158,8 +156,6 @@ public class AdvancedPowerUsageDetailTest {
doReturn(mLoaderManager).when(mFragment).getLoaderManager(); doReturn(mLoaderManager).when(mFragment).getLoaderManager();
ShadowEntityHeaderController.setUseMock(mEntityHeaderController); ShadowEntityHeaderController.setUseMock(mEntityHeaderController);
doReturn(mEntityHeaderController).when(mEntityHeaderController)
.setRecyclerView(nullable(RecyclerView.class), nullable(Lifecycle.class));
doReturn(mEntityHeaderController).when(mEntityHeaderController) doReturn(mEntityHeaderController).when(mEntityHeaderController)
.setButtonActions(anyInt(), anyInt()); .setButtonActions(anyInt(), anyInt());
doReturn(mEntityHeaderController).when(mEntityHeaderController) doReturn(mEntityHeaderController).when(mEntityHeaderController)

View File

@@ -127,7 +127,6 @@ public class BatteryHeaderPreferenceControllerTest {
mLifecycle.addObserver(mController); mLifecycle.addObserver(mController);
mController.setActivity(mActivity); mController.setActivity(mActivity);
mController.setFragment(mPreferenceFragment); mController.setFragment(mPreferenceFragment);
mController.setLifecycle(mLifecycle);
mController.mBatteryUsageProgressBarPref = mBatteryUsageProgressBarPref; mController.mBatteryUsageProgressBarPref = mBatteryUsageProgressBarPref;
mController.mBatteryStatusFeatureProvider = mBatteryStatusFeatureProvider; mController.mBatteryStatusFeatureProvider = mBatteryStatusFeatureProvider;
} }

View File

@@ -84,7 +84,7 @@ public class EntityHeaderControllerTest {
@Test @Test
public void testBuildView_constructedWithoutView_shouldCreateNewView() { public void testBuildView_constructedWithoutView_shouldCreateNewView() {
mController = EntityHeaderController.newInstance(mActivity, mFragment, null); mController = EntityHeaderController.newInstance(mActivity, mFragment, null);
View view = mController.done(mActivity); View view = mController.done();
assertThat(view).isNotNull(); assertThat(view).isNotNull();
} }
@@ -92,7 +92,7 @@ public class EntityHeaderControllerTest {
@Test @Test
public void testBuildView_withContext_shouldBuildPreferenceAllowedBelowDivider() { public void testBuildView_withContext_shouldBuildPreferenceAllowedBelowDivider() {
mController = EntityHeaderController.newInstance(mActivity, mFragment, null); mController = EntityHeaderController.newInstance(mActivity, mFragment, null);
Preference preference = mController.done(mActivity, mShadowContext); Preference preference = mController.done(mShadowContext);
assertThat(preference instanceof LayoutPreference).isTrue(); assertThat(preference instanceof LayoutPreference).isTrue();
assertThat(((LayoutPreference)preference).isAllowDividerBelow()).isTrue(); assertThat(((LayoutPreference)preference).isAllowDividerBelow()).isTrue();
@@ -103,7 +103,7 @@ public class EntityHeaderControllerTest {
View inputView = mLayoutInflater.inflate( View inputView = mLayoutInflater.inflate(
com.android.settingslib.widget.R.layout.settings_entity_header, null /* root */); com.android.settingslib.widget.R.layout.settings_entity_header, null /* root */);
mController = EntityHeaderController.newInstance(mActivity, mFragment, inputView); mController = EntityHeaderController.newInstance(mActivity, mFragment, inputView);
View view = mController.done(mActivity); View view = mController.done();
assertThat(view).isSameInstanceAs(inputView); assertThat(view).isSameInstanceAs(inputView);
} }
@@ -123,7 +123,7 @@ public class EntityHeaderControllerTest {
mController.setSummary(testString); mController.setSummary(testString);
mController.setSecondSummary(testString); mController.setSecondSummary(testString);
mController.setIcon(mShadowContext.getDrawable(R.drawable.ic_add_24dp)); mController.setIcon(mShadowContext.getDrawable(R.drawable.ic_add_24dp));
mController.done(mActivity); mController.done();
assertThat(label).isNotNull(); assertThat(label).isNotNull();
assertThat(label.getText()).isEqualTo(testString); assertThat(label.getText()).isEqualTo(testString);
@@ -144,15 +144,11 @@ public class EntityHeaderControllerTest {
when(mActivity.getApplicationContext()).thenReturn(mContext); when(mActivity.getApplicationContext()).thenReturn(mContext);
mController = EntityHeaderController.newInstance(mActivity, mFragment, view); mController = EntityHeaderController.newInstance(mActivity, mFragment, view);
mController.setEditListener(new View.OnClickListener() { mController.setEditListener(v -> {/* do nothing */});
public void onClick(View v) {
// do nothing
}
});
mController.setButtonActions( mController.setButtonActions(
EntityHeaderController.ActionType.ACTION_EDIT_PREFERENCE, EntityHeaderController.ActionType.ACTION_EDIT_PREFERENCE,
EntityHeaderController.ActionType.ACTION_NONE); EntityHeaderController.ActionType.ACTION_NONE);
mController.done(mActivity); mController.done();
final ImageButton button1 = view.findViewById(android.R.id.button1); final ImageButton button1 = view.findViewById(android.R.id.button1);
assertThat(button1).isNotNull(); assertThat(button1).isNotNull();
@@ -175,7 +171,7 @@ public class EntityHeaderControllerTest {
mController.setButtonActions( mController.setButtonActions(
EntityHeaderController.ActionType.ACTION_EDIT_PREFERENCE, EntityHeaderController.ActionType.ACTION_EDIT_PREFERENCE,
EntityHeaderController.ActionType.ACTION_NONE); EntityHeaderController.ActionType.ACTION_NONE);
mController.done(mActivity); mController.done();
assertThat(view.findViewById(android.R.id.button1).getVisibility()).isEqualTo(View.GONE); assertThat(view.findViewById(android.R.id.button1).getVisibility()).isEqualTo(View.GONE);
assertThat(view.findViewById(android.R.id.button2).getVisibility()).isEqualTo(View.GONE); assertThat(view.findViewById(android.R.id.button2).getVisibility()).isEqualTo(View.GONE);
@@ -195,7 +191,7 @@ public class EntityHeaderControllerTest {
.setButtonActions( .setButtonActions(
EntityHeaderController.ActionType.ACTION_NONE, EntityHeaderController.ActionType.ACTION_NONE,
EntityHeaderController.ActionType.ACTION_NONE); EntityHeaderController.ActionType.ACTION_NONE);
mController.done(mActivity); mController.done();
assertThat(appLinks.findViewById(android.R.id.button1).getVisibility()) assertThat(appLinks.findViewById(android.R.id.button1).getVisibility())
.isEqualTo(View.GONE); .isEqualTo(View.GONE);
@@ -224,7 +220,7 @@ public class EntityHeaderControllerTest {
.setButtonActions( .setButtonActions(
EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE, EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE,
EntityHeaderController.ActionType.ACTION_NONE); EntityHeaderController.ActionType.ACTION_NONE);
mController.done(mActivity); mController.done();
appLinks.findViewById(com.android.settingslib.widget.R.id.entity_header_content) appLinks.findViewById(com.android.settingslib.widget.R.id.entity_header_content)
.performClick(); .performClick();
@@ -241,7 +237,7 @@ public class EntityHeaderControllerTest {
String description = "Fake Description"; String description = "Fake Description";
mController.setIcon(mShadowContext.getDrawable(R.drawable.ic_add_24dp)); mController.setIcon(mShadowContext.getDrawable(R.drawable.ic_add_24dp));
mController.setIconContentDescription(description); mController.setIconContentDescription(description);
mController.done(mActivity); mController.done();
assertThat(view.findViewById(R.id.entity_header_icon).getContentDescription().toString()) assertThat(view.findViewById(R.id.entity_header_icon).getContentDescription().toString())
.isEqualTo(description); .isEqualTo(description);
} }
@@ -254,7 +250,7 @@ public class EntityHeaderControllerTest {
mController = EntityHeaderController.newInstance(mActivity, mFragment, view); mController = EntityHeaderController.newInstance(mActivity, mFragment, view);
String description = "Fake Description"; String description = "Fake Description";
mController.setIconContentDescription(description); mController.setIconContentDescription(description);
mController.done(mActivity); mController.done();
assertThat(view.findViewById(R.id.entity_header_icon).getContentDescription().toString()) assertThat(view.findViewById(R.id.entity_header_icon).getContentDescription().toString())
.isEqualTo(description); .isEqualTo(description);
} }
@@ -269,7 +265,7 @@ public class EntityHeaderControllerTest {
.setButtonActions( .setButtonActions(
EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE, EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE,
EntityHeaderController.ActionType.ACTION_NONE); EntityHeaderController.ActionType.ACTION_NONE);
mController.done(mActivity); mController.done();
assertThat(appLinks.findViewById(android.R.id.button1).getVisibility()) assertThat(appLinks.findViewById(android.R.id.button1).getVisibility())
.isEqualTo(View.VISIBLE); .isEqualTo(View.VISIBLE);
@@ -284,7 +280,7 @@ public class EntityHeaderControllerTest {
final View header = mLayoutInflater.inflate( final View header = mLayoutInflater.inflate(
com.android.settingslib.widget.R.layout.settings_entity_header, null /* root */); com.android.settingslib.widget.R.layout.settings_entity_header, null /* root */);
mController = EntityHeaderController.newInstance(mActivity, mFragment, header); mController = EntityHeaderController.newInstance(mActivity, mFragment, header);
mController.done(mActivity); mController.done();
View installType = header.findViewById(com.android.settingslib.widget.R.id.install_type); View installType = header.findViewById(com.android.settingslib.widget.R.id.install_type);
assertThat(installType.getVisibility()).isEqualTo(View.GONE); assertThat(installType.getVisibility()).isEqualTo(View.GONE);
@@ -297,7 +293,7 @@ public class EntityHeaderControllerTest {
com.android.settingslib.widget.R.layout.settings_entity_header, null /* root */); com.android.settingslib.widget.R.layout.settings_entity_header, null /* root */);
mController = EntityHeaderController.newInstance(mActivity, mFragment, header); mController = EntityHeaderController.newInstance(mActivity, mFragment, header);
mController.setIsInstantApp(true); mController.setIsInstantApp(true);
mController.done(mActivity); mController.done();
TextView label = header.findViewById(com.android.settingslib.widget.R.id.install_type); TextView label = header.findViewById(com.android.settingslib.widget.R.id.install_type);
assertThat(label.getVisibility()).isEqualTo(View.VISIBLE); assertThat(label.getVisibility()).isEqualTo(View.VISIBLE);

View File

@@ -299,8 +299,6 @@ public class WifiDetailPreferenceController2Test {
ShadowEntityHeaderController.setUseMock(mMockHeaderController); ShadowEntityHeaderController.setUseMock(mMockHeaderController);
// builder pattern // builder pattern
when(mMockHeaderController.setRecyclerView(mMockFragment.getListView(), mLifecycle))
.thenReturn(mMockHeaderController);
when(mMockHeaderController.setSummary(nullable(String.class))) when(mMockHeaderController.setSummary(nullable(String.class)))
.thenReturn(mMockHeaderController); .thenReturn(mMockHeaderController);
when(mMockHeaderController.setSecondSummary(nullable(String.class))) when(mMockHeaderController.setSecondSummary(nullable(String.class)))