diff --git a/core/java/android/animation/ObjectAnimator.java b/core/java/android/animation/ObjectAnimator.java index 87ad49b0a096b..3f71d51bd8abc 100644 --- a/core/java/android/animation/ObjectAnimator.java +++ b/core/java/android/animation/ObjectAnimator.java @@ -16,6 +16,7 @@ package android.animation; +import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Path; @@ -861,6 +862,7 @@ public final class ObjectAnimator extends ValueAnimator { *
Overriders of this method should call the superclass method to cause * internal mechanisms to be set up correctly.
*/ + @CallSuper @Override void initAnimation() { if (!mInitialized) { @@ -961,6 +963,7 @@ public final class ObjectAnimator extends ValueAnimator { * * @param fraction The elapsed fraction of the animation. */ + @CallSuper @Override void animateValue(float fraction) { final Object target = getTarget(); diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java index 118af6491d856..85dc8320803ff 100644 --- a/core/java/android/animation/ValueAnimator.java +++ b/core/java/android/animation/ValueAnimator.java @@ -16,6 +16,7 @@ package android.animation; +import android.annotation.CallSuper; import android.os.Looper; import android.os.Trace; import android.util.AndroidRuntimeException; @@ -506,6 +507,7 @@ public class ValueAnimator extends Animator { *Overrides of this method should call the superclass method to ensure * that internal mechanisms for the animation are set up correctly.
*/ + @CallSuper void initAnimation() { if (!mInitialized) { int numValues = mValues.length; @@ -1375,6 +1377,7 @@ public class ValueAnimator extends Animator { * * @param fraction The elapsed fraction of the animation. */ + @CallSuper void animateValue(float fraction) { fraction = mInterpolator.getInterpolation(fraction); mCurrentFraction = fraction; diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index a36d34add03ff..9f8befec9902f 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -16,6 +16,7 @@ package android.app; +import android.annotation.CallSuper; import android.annotation.DrawableRes; import android.annotation.IdRes; import android.annotation.IntDef; @@ -921,6 +922,7 @@ public class Activity extends ContextThemeWrapper * @see #onRestoreInstanceState * @see #onPostCreate */ + @CallSuper protected void onCreate(@Nullable Bundle savedInstanceState) { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState); if (mLastNonConfigurationInstances != null) { @@ -1122,6 +1124,7 @@ public class Activity extends ContextThemeWrapper * recently supplied in {@link #onSaveInstanceState}. Note: Otherwise it is null. * @see #onCreate */ + @CallSuper protected void onPostCreate(@Nullable Bundle savedInstanceState) { if (!isChild()) { mTitleReady = true; @@ -1159,6 +1162,7 @@ public class Activity extends ContextThemeWrapper * @see #onStop * @see #onResume */ + @CallSuper protected void onStart() { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onStart " + this); mCalled = true; @@ -1196,6 +1200,7 @@ public class Activity extends ContextThemeWrapper * @see #onStart * @see #onResume */ + @CallSuper protected void onRestart() { mCalled = true; } @@ -1220,6 +1225,7 @@ public class Activity extends ContextThemeWrapper * @see #onPostResume * @see #onPause */ + @CallSuper protected void onResume() { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onResume " + this); getApplication().dispatchActivityResumed(this); @@ -1239,6 +1245,7 @@ public class Activity extends ContextThemeWrapper * * @see #onResume */ + @CallSuper protected void onPostResume() { final Window win = getWindow(); if (win != null) win.makeActive(); @@ -1464,6 +1471,7 @@ public class Activity extends ContextThemeWrapper * @see #onSaveInstanceState * @see #onStop */ + @CallSuper protected void onPause() { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onPause " + this); getApplication().dispatchActivityPaused(this); @@ -1570,6 +1578,7 @@ public class Activity extends ContextThemeWrapper * @see #onSaveInstanceState * @see #onDestroy */ + @CallSuper protected void onStop() { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onStop " + this); if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(false); @@ -1607,6 +1616,7 @@ public class Activity extends ContextThemeWrapper * @see #finish * @see #isFinishing */ + @CallSuper protected void onDestroy() { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onDestroy " + this); mCalled = true; @@ -5587,6 +5597,7 @@ public class Activity extends ContextThemeWrapper * @see #requestVisibleBehind(boolean) * @see #onBackgroundVisibleBehindChanged(boolean) */ + @CallSuper public void onVisibleBehindCanceled() { mCalled = true; } @@ -5709,6 +5720,7 @@ public class Activity extends ContextThemeWrapper * * @param mode The new action mode. */ + @CallSuper @Override public void onActionModeStarted(ActionMode mode) { } @@ -5719,6 +5731,7 @@ public class Activity extends ContextThemeWrapper * * @param mode The action mode that just finished. */ + @CallSuper @Override public void onActionModeFinished(ActionMode mode) { } diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java index e465d577924eb..8e64b345d3178 100644 --- a/core/java/android/app/Dialog.java +++ b/core/java/android/app/Dialog.java @@ -16,6 +16,7 @@ package android.app; +import android.annotation.CallSuper; import android.annotation.DrawableRes; import android.annotation.IdRes; import android.annotation.LayoutRes; @@ -1010,6 +1011,7 @@ public class Dialog implements DialogInterface, Window.Callback, * Note that if you override this method you should always call through * to the superclass implementation by calling super.onActionModeStarted(mode). */ + @CallSuper public void onActionModeStarted(ActionMode mode) { mActionMode = mode; } @@ -1020,6 +1022,7 @@ public class Dialog implements DialogInterface, Window.Callback, * Note that if you override this method you should always call through * to the superclass implementation by calling super.onActionModeFinished(mode). */ + @CallSuper public void onActionModeFinished(ActionMode mode) { if (mode == mActionMode) { mActionMode = null; diff --git a/core/java/android/preference/DialogPreference.java b/core/java/android/preference/DialogPreference.java index 1b226c180529f..3d57b4db25982 100644 --- a/core/java/android/preference/DialogPreference.java +++ b/core/java/android/preference/DialogPreference.java @@ -17,6 +17,7 @@ package android.preference; +import android.annotation.CallSuper; import android.annotation.DrawableRes; import android.annotation.StringRes; import android.app.AlertDialog; @@ -360,6 +361,7 @@ public abstract class DialogPreference extends Preference implements * * @param view The content View of the dialog, if it is custom. */ + @CallSuper protected void onBindDialogView(View view) { View dialogMessageView = view.findViewById(com.android.internal.R.id.message); diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java index 78928b2ef24ea..ccf2cfabc828a 100644 --- a/core/java/android/preference/Preference.java +++ b/core/java/android/preference/Preference.java @@ -16,6 +16,7 @@ package android.preference; +import android.annotation.CallSuper; import com.android.internal.util.CharSequences; import android.annotation.DrawableRes; @@ -508,6 +509,7 @@ public class Preference implements Comparablenull otherwise.
*/
+ @CallSuper
protected void onFocusChanged(boolean gainFocus, @FocusDirection int direction,
@Nullable Rect previouslyFocusedRect) {
if (gainFocus) {
@@ -5371,6 +5373,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @see #sendAccessibilityEvent(int)
* @see #dispatchPopulateAccessibilityEvent(AccessibilityEvent)
*/
+ @CallSuper
public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
if (mAccessibilityDelegate != null) {
mAccessibilityDelegate.onPopulateAccessibilityEvent(this, event);
@@ -5415,6 +5418,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @see #sendAccessibilityEvent(int)
* @see #dispatchPopulateAccessibilityEvent(AccessibilityEvent)
*/
+ @CallSuper
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
if (mAccessibilityDelegate != null) {
mAccessibilityDelegate.onInitializeAccessibilityEvent(this, event);
@@ -5529,6 +5533,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @param info The instance to initialize.
*/
+ @CallSuper
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
if (mAccessibilityDelegate != null) {
mAccessibilityDelegate.onInitializeAccessibilityNodeInfo(this, info);
@@ -6090,6 +6095,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @hide pending API council approval
*/
+ @CallSuper
protected void onFocusLost() {
resetPressedState();
}
@@ -13426,6 +13432,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @hide
*/
+ @CallSuper
protected void onDetachedFromWindowInternal() {
mPrivateFlags &= ~PFLAG_CANCEL_NEXT_UP_EVENT;
mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT;
@@ -14040,6 +14047,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @hide
*/
+ @CallSuper
protected void destroyHardwareResources() {
// Although the Layer will be destroyed by RenderNode, we want to release
// the staging display list, which is also a signal to RenderNode that it's
@@ -15229,6 +15237,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*
* @param canvas The Canvas to which the View is rendered.
*/
+ @CallSuper
public void draw(Canvas canvas) {
final int privateFlags = mPrivateFlags;
final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&
@@ -15831,6 +15840,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* Even if the subclass overrides onFinishInflate, they should always be * sure to call the super method, so that we get called. */ + @CallSuper protected void onFinishInflate() { } @@ -15996,6 +16006,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see #unscheduleDrawable(android.graphics.drawable.Drawable) * @see #drawableStateChanged() */ + @CallSuper protected boolean verifyDrawable(Drawable who) { return who == mBackground || (mScrollCache != null && mScrollCache.scrollBar == who); } @@ -16011,6 +16022,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @see Drawable#setState(int[]) */ + @CallSuper protected void drawableStateChanged() { final int[] state = getDrawableState(); @@ -16043,6 +16055,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param x hotspot x coordinate * @param y hotspot y coordinate */ + @CallSuper public void drawableHotspotChanged(float x, float y) { if (mBackground != null) { mBackground.setHotspot(x, y); @@ -17516,6 +17529,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, *
Subclasses which override this method should call the superclass method to * handle possible request-during-layout errors correctly.
*/ + @CallSuper public void requestLayout() { if (mMeasureCache != null) mMeasureCache.clear();