Allow AppPicker to filter only non-system apps
Bug: 80239516 Test: Manual Change-Id: Iacd98d1aad6341dd229f0f648430bd2c16269e2e (cherry picked from commit 85db17e40cccd34329be9370d99458f28af36c25)
This commit is contained in:
@@ -45,9 +45,11 @@ public class AppPicker extends ListActivity {
|
|||||||
public static final String EXTRA_REQUESTIING_PERMISSION
|
public static final String EXTRA_REQUESTIING_PERMISSION
|
||||||
= "com.android.settings.extra.REQUESTIING_PERMISSION";
|
= "com.android.settings.extra.REQUESTIING_PERMISSION";
|
||||||
public static final String EXTRA_DEBUGGABLE = "com.android.settings.extra.DEBUGGABLE";
|
public static final String EXTRA_DEBUGGABLE = "com.android.settings.extra.DEBUGGABLE";
|
||||||
|
public static final String EXTRA_NON_SYSTEM = "com.android.settings.extra.NON_SYSTEM";
|
||||||
|
|
||||||
private String mPermissionName;
|
private String mPermissionName;
|
||||||
private boolean mDebuggableOnly;
|
private boolean mDebuggableOnly;
|
||||||
|
private boolean mNonSystemOnly;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle) {
|
protected void onCreate(Bundle icicle) {
|
||||||
@@ -55,6 +57,7 @@ public class AppPicker extends ListActivity {
|
|||||||
|
|
||||||
mPermissionName = getIntent().getStringExtra(EXTRA_REQUESTIING_PERMISSION);
|
mPermissionName = getIntent().getStringExtra(EXTRA_REQUESTIING_PERMISSION);
|
||||||
mDebuggableOnly = getIntent().getBooleanExtra(EXTRA_DEBUGGABLE, false);
|
mDebuggableOnly = getIntent().getBooleanExtra(EXTRA_DEBUGGABLE, false);
|
||||||
|
mNonSystemOnly = getIntent().getBooleanExtra(EXTRA_NON_SYSTEM, false);
|
||||||
|
|
||||||
mAdapter = new AppListAdapter(this);
|
mAdapter = new AppListAdapter(this);
|
||||||
if (mAdapter.getCount() <= 0) {
|
if (mAdapter.getCount() <= 0) {
|
||||||
@@ -113,6 +116,11 @@ public class AppPicker extends ListActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter out apps that are system apps if requested
|
||||||
|
if (mNonSystemOnly && ai.isSystemApp()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Filter out apps that do not request the permission if required.
|
// Filter out apps that do not request the permission if required.
|
||||||
if (mPermissionName != null) {
|
if (mPermissionName != null) {
|
||||||
boolean requestsPermission = false;
|
boolean requestsPermission = false;
|
||||||
|
Reference in New Issue
Block a user