diff options
| author | Yohei Yukawa <yukawa@google.com> | 2016-09-01 12:41:58 -0700 |
|---|---|---|
| committer | Yohei Yukawa <yukawa@google.com> | 2016-09-01 12:41:58 -0700 |
| commit | ac0211a47801dd8476f48dec7535b2136a324a19 (patch) | |
| tree | 46dc86ebc88f40a7b3cab63ccc5e806aa5e6e179 /core/java/android/inputmethodservice/InputMethodService.java | |
| parent | e74adb802fcf1dcf10f80ccf6dcb6bb31cdc42ad (diff) | |
Update JavaDoc for IMS#enableHardwareAcceleration
This makes it clear that on Android L+ devices IME developers basically
no longer need to call InputMethodService#enableHardwareAcceleration(),
because it is deprecated in Android L[1][2]. On L+ devices what IME
developers need to do is to make sure that their IMEs are compatible
with both hardware and software rendering so that the system can choose
the best rendering method.
This is basically a code clean-up that should not change any actual
behavior.
[1]: I906d48cb07af50fa02dae4f4ecdb5e65211fc6ef
5e1565ead6dbb7d5c414522591f61b16a23de1c3
[2]: I126ea823eb2eeabb29d30999dec9c9411b33b315
e07b595519e68a8ee524b1886dea01475047abec
Bug: 31202732
Change-Id: I416669b172737e3eb3d77165dcea50289d207514
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index ad3f4d296c67..c6338cb53c76 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -266,7 +266,6 @@ public class InputMethodService extends AbstractInputMethodService { InputMethodManager mImm; int mTheme = 0; - boolean mHardwareAccelerated = false; LayoutInflater mInflater; TypedArray mThemeAttrs; @@ -752,27 +751,27 @@ public class InputMethodService extends AbstractInputMethodService { } /** - * You can call this to try to enable hardware accelerated drawing for - * your IME. This must be set before {@link #onCreate}, so you - * will typically call it in your constructor. It is not always possible - * to use hardware accelerated drawing in an IME (for example on low-end - * devices that do not have the resources to support this), so the call - * returns true if it succeeds otherwise false if you will need to draw - * in software. You must be able to handle either case. + * You can call this to try to enable accelerated drawing for your IME. This must be set before + * {@link #onCreate()}, so you will typically call it in your constructor. It is not always + * possible to use hardware accelerated drawing in an IME (for example on low-end devices that + * do not have the resources to support this), so the call {@code true} if it succeeds otherwise + * {@code false} if you will need to draw in software. You must be able to handle either case. * - * @deprecated Starting in API 21, hardware acceleration is always enabled - * on capable devices. + * <p>In API 21 and later, system may automatically enable hardware accelerated drawing for your + * IME on capable devices even if this method is not explicitly called. Make sure that your IME + * is able to handle either case.</p> + * + * @return {@code true} if accelerated drawing is successfully enabled otherwise {@code false}. + * On API 21 and later devices the return value is basically just a hint and your IME + * does not need to change the behavior based on the it + * @deprecated Starting in API 21, hardware acceleration is always enabled on capable devices */ @Deprecated public boolean enableHardwareAcceleration() { if (mWindow != null) { throw new IllegalStateException("Must be called before onCreate()"); } - if (ActivityManager.isHighEndGfx()) { - mHardwareAccelerated = true; - return true; - } - return false; + return ActivityManager.isHighEndGfx(); } @Override public void onCreate() { @@ -793,9 +792,6 @@ public class InputMethodService extends AbstractInputMethodService { Context.LAYOUT_INFLATER_SERVICE); mWindow = new SoftInputWindow(this, "InputMethod", mTheme, null, null, mDispatcherState, WindowManager.LayoutParams.TYPE_INPUT_METHOD, Gravity.BOTTOM, false); - if (mHardwareAccelerated) { - mWindow.getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); - } initViews(); mWindow.getWindow().setLayout(MATCH_PARENT, WRAP_CONTENT); } |
