You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
fixme-desc: add some stubs
This commit is contained in:
@@ -27,6 +27,7 @@ marshal_files = gnome.genmarshal('marshal',
|
|||||||
# libandroid
|
# libandroid
|
||||||
libandroid_so = shared_library('android', [
|
libandroid_so = shared_library('android', [
|
||||||
'src/libandroid/asset_manager.c',
|
'src/libandroid/asset_manager.c',
|
||||||
|
'src/libandroid/bitmap.c',
|
||||||
'src/libandroid/configuration.c',
|
'src/libandroid/configuration.c',
|
||||||
'src/libandroid/input.c',
|
'src/libandroid/input.c',
|
||||||
'src/libandroid/looper.c',
|
'src/libandroid/looper.c',
|
||||||
|
|||||||
@@ -1,11 +1,70 @@
|
|||||||
package android.app;
|
package android.app;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public class Application extends Context {
|
public class Application extends Context {
|
||||||
public interface ActivityLifecycleCallbacks {}
|
public interface ActivityLifecycleCallbacks {
|
||||||
|
void onActivityCreated(Activity activity, Bundle savedInstanceState);
|
||||||
public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {
|
void onActivityStarted(Activity activity);
|
||||||
|
void onActivityResumed(Activity activity);
|
||||||
|
void onActivityPaused(Activity activity);
|
||||||
|
void onActivityStopped(Activity activity);
|
||||||
|
void onActivitySaveInstanceState(Activity activity, Bundle outState);
|
||||||
|
void onActivityDestroyed(Activity activity);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Callback interface for use with {@link Application#registerOnProvideAssistDataListener}
|
||||||
|
* and {@link Application#unregisterOnProvideAssistDataListener}.
|
||||||
|
*/
|
||||||
|
public interface OnProvideAssistDataListener {
|
||||||
|
/**
|
||||||
|
* This is called when the user is requesting an assist, to build a full
|
||||||
|
* {@link Intent#ACTION_ASSIST} Intent with all of the context of the current
|
||||||
|
* application. You can override this method to place into the bundle anything
|
||||||
|
* you would like to appear in the {@link Intent#EXTRA_ASSIST_CONTEXT} part
|
||||||
|
* of the assist Intent.
|
||||||
|
*/
|
||||||
|
public void onProvideAssistData(Activity activity, Bundle data);
|
||||||
|
}
|
||||||
|
public Application() {
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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().
|
||||||
|
*/
|
||||||
|
public void onCreate() {
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
public void onTerminate() {
|
||||||
|
}
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
}
|
||||||
|
public void onLowMemory() {
|
||||||
|
}
|
||||||
|
public void onTrimMemory(int level) {
|
||||||
|
}
|
||||||
|
/* public void registerComponentCallbacks(ComponentCallbacks callback) {
|
||||||
|
}
|
||||||
|
public void unregisterComponentCallbacks(ComponentCallbacks callback) {
|
||||||
|
}*/
|
||||||
|
public void registerActivityLifecycleCallbacks(ActivityLifecycleCallbacks callback) {
|
||||||
|
}
|
||||||
|
public void unregisterActivityLifecycleCallbacks(ActivityLifecycleCallbacks callback) {
|
||||||
|
}
|
||||||
|
public void registerOnProvideAssistDataListener(OnProvideAssistDataListener callback) {
|
||||||
|
}
|
||||||
|
public void unregisterOnProvideAssistDataListener(OnProvideAssistDataListener callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
src/api-impl/android/os/Debug.java
Normal file
15
src/api-impl/android/os/Debug.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package android.os;
|
||||||
|
public final class Debug
|
||||||
|
{
|
||||||
|
public static class MemoryInfo {
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Wait until a debugger attaches. As soon as the debugger attaches,
|
||||||
|
* this returns, so you will need to place a breakpoint after the
|
||||||
|
* waitForDebugger() call if you want to start tracing immediately.
|
||||||
|
*/
|
||||||
|
public static class InstructionCount {
|
||||||
|
public InstructionCount() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package android.support.multidex;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimal MultiDex capable application. To use the legacy multidex library there is 3 possibility:
|
||||||
|
* <ul>
|
||||||
|
* <li>Declare this class as the application in your AndroidManifest.xml.</li>
|
||||||
|
* <li>Have your {@link Application} extends this class.</li>
|
||||||
|
* <li>Have your {@link Application} override attachBaseContext starting with<br>
|
||||||
|
* <code>
|
||||||
|
protected void attachBaseContext(Context base) {<br>
|
||||||
|
super.attachBaseContext(base);<br>
|
||||||
|
MultiDex.install(this);
|
||||||
|
</code></li>
|
||||||
|
* <ul>
|
||||||
|
*/
|
||||||
|
public class MultiDexApplication extends Application {
|
||||||
|
protected void attachBaseContext(Context base) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -105,6 +105,7 @@ hax_jar = jar('hax', [
|
|||||||
'android/os/Build.java',
|
'android/os/Build.java',
|
||||||
'android/os/Bundle.java',
|
'android/os/Bundle.java',
|
||||||
'android/os/CancellationSignal.java',
|
'android/os/CancellationSignal.java',
|
||||||
|
'android/os/Debug.java',
|
||||||
'android/os/Environment.java',
|
'android/os/Environment.java',
|
||||||
'android/os/Handler.java',
|
'android/os/Handler.java',
|
||||||
'android/os/HandlerThread.java',
|
'android/os/HandlerThread.java',
|
||||||
@@ -128,6 +129,7 @@ hax_jar = jar('hax', [
|
|||||||
'android/preference/PreferenceManager.java',
|
'android/preference/PreferenceManager.java',
|
||||||
'android/provider/Settings.java',
|
'android/provider/Settings.java',
|
||||||
'android/R.java',
|
'android/R.java',
|
||||||
|
'android/support/multidex/MultiDexApplication.java',
|
||||||
'android/support/v4/app/FragmentActivity.java',
|
'android/support/v4/app/FragmentActivity.java',
|
||||||
'android/telephony/PhoneStateListener.java',
|
'android/telephony/PhoneStateListener.java',
|
||||||
'android/telephony/TelephonyManager.java',
|
'android/telephony/TelephonyManager.java',
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ struct AAssetManager {
|
|||||||
|
|
||||||
struct AAsset{
|
struct AAsset{
|
||||||
int fd;
|
int fd;
|
||||||
|
off64_t read;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int64_t off64_t;
|
typedef int64_t off64_t;
|
||||||
@@ -65,6 +66,7 @@ struct AAsset* AAssetManager_open(struct AAssetManager *amgr, const char *file_n
|
|||||||
|
|
||||||
struct AAsset* asset = malloc(sizeof(struct AAsset));
|
struct AAsset* asset = malloc(sizeof(struct AAsset));
|
||||||
asset->fd = fd;
|
asset->fd = fd;
|
||||||
|
asset->read = 0;
|
||||||
|
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
@@ -106,17 +108,40 @@ off64_t AAsset_getLength64(struct AAsset *asset)
|
|||||||
return statbuf.st_size;
|
return statbuf.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
off_t AAsset_getLength(struct AAsset *asset)
|
||||||
|
{
|
||||||
|
return AAsset_getLength64(asset);
|
||||||
|
}
|
||||||
struct AAssetManager * AAssetManager_fromJava(JNIEnv *env, jobject assetManager)
|
struct AAssetManager * AAssetManager_fromJava(JNIEnv *env, jobject assetManager)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AAsset_read(struct AAsset *asset, void *buf, size_t count) {
|
int AAsset_read(struct AAsset *asset, void *buf, size_t count) {
|
||||||
return read(asset->fd, buf, count);
|
off64_t tmp = read(asset->fd, buf, count);
|
||||||
|
asset->read += tmp;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
off_t AAsset_seek(struct AAsset *asset, off_t offset, int whence) {
|
||||||
|
off64_t tmp = lseek(asset->fd, offset, whence);
|
||||||
|
asset->read += tmp;
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
off64_t AAsset_seek64(struct AAsset *asset, off64_t offset, int whence) {
|
off64_t AAsset_seek64(struct AAsset *asset, off64_t offset, int whence) {
|
||||||
return lseek64(asset->fd, offset, whence);
|
off64_t tmp = lseek64(asset->fd, offset, whence);
|
||||||
|
asset->read += tmp;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
off_t AAsset_getRemainingLength(struct AAsset* asset)
|
||||||
|
{
|
||||||
|
return AAsset_getLength(asset) - asset->read;
|
||||||
|
}
|
||||||
|
off64_t AAsset_getRemainingLength64(struct AAsset* asset)
|
||||||
|
{
|
||||||
|
return AAsset_getLength64(asset) - asset->read;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AAsset_close(struct AAsset *asset)
|
void AAsset_close(struct AAsset *asset)
|
||||||
|
|||||||
18
src/libandroid/bitmap.c
Normal file
18
src/libandroid/bitmap.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
typedef void JNIEnv;
|
||||||
|
typedef void AndroidBitmapInfo;
|
||||||
|
typedef void* jobject;
|
||||||
|
|
||||||
|
#define ANDROID_BITMAP_RESULT_SUCCESS 0
|
||||||
|
|
||||||
|
|
||||||
|
int AndroidBitmap_getInfo(JNIEnv* env, jobject jbitmap,
|
||||||
|
AndroidBitmapInfo* info) {
|
||||||
|
return ANDROID_BITMAP_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
int AndroidBitmap_lockPixels(JNIEnv* env, jobject jbitmap, void** addrPtr) {
|
||||||
|
return ANDROID_BITMAP_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
int AndroidBitmap_unlockPixels(JNIEnv* env, jobject jbitmap) {
|
||||||
|
return ANDROID_BITMAP_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user