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.app.SharedPreferencesImpl;
|
||||
import android.os.Looper;
|
||||
import android.os.PowerManager;
|
||||
import android.app.Application;
|
||||
|
||||
import android.view.WindowManager;
|
||||
@@ -42,6 +43,8 @@ public class Context extends Object {
|
||||
static Configuration config;
|
||||
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;
|
||||
|
||||
File data_dir = null;
|
||||
@@ -96,6 +99,8 @@ public class Context extends Object {
|
||||
return new UsbManager();
|
||||
case "vibrator":
|
||||
return new Vibrator();
|
||||
case "power":
|
||||
return new PowerManager();
|
||||
default:
|
||||
System.out.println("!!!!!!! getSystemService: case >"+name+"< is not implemented yet");
|
||||
return null;
|
||||
@@ -115,6 +120,10 @@ public class Context extends Object {
|
||||
return "com.example.demo_app";
|
||||
}
|
||||
|
||||
public String getPackageCodePath() {
|
||||
return apk_path;
|
||||
}
|
||||
|
||||
public final String getString(int 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;
|
||||
|
||||
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 = ","; // ????
|
||||
return join(delimiter, list);
|
||||
}
|
||||
|
||||
public static boolean isEmpty(CharSequence str) {
|
||||
return str.equals(""); // presumably?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
hax_jar = jar('hax', [
|
||||
'android/accounts/Account.java',
|
||||
'android/annotation/PrivateApi.java',
|
||||
'android/annotation/SdkConstant.java',
|
||||
'android/annotation/SuppressLint.java',
|
||||
@@ -44,6 +45,7 @@ hax_jar = jar('hax', [
|
||||
'android/content/pm/PermissionGroupInfo.java',
|
||||
'android/content/pm/PermissionInfo.java',
|
||||
'android/content/pm/ProviderInfo.java',
|
||||
'android/content/pm/ResolveInfo.java',
|
||||
'android/content/pm/ServiceInfo.java',
|
||||
'android/content/pm/Signature.java',
|
||||
'android/content/pm/VerifierInfo.java',
|
||||
@@ -114,6 +116,7 @@ hax_jar = jar('hax', [
|
||||
'android/os/Parcelable.java',
|
||||
'android/os/ParcelFileDescriptor.java',
|
||||
'android/os/PatternMatcher.java',
|
||||
'android/os/PowerManager.java',
|
||||
'android/os/Process.java',
|
||||
'android/os/RemoteException.java',
|
||||
'android/os/ResultReceiver.java',
|
||||
|
||||
@@ -23,6 +23,25 @@ typedef void * jobject;
|
||||
#define ASSET_DIR "assets/"
|
||||
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)
|
||||
{
|
||||
char *app_data_dir = get_app_data_dir();
|
||||
|
||||
Reference in New Issue
Block a user