oasisfeng / island

Island for Android
https://play.google.com/store/apps/details?id=com.oasisfeng.island
Apache License 2.0
2.65k stars 201 forks source link

System share function crashed after Island initialized in EMUI 9 #48

Open ttimasdf opened 4 years ago

ttimasdf commented 4 years ago

Environment: Android 9, EMUI 9.1.0.222 Island 3.7.5

Symptom: Installed Island and enabled God Mode following the tutorial. After that, using share function from any app, invoking the app picker, will make the whole app crash.

Similar to https://github.com/oasisfeng/island/issues/29#issuecomment-507965054 , seems to be recoverable by completely removing the work profile.

Full crash log by adb logcat -v 'color' '*:W'

  1. Captured during clicking share button in Chrome. crash-chrome.log

  2. from Lynket crash-lynket.log

  3. from Pushbullet crash-pushbullet.log

Some apps with custom implementation of that app picker (e.g. Share Weibo) or sharing to specific app (like Share to Wechat in some apps) is not affected.

ttimasdf commented 4 years ago

补充复现:

用下面的代码片段创建一个空的share intent,并通过PackageManagerService查询能够接受分享的包列表。

        final Intent intent = new Intent(Intent.ACTION_SEND);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.setType("plain/text");

        final PackageManager pm = getPackageManager();
        final List<ResolveInfo> matches = pm.queryIntentActivities(intent, 0);

matches 列表末尾会包含一个无法解析的ResolveInfo,所有字段都是null,但 targetUserId 为10(壶中界的id)。

image

由于EMUI的应用选择框(com.huawei.android.internal.app.HwChooserActivity)也没有处理这个取值为null的异常,所以在Island外触发分享就会导致分享界面崩溃,但壶中界里面没有这个问题。

image

个人猜测可能是EMUI处理多用户的分享可能有问题,但我对安卓不太熟(上面的code snippet都是谷歌搜的 😅 ),请问这个算是Island引入的Bug还是垃圾EMUI?