src/api-impl: fix up code style, mainly for code imported from AOSP

used the following (plus manual edits):
`clang-format --style="{BasedOnStyle: LLVM, IndentWidth: 8, UseTab: Always, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 0}`
This commit is contained in:
Mis012
2023-06-22 11:45:46 +02:00
parent 824b821f5a
commit 0a9591c474
208 changed files with 154568 additions and 150150 deletions

View File

@@ -2,7 +2,7 @@ package android.view;
public final class Choreographer {
public static interface FrameCallback {
public void doFrame(long frametime_in_nanoseconds);
public void doFrame(long frametime_in_nanoseconds);
}
public static Choreographer getInstance() {
@@ -19,7 +19,7 @@ public final class Choreographer {
Thread async = new Thread(new Runnable() {
public void run() {
callback.doFrame(System.nanoTime());
}});
} });
async.start();
}
}

View File

@@ -23,7 +23,7 @@ public final class Display {
}
public int getRotation() {
return 0/*ROTATION_0*/;
return 0 /*ROTATION_0*/;
}
public float getRefreshRate() {

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@ package android.view;
public class InputDevice {
public static int[] getDeviceIds() {
return new int[]{0}; // might work?
return new int[] {0}; // might work?
}
public static InputDevice getDevice(int id) {

View File

@@ -22,193 +22,201 @@ import java.util.concurrent.atomic.AtomicInteger;
* Common base class for input events.
*/
public abstract class InputEvent {
/** @hide */
protected static final int PARCEL_TOKEN_MOTION_EVENT = 1;
/** @hide */
protected static final int PARCEL_TOKEN_KEY_EVENT = 2;
/**
* @hide
*/
protected static final int PARCEL_TOKEN_MOTION_EVENT = 1;
/**
* @hide
*/
protected static final int PARCEL_TOKEN_KEY_EVENT = 2;
// Next sequence number.
private static final AtomicInteger mNextSeq = new AtomicInteger();
// Next sequence number.
private static final AtomicInteger mNextSeq = new AtomicInteger();
/** @hide */
protected int mSeq;
/**
* @hide
*/
protected int mSeq;
/** @hide */
protected boolean mRecycled;
/**
* @hide
*/
protected boolean mRecycled;
private static final boolean TRACK_RECYCLED_LOCATION = false;
private RuntimeException mRecycledLocation;
private static final boolean TRACK_RECYCLED_LOCATION = false;
private RuntimeException mRecycledLocation;
/*package*/ InputEvent() {
mSeq = mNextSeq.getAndIncrement();
}
/*package*/ InputEvent() {
mSeq = mNextSeq.getAndIncrement();
}
/**
* Gets the id for the device that this event came from. An id of
* zero indicates that the event didn't come from a physical device
* and maps to the default keymap. The other numbers are arbitrary and
* you shouldn't depend on the values.
*
* @return The device id.
* @see InputDevice#getDevice
*/
public abstract int getDeviceId();
/**
* Gets the id for the device that this event came from. An id of
* zero indicates that the event didn't come from a physical device
* and maps to the default keymap. The other numbers are arbitrary and
* you shouldn't depend on the values.
*
* @return The device id.
* @see InputDevice#getDevice
*/
public abstract int getDeviceId();
/**
* Gets the device that this event came from.
*
* @return The device, or null if unknown.
*/
public final InputDevice getDevice() {
return null/*InputDevice.getDevice(getDeviceId())*/;
}
/**
* Gets the device that this event came from.
*
* @return The device, or null if unknown.
*/
public final InputDevice getDevice() {
return null /*InputDevice.getDevice(getDeviceId())*/;
}
/**
* Gets the source of the event.
*
* @return The event source or {@link InputDevice#SOURCE_UNKNOWN} if unknown.
* @see InputDevice#getSources
*/
public abstract int getSource();
/**
* Gets the source of the event.
*
* @return The event source or {@link InputDevice#SOURCE_UNKNOWN} if unknown.
* @see InputDevice#getSources
*/
public abstract int getSource();
/**
* Modifies the source of the event.
*
* @param source The new source.
* @hide
*/
public abstract void setSource(int source);
/**
* Modifies the source of the event.
*
* @param source The new source.
* @hide
*/
public abstract void setSource(int source);
/**
* Determines whether the event is from the given source.
*
* @param source The input source to check against. This can be a specific device type, such as
* {@link InputDevice#SOURCE_TOUCH_NAVIGATION}, or a more generic device class, such as
* {@link InputDevice#SOURCE_CLASS_POINTER}.
* @return Whether the event is from the given source.
*/
public boolean isFromSource(int source) {
return (getSource() & source) == source;
}
/**
* Determines whether the event is from the given source.
*
* @param source The input source to check against. This can be a specific device type, such as
* {@link InputDevice#SOURCE_TOUCH_NAVIGATION}, or a more generic device class, such as
* {@link InputDevice#SOURCE_CLASS_POINTER}.
* @return Whether the event is from the given source.
*/
public boolean isFromSource(int source) {
return (getSource() & source) == source;
}
/**
* Copies the event.
*
* @return A deep copy of the event.
* @hide
*/
public abstract InputEvent copy();
/**
* Copies the event.
*
* @return A deep copy of the event.
* @hide
*/
public abstract InputEvent copy();
/**
* Recycles the event.
* This method should only be used by the system since applications do not
* expect {@link KeyEvent} objects to be recycled, although {@link MotionEvent}
* objects are fine. See {@link KeyEvent#recycle()} for details.
* @hide
*/
public void recycle() {
if (TRACK_RECYCLED_LOCATION) {
if (mRecycledLocation != null) {
throw new RuntimeException(toString() + " recycled twice!", mRecycledLocation);
}
mRecycledLocation = new RuntimeException("Last recycled here");
} else {
if (mRecycled) {
throw new RuntimeException(toString() + " recycled twice!");
}
mRecycled = true;
}
}
/**
* Recycles the event.
* This method should only be used by the system since applications do not
* expect {@link KeyEvent} objects to be recycled, although {@link MotionEvent}
* objects are fine. See {@link KeyEvent#recycle()} for details.
* @hide
*/
public void recycle() {
if (TRACK_RECYCLED_LOCATION) {
if (mRecycledLocation != null) {
throw new RuntimeException(toString() + " recycled twice!", mRecycledLocation);
}
mRecycledLocation = new RuntimeException("Last recycled here");
} else {
if (mRecycled) {
throw new RuntimeException(toString() + " recycled twice!");
}
mRecycled = true;
}
}
/**
* Conditionally recycled the event if it is appropriate to do so after
* dispatching the event to an application.
*
* If the event is a {@link MotionEvent} then it is recycled.
*
* If the event is a {@link KeyEvent} then it is NOT recycled, because applications
* expect key events to be immutable so once the event has been dispatched to
* the application we can no longer recycle it.
* @hide
*/
public void recycleIfNeededAfterDispatch() {
recycle();
}
/**
* Conditionally recycled the event if it is appropriate to do so after
* dispatching the event to an application.
*
* If the event is a {@link MotionEvent} then it is recycled.
*
* If the event is a {@link KeyEvent} then it is NOT recycled, because applications
* expect key events to be immutable so once the event has been dispatched to
* the application we can no longer recycle it.
* @hide
*/
public void recycleIfNeededAfterDispatch() {
recycle();
}
/**
* Reinitializes the event on reuse (after recycling).
* @hide
*/
protected void prepareForReuse() {
mRecycled = false;
mRecycledLocation = null;
mSeq = mNextSeq.getAndIncrement();
}
/**
* Reinitializes the event on reuse (after recycling).
* @hide
*/
protected void prepareForReuse() {
mRecycled = false;
mRecycledLocation = null;
mSeq = mNextSeq.getAndIncrement();
}
/**
* Gets a private flag that indicates when the system has detected that this input event
* may be inconsistent with respect to the sequence of previously delivered input events,
* such as when a key up event is sent but the key was not down or when a pointer
* move event is sent but the pointer is not down.
*
* @return True if this event is tainted.
* @hide
*/
public abstract boolean isTainted();
/**
* Gets a private flag that indicates when the system has detected that this input event
* may be inconsistent with respect to the sequence of previously delivered input events,
* such as when a key up event is sent but the key was not down or when a pointer
* move event is sent but the pointer is not down.
*
* @return True if this event is tainted.
* @hide
*/
public abstract boolean isTainted();
/**
* Sets a private flag that indicates when the system has detected that this input event
* may be inconsistent with respect to the sequence of previously delivered input events,
* such as when a key up event is sent but the key was not down or when a pointer
* move event is sent but the pointer is not down.
*
* @param tainted True if this event is tainted.
* @hide
*/
public abstract void setTainted(boolean tainted);
/**
* Sets a private flag that indicates when the system has detected that this input event
* may be inconsistent with respect to the sequence of previously delivered input events,
* such as when a key up event is sent but the key was not down or when a pointer
* move event is sent but the pointer is not down.
*
* @param tainted True if this event is tainted.
* @hide
*/
public abstract void setTainted(boolean tainted);
/**
* Retrieve the time this event occurred,
* in the {@link android.os.SystemClock#uptimeMillis} time base.
*
* @return Returns the time this event occurred,
* in the {@link android.os.SystemClock#uptimeMillis} time base.
*/
public abstract long getEventTime();
/**
* Retrieve the time this event occurred,
* in the {@link android.os.SystemClock#uptimeMillis} time base.
*
* @return Returns the time this event occurred,
* in the {@link android.os.SystemClock#uptimeMillis} time base.
*/
public abstract long getEventTime();
/**
* Retrieve the time this event occurred,
* in the {@link android.os.SystemClock#uptimeMillis} time base but with
* nanosecond (instead of millisecond) precision.
* <p>
* The value is in nanosecond precision but it may not have nanosecond accuracy.
* </p>
*
* @return Returns the time this event occurred,
* in the {@link android.os.SystemClock#uptimeMillis} time base but with
* nanosecond (instead of millisecond) precision.
*
* @hide
*/
public abstract long getEventTimeNano();
/**
* Retrieve the time this event occurred,
* in the {@link android.os.SystemClock#uptimeMillis} time base but with
* nanosecond (instead of millisecond) precision.
* <p>
* The value is in nanosecond precision but it may not have nanosecond accuracy.
* </p>
*
* @return Returns the time this event occurred,
* in the {@link android.os.SystemClock#uptimeMillis} time base but with
* nanosecond (instead of millisecond) precision.
*
* @hide
*/
public abstract long getEventTimeNano();
/**
* Gets the unique sequence number of this event.
* Every input event that is created or received by a process has a
* unique sequence number. Moreover, a new sequence number is obtained
* each time an event object is recycled.
*
* Sequence numbers are only guaranteed to be locally unique within a process.
* Sequence numbers are not preserved when events are parceled.
*
* @return The unique sequence number of this event.
* @hide
*/
public int getSequenceNumber() {
return mSeq;
}
/**
* Gets the unique sequence number of this event.
* Every input event that is created or received by a process has a
* unique sequence number. Moreover, a new sequence number is obtained
* each time an event object is recycled.
*
* Sequence numbers are only guaranteed to be locally unique within a process.
* Sequence numbers are not preserved when events are parceled.
*
* @return The unique sequence number of this event.
* @hide
*/
public int getSequenceNumber() {
return mSeq;
}
public int describeContents() {
return 0;
}
public int describeContents() {
return 0;
}
}

View File

@@ -4,21 +4,21 @@ public final class InputQueue {
// for now, we will put a GtkEventController for the window here
private long native_ptr = 0;
public long getNativePtr() {
return native_ptr; // FIXME?
}
public long getNativePtr() {
return native_ptr; // FIXME?
}
public static interface Callback {
/**
* Called when the given InputQueue is now associated with the
* thread making this call, so it can start receiving events from it.
*/
void onInputQueueCreated(InputQueue queue);
public static interface Callback {
/**
* Called when the given InputQueue is now associated with the
* thread making this call, so it can start receiving events from it.
*/
void onInputQueueCreated(InputQueue queue);
/**
* Called when the given InputQueue is no longer associated with
* the thread and thus not dispatching events.
*/
void onInputQueueDestroyed(InputQueue queue);
}
/**
* Called when the given InputQueue is no longer associated with
* the thread and thus not dispatching events.
*/
void onInputQueueDestroyed(InputQueue queue);
}
}

View File

@@ -3,15 +3,12 @@ package android.view;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Xml;
import java.io.FileReader;
import java.lang.reflect.Constructor;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.lang.reflect.Constructor;
import java.io.FileReader;
public class LayoutInflater {
public interface Factory {
@@ -26,18 +23,18 @@ public class LayoutInflater {
return null;
}
public void setFactory2 (Factory2 factory) {
public void setFactory2(Factory2 factory) {
this.factory2 = factory;
}
public static LayoutInflater from (Context context) {
public static LayoutInflater from(Context context) {
return new LayoutInflater();
}
public final View createView(String name, String prefix, AttributeSet attrs) throws Exception {
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>> createView("+name+", "+prefix+", "+attrs+");");
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>> createView(" + name + ", " + prefix + ", " + attrs + ");");
String view_class_name = prefix+name;
String view_class_name = prefix + name;
Class view_class = Class.forName(view_class_name);
Constructor constructor = view_class.getConstructor(AttributeSet.class);
@@ -53,7 +50,7 @@ public class LayoutInflater {
protected View onCreateView(String name, AttributeSet attrs) throws Exception {
try { // FIXME ugly
return createView(name, "android.view.", attrs);
} catch(java.lang.ClassNotFoundException e) {
} catch (java.lang.ClassNotFoundException e) {
return createView(name, "android.widget.", attrs);
}
}
@@ -82,14 +79,13 @@ public class LayoutInflater {
System.out.println("Created view is: " + view);
return view;
}
public View inflate(int resource, ViewGroup root) throws Exception {
return inflate(resource, root, root != null);
}
public View inflate(int resource, ViewGroup root) throws Exception {
return inflate(resource, root, root != null);
}
public View inflate(int layoutResID, ViewGroup root, boolean attachToRoot) throws Exception {
public View inflate(int layoutResID, ViewGroup root, boolean attachToRoot) throws Exception {
String layout_xml_file = android.os.Environment.getExternalStorageDirectory().getPath() + "/" + Context.this_application.getString(layoutResID);
@@ -99,10 +95,10 @@ public class LayoutInflater {
factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput( new FileReader(layout_xml_file) );
xpp.setInput(new FileReader(layout_xml_file));
return inflate(xpp, root, attachToRoot);
}
return inflate(xpp, root, attachToRoot);
}
public View inflate(XmlPullParser parser, ViewGroup root, boolean attachToRoot) throws Exception {
@@ -113,7 +109,7 @@ public class LayoutInflater {
// Look for the root node.
int type;
while ((type = parser.next()) != XmlPullParser.START_TAG &&
type != XmlPullParser.END_DOCUMENT) {
type != XmlPullParser.END_DOCUMENT) {
// Empty
}
@@ -186,7 +182,8 @@ public class LayoutInflater {
int type;
while (((type = parser.next()) != XmlPullParser.END_TAG ||
parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
parser.getDepth() > depth) &&
type != XmlPullParser.END_DOCUMENT) {
if (type != XmlPullParser.START_TAG) {
continue;
@@ -196,7 +193,7 @@ public class LayoutInflater {
if (name.equals("requestFocus")) {
throw new Exception("<requestFocus /> not supported atm");
//parseRequestFocus(parser, parent);
// parseRequestFocus(parser, parent);
} else if (name.equals("include")) {
throw new Exception("<include /> not supported atm");
/*if (parser.getDepth() == 0) {
@@ -214,13 +211,14 @@ public class LayoutInflater {
viewGroup.addView(view, params);*/
} else {
final View view = createViewFromTag(parent, name, attrs);
final ViewGroup viewGroup = (ViewGroup) parent;
final ViewGroup viewGroup = (ViewGroup)parent;
final ViewGroup.LayoutParams params = viewGroup.generateLayoutParams(attrs);
rInflate(parser, view, attrs, true);
viewGroup.addView(view, params);
}
}
if (finishInflate) parent.onFinishInflate();
if (finishInflate)
parent.onFinishInflate();
}
}

View File

@@ -1,5 +1,4 @@
package android.view;
public interface Menu {
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,8 @@
package android.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.content.Context;
import java.util.ArrayList;
public class SurfaceView extends View {
@@ -38,7 +36,7 @@ public class SurfaceView extends View {
@Override
public boolean isCreating() {
// return mIsCreating;
// return mIsCreating;
return false;
}
@@ -53,40 +51,40 @@ public class SurfaceView extends View {
@Override
public void removeCallback(Callback callback) {
/* synchronized (mCallbacks) {
mCallbacks.remove(callback);
}*/
/* synchronized (mCallbacks) {
mCallbacks.remove(callback);
}*/
}
@Override
public void setFixedSize(int width, int height) {
/* if (mRequestedWidth != width || mRequestedHeight != height) {
mRequestedWidth = width;
mRequestedHeight = height;
requestLayout();
}*/
/* if (mRequestedWidth != width || mRequestedHeight != height) {
mRequestedWidth = width;
mRequestedHeight = height;
requestLayout();
}*/
}
@Override
public void setSizeFromLayout() {
/* if (mRequestedWidth != -1 || mRequestedHeight != -1) {
mRequestedWidth = mRequestedHeight = -1;
requestLayout();
}*/
/* if (mRequestedWidth != -1 || mRequestedHeight != -1) {
mRequestedWidth = mRequestedHeight = -1;
requestLayout();
}*/
}
@Override
public void setFormat(int format) {
/*
// for backward compatibility reason, OPAQUE always
// means 565 for SurfaceView
if (format == PixelFormat.OPAQUE)
format = PixelFormat.RGB_565;
/*
// for backward compatibility reason, OPAQUE always
// means 565 for SurfaceView
if (format == PixelFormat.OPAQUE)
format = PixelFormat.RGB_565;
mRequestedFormat = format;
if (mWindow != null) {
updateWindow(false, false);
}*/
mRequestedFormat = format;
if (mWindow != null) {
updateWindow(false, false);
}*/
}
/**
@@ -94,13 +92,13 @@ public class SurfaceView extends View {
*/
@Override
@Deprecated
public void setType(int type) { }
public void setType(int type) {}
@Override
public void setKeepScreenOn(boolean screenOn) {
// Message msg = mHandler.obtainMessage(KEEP_SCREEN_ON_MSG);
// msg.arg1 = screenOn ? 1 : 0;
// mHandler.sendMessage(msg);
// Message msg = mHandler.obtainMessage(KEEP_SCREEN_ON_MSG);
// msg.arg1 = screenOn ? 1 : 0;
// mHandler.sendMessage(msg);
}
/**
@@ -114,7 +112,7 @@ public class SurfaceView extends View {
*/
@Override
public Canvas lockCanvas() {
// return internalLockCanvas(null);
// return internalLockCanvas(null);
return null;
}
@@ -135,46 +133,46 @@ public class SurfaceView extends View {
*/
@Override
public Canvas lockCanvas(Rect inOutDirty) {
// return internalLockCanvas(inOutDirty);
// return internalLockCanvas(inOutDirty);
return null;
}
private final Canvas internalLockCanvas(Rect dirty) {
/* mSurfaceLock.lock();
/* mSurfaceLock.lock();
if (DEBUG) Log.i(TAG, "Locking canvas... stopped="
+ mDrawingStopped + ", win=" + mWindow);
if (DEBUG) Log.i(TAG, "Locking canvas... stopped="
+ mDrawingStopped + ", win=" + mWindow);
Canvas c = null;
if (!mDrawingStopped && mWindow != null) {
try {
c = mSurface.lockCanvas(dirty);
} catch (Exception e) {
Log.e(LOG_TAG, "Exception locking surface", e);
}
}
Canvas c = null;
if (!mDrawingStopped && mWindow != null) {
try {
c = mSurface.lockCanvas(dirty);
} catch (Exception e) {
Log.e(LOG_TAG, "Exception locking surface", e);
}
}
if (DEBUG) Log.i(TAG, "Returned canvas: " + c);
if (c != null) {
mLastLockTime = SystemClock.uptimeMillis();
return c;
}
if (DEBUG) Log.i(TAG, "Returned canvas: " + c);
if (c != null) {
mLastLockTime = SystemClock.uptimeMillis();
return c;
}
// If the Surface is not ready to be drawn, then return null,
// but throttle calls to this function so it isn't called more
// than every 100ms.
long now = SystemClock.uptimeMillis();
long nextTime = mLastLockTime + 100;
if (nextTime > now) {
try {
Thread.sleep(nextTime-now);
} catch (InterruptedException e) {
}
now = SystemClock.uptimeMillis();
}
mLastLockTime = now;
mSurfaceLock.unlock();
*/
// If the Surface is not ready to be drawn, then return null,
// but throttle calls to this function so it isn't called more
// than every 100ms.
long now = SystemClock.uptimeMillis();
long nextTime = mLastLockTime + 100;
if (nextTime > now) {
try {
Thread.sleep(nextTime-now);
} catch (InterruptedException e) {
}
now = SystemClock.uptimeMillis();
}
mLastLockTime = now;
mSurfaceLock.unlock();
*/
return null;
}
@@ -186,8 +184,8 @@ public class SurfaceView extends View {
*/
@Override
public void unlockCanvasAndPost(Canvas canvas) {
// mSurface.unlockCanvasAndPost(canvas);
// mSurfaceLock.unlock();
// mSurface.unlockCanvasAndPost(canvas);
// mSurfaceLock.unlock();
}
@Override
@@ -197,7 +195,7 @@ public class SurfaceView extends View {
@Override
public Rect getSurfaceFrame() {
// return mSurfaceFrame;
// return mSurfaceFrame;
return null;
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,7 @@
package android.view;
import android.util.AttributeSet;
import android.content.Context;
import android.util.AttributeSet;
import java.util.ArrayList;
public class ViewGroup extends View implements ViewParent, ViewManager {
@@ -49,14 +48,14 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
public native void addView(View child, int index, LayoutParams params);
public native void removeView(View view);
public native void removeView(View view);
public native void removeAllViews();
public View getChildAt(int index) {
return children.get(index);
}
public void updateViewLayout(View view, ViewGroup.LayoutParams params) {}
public void updateViewLayout(View view, ViewGroup.LayoutParams params) {}
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return new LayoutParams(/*getContext(), attrs*/);
@@ -67,14 +66,14 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
}
/**
* Returns the number of children in the group.
*
* @return a positive integer representing the number of children in
* the group
*/
public int getChildCount() {
return children.size();
}
* Returns the number of children in the group.
*
* @return a positive integer representing the number of children in
* the group
*/
public int getChildCount() {
return children.size();
}
public static class LayoutParams {
public static final int FILL_PARENT = -1;
@@ -87,7 +86,7 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
public int gravity = -1;
public LayoutParams() {
//FIXME
// FIXME
}
public LayoutParams(int width, int height) {
@@ -109,13 +108,13 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
// public LayoutAnimationController.AnimationParameters layoutAnimationParameters;
}
public static class MarginLayoutParams extends ViewGroup.LayoutParams{
public static class MarginLayoutParams extends ViewGroup.LayoutParams {
public MarginLayoutParams() {
super();
}
public MarginLayoutParams(int width, int height) {
public MarginLayoutParams(int width, int height) {
super(width, height);
}

View File

@@ -16,22 +16,22 @@
package android.view;
/** Interface to let you add and remove child views to an Activity. To get an instance
* of this class, call {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}.
*/
public interface ViewManager
{
/**
* Assign the passed LayoutParams to the passed View and add the view to the window.
* <p>Throws {@link android.view.WindowManager.BadTokenException} for certain programming
* errors, such as adding a second view to a window without removing the first view.
* <p>Throws {@link android.view.WindowManager.InvalidDisplayException} if the window is on a
* secondary {@link Display} and the specified display can't be found
* (see {@link android.app.Presentation}).
* @param view The view to be added to this window.
* @param params The LayoutParams to assign to view.
*/
public void addView(View view, ViewGroup.LayoutParams params);
public void updateViewLayout(View view, ViewGroup.LayoutParams params);
public void removeView(View view);
/**
* Interface to let you add and remove child views to an Activity. To get an instance
* of this class, call {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}.
*/
public interface ViewManager {
/**
* Assign the passed LayoutParams to the passed View and add the view to the window.
* <p>Throws {@link android.view.WindowManager.BadTokenException} for certain programming
* errors, such as adding a second view to a window without removing the first view.
* <p>Throws {@link android.view.WindowManager.InvalidDisplayException} if the window is on a
* secondary {@link Display} and the specified display can't be found
* (see {@link android.app.Presentation}).
* @param view The view to be added to this window.
* @param params The LayoutParams to assign to view.
*/
public void addView(View view, ViewGroup.LayoutParams params);
public void updateViewLayout(View view, ViewGroup.LayoutParams params);
public void removeView(View view);
}

View File

@@ -3,5 +3,4 @@ package android.view;
import android.graphics.Rect;
public interface ViewParent {
}

File diff suppressed because it is too large Load Diff

View File

@@ -40,187 +40,189 @@ class ComposingText {
*/
public class BaseInputConnection implements InputConnection {
BaseInputConnection(InputMethodManager mgr, boolean fullEditor) {
}
BaseInputConnection(InputMethodManager mgr, boolean fullEditor) {
}
public BaseInputConnection(View targetView, boolean fullEditor) {
}
public BaseInputConnection(View targetView, boolean fullEditor) {
}
public static final void removeComposingSpans(Spannable text) {
}
public static void setComposingSpans(Spannable text) {
setComposingSpans(text, 0, text.length());
}
/** @hide */
public static void setComposingSpans(Spannable text, int start, int end) {
}
public static final void removeComposingSpans(Spannable text) {
}
public static void setComposingSpans(Spannable text) {
setComposingSpans(text, 0, text.length());
}
/**
* @hide
*/
public static void setComposingSpans(Spannable text, int start, int end) {
}
public static int getComposingSpanStart(Spannable text) {
return 0;
}
public static int getComposingSpanStart(Spannable text) {
return 0;
}
public static int getComposingSpanEnd(Spannable text) {
return 0;
}
public static int getComposingSpanEnd(Spannable text) {
return 0;
}
/**
* Return the target of edit operations. The default implementation
* returns its own fake editable that is just used for composing text;
* subclasses that are real text editors should override this and
* supply their own.
*/
public Editable getEditable() {
return new Editable();
}
/**
* Return the target of edit operations. The default implementation
* returns its own fake editable that is just used for composing text;
* subclasses that are real text editors should override this and
* supply their own.
*/
public Editable getEditable() {
return new Editable();
}
/**
* Default implementation does nothing.
*/
public boolean beginBatchEdit() {
return false;
}
/**
* Default implementation does nothing.
*/
public boolean endBatchEdit() {
return false;
}
/**
* Called when this InputConnection is no longer used by the InputMethodManager.
*
* @hide
*/
protected void reportFinish() {
// Intentionaly empty
}
/**
* Default implementation uses
* {@link MetaKeyKeyListener#clearMetaKeyState(long, int)
* MetaKeyKeyListener.clearMetaKeyState(long, int)} to clear the state.
*/
public boolean clearMetaKeyStates(int states) {
return true;
}
/**
* Default implementation does nothing and returns false.
*/
public boolean commitCompletion(CompletionInfo text) {
return false;
}
/**
* Default implementation does nothing and returns false.
*/
public boolean commitCorrection(CorrectionInfo correctionInfo) {
return false;
}
/**
* Default implementation replaces any existing composing text with
* the given text. In addition, only if dummy mode, a key event is
* sent for the new text and the current editable buffer cleared.
*/
public boolean commitText(CharSequence text, int newCursorPosition) {
return true;
}
/**
* The default implementation performs the deletion around the current
* selection position of the editable text.
* @param beforeLength
* @param afterLength
*/
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
return true;
}
/**
* The default implementation removes the composing state from the
* current editable text. In addition, only if dummy mode, a key event is
* sent for the new text and the current editable buffer cleared.
*/
public boolean finishComposingText() {
return true;
}
/**
* The default implementation uses TextUtils.getCapsMode to get the
* cursor caps mode for the current selection position in the editable
* text, unless in dummy mode in which case 0 is always returned.
*/
public int getCursorCapsMode(int reqModes) {
return 0;
}
/**
* The default implementation always returns null.
*/
public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
return null;
}
/**
* The default implementation returns the given amount of text from the
* current cursor position in the buffer.
*/
public CharSequence getTextBeforeCursor(int length, int flags) {
return "";
}
/**
* The default implementation returns the text currently selected, or null if none is
* selected.
*/
public CharSequence getSelectedText(int flags) {
return "";
}
/**
* The default implementation returns the given amount of text from the
* current cursor position in the buffer.
*/
public CharSequence getTextAfterCursor(int length, int flags) {
return "";
}
/**
* The default implementation turns this into the enter key.
*/
public boolean performEditorAction(int actionCode) {
return true;
}
/**
* The default implementation does nothing.
*/
public boolean performContextMenuAction(int id) {
return false;
}
/**
* The default implementation does nothing.
*/
public boolean performPrivateCommand(String action, Bundle data) {
return false;
}
/**
* The default implementation places the given text into the editable,
* replacing any existing composing text. The new text is marked as
* in a composing state with the composing style.
*/
public boolean setComposingText(CharSequence text, int newCursorPosition) {
return true;
}
public boolean setComposingRegion(int start, int end) {
return true;
}
/**
* The default implementation changes the selection position in the
* current editable text.
*/
public boolean setSelection(int start, int end) {
return true;
}
/**
* Provides standard implementation for sending a key event to the window
* attached to the input connection's view.
*/
public boolean sendKeyEvent(KeyEvent event) {
return false;
}
/**
* Default implementation does nothing.
*/
public boolean beginBatchEdit() {
return false;
}
/**
* Default implementation does nothing.
*/
public boolean endBatchEdit() {
return false;
}
/**
* Called when this InputConnection is no longer used by the InputMethodManager.
*
* @hide
*/
protected void reportFinish() {
// Intentionaly empty
}
/**
* Default implementation uses
* {@link MetaKeyKeyListener#clearMetaKeyState(long, int)
* MetaKeyKeyListener.clearMetaKeyState(long, int)} to clear the state.
*/
public boolean clearMetaKeyStates(int states) {
return true;
}
/**
* Default implementation does nothing and returns false.
*/
public boolean commitCompletion(CompletionInfo text) {
return false;
}
/**
* Default implementation does nothing and returns false.
*/
public boolean commitCorrection(CorrectionInfo correctionInfo) {
return false;
}
/**
* Default implementation replaces any existing composing text with
* the given text. In addition, only if dummy mode, a key event is
* sent for the new text and the current editable buffer cleared.
*/
public boolean commitText(CharSequence text, int newCursorPosition) {
return true;
}
/**
* The default implementation performs the deletion around the current
* selection position of the editable text.
* @param beforeLength
* @param afterLength
*/
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
return true;
}
/**
* The default implementation removes the composing state from the
* current editable text. In addition, only if dummy mode, a key event is
* sent for the new text and the current editable buffer cleared.
*/
public boolean finishComposingText() {
return true;
}
/**
* The default implementation uses TextUtils.getCapsMode to get the
* cursor caps mode for the current selection position in the editable
* text, unless in dummy mode in which case 0 is always returned.
*/
public int getCursorCapsMode(int reqModes) {
return 0;
}
/**
* The default implementation always returns null.
*/
public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
return null;
}
/**
* The default implementation returns the given amount of text from the
* current cursor position in the buffer.
*/
public CharSequence getTextBeforeCursor(int length, int flags) {
return "";
}
/**
* The default implementation returns the text currently selected, or null if none is
* selected.
*/
public CharSequence getSelectedText(int flags) {
return "";
}
/**
* The default implementation returns the given amount of text from the
* current cursor position in the buffer.
*/
public CharSequence getTextAfterCursor(int length, int flags) {
return "";
}
/**
* The default implementation turns this into the enter key.
*/
public boolean performEditorAction(int actionCode) {
return true;
}
/**
* The default implementation does nothing.
*/
public boolean performContextMenuAction(int id) {
return false;
}
/**
* The default implementation does nothing.
*/
public boolean performPrivateCommand(String action, Bundle data) {
return false;
}
/**
* The default implementation places the given text into the editable,
* replacing any existing composing text. The new text is marked as
* in a composing state with the composing style.
*/
public boolean setComposingText(CharSequence text, int newCursorPosition) {
return true;
}
public boolean setComposingRegion(int start, int end) {
return true;
}
/**
* The default implementation changes the selection position in the
* current editable text.
*/
public boolean setSelection(int start, int end) {
return true;
}
/**
* Provides standard implementation for sending a key event to the window
* attached to the input connection's view.
*/
public boolean sendKeyEvent(KeyEvent event) {
return false;
}
/**
* Updates InputMethodManager with the current fullscreen mode.
*/
public boolean reportFullscreenMode(boolean enabled) {
return true;
}
/**
* Updates InputMethodManager with the current fullscreen mode.
*/
public boolean reportFullscreenMode(boolean enabled) {
return true;
}
}

File diff suppressed because it is too large Load Diff