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
implement/stub some stuff to make SmashHit launch
This commit is contained in:
14
src/api-impl/android/accounts/Account.java
Normal file
14
src/api-impl/android/accounts/Account.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package android.accounts;
|
||||||
|
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
public class Account implements Parcelable {
|
||||||
|
public static final Creator<Account> CREATOR = null;
|
||||||
|
public final String name;
|
||||||
|
public final String type;
|
||||||
|
|
||||||
|
public Account(String name, String type) {
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ import android.util.DisplayMetrics;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.app.SharedPreferencesImpl;
|
import android.app.SharedPreferencesImpl;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.os.PowerManager;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
@@ -42,6 +43,8 @@ public class Context extends Object {
|
|||||||
static Configuration config;
|
static Configuration config;
|
||||||
static Resources r;
|
static Resources r;
|
||||||
|
|
||||||
|
static String apk_path = "/tmp/APK_PATH_SHOULD_HAVE_BEEN_FILLED_IN_BY_CODE_IN_main.c/";
|
||||||
|
|
||||||
public /*← FIXME?*/ static Application this_application;
|
public /*← FIXME?*/ static Application this_application;
|
||||||
|
|
||||||
File data_dir = null;
|
File data_dir = null;
|
||||||
@@ -96,6 +99,8 @@ public class Context extends Object {
|
|||||||
return new UsbManager();
|
return new UsbManager();
|
||||||
case "vibrator":
|
case "vibrator":
|
||||||
return new Vibrator();
|
return new Vibrator();
|
||||||
|
case "power":
|
||||||
|
return new PowerManager();
|
||||||
default:
|
default:
|
||||||
System.out.println("!!!!!!! getSystemService: case >"+name+"< is not implemented yet");
|
System.out.println("!!!!!!! getSystemService: case >"+name+"< is not implemented yet");
|
||||||
return null;
|
return null;
|
||||||
@@ -115,6 +120,10 @@ public class Context extends Object {
|
|||||||
return "com.example.demo_app";
|
return "com.example.demo_app";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPackageCodePath() {
|
||||||
|
return apk_path;
|
||||||
|
}
|
||||||
|
|
||||||
public final String getString(int resId) {
|
public final String getString(int resId) {
|
||||||
return r.getString(resId);
|
return r.getString(resId);
|
||||||
}
|
}
|
||||||
|
|||||||
5
src/api-impl/android/content/pm/ResolveInfo.java
Normal file
5
src/api-impl/android/content/pm/ResolveInfo.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package android.content.pm;
|
||||||
|
|
||||||
|
public class ResolveInfo {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
package android.os;
|
package android.os;
|
||||||
|
|
||||||
public interface Parcelable {
|
public interface Parcelable {
|
||||||
|
public static interface Creator<T> {}
|
||||||
}
|
}
|
||||||
|
|||||||
9
src/api-impl/android/os/PowerManager.java
Normal file
9
src/api-impl/android/os/PowerManager.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package android.os;
|
||||||
|
|
||||||
|
public final class PowerManager {
|
||||||
|
public final class WakeLock {}
|
||||||
|
|
||||||
|
public WakeLock newWakeLock(int levelAndFlags, String tag) {
|
||||||
|
return new WakeLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,4 +61,8 @@ public class TextUtils {
|
|||||||
final CharSequence delimiter = ","; // ????
|
final CharSequence delimiter = ","; // ????
|
||||||
return join(delimiter, list);
|
return join(delimiter, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isEmpty(CharSequence str) {
|
||||||
|
return str.equals(""); // presumably?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
hax_jar = jar('hax', [
|
hax_jar = jar('hax', [
|
||||||
|
'android/accounts/Account.java',
|
||||||
'android/annotation/PrivateApi.java',
|
'android/annotation/PrivateApi.java',
|
||||||
'android/annotation/SdkConstant.java',
|
'android/annotation/SdkConstant.java',
|
||||||
'android/annotation/SuppressLint.java',
|
'android/annotation/SuppressLint.java',
|
||||||
@@ -44,6 +45,7 @@ hax_jar = jar('hax', [
|
|||||||
'android/content/pm/PermissionGroupInfo.java',
|
'android/content/pm/PermissionGroupInfo.java',
|
||||||
'android/content/pm/PermissionInfo.java',
|
'android/content/pm/PermissionInfo.java',
|
||||||
'android/content/pm/ProviderInfo.java',
|
'android/content/pm/ProviderInfo.java',
|
||||||
|
'android/content/pm/ResolveInfo.java',
|
||||||
'android/content/pm/ServiceInfo.java',
|
'android/content/pm/ServiceInfo.java',
|
||||||
'android/content/pm/Signature.java',
|
'android/content/pm/Signature.java',
|
||||||
'android/content/pm/VerifierInfo.java',
|
'android/content/pm/VerifierInfo.java',
|
||||||
@@ -114,6 +116,7 @@ hax_jar = jar('hax', [
|
|||||||
'android/os/Parcelable.java',
|
'android/os/Parcelable.java',
|
||||||
'android/os/ParcelFileDescriptor.java',
|
'android/os/ParcelFileDescriptor.java',
|
||||||
'android/os/PatternMatcher.java',
|
'android/os/PatternMatcher.java',
|
||||||
|
'android/os/PowerManager.java',
|
||||||
'android/os/Process.java',
|
'android/os/Process.java',
|
||||||
'android/os/RemoteException.java',
|
'android/os/RemoteException.java',
|
||||||
'android/os/ResultReceiver.java',
|
'android/os/ResultReceiver.java',
|
||||||
|
|||||||
@@ -23,6 +23,25 @@ typedef void * jobject;
|
|||||||
#define ASSET_DIR "assets/"
|
#define ASSET_DIR "assets/"
|
||||||
char *get_app_data_dir();
|
char *get_app_data_dir();
|
||||||
|
|
||||||
|
int AAsset_openFileDescriptor(struct AAsset *asset, off_t *out_start, off_t *out_length)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
int fd = asset->fd;
|
||||||
|
|
||||||
|
printf("openning asset's file descriptor: : %d\n", fd);
|
||||||
|
|
||||||
|
struct stat statbuf;
|
||||||
|
|
||||||
|
ret = fstat(fd, &statbuf);
|
||||||
|
if(ret)
|
||||||
|
printf("oopsie, fstat failed on fd: %d with errno: %d\n", fd, errno);
|
||||||
|
|
||||||
|
*out_start = 0; // on android, we would be returning the fd of the app's apk, and this would be the offet to a non-compressed archive member
|
||||||
|
*out_length = statbuf.st_size; // similarly, this would be the size of the section of memory containing the non-compressed archive member
|
||||||
|
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
struct AAsset* AAssetManager_open(struct AAssetManager *amgr, const char *file_name, int mode)
|
struct AAsset* AAssetManager_open(struct AAssetManager *amgr, const char *file_name, int mode)
|
||||||
{
|
{
|
||||||
char *app_data_dir = get_app_data_dir();
|
char *app_data_dir = get_app_data_dir();
|
||||||
|
|||||||
Reference in New Issue
Block a user