Merge "Make ResolverActivity respect selector intent when making filters" into nyc-dev
am: 651e09f
* commit '651e09fdc1b4c26dc7661e1ab127276656ece041':
Make ResolverActivity respect selector intent when making filters
Change-Id: I4bf1b16e6afb07c7c9bd0172539efa32dc14724e
This commit is contained in:
@@ -668,12 +668,19 @@ public class ResolverActivity extends Activity {
|
|||||||
&& mAdapter.mOrigResolveList != null) {
|
&& mAdapter.mOrigResolveList != null) {
|
||||||
// Build a reasonable intent filter, based on what matched.
|
// Build a reasonable intent filter, based on what matched.
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
String action = intent.getAction();
|
Intent filterIntent;
|
||||||
|
|
||||||
|
if (intent.getSelector() != null) {
|
||||||
|
filterIntent = intent.getSelector();
|
||||||
|
} else {
|
||||||
|
filterIntent = intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
String action = filterIntent.getAction();
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
filter.addAction(action);
|
filter.addAction(action);
|
||||||
}
|
}
|
||||||
Set<String> categories = intent.getCategories();
|
Set<String> categories = filterIntent.getCategories();
|
||||||
if (categories != null) {
|
if (categories != null) {
|
||||||
for (String cat : categories) {
|
for (String cat : categories) {
|
||||||
filter.addCategory(cat);
|
filter.addCategory(cat);
|
||||||
@@ -682,9 +689,9 @@ public class ResolverActivity extends Activity {
|
|||||||
filter.addCategory(Intent.CATEGORY_DEFAULT);
|
filter.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
|
|
||||||
int cat = ri.match & IntentFilter.MATCH_CATEGORY_MASK;
|
int cat = ri.match & IntentFilter.MATCH_CATEGORY_MASK;
|
||||||
Uri data = intent.getData();
|
Uri data = filterIntent.getData();
|
||||||
if (cat == IntentFilter.MATCH_CATEGORY_TYPE) {
|
if (cat == IntentFilter.MATCH_CATEGORY_TYPE) {
|
||||||
String mimeType = intent.resolveType(this);
|
String mimeType = filterIntent.resolveType(this);
|
||||||
if (mimeType != null) {
|
if (mimeType != null) {
|
||||||
try {
|
try {
|
||||||
filter.addDataType(mimeType);
|
filter.addDataType(mimeType);
|
||||||
|
|||||||
Reference in New Issue
Block a user