Fix profile photo chooser
The underlying Dialog API changed when it returns true for isShowing() in a way that broke our profile photo chooser, but it turns out it was an intended change and we were depending on it in a way we shouldn't have been. Instead we'll just keep track of whether we were showing the dialog by using an already existing boolean flag that gets set before we start the photo collection activity. Fixes: 110101157 Test: make -j RunSettingsRoboTests Change-Id: I166230e85142c348b6760e436324261f2a41f1e0
This commit is contained in:
@@ -41,6 +41,7 @@ import com.android.settingslib.drawable.CircleFramedDrawable;
|
||||
import java.io.File;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
/**
|
||||
@@ -103,9 +104,8 @@ public class EditUserInfoController {
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
mWaitingForActivityResult = false;
|
||||
|
||||
if (mEditUserInfoDialog != null && mEditUserInfoDialog.isShowing()
|
||||
&& mEditUserPhotoController.onActivityResult(requestCode, resultCode, data)) {
|
||||
return;
|
||||
if (mEditUserInfoDialog != null) {
|
||||
mEditUserPhotoController.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class EditUserInfoController {
|
||||
Activity activity = fragment.getActivity();
|
||||
mUser = user;
|
||||
if (mUserManager == null) {
|
||||
mUserManager = UserManager.get(activity);
|
||||
mUserManager = activity.getSystemService(UserManager.class);
|
||||
}
|
||||
LayoutInflater inflater = activity.getLayoutInflater();
|
||||
View content = inflater.inflate(R.layout.edit_user_info_dialog_content, null);
|
||||
@@ -136,8 +136,7 @@ public class EditUserInfoController {
|
||||
}
|
||||
}
|
||||
userPhotoView.setImageDrawable(drawable);
|
||||
mEditUserPhotoController = new EditUserPhotoController(fragment, userPhotoView,
|
||||
mSavedPhoto, drawable, mWaitingForActivityResult);
|
||||
mEditUserPhotoController = createEditUserPhotoController(fragment, userPhotoView, drawable);
|
||||
mEditUserInfoDialog = new AlertDialog.Builder(activity)
|
||||
.setTitle(R.string.profile_info_settings_title)
|
||||
.setView(content)
|
||||
@@ -195,4 +194,11 @@ public class EditUserInfoController {
|
||||
|
||||
return mEditUserInfoDialog;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
EditUserPhotoController createEditUserPhotoController(Fragment fragment,
|
||||
ImageView userPhotoView, Drawable drawable) {
|
||||
return new EditUserPhotoController(fragment, userPhotoView,
|
||||
mSavedPhoto, drawable, mWaitingForActivityResult);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user