Merge "Fix issue #77721907: Add global setting to hide all error dialogs" into pi-dev

am: 1f596e0c2e

Change-Id: I64a8fceb305856c12645cb4c9ba7cf691cf23976
This commit is contained in:
Dianne Hackborn
2018-04-09 23:39:36 -07:00
committed by android-build-merger
3 changed files with 22 additions and 3 deletions

View File

@@ -11130,6 +11130,14 @@ public final class Settings {
*/
public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
/**
* If nonzero, all system error dialogs will be hidden. For example, the
* crash and ANR dialogs will not be shown, and the system will just proceed
* as if they had been accepted by the user.
* @hide
*/
public static final String HIDE_ERROR_DIALOGS = "hide_error_dialogs";
/**
* Use Dock audio output for media:
* 0 = disabled

View File

@@ -247,6 +247,7 @@ public class SettingsBackupTest {
Settings.Global.HDMI_CONTROL_ENABLED,
Settings.Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED,
Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED,
Settings.Global.HIDE_ERROR_DIALOGS,
Settings.Global.HTTP_PROXY,
HYBRID_SYSUI_BATTERY_WARNING_FLAGS,
Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY,

View File

@@ -118,6 +118,7 @@ import static android.provider.Settings.Global.DEBUG_APP;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RTL;
import static android.provider.Settings.Global.HIDE_ERROR_DIALOGS;
import static android.provider.Settings.Global.NETWORK_ACCESS_TIMEOUT_MS;
import static android.provider.Settings.Global.WAIT_FOR_DEBUGGER;
import static android.provider.Settings.System.FONT_SCALE;
@@ -1282,17 +1283,24 @@ public class ActivityManagerService extends IActivityManager.Stub
private final class FontScaleSettingObserver extends ContentObserver {
private final Uri mFontScaleUri = Settings.System.getUriFor(FONT_SCALE);
private final Uri mHideErrorDialogsUri = Settings.Global.getUriFor(HIDE_ERROR_DIALOGS);
public FontScaleSettingObserver() {
super(mHandler);
ContentResolver resolver = mContext.getContentResolver();
resolver.registerContentObserver(mFontScaleUri, false, this, UserHandle.USER_ALL);
resolver.registerContentObserver(mHideErrorDialogsUri, false, this,
UserHandle.USER_ALL);
}
@Override
public void onChange(boolean selfChange, Uri uri, @UserIdInt int userId) {
if (mFontScaleUri.equals(uri)) {
updateFontScaleIfNeeded(userId);
} else if (mHideErrorDialogsUri.equals(uri)) {
synchronized (ActivityManagerService.this) {
updateShouldShowDialogsLocked(getGlobalConfiguration());
}
}
}
}
@@ -22323,7 +22331,7 @@ public class ActivityManagerService extends IActivityManager.Stub
mUserController.getCurrentUserId());
// TODO: If our config changes, should we auto dismiss any currently showing dialogs?
mShowDialogs = shouldShowDialogs(mTempConfig);
updateShouldShowDialogsLocked(mTempConfig);
AttributeCache ac = AttributeCache.instance();
if (ac != null) {
@@ -22578,7 +22586,7 @@ public class ActivityManagerService extends IActivityManager.Stub
* A thought: SystemUI might also want to get told about this, the Power
* dialog / global actions also might want different behaviors.
*/
private static boolean shouldShowDialogs(Configuration config) {
private void updateShouldShowDialogsLocked(Configuration config) {
final boolean inputMethodExists = !(config.keyboard == Configuration.KEYBOARD_NOKEYS
&& config.touchscreen == Configuration.TOUCHSCREEN_NOTOUCH
&& config.navigation == Configuration.NAVIGATION_NONAV);
@@ -22587,7 +22595,9 @@ public class ActivityManagerService extends IActivityManager.Stub
&& !(modeType == Configuration.UI_MODE_TYPE_WATCH && Build.IS_USER)
&& modeType != Configuration.UI_MODE_TYPE_TELEVISION
&& modeType != Configuration.UI_MODE_TYPE_VR_HEADSET);
return inputMethodExists && uiModeSupportsDialogs;
final boolean hideDialogsSet = Settings.Global.getInt(mContext.getContentResolver(),
HIDE_ERROR_DIALOGS, 0) != 0;
mShowDialogs = inputMethodExists && uiModeSupportsDialogs && !hideDialogsSet;
}
@Override