Fix NotificationAssistantPreferenceController constructor
Fix flaky test due to the constructor must either only take Context, or (Context, String). Bug: 187998873 Test: CodeInspectionTest, NotificationAssistantPreferenceControllerTest Change-Id: Ie383ea6773afda05adfb7aa9d7de9e27676f6b29
This commit is contained in:
@@ -30,6 +30,8 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
public class NotificationAssistantPreferenceController extends TogglePreferenceController {
|
||||
private static final String TAG = "NASPreferenceController";
|
||||
private static final String KEY_NAS = "notification_assistant";
|
||||
|
||||
private static final int AVAILABLE = 1;
|
||||
private final UserManager mUserManager;
|
||||
private Fragment mFragment;
|
||||
@@ -38,11 +40,8 @@ public class NotificationAssistantPreferenceController extends TogglePreferenceC
|
||||
@VisibleForTesting
|
||||
protected NotificationBackend mNotificationBackend;
|
||||
|
||||
public NotificationAssistantPreferenceController(Context context, NotificationBackend backend,
|
||||
Fragment fragment, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
mNotificationBackend = backend;
|
||||
mFragment = fragment;
|
||||
public NotificationAssistantPreferenceController(Context context) {
|
||||
super(context, KEY_NAS);
|
||||
mUserManager = UserManager.get(context);
|
||||
}
|
||||
|
||||
@@ -87,4 +86,13 @@ public class NotificationAssistantPreferenceController extends TogglePreferenceC
|
||||
NotificationAssistantDialogFragment.newInstance(mFragment, cn);
|
||||
dialogFragment.show(mFragment.getFragmentManager(), TAG);
|
||||
}
|
||||
|
||||
public void setFragment(Fragment fragment) {
|
||||
mFragment = fragment;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setBackend(NotificationBackend backend) {
|
||||
mNotificationBackend = backend;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user