MonoRuntimeProvider.java 1.89 KB
Newer Older
Mattia's avatar
Mattia committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
package mono;

//NOTE: we can't use import, see Generator.GetMonoInitSource

public class MonoRuntimeProvider
	extends android.content.ContentProvider
{
	public MonoRuntimeProvider ()
	{
	}

	@Override
	public boolean onCreate ()
	{
		return true;
	}

	@Override
	public void attachInfo (android.content.Context context, android.content.pm.ProviderInfo info)
	{
		// Mono Runtime Initialization {{{
		android.content.pm.ApplicationInfo applicationInfo = context.getApplicationInfo ();
		String[] apks = null;
		if (android.os.Build.VERSION.SDK_INT >= 21) {
			String[] splitApks = applicationInfo.splitPublicSourceDirs;
			if (splitApks != null && splitApks.length > 0) {
				apks = new String[splitApks.length + 1];
				apks [0] = applicationInfo.sourceDir;
				System.arraycopy (splitApks, 0, apks, 1, splitApks.length);
			}
		}
		if (apks == null) {
			apks = new String[] { applicationInfo.sourceDir };
		}
		mono.MonoPackageManager.LoadApplication (context, applicationInfo, apks);
		// }}}
		super.attachInfo (context, info);
	}

	@Override
	public android.database.Cursor query (android.net.Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
	{
		throw new RuntimeException ("This operation is not supported.");
	}

	@Override
	public String getType (android.net.Uri uri)
	{
		throw new RuntimeException ("This operation is not supported.");
	}

	@Override
	public android.net.Uri insert (android.net.Uri uri, android.content.ContentValues initialValues)
	{
		throw new RuntimeException ("This operation is not supported.");
	}

	@Override
	public int delete (android.net.Uri uri, String where, String[] whereArgs)
	{
		throw new RuntimeException ("This operation is not supported.");
	}

	@Override
	public int update (android.net.Uri uri, android.content.ContentValues values, String where, String[] whereArgs)
	{
		throw new RuntimeException ("This operation is not supported.");
	}
}