Loading core/java/android/inputmethodservice/InputMethodService.java +14 −18 Original line number Diff line number Diff line Loading @@ -266,7 +266,6 @@ public class InputMethodService extends AbstractInputMethodService { InputMethodManager mImm; int mTheme = 0; boolean mHardwareAccelerated = false; LayoutInflater mInflater; TypedArray mThemeAttrs; Loading Loading @@ -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() { Loading @@ -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); } Loading Loading
core/java/android/inputmethodservice/InputMethodService.java +14 −18 Original line number Diff line number Diff line Loading @@ -266,7 +266,6 @@ public class InputMethodService extends AbstractInputMethodService { InputMethodManager mImm; int mTheme = 0; boolean mHardwareAccelerated = false; LayoutInflater mInflater; TypedArray mThemeAttrs; Loading Loading @@ -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() { Loading @@ -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); } Loading