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:
Cody Northrop
2018-06-19 09:17:27 -06:00
parent d13f28433c
commit fbe7b986f2

View File

@@ -45,9 +45,11 @@ public class AppPicker extends ListActivity {
public static final String 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_NON_SYSTEM = "com.android.settings.extra.NON_SYSTEM";
private String mPermissionName;
private boolean mDebuggableOnly;
private boolean mNonSystemOnly;
@Override
protected void onCreate(Bundle icicle) {
@@ -55,6 +57,7 @@ public class AppPicker extends ListActivity {
mPermissionName = getIntent().getStringExtra(EXTRA_REQUESTIING_PERMISSION);
mDebuggableOnly = getIntent().getBooleanExtra(EXTRA_DEBUGGABLE, false);
mNonSystemOnly = getIntent().getBooleanExtra(EXTRA_NON_SYSTEM, false);
mAdapter = new AppListAdapter(this);
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.
if (mPermissionName != null) {
boolean requestsPermission = false;