Merge "Return null for getWindowParams() on system-rendered toasts"

This commit is contained in:
Bernardo Rufino
2020-02-11 11:10:10 +00:00
committed by Android (Google) Code Review

View File

@@ -460,8 +460,19 @@ public class Toast {
* @hide
*/
@UnsupportedAppUsage
public WindowManager.LayoutParams getWindowParams() {
return mTN.mParams;
@Nullable public WindowManager.LayoutParams getWindowParams() {
if (Compatibility.isChangeEnabled(CHANGE_TEXT_TOASTS_IN_THE_SYSTEM)) {
if (mNextView != null) {
// Custom toasts
return mTN.mParams;
} else {
// Text toasts
return null;
}
} else {
// Text and custom toasts are app-rendered
return mTN.mParams;
}
}
/**