Merge "Fix for settings crash during PS setup" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
98a5dbfb42
@@ -157,22 +157,26 @@ public class PrivateSpaceCreationFragment extends InstrumentedFragment {
|
|||||||
|
|
||||||
/** Start new activity in private profile to add an account to private profile */
|
/** Start new activity in private profile to add an account to private profile */
|
||||||
private void startAccountLogin() {
|
private void startAccountLogin() {
|
||||||
Intent intent = new Intent(getContext(), PrivateProfileContextHelperActivity.class);
|
if (isAdded() && getContext() != null && getActivity() != null) {
|
||||||
intent.putExtra(EXTRA_ACTION_TYPE, ACCOUNT_LOGIN_ACTION);
|
Intent intent = new Intent(getContext(), PrivateProfileContextHelperActivity.class);
|
||||||
mMetricsFeatureProvider.action(
|
intent.putExtra(EXTRA_ACTION_TYPE, ACCOUNT_LOGIN_ACTION);
|
||||||
getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_START);
|
mMetricsFeatureProvider.action(
|
||||||
getActivity().startActivityForResult(intent, ACCOUNT_LOGIN_ACTION);
|
getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_START);
|
||||||
|
getActivity().startActivityForResult(intent, ACCOUNT_LOGIN_ACTION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerReceiver() {
|
private void registerReceiver() {
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(Intent.ACTION_PROFILE_ACCESSIBLE);
|
filter.addAction(Intent.ACTION_PROFILE_ACCESSIBLE);
|
||||||
getActivity().registerReceiver(mProfileAccessReceiver, filter);
|
if (getContext() != null) {
|
||||||
|
getContext().registerReceiver(mProfileAccessReceiver, filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unRegisterReceiver() {
|
private void unRegisterReceiver() {
|
||||||
if (mProfileAccessReceiver != null) {
|
if (mProfileAccessReceiver != null && isAdded() && getContext() != null) {
|
||||||
getActivity().unregisterReceiver(mProfileAccessReceiver);
|
getContext().unregisterReceiver(mProfileAccessReceiver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user