Skip to content

Commit 2d80962

Browse files
committed
Let users reach app details from ResolverActivity
A long press on a list item in ResolverActivity (shown when users are asked to choose an activity to complete an action) will now open the app detail settings for the package providing that item. This is a work in progress; awaiting more UX input on other changes and better discoverability of this feature. Change-Id: I2cc07c5520fdd23cf1a43f169b114295f5d9d0ac
1 parent 3004cc5 commit 2d80962

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

core/java/com/android/internal/app/ResolverActivity.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@
3333
import android.os.Bundle;
3434
import android.os.PatternMatcher;
3535
import android.util.Log;
36+
import android.view.LayoutInflater;
3637
import android.view.View;
3738
import android.view.ViewGroup;
38-
import android.view.LayoutInflater;
39+
import android.widget.AdapterView;
3940
import android.widget.BaseAdapter;
4041
import android.widget.CheckBox;
4142
import android.widget.CompoundButton;
4243
import android.widget.ImageView;
44+
import android.widget.ListView;
4345
import android.widget.TextView;
46+
4447
import java.util.ArrayList;
4548
import java.util.Collections;
4649
import java.util.HashSet;
@@ -122,6 +125,11 @@ protected void onCreate(Bundle savedInstanceState, Intent intent,
122125
}
123126

124127
setupAlert();
128+
129+
ListView lv = mAlert.getListView();
130+
if (lv != null) {
131+
lv.setOnItemLongClickListener(new ItemLongClickListener());
132+
}
125133
}
126134

127135
@Override
@@ -489,5 +497,18 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
489497
mClearDefaultHint.setVisibility(View.GONE);
490498
}
491499
}
500+
501+
class ItemLongClickListener implements AdapterView.OnItemLongClickListener {
502+
503+
@Override
504+
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
505+
ResolveInfo ri = mAdapter.resolveInfoForPosition(position);
506+
Intent in = new Intent().setAction("android.settings.APPLICATION_DETAILS_SETTINGS")
507+
.setData(Uri.fromParts("package", ri.activityInfo.packageName, null));
508+
startActivity(in);
509+
return true;
510+
}
511+
512+
}
492513
}
493514

0 commit comments

Comments
 (0)