Skip to content

Commit 5b972e7

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Don't check whether dismiss() is called on the UI thread Bug #6436642" into jb-dev
2 parents 35d7999 + 05e1c3a commit 5b972e7

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

core/java/android/app/Dialog.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ public class Dialog implements DialogInterface, Window.Callback,
103103
private boolean mShowing = false;
104104
private boolean mCanceled = false;
105105

106-
private final Thread mUiThread;
107106
private final Handler mHandler = new Handler();
108107

109108
private static final int DISMISS = 0x43;
@@ -162,7 +161,6 @@ public Dialog(Context context, int theme) {
162161
w.setCallback(this);
163162
w.setWindowManager(mWindowManager, null, null);
164163
w.setGravity(Gravity.CENTER);
165-
mUiThread = Thread.currentThread();
166164
mListenersHandler = new ListenersHandler(this);
167165
}
168166

@@ -299,12 +297,7 @@ public void hide() {
299297
* that in {@link #onStop}.
300298
*/
301299
public void dismiss() {
302-
if (Thread.currentThread() != mUiThread) {
303-
mHandler.post(mDismissAction);
304-
} else {
305-
mHandler.removeCallbacks(mDismissAction);
306-
mDismissAction.run();
307-
}
300+
mHandler.post(mDismissAction);
308301
}
309302

310303
void dismissDialog() {

0 commit comments

Comments
 (0)