weex: Invalid activity declaration for WXPageActivity in playground app
I noticed that the declaration for https://github.com/alibaba/weex/blob/4abcd6cf0070c6301ed64d6bbcdef727365f347e/android/playground/app/src/main/AndroidManifest.xml#L49 contains a bug.
The activity has an intent filter that will match any URI starting with http/https and launch WXPageActivity but this activity is NOT exported. the activity tag specifies that if android:exported
is missing it defaults to android:export=false
If any other app on the phone tries to launch an intent with an http/https uri (eg: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
) that app will crash with a security exception as it is trying to launch an activity that is not exported.
This issue also occurs with the Alibaba.com app
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.VIEW dat=https://tools.usps.com/... cmp=com.alibaba.intl.android.apps.poseidon/com.alibaba.android.intl.weex.activity.WeexPageActivity (has extras) } from ProcessRecord{e23a770 21945:com.shopify.mobile/u0a82} (pid=21945, uid=10082) not exported from uid 10442
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3131)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1540)
at android.app.Activity.startActivityForResult(Activity.java:4283)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:75)
at android.app.Activity.startActivity(Activity.java:4563)
at android.support.v4.app.ActivityCompatJB.startActivity(ActivityCompatJB.java:27)
at android.support.v4.app.ActivityCompat.startActivity(ActivityCompat.java:140)
at android.support.customtabs.CustomTabsIntent.launchUrl(CustomTabsIntent.java:262)
at com.shopify.mobile.lib.app.Router.launchWithChrome(Router.java:126)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 17
- Comments: 19 (4 by maintainers)
@FrankNT
Should I also use try catch when defining a String?
You can avoid crash in your application using try catch
try { context.startActivity(browserIntent); } catch (Exception ex) { Toast.makeText("Error").show(); }
Even if Alibaba eventually fix this, some other apps could make the same mistake again.
Also getting these crashes… This is quite ridiculous, please fix ASAP.
The aliexpress team told me they’ll fix that with next version. @maxme @tahnok .
I uninstalled alibaba app because of this bug. Whoever could fix the problem but chose not to do it promptly hurt alibaba badly.
When will the next version be released? Are there any devs from AliBaba reading this - quite critical - bug?
FYI, I’ve also contacted the team via developer.android@aliexpress.com since we get a lot of crashes in our app due to this issue.
Ref: https://github.com/wordpress-mobile/WordPress-Android/issues/4991