Revert "DO NOT MERGE Wear Fwk: Disable Animations for A11y"

am: 7b62df8556

Change-Id: I7c8d922fb125bf786990642679ebdd17ba589a54
This commit is contained in:
vinodkrishnan
2016-11-30 21:52:13 +00:00
committed by android-build-merger
4 changed files with 4 additions and 46 deletions

View File

@@ -5163,16 +5163,6 @@ public final class Settings {
public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE = public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE =
"accessibility_soft_keyboard_mode"; "accessibility_soft_keyboard_mode";
/**
* Should we disable all animations when accessibility is turned on. On low-power devices
* like Android Wear, the performance makes the device unusable. Turning off animations
* is a partial fix.
*
* @hide
*/
public static final String ACCESSIBILITY_DISABLE_ANIMATIONS =
"accessibility_disable_animations";
/** /**
* Default soft keyboard behavior. * Default soft keyboard behavior.
* *
@@ -6451,7 +6441,6 @@ public final class Settings {
ACCESSIBILITY_CAPTIONING_TYPEFACE, ACCESSIBILITY_CAPTIONING_TYPEFACE,
ACCESSIBILITY_CAPTIONING_FONT_SCALE, ACCESSIBILITY_CAPTIONING_FONT_SCALE,
ACCESSIBILITY_CAPTIONING_WINDOW_COLOR, ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
ACCESSIBILITY_DISABLE_ANIMATIONS,
TTS_USE_DEFAULTS, TTS_USE_DEFAULTS,
TTS_DEFAULT_RATE, TTS_DEFAULT_RATE,
TTS_DEFAULT_PITCH, TTS_DEFAULT_PITCH,

View File

@@ -220,7 +220,4 @@
<!-- Default setting for ability to add users from the lock screen --> <!-- Default setting for ability to add users from the lock screen -->
<bool name="def_add_users_from_lockscreen">false</bool> <bool name="def_add_users_from_lockscreen">false</bool>
<!-- Default setting for disable animations when accessibility is turned on. -->
<bool name="def_accessibility_disable_animations">false</bool>
</resources> </resources>

View File

@@ -2484,9 +2484,6 @@ class DatabaseHelper extends SQLiteOpenHelper {
loadStringSetting(stmt, Settings.Secure.ACCESSIBILITY_SCREEN_READER_URL, loadStringSetting(stmt, Settings.Secure.ACCESSIBILITY_SCREEN_READER_URL,
R.string.def_accessibility_screen_reader_url); R.string.def_accessibility_screen_reader_url);
loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_DISABLE_ANIMATIONS,
R.bool.def_accessibility_disable_animations);
if (SystemProperties.getBoolean("ro.lockscreen.disable.default", false) == true) { if (SystemProperties.getBoolean("ro.lockscreen.disable.default", false) == true) {
loadSetting(stmt, Settings.System.LOCKSCREEN_DISABLED, "1"); loadSetting(stmt, Settings.System.LOCKSCREEN_DISABLED, "1");
} else { } else {

View File

@@ -350,13 +350,11 @@ public class WindowManagerService extends IWindowManager.Stub
// Enums for animation scale update types. // Enums for animation scale update types.
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({WINDOW_ANIMATION_SCALE, TRANSITION_ANIMATION_SCALE, ANIMATION_DURATION_SCALE, @IntDef({WINDOW_ANIMATION_SCALE, TRANSITION_ANIMATION_SCALE, ANIMATION_DURATION_SCALE})
ACCESSIBILITY_CHANGED})
private @interface UpdateAnimationScaleMode {}; private @interface UpdateAnimationScaleMode {};
private static final int WINDOW_ANIMATION_SCALE = 0; private static final int WINDOW_ANIMATION_SCALE = 0;
private static final int TRANSITION_ANIMATION_SCALE = 1; private static final int TRANSITION_ANIMATION_SCALE = 1;
private static final int ANIMATION_DURATION_SCALE = 2; private static final int ANIMATION_DURATION_SCALE = 2;
private static final int ACCESSIBILITY_CHANGED = 3;
final private KeyguardDisableHandler mKeyguardDisableHandler; final private KeyguardDisableHandler mKeyguardDisableHandler;
@@ -671,8 +669,6 @@ public class WindowManagerService extends IWindowManager.Stub
Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE); Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE);
private final Uri mAnimationDurationScaleUri = private final Uri mAnimationDurationScaleUri =
Settings.Global.getUriFor(Settings.Global.ANIMATOR_DURATION_SCALE); Settings.Global.getUriFor(Settings.Global.ANIMATOR_DURATION_SCALE);
private final Uri mAccessibilityEnabledUri =
Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_ENABLED);
public SettingsObserver() { public SettingsObserver() {
super(new Handler()); super(new Handler());
@@ -685,8 +681,6 @@ public class WindowManagerService extends IWindowManager.Stub
UserHandle.USER_ALL); UserHandle.USER_ALL);
resolver.registerContentObserver(mAnimationDurationScaleUri, false, this, resolver.registerContentObserver(mAnimationDurationScaleUri, false, this,
UserHandle.USER_ALL); UserHandle.USER_ALL);
resolver.registerContentObserver(mAccessibilityEnabledUri, false, this,
UserHandle.USER_ALL);
} }
@Override @Override
@@ -706,9 +700,6 @@ public class WindowManagerService extends IWindowManager.Stub
mode = TRANSITION_ANIMATION_SCALE; mode = TRANSITION_ANIMATION_SCALE;
} else if (mAnimationDurationScaleUri.equals(uri)) { } else if (mAnimationDurationScaleUri.equals(uri)) {
mode = ANIMATION_DURATION_SCALE; mode = ANIMATION_DURATION_SCALE;
} else if (mAccessibilityEnabledUri.equals(uri)) {
// Change all of them.
mode = ACCESSIBILITY_CHANGED;
} else { } else {
// Ignoring unrecognized content changes // Ignoring unrecognized content changes
return; return;
@@ -1007,12 +998,13 @@ public class WindowManagerService extends IWindowManager.Stub
public void onLowPowerModeChanged(boolean enabled) { public void onLowPowerModeChanged(boolean enabled) {
synchronized (mWindowMap) { synchronized (mWindowMap) {
if (mAnimationsDisabled != enabled && !mAllowAnimationsInLowPowerMode) { if (mAnimationsDisabled != enabled && !mAllowAnimationsInLowPowerMode) {
setShouldAnimationsDisabled(enabled); mAnimationsDisabled = enabled;
dispatchNewAnimatorScaleLocked(null);
} }
} }
} }
}); });
setShouldAnimationsDisabled(mPowerManagerInternal.getLowPowerModeEnabled()); mAnimationsDisabled = mPowerManagerInternal.getLowPowerModeEnabled();
mScreenFrozenLock = mPowerManager.newWakeLock( mScreenFrozenLock = mPowerManager.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK, "SCREEN_FROZEN"); PowerManager.PARTIAL_WAKE_LOCK, "SCREEN_FROZEN");
mScreenFrozenLock.setReferenceCounted(false); mScreenFrozenLock.setReferenceCounted(false);
@@ -1095,18 +1087,6 @@ public class WindowManagerService extends IWindowManager.Stub
} }
} }
private void setShouldAnimationsDisabled(boolean isLowPowerEnabled) {
boolean accessibilityEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED, 0) == 1;
boolean disableAnimationsWhenAccessibility = Settings.Secure.getInt(
mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_DISABLE_ANIMATIONS, 0) == 1;
mAnimationsDisabled = isLowPowerEnabled ||
(accessibilityEnabled && disableAnimationsWhenAccessibility);
dispatchNewAnimatorScaleLocked(null);
}
private void placeWindowAfter(WindowState pos, WindowState window) { private void placeWindowAfter(WindowState pos, WindowState window) {
final WindowList windows = pos.getWindowList(); final WindowList windows = pos.getWindowList();
final int i = windows.indexOf(pos); final int i = windows.indexOf(pos);
@@ -8610,11 +8590,6 @@ public class WindowManagerService extends IWindowManager.Stub
dispatchNewAnimatorScaleLocked(null); dispatchNewAnimatorScaleLocked(null);
break; break;
} }
case ACCESSIBILITY_CHANGED: {
setShouldAnimationsDisabled(
mPowerManagerInternal.getLowPowerModeEnabled());
}
break;
} }
break; break;
} }