Handle explicit intent internally for single generic public intent

This will fix apps like Nostalgia crashing because of a “bug” that is
created when the intent is not specifically provided
This commit is contained in:
TwistedUmbrella 2014-04-03 02:29:49 -04:00
parent 164b93be98
commit 9162a927c4
4 changed files with 106 additions and 11 deletions

View File

@ -1,8 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reicast.emulator"
android:sharedUserId="android.uid.reicast"
android:versionCode="6"
android:versionName="0.r6"
android:sharedUserId="android.uid.reicast" >
android:versionName="0.r6" >
<uses-sdk
android:minSdkVersion="8"
@ -10,8 +10,8 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:glEsVersion="0x00020000"
@ -28,8 +28,9 @@
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="xperiaplayoptimized_content"
android:resource="@drawable/ic_xperia_play" />
android:name="xperiaplayoptimized_content"
android:resource="@drawable/ic_xperia_play" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|screenLayout|uiMode|keyboard|keyboardHidden"
@ -40,6 +41,43 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="tv.ouya.intent.category.GAME" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.GDI"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.gdi"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.CHD"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.chd"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.CDI"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.cdi"
android:scheme="file" />
</intent-filter>
</activity>
<activity
android:name=".GL2JNIActivity"
@ -51,7 +89,57 @@
android:value="dc" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="com.reicast.LAUNCH_ROM" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.GDI"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.gdi"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.CHD"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.chd"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.CDI"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.cdi"
android:scheme="file" />
</intent-filter>
</activity>
<activity
android:name=".GL2JNINative"
android:configChanges="orientation|screenSize|screenLayout|uiMode|keyboard|keyboardHidden"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<meta-data
android:name="android.app.lib_name"
android:value="dc" />
<meta-data
android:name="android.app.lib_name"
android:value="sexplay" />
<intent-filter>
<action android:name="com.reicast.LAUNCH_ROM" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

View File

@ -191,7 +191,7 @@ public class GL2JNIActivity extends Activity {
// When viewing a resource, pass its URI to the native code for opening
Intent intent = getIntent();
if (intent.getAction().equals(Intent.ACTION_VIEW))
if (intent.getAction().equals("com.reciast.LAUNCH_ROM"))
fileName = Uri.decode(intent.getData().toString());
// Create the actual GLES view

View File

@ -210,7 +210,7 @@ public class GL2JNINative extends NativeActivity {
// When viewing a resource, pass its URI to the native code for opening
Intent intent = getIntent();
if (intent.getAction().equals(Intent.ACTION_VIEW))
if (intent.getAction().equals("com.reciast.LAUNCH_ROM"))
fileName = Uri.decode(intent.getData().toString());
// Create the actual GLES view

View File

@ -108,6 +108,11 @@ public class MainActivity extends SlidingFragmentActivity implements
getFilesDir().mkdir();
}
JNIdc.config(home_directory);
// When viewing a resource, pass its URI to the native code for opening
Intent intent = getIntent();
if (intent.getAction().equals(Intent.ACTION_VIEW))
onGameSelected(Uri.parse(intent.getData().toString()));
// Check that the activity is using the layout version with
// the fragment_container FrameLayout
@ -309,8 +314,10 @@ public class MainActivity extends SlidingFragmentActivity implements
/**
* Display a dialog to notify the user of prior crash
*
* @param error
* @param string
* A generalized summary of the crash cause
* @param bundle
* The savedInstanceState passed from onCreate
*/
private void displayLogOutput(final String error) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
@ -409,10 +416,10 @@ public class MainActivity extends SlidingFragmentActivity implements
alertDialog.show();
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && Config.nativeact) {
startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(),
startActivity(new Intent("com.reciast.LAUNCH_ROM", uri, getBaseContext(),
GL2JNINative.class));
} else {
startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(),
startActivity(new Intent("com.reciast.LAUNCH_ROM", uri, getBaseContext(),
GL2JNIActivity.class));
}
}