fixme-desc: add some stubs

This commit is contained in:
Nikita Travkin
2022-11-04 21:18:44 +05:00
committed by Mis012
parent 638667efbb
commit d419d6d324
7 changed files with 148 additions and 6 deletions

View File

@@ -27,6 +27,7 @@ marshal_files = gnome.genmarshal('marshal',
# libandroid
libandroid_so = shared_library('android', [
'src/libandroid/asset_manager.c',
'src/libandroid/bitmap.c',
'src/libandroid/configuration.c',
'src/libandroid/input.c',
'src/libandroid/looper.c',

View File

@@ -1,11 +1,70 @@
package android.app;
import android.os.Bundle;
import android.content.res.Configuration;
import android.content.Context;
public class Application extends Context {
public interface ActivityLifecycleCallbacks {}
public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {
public interface ActivityLifecycleCallbacks {
void onActivityCreated(Activity activity, Bundle savedInstanceState);
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) {
}
}

View 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() {
}
}
}

View File

@@ -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) {
}
}

View File

@@ -105,6 +105,7 @@ hax_jar = jar('hax', [
'android/os/Build.java',
'android/os/Bundle.java',
'android/os/CancellationSignal.java',
'android/os/Debug.java',
'android/os/Environment.java',
'android/os/Handler.java',
'android/os/HandlerThread.java',
@@ -128,6 +129,7 @@ hax_jar = jar('hax', [
'android/preference/PreferenceManager.java',
'android/provider/Settings.java',
'android/R.java',
'android/support/multidex/MultiDexApplication.java',
'android/support/v4/app/FragmentActivity.java',
'android/telephony/PhoneStateListener.java',
'android/telephony/TelephonyManager.java',

View File

@@ -14,6 +14,7 @@ struct AAssetManager {
struct AAsset{
int fd;
off64_t read;
};
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));
asset->fd = fd;
asset->read = 0;
return asset;
}
@@ -106,17 +108,40 @@ off64_t AAsset_getLength64(struct AAsset *asset)
return statbuf.st_size;
}
off_t AAsset_getLength(struct AAsset *asset)
{
return AAsset_getLength64(asset);
}
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 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) {
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)

18
src/libandroid/bitmap.c Normal file
View 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;
}