Merge "Ensure mShowDialogs gets updated as part of global config update" into rvc-dev am: 0cf1ad8495
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11911999 Change-Id: Id964f7b5ffed9c9836f8fd8db2d958f8ea9be582
This commit is contained in:
@@ -433,13 +433,21 @@ public class ActivityTaskManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns whether the current UI mode supports error dialogs (ANR, crash, etc). */
|
/**
|
||||||
public static boolean currentUiModeSupportsErrorDialogs(@NonNull Context context) {
|
* @return whether the UI mode of the given config supports error dialogs (ANR, crash, etc).
|
||||||
final Configuration config = context.getResources().getConfiguration();
|
* @hide
|
||||||
|
*/
|
||||||
|
public static boolean currentUiModeSupportsErrorDialogs(@NonNull Configuration config) {
|
||||||
int modeType = config.uiMode & Configuration.UI_MODE_TYPE_MASK;
|
int modeType = config.uiMode & Configuration.UI_MODE_TYPE_MASK;
|
||||||
return (modeType != Configuration.UI_MODE_TYPE_CAR
|
return (modeType != Configuration.UI_MODE_TYPE_CAR
|
||||||
&& !(modeType == Configuration.UI_MODE_TYPE_WATCH && Build.IS_USER)
|
&& !(modeType == Configuration.UI_MODE_TYPE_WATCH && Build.IS_USER)
|
||||||
&& modeType != Configuration.UI_MODE_TYPE_TELEVISION
|
&& modeType != Configuration.UI_MODE_TYPE_TELEVISION
|
||||||
&& modeType != Configuration.UI_MODE_TYPE_VR_HEADSET);
|
&& modeType != Configuration.UI_MODE_TYPE_VR_HEADSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return whether the current UI mode supports error dialogs (ANR, crash, etc). */
|
||||||
|
public static boolean currentUiModeSupportsErrorDialogs(@NonNull Context context) {
|
||||||
|
final Configuration config = context.getResources().getConfiguration();
|
||||||
|
return currentUiModeSupportsErrorDialogs(config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5413,7 +5413,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
final boolean hideDialogsSet = Settings.Global.getInt(mContext.getContentResolver(),
|
final boolean hideDialogsSet = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
HIDE_ERROR_DIALOGS, 0) != 0;
|
HIDE_ERROR_DIALOGS, 0) != 0;
|
||||||
mShowDialogs = inputMethodExists
|
mShowDialogs = inputMethodExists
|
||||||
&& ActivityTaskManager.currentUiModeSupportsErrorDialogs(mContext)
|
&& ActivityTaskManager.currentUiModeSupportsErrorDialogs(config)
|
||||||
&& !hideDialogsSet;
|
&& !hideDialogsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user