Fix passwords settings crash due to null lifecycle owner.
A change related to lifecycles was reverted some time ago (I7e6d2e9e6fd363a3afdd3dbab24e7c3b36e9ed29), which caused this to break. The crash is only seen if an autofill service sets the new Passwords Activity attr; currently no services do. Fix: 184077486 Test: manual - check settings page and see no crash Test: manual - same with work profile added Test: make RunSettingsRoboTests Change-Id: Ie439f37c9e884f9de2b112b348e1bef03adcd077
This commit is contained in:
@@ -25,6 +25,7 @@ import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.applications.autofill.PasswordsPreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
|
||||
import com.android.settings.users.AutoSyncDataPreferenceController;
|
||||
@@ -61,6 +62,12 @@ public class AccountPersonalDashboardFragment extends DashboardFragment {
|
||||
return R.string.help_url_user_and_account_dashboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
|
Reference in New Issue
Block a user