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

This reverts commit 8500f26d51.

Change-Id: I6408fa3f307d7611443e26b24d3876c1a1f92fdc
This commit is contained in:
vinodkrishnan
2016-11-30 20:09:59 +00:00
parent 8500f26d51
commit 7b62df8556
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 =
"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.
*
@@ -6451,7 +6441,6 @@ public final class Settings {
ACCESSIBILITY_CAPTIONING_TYPEFACE,
ACCESSIBILITY_CAPTIONING_FONT_SCALE,
ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
ACCESSIBILITY_DISABLE_ANIMATIONS,
TTS_USE_DEFAULTS,
TTS_DEFAULT_RATE,
TTS_DEFAULT_PITCH,

View File

@@ -220,7 +220,4 @@
<!-- Default setting for ability to add users from the lock screen -->
<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>

View File

@@ -2484,9 +2484,6 @@ class DatabaseHelper extends SQLiteOpenHelper {
loadStringSetting(stmt, Settings.Secure.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) {
loadSetting(stmt, Settings.System.LOCKSCREEN_DISABLED, "1");
} else {

View File

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