diff --git a/meson.build b/meson.build index d66b9f9e..d3175763 100644 --- a/meson.build +++ b/meson.build @@ -70,6 +70,7 @@ executable('android-translation-layer', [ # libandroid shared_library('android', [ 'src/libandroid/asset_manager.c', + 'src/libandroid/configuration.c', 'src/libandroid/media.c', 'src/libandroid/native_window.c', 'src/libandroid/sensor.c', diff --git a/src/api-impl/android/content/ClipboardManager.java b/src/api-impl/android/content/ClipboardManager.java new file mode 100644 index 00000000..3da3ff7a --- /dev/null +++ b/src/api-impl/android/content/ClipboardManager.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) 2010, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.content; +import android.content.Context; +import android.os.Message; +import android.os.RemoteException; +import android.os.Handler; +import android.os.IBinder; +import android.util.Log; +import java.util.ArrayList; + +class ClipData {} +class ClipDescription {} + +/** + * Interface to the clipboard service, for placing and retrieving text in + * the global clipboard. + * + *

+ * You do not instantiate this class directly; instead, retrieve it through + * {@link android.content.Context#getSystemService}. + * + *

+ * The ClipboardManager API itself is very simple: it consists of methods + * to atomically get and set the current primary clipboard data. That data + * is expressed as a {@link ClipData} object, which defines the protocol + * for data exchange between applications. + * + *

+ *

Developer Guides

+ *

For more information about using the clipboard framework, read the + * Copy and Paste + * developer guide.

+ *
+ * + * @see android.content.Context#getSystemService + */ +public class ClipboardManager extends android.text.ClipboardManager { + static final int MSG_REPORT_PRIMARY_CLIP_CHANGED = 1; + /** + * Defines a listener callback that is invoked when the primary clip on the clipboard changes. + * Objects that want to register a listener call + * {@link android.content.ClipboardManager#addPrimaryClipChangedListener(OnPrimaryClipChangedListener) + * addPrimaryClipChangedListener()} with an + * object that implements OnPrimaryClipChangedListener. + * + */ + public interface OnPrimaryClipChangedListener { + /** + * Callback that is invoked by {@link android.content.ClipboardManager} when the primary + * clip changes. + */ + void onPrimaryClipChanged(); + } + /** {@hide} */ + public ClipboardManager(Context context, Handler handler) { + } + public ClipboardManager() { + } + /** + * Sets the current primary clip on the clipboard. This is the clip that + * is involved in normal cut and paste operations. + * + * @param clip The clipped data item to set. + */ + public void setPrimaryClip(ClipData clip) { + } + /** + * Returns the current primary clip on the clipboard. + */ + public ClipData getPrimaryClip() { + return null; + } + /** + * Returns a description of the current primary clip on the clipboard + * but not a copy of its data. + */ + public ClipDescription getPrimaryClipDescription() { + return null; + } + /** + * Returns true if there is currently a primary clip on the clipboard. + */ + public boolean hasPrimaryClip() { + return false; + } + public void addPrimaryClipChangedListener(OnPrimaryClipChangedListener what) { + } + public void removePrimaryClipChangedListener(OnPrimaryClipChangedListener what) { + } + /** + * @deprecated Use {@link #getPrimaryClip()} instead. This retrieves + * the primary clip and tries to coerce it to a string. + */ + public CharSequence getText() { + return null; + } + /** + * @deprecated Use {@link #setPrimaryClip(ClipData)} instead. This + * creates a ClippedItem holding the given text and sets it as the + * primary clip. It has no label or icon. + */ + public void setText(CharSequence text) { + } + /** + * @deprecated Use {@link #hasPrimaryClip()} instead. + */ + public boolean hasText() { + return false; + } + void reportPrimaryClipChanged() { + } +} diff --git a/src/api-impl/android/content/Context.java b/src/api-impl/android/content/Context.java index 66933f5c..dd550d23 100644 --- a/src/api-impl/android/content/Context.java +++ b/src/api-impl/android/content/Context.java @@ -20,7 +20,7 @@ import android.app.Application; import android.view.WindowManager; import android.view.WindowManagerImpl; -import android.text.ClipboardManager; +import android.content.ClipboardManager; import android.hardware.SensorManager; import android.net.ConnectivityManager; import android.app.KeyguardManager; diff --git a/src/api-impl/android/text/ClipboardManager.java b/src/api-impl/android/text/ClipboardManager.java index eeb27488..4e2e7eac 100644 --- a/src/api-impl/android/text/ClipboardManager.java +++ b/src/api-impl/android/text/ClipboardManager.java @@ -1,5 +1,22 @@ package android.text; - -public class ClipboardManager { - +/** + * @deprecated Old text-only interface to the clipboard. See + * {@link android.content.ClipboardManager} for the modern API. + */ +@Deprecated +public abstract class ClipboardManager { + /** + * Returns the text on the clipboard. It will eventually be possible + * to store types other than text too, in which case this will return + * null if the type cannot be coerced to text. + */ + public abstract CharSequence getText(); + /** + * Sets the contents of the clipboard to the specified text. + */ + public abstract void setText(CharSequence text); + /** + * Returns true if the clipboard contains text; false otherwise. + */ + public abstract boolean hasText(); } diff --git a/src/api-impl/android/view/View.java b/src/api-impl/android/view/View.java index 2ae9e1b4..7f402762 100644 --- a/src/api-impl/android/view/View.java +++ b/src/api-impl/android/view/View.java @@ -845,4 +845,6 @@ public class View extends Object { public void postInvalidate(int left, int top, int right, int bottom) { System.out.println("postInvalidate("+left+","+top+","+right+","+bottom+") called"); } + + public void setOnGenericMotionListener (View.OnGenericMotionListener l) {} } diff --git a/src/api-impl/android/view/inputmethod/BaseInputConnection.java b/src/api-impl/android/view/inputmethod/BaseInputConnection.java new file mode 100644 index 00000000..012f7dbe --- /dev/null +++ b/src/api-impl/android/view/inputmethod/BaseInputConnection.java @@ -0,0 +1,226 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package android.view.inputmethod; + +import android.content.Context; +import android.content.res.TypedArray; +import android.os.Bundle; +import android.os.SystemClock; +import android.text.NoCopySpan; +import android.text.Spannable; +import android.text.Spanned; +import android.text.TextUtils; +import android.util.Log; +import android.view.View; + +class InputMethodManager {} +class Editable {} + +class ComposingText { +} + +/** + * Base class for implementors of the InputConnection interface, taking care + * of most of the common behavior for providing a connection to an Editable. + * Implementors of this class will want to be sure to implement + * {@link #getEditable} to provide access to their own editable object. + */ +public class BaseInputConnection implements InputConnection { + + BaseInputConnection(InputMethodManager mgr, 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 int getComposingSpanStart(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(); + } + + /** + * 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; + } +} diff --git a/src/api-impl/android/view/inputmethod/InputConnection.java b/src/api-impl/android/view/inputmethod/InputConnection.java new file mode 100644 index 00000000..3e9f160b --- /dev/null +++ b/src/api-impl/android/view/inputmethod/InputConnection.java @@ -0,0 +1,354 @@ +/* + * Copyright (C) 2007-2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package android.view.inputmethod; +import android.os.Bundle; + +class ExtractedText {} +class ExtractedTextRequest {} +class CompletionInfo {} +class CorrectionInfo {} +class KeyEvent {} + +/** + * The InputConnection interface is the communication channel from an + * {@link InputMethod} back to the application that is receiving its input. It + * is used to perform such things as reading text around the cursor, + * committing text to the text box, and sending raw key events to the application. + * + *

Applications should never directly implement this interface, but instead + * subclass from {@link BaseInputConnection}. This will ensure that the + * application does not break when new methods are added to the interface. + */ +public interface InputConnection { + /** + * Flag for use with {@link #getTextAfterCursor} and + * {@link #getTextBeforeCursor} to have style information returned along + * with the text. If not set, you will receive only the raw text. If + * set, you may receive a complex CharSequence of both text and style + * spans. + */ + static final int GET_TEXT_WITH_STYLES = 0x0001; + + /** + * Flag for use with {@link #getExtractedText} to indicate you would + * like to receive updates when the extracted text changes. + */ + public static final int GET_EXTRACTED_TEXT_MONITOR = 0x0001; + + /** + * Get n characters of text before the current cursor position. + * + *

This method may fail either if the input connection has become invalid + * (such as its process crashing) or the client is taking too long to + * respond with the text (it is given a couple seconds to return). + * In either case, a null is returned. + * + * @param n The expected length of the text. + * @param flags Supplies additional options controlling how the text is + * returned. May be either 0 or {@link #GET_TEXT_WITH_STYLES}. + * + * @return Returns the text before the cursor position; the length of the + * returned text might be less than n. + */ + public CharSequence getTextBeforeCursor(int n, int flags); + /** + * Get n characters of text after the current cursor position. + * + *

This method may fail either if the input connection has become invalid + * (such as its process crashing) or the client is taking too long to + * respond with the text (it is given a couple seconds to return). + * In either case, a null is returned. + * + * @param n The expected length of the text. + * @param flags Supplies additional options controlling how the text is + * returned. May be either 0 or {@link #GET_TEXT_WITH_STYLES}. + * + * @return Returns the text after the cursor position; the length of the + * returned text might be less than n. + */ + public CharSequence getTextAfterCursor(int n, int flags); + /** + * Gets the selected text, if any. + * + *

This method may fail if either the input connection has become + * invalid (such as its process crashing) or the client is taking too + * long to respond with the text (it is given a couple of seconds to return). + * In either case, a null is returned. + * + * @param flags Supplies additional options controlling how the text is + * returned. May be either 0 or {@link #GET_TEXT_WITH_STYLES}. + * @return Returns the text that is currently selected, if any, or null if + * no text is selected. + */ + public CharSequence getSelectedText(int flags); + /** + * Retrieve the current capitalization mode in effect at the current + * cursor position in the text. See + * {@link android.text.TextUtils#getCapsMode TextUtils.getCapsMode} for + * more information. + * + *

This method may fail either if the input connection has become invalid + * (such as its process crashing) or the client is taking too long to + * respond with the text (it is given a couple seconds to return). + * In either case, a 0 is returned. + * + * @param reqModes The desired modes to retrieve, as defined by + * {@link android.text.TextUtils#getCapsMode TextUtils.getCapsMode}. These + * constants are defined so that you can simply pass the current + * {@link EditorInfo#inputType TextBoxAttribute.contentType} value + * directly in to here. + * + * @return Returns the caps mode flags that are in effect. + */ + public int getCursorCapsMode(int reqModes); + + /** + * Retrieve the current text in the input connection's editor, and monitor + * for any changes to it. This function returns with the current text, + * and optionally the input connection can send updates to the + * input method when its text changes. + * + *

This method may fail either if the input connection has become invalid + * (such as its process crashing) or the client is taking too long to + * respond with the text (it is given a couple seconds to return). + * In either case, a null is returned. + * + * @param request Description of how the text should be returned. + * @param flags Additional options to control the client, either 0 or + * {@link #GET_EXTRACTED_TEXT_MONITOR}. + * + * @return Returns an ExtractedText object describing the state of the + * text view and containing the extracted text itself. + */ + public ExtractedText getExtractedText(ExtractedTextRequest request, + int flags); + /** + * Delete beforeLength characters of text before the current cursor + * position, and delete afterLength characters of text after the + * current cursor position, excluding composing text. Before and after refer + * to the order of the characters in the string, not to their visual representation. + * + * + * @param beforeLength The number of characters to be deleted before the + * current cursor position. + * @param afterLength The number of characters to be deleted after the + * current cursor position. + * + * @return Returns true on success, false if the input connection is no longer + * valid. + */ + public boolean deleteSurroundingText(int beforeLength, int afterLength); + /** + * Set composing text around the current cursor position with the given text, + * and set the new cursor position. Any composing text set previously will + * be removed automatically. + * + * @param text The composing text with styles if necessary. If no style + * object attached to the text, the default style for composing text + * is used. See {#link android.text.Spanned} for how to attach style + * object to the text. {#link android.text.SpannableString} and + * {#link android.text.SpannableStringBuilder} are two + * implementations of the interface {#link android.text.Spanned}. + * @param newCursorPosition The new cursor position around the text. If + * > 0, this is relative to the end of the text - 1; if <= 0, this + * is relative to the start of the text. So a value of 1 will + * always advance you to the position after the full text being + * inserted. Note that this means you can't position the cursor + * within the text, because the editor can make modifications to + * the text you are providing so it is not possible to correctly + * specify locations there. + * + * @return Returns true on success, false if the input connection is no longer + * valid. + */ + public boolean setComposingText(CharSequence text, int newCursorPosition); + /** + * Mark a certain region of text as composing text. Any composing text set + * previously will be removed automatically. The default style for composing + * text is used. + * + * @param start the position in the text at which the composing region begins + * @param end the position in the text at which the composing region ends + * @return Returns true on success, false if the input connection is no longer + * valid. + */ + public boolean setComposingRegion(int start, int end); + /** + * Have the text editor finish whatever composing text is currently + * active. This simply leaves the text as-is, removing any special + * composing styling or other state that was around it. The cursor + * position remains unchanged. + */ + public boolean finishComposingText(); + + /** + * Commit text to the text box and set the new cursor position. + * Any composing text set previously will be removed + * automatically. + * + * @param text The committed text. + * @param newCursorPosition The new cursor position around the text. If + * > 0, this is relative to the end of the text - 1; if <= 0, this + * is relative to the start of the text. So a value of 1 will + * always advance you to the position after the full text being + * inserted. Note that this means you can't position the cursor + * within the text, because the editor can make modifications to + * the text you are providing so it is not possible to correctly + * specify locations there. + * + * + * @return Returns true on success, false if the input connection is no longer + * valid. + */ + public boolean commitText(CharSequence text, int newCursorPosition); + /** + * Commit a completion the user has selected from the possible ones + * previously reported to {@link InputMethodSession#displayCompletions + * InputMethodSession.displayCompletions()}. This will result in the + * same behavior as if the user had selected the completion from the + * actual UI. + * + * @param text The committed completion. + * + * @return Returns true on success, false if the input connection is no longer + * valid. + */ + public boolean commitCompletion(CompletionInfo text); + /** + * Commit a correction automatically performed on the raw user's input. A typical example would + * be to correct typos using a dictionary. + * + * @param correctionInfo Detailed information about the correction. + * + * @return True on success, false if the input connection is no longer valid. + */ + public boolean commitCorrection(CorrectionInfo correctionInfo); + /** + * Set the selection of the text editor. To set the cursor position, + * start and end should have the same value. + * @return Returns true on success, false if the input connection is no longer + * valid. + */ + public boolean setSelection(int start, int end); + + /** + * Have the editor perform an action it has said it can do. + * + * @param editorAction This must be one of the action constants for + * {@link EditorInfo#imeOptions EditorInfo.editorType}, such as + * {@link EditorInfo#IME_ACTION_GO EditorInfo.EDITOR_ACTION_GO}. + * + * @return Returns true on success, false if the input connection is no longer + * valid. + */ + public boolean performEditorAction(int editorAction); + + /** + * Perform a context menu action on the field. The given id may be one of: + * {@link android.R.id#selectAll}, + * {@link android.R.id#startSelectingText}, {@link android.R.id#stopSelectingText}, + * {@link android.R.id#cut}, {@link android.R.id#copy}, + * {@link android.R.id#paste}, {@link android.R.id#copyUrl}, + * or {@link android.R.id#switchInputMethod} + */ + public boolean performContextMenuAction(int id); + + /** + * Tell the editor that you are starting a batch of editor operations. + * The editor will try to avoid sending you updates about its state + * until {@link #endBatchEdit} is called. + */ + public boolean beginBatchEdit(); + + /** + * Tell the editor that you are done with a batch edit previously + * initiated with {@link #beginBatchEdit}. + */ + public boolean endBatchEdit(); + + /** + * Send a key event to the process that is currently attached through + * this input connection. The event will be dispatched like a normal + * key event, to the currently focused; this generally is the view that + * is providing this InputConnection, but due to the asynchronous nature + * of this protocol that can not be guaranteed and the focus may have + * changed by the time the event is received. + * + *

+ * This method can be used to send key events to the application. For + * example, an on-screen keyboard may use this method to simulate a hardware + * keyboard. There are three types of standard keyboards, numeric (12-key), + * predictive (20-key) and ALPHA (QWERTY). You can specify the keyboard type + * by specify the device id of the key event. + * + *

+ * You will usually want to set the flag + * {@link KeyEvent#FLAG_SOFT_KEYBOARD KeyEvent.FLAG_SOFT_KEYBOARD} on all + * key event objects you give to this API; the flag will not be set + * for you. + * + *

Note that it's discouraged to send such key events in normal operation; + * this is mainly for use with {@link android.text.InputType#TYPE_NULL} type + * text fields. Use the {@link #commitText} family of methods to send text + * to the application instead. + * @param event The key event. + * + * @return Returns true on success, false if the input connection is no longer + * valid. + * + * @see KeyEvent + * @see KeyCharacterMap#NUMERIC + * @see KeyCharacterMap#PREDICTIVE + * @see KeyCharacterMap#ALPHA + */ + public boolean sendKeyEvent(KeyEvent event); + /** + * Clear the given meta key pressed states in the given input connection. + * + * @param states The states to be cleared, may be one or more bits as + * per {@link KeyEvent#getMetaState() KeyEvent.getMetaState()}. + * + * @return Returns true on success, false if the input connection is no longer + * valid. + */ + public boolean clearMetaKeyStates(int states); + + /** + * Called by the IME to tell the client when it switches between fullscreen + * and normal modes. This will normally be called for you by the standard + * implementation of {@link android.inputmethodservice.InputMethodService}. + */ + public boolean reportFullscreenMode(boolean enabled); + + /** + * API to send private commands from an input method to its connected + * editor. This can be used to provide domain-specific features that are + * only known between certain input methods and their clients. Note that + * because the InputConnection protocol is asynchronous, you have no way + * to get a result back or know if the client understood the command; you + * can use the information in {@link EditorInfo} to determine if + * a client supports a particular command. + * + * @param action Name of the command to be performed. This must + * be a scoped name, i.e. prefixed with a package name you own, so that + * different developers will not create conflicting commands. + * @param data Any data to include with the command. + * @return Returns true if the command was sent (whether or not the + * associated editor understood it), false if the input connection is no longer + * valid. + */ + public boolean performPrivateCommand(String action, Bundle data); +} diff --git a/src/api-impl/meson.build b/src/api-impl/meson.build index 1b56822f..e84ca864 100644 --- a/src/api-impl/meson.build +++ b/src/api-impl/meson.build @@ -152,6 +152,8 @@ hax_jar = jar('hax', [ 'android/view/WindowManagerImpl.java', 'android/view/Gravity.java', 'android/view/Display.java', + 'android/view/inputmethod/BaseInputConnection.java', + 'android/view/inputmethod/InputConnection.java', 'android/hardware/SensorEventListener.java', 'android/hardware/Sensor.java', 'android/hardware/SensorManager.java', @@ -173,6 +175,7 @@ hax_jar = jar('hax', [ 'android/text/SpanWatcher.java', 'android/content/BroadcastReceiver.java', 'android/content/Context.java', + 'android/content/ClipboardManager.java', 'android/content/ActivityNotFoundException.java', 'android/content/DialogInterface.java', 'android/content/IntentFilter.java', diff --git a/src/libandroid/asset_manager.c b/src/libandroid/asset_manager.c index e7f1afd9..245fa25c 100644 --- a/src/libandroid/asset_manager.c +++ b/src/libandroid/asset_manager.c @@ -1,3 +1,5 @@ + +#define _LARGEFILE64_SOURCE #include #include #include @@ -90,6 +92,14 @@ struct AAssetManager * AAssetManager_fromJava(JNIEnv *env, jobject assetManager) return NULL; } +int AAsset_read(struct AAsset *asset, void *buf, size_t count) { + return read(asset->fd, buf, count); +} + +off64_t AAsset_seek64(struct AAsset *asset, off64_t offset, int whence) { + return lseek64(asset->fd, offset, whence); +} + void AAsset_close(struct AAsset *asset) { int fd = asset->fd; diff --git a/src/libandroid/configuration.c b/src/libandroid/configuration.c new file mode 100644 index 00000000..5adc6bea --- /dev/null +++ b/src/libandroid/configuration.c @@ -0,0 +1,23 @@ + +typedef void AConfiguration; +typedef void AAssetManager; + +void AConfiguration_getCountry(AConfiguration* config, char* outCountry) { + /* Assume not set. */ + outCountry[0] = 0; + outCountry[1] = 0; +} + +void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage) { + /* Assume not set. */ + outLanguage[0] = 0; + outLanguage[1] = 0; +} + +void AConfiguration_delete(AConfiguration *config) {} + +void * AConfiguration_new(void) { return 0; } + +void AConfiguration_fromAssetManager(AConfiguration *out, AAssetManager *am) +{ +} diff --git a/src/libandroid/media.c b/src/libandroid/media.c index aac9db5c..67b502ce 100644 --- a/src/libandroid/media.c +++ b/src/libandroid/media.c @@ -68,41 +68,71 @@ typedef enum { struct AMediaFormat; typedef struct AMediaFormat AMediaFormat; -AMediaFormat *AMediaFormat_new(); -media_status_t AMediaFormat_delete(AMediaFormat*); +AMediaFormat *AMediaFormat_new() +{ + return NULL; +} + +media_status_t AMediaFormat_delete(AMediaFormat*) +{ + return AMEDIA_ERROR_UNKNOWN; +} /** * Human readable representation of the format. The returned string is owned by the format, * and remains valid until the next call to toString, or until the format is deleted. */ -const char* AMediaFormat_toString(AMediaFormat*); +const char* AMediaFormat_toString(AMediaFormat*) +{ + return NULL; +} + +bool AMediaFormat_getInt32(AMediaFormat*, const char *name, int32_t *out) +{ + return false; +} + +bool AMediaFormat_getInt64(AMediaFormat*, const char *name, int64_t *out) +{ + return false; +} + +bool AMediaFormat_getFloat(AMediaFormat*, const char *name, float *out) +{ + return false; +} -bool AMediaFormat_getInt32(AMediaFormat*, const char *name, int32_t *out); -bool AMediaFormat_getInt64(AMediaFormat*, const char *name, int64_t *out); -bool AMediaFormat_getFloat(AMediaFormat*, const char *name, float *out); /** * The returned data is owned by the format and remains valid as long as the named entry * is part of the format. */ -bool AMediaFormat_getBuffer(AMediaFormat*, const char *name, void** data, size_t *size); +bool AMediaFormat_getBuffer(AMediaFormat*, const char *name, void** data, size_t *size) +{ + return false; +} + /** * The returned string is owned by the format, and remains valid until the next call to getString, * or until the format is deleted. */ -bool AMediaFormat_getString(AMediaFormat*, const char *name, const char **out); +bool AMediaFormat_getString(AMediaFormat*, const char *name, const char **out) +{ + return false; +} -void AMediaFormat_setInt32(AMediaFormat*, const char* name, int32_t value); -void AMediaFormat_setInt64(AMediaFormat*, const char* name, int64_t value); -void AMediaFormat_setFloat(AMediaFormat*, const char* name, float value); + +void AMediaFormat_setInt32(AMediaFormat*, const char* name, int32_t value) {} +void AMediaFormat_setInt64(AMediaFormat*, const char* name, int64_t value) {} +void AMediaFormat_setFloat(AMediaFormat*, const char* name, float value) {} /** * The provided string is copied into the format. */ -void AMediaFormat_setString(AMediaFormat*, const char* name, const char* value); +void AMediaFormat_setString(AMediaFormat*, const char* name, const char* value) {} /** * The provided data is copied into the format. */ -void AMediaFormat_setBuffer(AMediaFormat*, const char* name, void* data, size_t size); +void AMediaFormat_setBuffer(AMediaFormat*, const char* name, void* data, size_t size) {}