一、系统分享面板界面入口
打开Git命令行,输入adb shell dumpsys activity | grep "Running activities" -A 7
可以得知分享面板的界面类为ChooserActivity。
- ChooserActivity是如何被启动的
通过查看浏览器应用/packages/apps/Browser
源码/packages/apps/Browser/src/com/android/browser/Controller.java
static final void sharePage(Context c, String title, String url,
Bitmap favicon, Bitmap screenshot) {
Intent send = new Intent(Intent.ACTION_SEND);
send.setType("text/plain");
send.putExtra(Intent.EXTRA_TEXT, url);
send.putExtra(Intent.EXTRA_SUBJECT, title);
send.putExtra(Browser.EXTRA_SHARE_FAVICON, favicon);
send.putExtra(Browser.EXTRA_SHARE_SCREENSHOT, screenshot);
try {
c.startActivity((send, c.getString(
R.string.choosertitle_sharevia)));
} catch (android.content.ActivityNotFoundException ex) {
// if no app handles it, do nothing
}
}
Intent.createChooser()方法启动action为"android.intent.action.CHOOSER"的activity,也就是ChooserActivity.java。
- ChooserActivity.java
源码位置:
/frameworks/base/core/java/com/android/internal/app/ChooserActivity.java
>可跳转的应用是如何加载的?
//TODO
点击应用做了啥?
//TODO
- ResolverActivity.java
源码位置:/frameworks/base/core/java/com/android/internal/app/ResolverActivity.java
0 条评论