Loading core/java/android/content/SharedPreferences.java +15 −3 Original line number Diff line number Diff line Loading @@ -186,9 +186,21 @@ public interface SharedPreferences { * {@link #commit} will block until all async commits are * completed as well as the commit itself. * * <p>If you call this from an {@link android.app.Activity}, * the base class will wait for any async commits to finish in * its {@link android.app.Activity#onPause}.</p> * <p>As {@link SharedPreferences} instances are singletons within * a process, it's safe to replace any instance of {@link #commit} with * {@link #apply} if you were already ignoring the return value. * * <p>You don't need to worry about Android component * lifecycles and their interaction with <code>apply()</code> * writing to disk. The framework makes sure in-flight disk * writes from <code>apply()</code> complete before switching * states. * * <p class='note'>The SharedPreferences.Editor interface * isn't expected to be implemented directly. However, if you * previously did implement it and are now getting errors * about missing <code>apply()</code>, you can simply call * {@link #commit} from <code>apply()</code>. */ void apply(); } Loading core/java/android/inputmethodservice/ExtractEditText.java +2 −10 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.inputmethodservice; import android.content.Context; import android.util.AttributeSet; import android.view.ContextMenu; import android.view.inputmethod.ExtractedText; import android.widget.EditText; Loading @@ -29,7 +28,6 @@ import android.widget.EditText; public class ExtractEditText extends EditText { private InputMethodService mIME; private int mSettingExtractedText; private boolean mContextMenuShouldBeHandledBySuper = false; public ExtractEditText(Context context) { super(context, null); Loading Loading @@ -99,19 +97,13 @@ public class ExtractEditText extends EditText { return false; } @Override protected void onCreateContextMenu(ContextMenu menu) { super.onCreateContextMenu(menu); mContextMenuShouldBeHandledBySuper = true; } @Override public boolean onTextContextMenuItem(int id) { if (mIME != null && !mContextMenuShouldBeHandledBySuper) { // Horrible hack: select word option has to be handled by original view to work. if (mIME != null && id != android.R.id.startSelectingText) { if (mIME.onExtractTextContextMenuItem(id)) { return true; } } mContextMenuShouldBeHandledBySuper = false; return super.onTextContextMenuItem(id); } Loading core/java/android/preference/Preference.java +8 −1 Original line number Diff line number Diff line Loading @@ -1195,7 +1195,14 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis private void tryCommit(SharedPreferences.Editor editor) { if (mPreferenceManager.shouldCommit()) { try { editor.apply(); } catch (AbstractMethodError unused) { // The app injected its own pre-Gingerbread // SharedPreferences.Editor implementation without // an apply method. editor.commit(); } } } Loading core/java/android/preference/PreferenceManager.java +20 −5 Original line number Diff line number Diff line Loading @@ -443,7 +443,16 @@ public class PreferenceManager { pm.setSharedPreferencesMode(sharedPreferencesMode); pm.inflateFromResource(context, resId, null); defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, true).apply(); SharedPreferences.Editor editor = defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, true); try { editor.apply(); } catch (AbstractMethodError unused) { // The app injected its own pre-Gingerbread // SharedPreferences.Editor implementation without // an apply method. editor.commit(); } } } Loading Loading @@ -481,9 +490,15 @@ public class PreferenceManager { private void setNoCommit(boolean noCommit) { if (!noCommit && mEditor != null) { try { mEditor.apply(); } catch (AbstractMethodError unused) { // The app injected its own pre-Gingerbread // SharedPreferences.Editor implementation without // an apply method. mEditor.commit(); } } mNoCommit = noCommit; } Loading core/java/android/view/KeyEvent.java +6 −4 Original line number Diff line number Diff line Loading @@ -46,10 +46,12 @@ import android.view.KeyCharacterMap.KeyData; * with the special action {@link #ACTION_MULTIPLE} that either specifies * that single repeated key code or a sequence of characters to insert. * </p><p> * In general, the framework makes no guarantees that the key events delivered * to a view constitute a complete key press. In particular, there is no * guarantee that a view will always receive a key event with {@link #ACTION_UP} * for each {@link #ACTION_DOWN} that was delivered. * In general, the framework cannot guarantee that the key events it delivers * to a view always constitute complete key sequences since some events may be dropped * or modified by containing views before they are delivered. The view implementation * should be prepared to handle {@link #FLAG_CANCELED} and should tolerate anomalous * situations such as receiving a new {@link #ACTION_DOWN} without first having * received an {@link #ACTION_UP} for the prior key press. * </p><p> * Refer to {@link InputDevice} for more information about how different kinds of * input devices and sources represent keys and buttons. Loading Loading
core/java/android/content/SharedPreferences.java +15 −3 Original line number Diff line number Diff line Loading @@ -186,9 +186,21 @@ public interface SharedPreferences { * {@link #commit} will block until all async commits are * completed as well as the commit itself. * * <p>If you call this from an {@link android.app.Activity}, * the base class will wait for any async commits to finish in * its {@link android.app.Activity#onPause}.</p> * <p>As {@link SharedPreferences} instances are singletons within * a process, it's safe to replace any instance of {@link #commit} with * {@link #apply} if you were already ignoring the return value. * * <p>You don't need to worry about Android component * lifecycles and their interaction with <code>apply()</code> * writing to disk. The framework makes sure in-flight disk * writes from <code>apply()</code> complete before switching * states. * * <p class='note'>The SharedPreferences.Editor interface * isn't expected to be implemented directly. However, if you * previously did implement it and are now getting errors * about missing <code>apply()</code>, you can simply call * {@link #commit} from <code>apply()</code>. */ void apply(); } Loading
core/java/android/inputmethodservice/ExtractEditText.java +2 −10 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.inputmethodservice; import android.content.Context; import android.util.AttributeSet; import android.view.ContextMenu; import android.view.inputmethod.ExtractedText; import android.widget.EditText; Loading @@ -29,7 +28,6 @@ import android.widget.EditText; public class ExtractEditText extends EditText { private InputMethodService mIME; private int mSettingExtractedText; private boolean mContextMenuShouldBeHandledBySuper = false; public ExtractEditText(Context context) { super(context, null); Loading Loading @@ -99,19 +97,13 @@ public class ExtractEditText extends EditText { return false; } @Override protected void onCreateContextMenu(ContextMenu menu) { super.onCreateContextMenu(menu); mContextMenuShouldBeHandledBySuper = true; } @Override public boolean onTextContextMenuItem(int id) { if (mIME != null && !mContextMenuShouldBeHandledBySuper) { // Horrible hack: select word option has to be handled by original view to work. if (mIME != null && id != android.R.id.startSelectingText) { if (mIME.onExtractTextContextMenuItem(id)) { return true; } } mContextMenuShouldBeHandledBySuper = false; return super.onTextContextMenuItem(id); } Loading
core/java/android/preference/Preference.java +8 −1 Original line number Diff line number Diff line Loading @@ -1195,7 +1195,14 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis private void tryCommit(SharedPreferences.Editor editor) { if (mPreferenceManager.shouldCommit()) { try { editor.apply(); } catch (AbstractMethodError unused) { // The app injected its own pre-Gingerbread // SharedPreferences.Editor implementation without // an apply method. editor.commit(); } } } Loading
core/java/android/preference/PreferenceManager.java +20 −5 Original line number Diff line number Diff line Loading @@ -443,7 +443,16 @@ public class PreferenceManager { pm.setSharedPreferencesMode(sharedPreferencesMode); pm.inflateFromResource(context, resId, null); defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, true).apply(); SharedPreferences.Editor editor = defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, true); try { editor.apply(); } catch (AbstractMethodError unused) { // The app injected its own pre-Gingerbread // SharedPreferences.Editor implementation without // an apply method. editor.commit(); } } } Loading Loading @@ -481,9 +490,15 @@ public class PreferenceManager { private void setNoCommit(boolean noCommit) { if (!noCommit && mEditor != null) { try { mEditor.apply(); } catch (AbstractMethodError unused) { // The app injected its own pre-Gingerbread // SharedPreferences.Editor implementation without // an apply method. mEditor.commit(); } } mNoCommit = noCommit; } Loading
core/java/android/view/KeyEvent.java +6 −4 Original line number Diff line number Diff line Loading @@ -46,10 +46,12 @@ import android.view.KeyCharacterMap.KeyData; * with the special action {@link #ACTION_MULTIPLE} that either specifies * that single repeated key code or a sequence of characters to insert. * </p><p> * In general, the framework makes no guarantees that the key events delivered * to a view constitute a complete key press. In particular, there is no * guarantee that a view will always receive a key event with {@link #ACTION_UP} * for each {@link #ACTION_DOWN} that was delivered. * In general, the framework cannot guarantee that the key events it delivers * to a view always constitute complete key sequences since some events may be dropped * or modified by containing views before they are delivered. The view implementation * should be prepared to handle {@link #FLAG_CANCELED} and should tolerate anomalous * situations such as receiving a new {@link #ACTION_DOWN} without first having * received an {@link #ACTION_UP} for the prior key press. * </p><p> * Refer to {@link InputDevice} for more information about how different kinds of * input devices and sources represent keys and buttons. Loading