summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2015-03-02 10:11:44 -0800
committerTor Norbye <tnorbye@google.com>2015-03-07 20:49:18 -0800
commitc615c6fc9caca76cd96998f86e1f1e6393aeadbb (patch)
tree4b481c34d57468eb166860d4827aebe11ed6bd94
parent3aa2d01752ffecb4a9847249eefd7fa3cffeb309 (diff)
downloadframeworks_base-c615c6fc9caca76cd96998f86e1f1e6393aeadbb.zip
frameworks_base-c615c6fc9caca76cd96998f86e1f1e6393aeadbb.tar.gz
frameworks_base-c615c6fc9caca76cd96998f86e1f1e6393aeadbb.tar.bz2
Annotate methods to be called from overrides with @CallSuper
Change-Id: Ibc587c2aaee9f3e7f448079f72a75459fe4e15e7
-rw-r--r--core/java/android/animation/ObjectAnimator.java3
-rw-r--r--core/java/android/animation/ValueAnimator.java3
-rw-r--r--core/java/android/app/Activity.java13
-rw-r--r--core/java/android/app/Dialog.java3
-rw-r--r--core/java/android/preference/DialogPreference.java2
-rw-r--r--core/java/android/preference/Preference.java4
-rw-r--r--core/java/android/provider/DocumentsProvider.java3
-rw-r--r--core/java/android/view/View.java14
8 files changed, 45 insertions, 0 deletions
diff --git a/core/java/android/animation/ObjectAnimator.java b/core/java/android/animation/ObjectAnimator.java
index 87ad49b..3f71d51 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 {
* <p>Overriders of this method should call the superclass method to cause
* internal mechanisms to be set up correctly.</p>
*/
+ @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 118af64..85dc832 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 {
* <p>Overrides of this method should call the superclass method to ensure
* that internal mechanisms for the animation are set up correctly.</p>
*/
+ @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 a36d34a..9f8befe 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}. <b><i>Note: Otherwise it is null.</i></b>
* @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 e465d57..8e64b34 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 1b226c1..3d57b4d 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 78928b2..ccf2cfa 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 Comparable<Preference> {
* @return The View that displays this Preference.
* @see #onBindView(View)
*/
+ @CallSuper
protected View onCreateView(ViewGroup parent) {
final LayoutInflater layoutInflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -537,6 +539,7 @@ public class Preference implements Comparable<Preference> {
* @param view The View that shows this Preference.
* @see #onCreateView(ViewGroup)
*/
+ @CallSuper
protected void onBindView(View view) {
final TextView titleView = (TextView) view.findViewById(com.android.internal.R.id.title);
if (titleView != null) {
@@ -1356,6 +1359,7 @@ public class Preference implements Comparable<Preference> {
* should remove any references to this Preference that you know about. Make
* sure to call through to the superclass implementation.
*/
+ @CallSuper
protected void onPrepareForRemoval() {
unregisterDependency();
}
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java
index 1316471..6979bee 100644
--- a/core/java/android/provider/DocumentsProvider.java
+++ b/core/java/android/provider/DocumentsProvider.java
@@ -28,6 +28,7 @@ import static android.provider.DocumentsContract.getSearchDocumentsQuery;
import static android.provider.DocumentsContract.getTreeDocumentId;
import static android.provider.DocumentsContract.isTreeUri;
+import android.annotation.CallSuper;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.ContentValues;
@@ -541,6 +542,7 @@ public abstract class DocumentsProvider extends ContentProvider {
*
* @see DocumentsContract#buildDocumentUriUsingTree(Uri, String)
*/
+ @CallSuper
@Override
public Uri canonicalize(Uri uri) {
final Context context = getContext();
@@ -616,6 +618,7 @@ public abstract class DocumentsProvider extends ContentProvider {
* call the superclass. If the superclass returns {@code null}, the subclass
* may implement custom behavior.
*/
+ @CallSuper
@Override
public Bundle call(String method, String arg, Bundle extras) {
if (!method.startsWith("android:")) {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index ed1197c..6f8d822 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -18,6 +18,7 @@ package android.view;
import android.animation.AnimatorInflater;
import android.animation.StateListAnimator;
+import android.annotation.CallSuper;
import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.IdRes;
@@ -5149,6 +5150,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* passed in as finer grained information about where the focus is coming
* from (in addition to direction). Will be <code>null</code> 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,
* <p>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,
* <p>Subclasses which override this method should call the superclass method to
* handle possible request-during-layout errors correctly.</p>
*/
+ @CallSuper
public void requestLayout() {
if (mMeasureCache != null) mMeasureCache.clear();