Here are the examples of the java api @android.annotation.CallSuper taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
25 Examples
19
Source : WindowContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Move a child from it's current place in siblings list to the specified position,
* with an option to move all its parents to top.
* @param position Target position to move the child to.
* @param child Child to move to selected position.
* @param includingParents Flag indicating whether we need to move the entire branch of the
* hierarchy when we're moving a child to {@link #POSITION_TOP} or
* {@link #POSITION_BOTTOM}. When moving to other intermediate positions
* this flag will do nothing.
*/
@CallSuper
void positionChildAt(int position, E child, boolean includingParents) {
if (child.getParent() != this) {
throw new IllegalArgumentException("removeChild: container=" + child.getName() + " is not a child of container=" + getName() + " current parent=" + child.getParent());
}
if ((position < 0 && position != POSITION_BOTTOM) || (position > mChildren.size() && position != POSITION_TOP)) {
throw new IllegalArgumentException("positionAt: invalid position=" + position + ", children number=" + mChildren.size());
}
if (position >= mChildren.size() - 1) {
position = POSITION_TOP;
} else if (position == 0) {
position = POSITION_BOTTOM;
}
switch(position) {
case POSITION_TOP:
if (mChildren.peekLast() != child) {
mChildren.remove(child);
mChildren.add(child);
}
if (includingParents && getParent() != null) {
getParent().positionChildAt(POSITION_TOP, this, /* child */
true);
}
break;
case POSITION_BOTTOM:
if (mChildren.peekFirst() != child) {
mChildren.remove(child);
mChildren.addFirst(child);
}
if (includingParents && getParent() != null) {
getParent().positionChildAt(POSITION_BOTTOM, this, /* child */
true);
}
break;
default:
// TODO: Removing the child before reinserting requires the caller to provide a
// position that takes into account the removed child (if the index of the
// child < position, then the position should be adjusted). We should consider
// doing this adjustment here and remove any adjustments in the callers.
mChildren.remove(child);
mChildren.add(position, child);
}
}
19
Source : WindowContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Removes the input child container from this container which is its parent.
*
* @return True if the container did contain the input child and it was detached.
*/
@CallSuper
void removeChild(E child) {
if (mChildren.remove(child)) {
onChildRemoved(child);
child.setParent(null);
} else {
throw new IllegalArgumentException("removeChild: container=" + child.getName() + " is not a child of container=" + getName());
}
}
19
Source : WindowContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Adds the input window container has a child of this container at the input index.
*/
@CallSuper
void addChild(E child, int index) {
if (child.getParent() != null) {
throw new IllegalArgumentException("addChild: container=" + child.getName() + " is already a child of container=" + child.getParent().getName() + " can't add to container=" + getName());
}
mChildren.add(index, child);
onChildAdded(child);
// Set the parent after we've actually added a child in case a subclreplaced depends on this.
child.setParent(this);
}
19
Source : WindowContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Adds the input window container has a child of this container in order based on the input
* comparator.
* @param child The window container to add as a child of this window container.
* @param comparator Comparator to use in determining the position the child should be added to.
* If null, the child will be added to the top.
*/
@CallSuper
protected void addChild(E child, Comparator<E> comparator) {
if (child.getParent() != null) {
throw new IllegalArgumentException("addChild: container=" + child.getName() + " is already a child of container=" + child.getParent().getName() + " can't add to container=" + getName());
}
int positionToAdd = -1;
if (comparator != null) {
final int count = mChildren.size();
for (int i = 0; i < count; i++) {
if (comparator.compare(child, mChildren.get(i)) < 0) {
positionToAdd = i;
break;
}
}
}
if (positionToAdd == -1) {
mChildren.add(child);
} else {
mChildren.add(positionToAdd, child);
}
onChildAdded(child);
// Set the parent after we've actually added a child in case a subclreplaced depends on this.
child.setParent(this);
}
19
Source : RootWindowContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@CallSuper
@Override
public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
super.writeToProto(proto, WINDOW_CONTAINER, trim);
if (mService.mDisplayReady) {
final int count = mChildren.size();
for (int i = 0; i < count; ++i) {
final DisplayContent displayContent = mChildren.get(i);
displayContent.writeToProto(proto, DISPLAYS, trim);
}
}
if (!trim) {
forAllWindows((w) -> {
w.writeIdentifierToProto(proto, WINDOWS);
}, true);
}
proto.end(token);
}
19
Source : BaseInputConnection.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Default implementation calls {@link #finishComposingText()}.
*/
@CallSuper
public void closeConnection() {
finishComposingText();
}
19
Source : AutofillService.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@CallSuper
@Override
public void onCreate() {
super.onCreate();
mHandler = new Handler(Looper.getMainLooper(), null, true);
}
19
Source : Application.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@CallSuper
public void onTrimMemory(int level) {
Object[] callbacks = collectComponentCallbacks();
if (callbacks != null) {
for (int i = 0; i < callbacks.length; i++) {
Object c = callbacks[i];
if (c instanceof ComponentCallbacks2) {
((ComponentCallbacks2) c).onTrimMemory(level);
}
}
}
}
19
Source : Application.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* This method is for use in emulated process environments. It will
* never be called on a production Android device, where processes are
* removed by simply killing them; no user code (including this callback)
* is executed when doing so.
*/
@CallSuper
public void onTerminate() {
}
19
Source : Application.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@CallSuper
public void onLowMemory() {
Object[] callbacks = collectComponentCallbacks();
if (callbacks != null) {
for (int i = 0; i < callbacks.length; i++) {
((ComponentCallbacks) callbacks[i]).onLowMemory();
}
}
}
19
Source : Application.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Called when the application is starting, before any activity, service,
* or receiver objects (excluding content providers) have been created.
*
* <p>Implementations should be as quick as possible (for example using
* lazy initialization of state) since the time spent in this function
* directly impacts the performance of starting the first activity,
* service, or receiver in a process.</p>
*
* <p>If you override this method, be sure to call {@code super.onCreate()}.</p>
*
* <p clreplaced="note">Be aware that direct boot may also affect callback order on
* Android {@link android.os.Build.VERSION_CODES#N} and later devices.
* Until the user unlocks the device, only direct boot aware components are
* allowed to run. You should consider that all direct boot unaware
* components, including such {@link android.content.ContentProvider}, are
* disabled until user unlock happens, especially when component callback
* order matters.</p>
*/
@CallSuper
public void onCreate() {
}
19
Source : Application.java
with MIT License
from BaoBaoJianqiang
with MIT License
from BaoBaoJianqiang
/**
* Called when the application is starting, before any activity, service,
* or receiver objects (excluding content providers) have been created.
* Implementations should be as quick as possible (for example using
* lazy initialization of state) since the time spent in this function
* directly impacts the performance of starting the first activity,
* service, or receiver in a process.
* If you override this method, be sure to call super.onCreate().
*/
@CallSuper
public void onCreate() {
}
18
Source : WindowContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Removes this window container and its children with no regard for what else might be going on
* in the system. For example, the container will be removed during animation if this method is
* called which isn't desirable. For most cases you want to call {@link #removeIfPossible()}
* which allows the system to defer removal until a suitable time.
*/
@CallSuper
void removeImmediately() {
while (!mChildren.isEmpty()) {
final E child = mChildren.peekLast();
child.removeImmediately();
// Need to do this after calling remove on the child because the child might try to
// remove/detach itself from its parent which will cause an exception if we remove
// it before calling remove on the child.
if (mChildren.remove(child)) {
onChildRemoved(child);
}
}
if (mSurfaceControl != null) {
mPendingTransaction.destroy(mSurfaceControl);
// Merge to parent transaction to ensure the transactions on this WindowContainer are
// applied in native even if WindowContainer is removed.
if (mParent != null) {
mParent.getPendingTransaction().merge(mPendingTransaction);
}
mSurfaceControl = null;
scheduleAnimation();
}
if (mParent != null) {
mParent.removeChild(this);
}
if (mController != null) {
setController(null);
}
}
18
Source : WindowContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Write to a protocol buffer output stream. Protocol buffer message definition is at
* {@link com.android.server.wm.WindowContainerProto}.
*
* @param proto Stream to write the WindowContainer object to.
* @param fieldId Field Id of the WindowContainer as defined in the parent message.
* @param trim If true, reduce the amount of data written.
* @hide
*/
@CallSuper
@Override
public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
super.writeToProto(proto, CONFIGURATION_CONTAINER, trim);
proto.write(ORIENTATION, mOrientation);
proto.write(VISIBLE, isVisible());
mSurfaceAnimator.writeToProto(proto, SURFACE_ANIMATOR);
proto.end(token);
}
18
Source : WindowContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@CallSuper
void dump(PrintWriter pw, String prefix, boolean dumpAll) {
if (mSurfaceAnimator.isAnimating()) {
pw.print(prefix);
pw.println("ContainerAnimator:");
mSurfaceAnimator.dump(pw, prefix + " ");
}
}
18
Source : ConfigurationContainer.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Write to a protocol buffer output stream. Protocol buffer message definition is at
* {@link com.android.server.wm.ConfigurationContainerProto}.
*
* @param proto Stream to write the ConfigurationContainer object to.
* @param fieldId Field Id of the ConfigurationContainer as defined in the parent
* message.
* @param trim If true, reduce amount of data written.
* @hide
*/
@CallSuper
public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
if (!trim || mHasOverrideConfiguration) {
mOverrideConfiguration.writeToProto(proto, OVERRIDE_CONFIGURATION);
}
if (!trim) {
mFullConfiguration.writeToProto(proto, FULL_CONFIGURATION);
mMergedOverrideConfiguration.writeToProto(proto, MERGED_OVERRIDE_CONFIGURATION);
}
proto.end(token);
}
18
Source : EuiccService.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* If overriding this method, call through to the super method for any unknown actions.
* {@inheritDoc}
*/
@Override
@CallSuper
public IBinder onBind(Intent intent) {
return mStubWrapper;
}
18
Source : DialogPreference.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Binds views in the content View of the dialog to data.
* <p>
* Make sure to call through to the superclreplaced implementation.
*
* @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);
if (dialogMessageView != null) {
final CharSequence message = getDialogMessage();
int newVisibility = View.GONE;
if (!TextUtils.isEmpty(message)) {
if (dialogMessageView instanceof TextView) {
((TextView) dialogMessageView).setText(message);
}
newVisibility = View.VISIBLE;
}
if (dialogMessageView.getVisibility() != newVisibility) {
dialogMessageView.setVisibility(newVisibility);
}
}
}
18
Source : Dialog.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* {@inheritDoc}
*
* Note that if you override this method you should always call through
* to the superclreplaced implementation by calling super.onActionModeFinished(mode).
*/
@Override
@CallSuper
public void onActionModeFinished(ActionMode mode) {
if (mode == mActionMode) {
mActionMode = null;
}
}
18
Source : Dialog.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* {@inheritDoc}
*
* Note that if you override this method you should always call through
* to the superclreplaced implementation by calling super.onActionModeStarted(mode).
*/
@Override
@CallSuper
public void onActionModeStarted(ActionMode mode) {
mActionMode = mode;
}
18
Source : Application.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@CallSuper
public void onConfigurationChanged(Configuration newConfig) {
Object[] callbacks = collectComponentCallbacks();
if (callbacks != null) {
for (int i = 0; i < callbacks.length; i++) {
((ComponentCallbacks) callbacks[i]).onConfigurationChanged(newConfig);
}
}
}
17
Source : WindowToken.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@CallSuper
@Override
public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
super.writeToProto(proto, WINDOW_CONTAINER, trim);
proto.write(HASH_CODE, System.idenreplacedyHashCode(this));
for (int i = 0; i < mChildren.size(); i++) {
final WindowState w = mChildren.get(i);
w.writeToProto(proto, WINDOWS, trim);
}
proto.write(HIDDEN, mHidden);
proto.write(WAITING_TO_SHOW, waitingToShow);
proto.write(PAUSED, paused);
proto.end(token);
}
17
Source : EuiccService.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@Override
@CallSuper
public void onCreate() {
super.onCreate();
// We use a oneway AIDL interface to avoid blocking phone process binder threads on IPCs to
// an external process, but doing so means the requests are serialized by binder, which is
// not desired. Spin up a background thread pool to allow requests to be parallelized.
// TODO(b/38206971): Consider removing this if basic card-level functions like listing
// profiles are moved to the platform.
mExecutor = new ThreadPoolExecutor(4, /* corePoolSize */
4, /* maxPoolSize */
30, TimeUnit.SECONDS, /* keepAliveTime */
new LinkedBlockingQueue<>(), /* workQueue */
new ThreadFactory() {
private final AtomicInteger mCount = new AtomicInteger(1);
@Override
public Thread newThread(Runnable r) {
return new Thread(r, "EuiccService #" + mCount.getAndIncrement());
}
});
mExecutor.allowCoreThreadTimeOut(true);
}
17
Source : EuiccService.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@Override
@CallSuper
public void onDestroy() {
mExecutor.shutdownNow();
super.onDestroy();
}
16
Source : Task.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
@CallSuper
@Override
public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
final long token = proto.start(fieldId);
super.writeToProto(proto, WINDOW_CONTAINER, trim);
proto.write(ID, mTaskId);
for (int i = mChildren.size() - 1; i >= 0; i--) {
final AppWindowToken appWindowToken = mChildren.get(i);
appWindowToken.writeToProto(proto, APP_WINDOW_TOKENS, trim);
}
proto.write(FILLS_PARENT, matchParentBounds());
getBounds().writeToProto(proto, BOUNDS);
mTempInsetBounds.writeToProto(proto, TEMP_INSET_BOUNDS);
proto.write(DEFER_REMOVAL, mDeferRemoval);
proto.end(token);
}