Merge "Revert ResolverActivity changes associated with browseables." into rvc-dev am: 101fcc5746
Change-Id: I3cd05030567145ae5528db56a3b4d73faa4fb814
This commit is contained in:
@@ -54,8 +54,6 @@ public abstract class AbstractResolverComparator implements Comparator<ResolvedC
|
|||||||
|
|
||||||
// True if the current share is a link.
|
// True if the current share is a link.
|
||||||
private final boolean mHttp;
|
private final boolean mHttp;
|
||||||
// can be null if mHttp == false or current user has no default browser package
|
|
||||||
private final String mDefaultBrowserPackageName;
|
|
||||||
|
|
||||||
// message types
|
// message types
|
||||||
static final int RANKER_SERVICE_RESULT = 0;
|
static final int RANKER_SERVICE_RESULT = 0;
|
||||||
@@ -102,9 +100,6 @@ public abstract class AbstractResolverComparator implements Comparator<ResolvedC
|
|||||||
getContentAnnotations(intent);
|
getContentAnnotations(intent);
|
||||||
mPm = context.getPackageManager();
|
mPm = context.getPackageManager();
|
||||||
mUsm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
|
mUsm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
|
||||||
mDefaultBrowserPackageName = mHttp
|
|
||||||
? mPm.getDefaultBrowserPackageNameAsUser(UserHandle.myUserId())
|
|
||||||
: null;
|
|
||||||
mAzComparator = new AzInfoComparator(context);
|
mAzComparator = new AzInfoComparator(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,17 +152,6 @@ public abstract class AbstractResolverComparator implements Comparator<ResolvedC
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mHttp) {
|
if (mHttp) {
|
||||||
// Special case: we want filters that match URI paths/schemes to be
|
|
||||||
// ordered before others. This is for the case when opening URIs,
|
|
||||||
// to make native apps go above browsers - except for 1 even more special case
|
|
||||||
// which is the default browser, as we want that to go above them all.
|
|
||||||
if (isDefaultBrowser(lhs)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDefaultBrowser(rhs)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
final boolean lhsSpecific = ResolverActivity.isSpecificUriMatch(lhs.match);
|
final boolean lhsSpecific = ResolverActivity.isSpecificUriMatch(lhs.match);
|
||||||
final boolean rhsSpecific = ResolverActivity.isSpecificUriMatch(rhs.match);
|
final boolean rhsSpecific = ResolverActivity.isSpecificUriMatch(rhs.match);
|
||||||
if (lhsSpecific != rhsSpecific) {
|
if (lhsSpecific != rhsSpecific) {
|
||||||
@@ -272,21 +256,6 @@ public abstract class AbstractResolverComparator implements Comparator<ResolvedC
|
|||||||
mAfterCompute = null;
|
mAfterCompute = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDefaultBrowser(ResolveInfo ri) {
|
|
||||||
// It makes sense to prefer the default browser
|
|
||||||
// only if the targeted user is the current user
|
|
||||||
if (ri.targetUserId != UserHandle.USER_CURRENT) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ri.activityInfo.packageName != null
|
|
||||||
&& ri.activityInfo.packageName.equals(mDefaultBrowserPackageName)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort intents alphabetically based on package name.
|
* Sort intents alphabetically based on package name.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -875,7 +875,6 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
initialIntents,
|
initialIntents,
|
||||||
rList,
|
rList,
|
||||||
filterLastUsed,
|
filterLastUsed,
|
||||||
mUseLayoutForBrowsables,
|
|
||||||
/* userHandle */ UserHandle.of(UserHandle.myUserId()));
|
/* userHandle */ UserHandle.of(UserHandle.myUserId()));
|
||||||
return new ChooserMultiProfilePagerAdapter(
|
return new ChooserMultiProfilePagerAdapter(
|
||||||
/* context */ this,
|
/* context */ this,
|
||||||
@@ -896,7 +895,6 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
selectedProfile == PROFILE_PERSONAL ? initialIntents : null,
|
selectedProfile == PROFILE_PERSONAL ? initialIntents : null,
|
||||||
rList,
|
rList,
|
||||||
filterLastUsed,
|
filterLastUsed,
|
||||||
mUseLayoutForBrowsables,
|
|
||||||
/* userHandle */ getPersonalProfileUserHandle());
|
/* userHandle */ getPersonalProfileUserHandle());
|
||||||
ChooserGridAdapter workAdapter = createChooserGridAdapter(
|
ChooserGridAdapter workAdapter = createChooserGridAdapter(
|
||||||
/* context */ this,
|
/* context */ this,
|
||||||
@@ -904,7 +902,6 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
selectedProfile == PROFILE_WORK ? initialIntents : null,
|
selectedProfile == PROFILE_WORK ? initialIntents : null,
|
||||||
rList,
|
rList,
|
||||||
filterLastUsed,
|
filterLastUsed,
|
||||||
mUseLayoutForBrowsables,
|
|
||||||
/* userHandle */ getWorkProfileUserHandle());
|
/* userHandle */ getWorkProfileUserHandle());
|
||||||
return new ChooserMultiProfilePagerAdapter(
|
return new ChooserMultiProfilePagerAdapter(
|
||||||
/* context */ this,
|
/* context */ this,
|
||||||
@@ -2486,10 +2483,10 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public ChooserGridAdapter createChooserGridAdapter(Context context,
|
public ChooserGridAdapter createChooserGridAdapter(Context context,
|
||||||
List<Intent> payloadIntents, Intent[] initialIntents, List<ResolveInfo> rList,
|
List<Intent> payloadIntents, Intent[] initialIntents, List<ResolveInfo> rList,
|
||||||
boolean filterLastUsed, boolean useLayoutForBrowsables, UserHandle userHandle) {
|
boolean filterLastUsed, UserHandle userHandle) {
|
||||||
ChooserListAdapter chooserListAdapter = createChooserListAdapter(context, payloadIntents,
|
ChooserListAdapter chooserListAdapter = createChooserListAdapter(context, payloadIntents,
|
||||||
initialIntents, rList, filterLastUsed,
|
initialIntents, rList, filterLastUsed,
|
||||||
useLayoutForBrowsables, createListController(userHandle));
|
createListController(userHandle));
|
||||||
AppPredictor.Callback appPredictorCallback = createAppPredictorCallback(chooserListAdapter);
|
AppPredictor.Callback appPredictorCallback = createAppPredictorCallback(chooserListAdapter);
|
||||||
AppPredictor appPredictor = setupAppPredictorForUser(userHandle, appPredictorCallback);
|
AppPredictor appPredictor = setupAppPredictorForUser(userHandle, appPredictorCallback);
|
||||||
chooserListAdapter.setAppPredictor(appPredictor);
|
chooserListAdapter.setAppPredictor(appPredictor);
|
||||||
@@ -2500,11 +2497,10 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public ChooserListAdapter createChooserListAdapter(Context context,
|
public ChooserListAdapter createChooserListAdapter(Context context,
|
||||||
List<Intent> payloadIntents, Intent[] initialIntents, List<ResolveInfo> rList,
|
List<Intent> payloadIntents, Intent[] initialIntents, List<ResolveInfo> rList,
|
||||||
boolean filterLastUsed, boolean useLayoutForBrowsables,
|
boolean filterLastUsed, ResolverListController resolverListController) {
|
||||||
ResolverListController resolverListController) {
|
|
||||||
return new ChooserListAdapter(context, payloadIntents, initialIntents, rList,
|
return new ChooserListAdapter(context, payloadIntents, initialIntents, rList,
|
||||||
filterLastUsed, resolverListController, useLayoutForBrowsables,
|
filterLastUsed, resolverListController, this,
|
||||||
this, this, context.getPackageManager());
|
this, context.getPackageManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -120,15 +120,13 @@ public class ChooserListAdapter extends ResolverListAdapter {
|
|||||||
public ChooserListAdapter(Context context, List<Intent> payloadIntents,
|
public ChooserListAdapter(Context context, List<Intent> payloadIntents,
|
||||||
Intent[] initialIntents, List<ResolveInfo> rList,
|
Intent[] initialIntents, List<ResolveInfo> rList,
|
||||||
boolean filterLastUsed, ResolverListController resolverListController,
|
boolean filterLastUsed, ResolverListController resolverListController,
|
||||||
boolean useLayoutForBrowsables,
|
|
||||||
ChooserListCommunicator chooserListCommunicator,
|
ChooserListCommunicator chooserListCommunicator,
|
||||||
SelectableTargetInfo.SelectableTargetInfoCommunicator selectableTargetInfoCommunicator,
|
SelectableTargetInfo.SelectableTargetInfoCommunicator selectableTargetInfoCommunicator,
|
||||||
PackageManager packageManager) {
|
PackageManager packageManager) {
|
||||||
// Don't send the initial intents through the shared ResolverActivity path,
|
// Don't send the initial intents through the shared ResolverActivity path,
|
||||||
// we want to separate them into a different section.
|
// we want to separate them into a different section.
|
||||||
super(context, payloadIntents, null, rList, filterLastUsed,
|
super(context, payloadIntents, null, rList, filterLastUsed,
|
||||||
resolverListController, useLayoutForBrowsables,
|
resolverListController, chooserListCommunicator, false);
|
||||||
chooserListCommunicator, false);
|
|
||||||
|
|
||||||
createPlaceHolders();
|
createPlaceHolders();
|
||||||
mMaxShortcutTargetsPerApp =
|
mMaxShortcutTargetsPerApp =
|
||||||
|
|||||||
@@ -133,9 +133,6 @@ public class ResolverActivity extends Activity implements
|
|||||||
private CharSequence mTitle;
|
private CharSequence mTitle;
|
||||||
private int mDefaultTitleResId;
|
private int mDefaultTitleResId;
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
protected boolean mUseLayoutForBrowsables;
|
|
||||||
|
|
||||||
// Whether or not this activity supports choosing a default handler for the intent.
|
// Whether or not this activity supports choosing a default handler for the intent.
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected boolean mSupportsAlwaysUseOption;
|
protected boolean mSupportsAlwaysUseOption;
|
||||||
@@ -364,10 +361,6 @@ public class ResolverActivity extends Activity implements
|
|||||||
mTitle = title;
|
mTitle = title;
|
||||||
mDefaultTitleResId = defaultTitleRes;
|
mDefaultTitleResId = defaultTitleRes;
|
||||||
|
|
||||||
mUseLayoutForBrowsables = getTargetIntent() == null
|
|
||||||
? false
|
|
||||||
: isHttpSchemeAndViewAction(getTargetIntent());
|
|
||||||
|
|
||||||
mSupportsAlwaysUseOption = supportsAlwaysUseOption;
|
mSupportsAlwaysUseOption = supportsAlwaysUseOption;
|
||||||
mWorkProfileUserHandle = fetchWorkProfileUserProfile();
|
mWorkProfileUserHandle = fetchWorkProfileUserProfile();
|
||||||
|
|
||||||
@@ -461,7 +454,6 @@ public class ResolverActivity extends Activity implements
|
|||||||
initialIntents,
|
initialIntents,
|
||||||
rList,
|
rList,
|
||||||
filterLastUsed,
|
filterLastUsed,
|
||||||
mUseLayoutForBrowsables,
|
|
||||||
/* userHandle */ UserHandle.of(UserHandle.myUserId()));
|
/* userHandle */ UserHandle.of(UserHandle.myUserId()));
|
||||||
return new ResolverMultiProfilePagerAdapter(
|
return new ResolverMultiProfilePagerAdapter(
|
||||||
/* context */ this,
|
/* context */ this,
|
||||||
@@ -500,7 +492,6 @@ public class ResolverActivity extends Activity implements
|
|||||||
rList,
|
rList,
|
||||||
(filterLastUsed && UserHandle.myUserId()
|
(filterLastUsed && UserHandle.myUserId()
|
||||||
== getPersonalProfileUserHandle().getIdentifier()),
|
== getPersonalProfileUserHandle().getIdentifier()),
|
||||||
mUseLayoutForBrowsables,
|
|
||||||
/* userHandle */ getPersonalProfileUserHandle());
|
/* userHandle */ getPersonalProfileUserHandle());
|
||||||
UserHandle workProfileUserHandle = getWorkProfileUserHandle();
|
UserHandle workProfileUserHandle = getWorkProfileUserHandle();
|
||||||
ResolverListAdapter workAdapter = createResolverListAdapter(
|
ResolverListAdapter workAdapter = createResolverListAdapter(
|
||||||
@@ -510,7 +501,6 @@ public class ResolverActivity extends Activity implements
|
|||||||
rList,
|
rList,
|
||||||
(filterLastUsed && UserHandle.myUserId()
|
(filterLastUsed && UserHandle.myUserId()
|
||||||
== workProfileUserHandle.getIdentifier()),
|
== workProfileUserHandle.getIdentifier()),
|
||||||
mUseLayoutForBrowsables,
|
|
||||||
/* userHandle */ workProfileUserHandle);
|
/* userHandle */ workProfileUserHandle);
|
||||||
return new ResolverMultiProfilePagerAdapter(
|
return new ResolverMultiProfilePagerAdapter(
|
||||||
/* context */ this,
|
/* context */ this,
|
||||||
@@ -775,26 +765,6 @@ public class ResolverActivity extends Activity implements
|
|||||||
mMultiProfilePagerAdapter.getActiveListAdapter().getFilteredPosition() >= 0;
|
mMultiProfilePagerAdapter.getActiveListAdapter().getFilteredPosition() >= 0;
|
||||||
if (title == ActionTitle.DEFAULT && defaultTitleRes != 0) {
|
if (title == ActionTitle.DEFAULT && defaultTitleRes != 0) {
|
||||||
return getString(defaultTitleRes);
|
return getString(defaultTitleRes);
|
||||||
} else if (isHttpSchemeAndViewAction(intent)) {
|
|
||||||
// If the Intent's scheme is http(s) then we need to warn the user that
|
|
||||||
// they're giving access for the activity to open URLs from this specific host
|
|
||||||
String dialogTitle = null;
|
|
||||||
if (named && !mUseLayoutForBrowsables) {
|
|
||||||
dialogTitle = getString(ActionTitle.BROWSABLE_APP_TITLE_RES,
|
|
||||||
mMultiProfilePagerAdapter.getActiveListAdapter().getFilteredItem()
|
|
||||||
.getDisplayLabel());
|
|
||||||
} else if (named && mUseLayoutForBrowsables) {
|
|
||||||
dialogTitle = getString(ActionTitle.BROWSABLE_HOST_APP_TITLE_RES,
|
|
||||||
intent.getData().getHost(),
|
|
||||||
mMultiProfilePagerAdapter.getActiveListAdapter().getFilteredItem()
|
|
||||||
.getDisplayLabel());
|
|
||||||
} else if (mMultiProfilePagerAdapter.getActiveListAdapter().areAllTargetsBrowsers()) {
|
|
||||||
dialogTitle = getString(ActionTitle.BROWSABLE_TITLE_RES);
|
|
||||||
} else {
|
|
||||||
dialogTitle = getString(ActionTitle.BROWSABLE_HOST_TITLE_RES,
|
|
||||||
intent.getData().getHost());
|
|
||||||
}
|
|
||||||
return dialogTitle;
|
|
||||||
} else {
|
} else {
|
||||||
return named
|
return named
|
||||||
? getString(title.namedTitleRes, mMultiProfilePagerAdapter
|
? getString(title.namedTitleRes, mMultiProfilePagerAdapter
|
||||||
@@ -907,12 +877,6 @@ public class ResolverActivity extends Activity implements
|
|||||||
mMultiProfilePagerAdapter.clearInactiveProfileCache();
|
mMultiProfilePagerAdapter.clearInactiveProfileCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isHttpSchemeAndViewAction(Intent intent) {
|
|
||||||
return (IntentFilter.SCHEME_HTTP.equals(intent.getScheme())
|
|
||||||
|| IntentFilter.SCHEME_HTTPS.equals(intent.getScheme()))
|
|
||||||
&& Intent.ACTION_VIEW.equals(intent.getAction());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasManagedProfile() {
|
private boolean hasManagedProfile() {
|
||||||
UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
|
UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||||
if (userManager == null) {
|
if (userManager == null) {
|
||||||
@@ -963,13 +927,9 @@ public class ResolverActivity extends Activity implements
|
|||||||
} else {
|
} else {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
if (mUseLayoutForBrowsables && !ri.handleAllWebDataURI) {
|
|
||||||
mAlwaysButton.setText(getResources()
|
mAlwaysButton.setText(getResources()
|
||||||
.getString(R.string.activity_resolver_set_always));
|
.getString(R.string.activity_resolver_use_always));
|
||||||
} else {
|
|
||||||
mAlwaysButton.setText(getResources()
|
|
||||||
.getString(R.string.activity_resolver_use_always));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
@@ -999,31 +959,7 @@ public class ResolverActivity extends Activity implements
|
|||||||
? currentListAdapter.getFilteredPosition()
|
? currentListAdapter.getFilteredPosition()
|
||||||
: listView.getCheckedItemPosition();
|
: listView.getCheckedItemPosition();
|
||||||
boolean hasIndexBeenFiltered = !currentListAdapter.hasFilteredItem();
|
boolean hasIndexBeenFiltered = !currentListAdapter.hasFilteredItem();
|
||||||
ResolveInfo ri = currentListAdapter.resolveInfoForPosition(which, hasIndexBeenFiltered);
|
startSelected(which, id == R.id.button_always, hasIndexBeenFiltered);
|
||||||
if (mUseLayoutForBrowsables
|
|
||||||
&& !ri.handleAllWebDataURI && id == R.id.button_always) {
|
|
||||||
showSettingsForSelected(ri);
|
|
||||||
} else {
|
|
||||||
startSelected(which, id == R.id.button_always, hasIndexBeenFiltered);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showSettingsForSelected(ResolveInfo ri) {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
|
|
||||||
final String packageName = ri.activityInfo.packageName;
|
|
||||||
Bundle showFragmentArgs = new Bundle();
|
|
||||||
showFragmentArgs.putString(EXTRA_FRAGMENT_ARG_KEY, OPEN_LINKS_COMPONENT_KEY);
|
|
||||||
showFragmentArgs.putString("package", packageName);
|
|
||||||
|
|
||||||
// For regular apps, we open the Open by Default page
|
|
||||||
intent.setAction(Settings.ACTION_APP_OPEN_BY_DEFAULT_SETTINGS)
|
|
||||||
.setData(Uri.fromParts("package", packageName, null))
|
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)
|
|
||||||
.putExtra(EXTRA_FRAGMENT_ARG_KEY, OPEN_LINKS_COMPONENT_KEY)
|
|
||||||
.putExtra(EXTRA_SHOW_FRAGMENT_ARGS, showFragmentArgs);
|
|
||||||
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startSelected(int which, boolean always, boolean hasIndexBeenFiltered) {
|
public void startSelected(int which, boolean always, boolean hasIndexBeenFiltered) {
|
||||||
@@ -1415,12 +1351,12 @@ public class ResolverActivity extends Activity implements
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected ResolverListAdapter createResolverListAdapter(Context context,
|
protected ResolverListAdapter createResolverListAdapter(Context context,
|
||||||
List<Intent> payloadIntents, Intent[] initialIntents, List<ResolveInfo> rList,
|
List<Intent> payloadIntents, Intent[] initialIntents, List<ResolveInfo> rList,
|
||||||
boolean filterLastUsed, boolean useLayoutForBrowsables, UserHandle userHandle) {
|
boolean filterLastUsed, UserHandle userHandle) {
|
||||||
Intent startIntent = getIntent();
|
Intent startIntent = getIntent();
|
||||||
boolean isAudioCaptureDevice =
|
boolean isAudioCaptureDevice =
|
||||||
startIntent.getBooleanExtra(EXTRA_IS_AUDIO_CAPTURE_DEVICE, false);
|
startIntent.getBooleanExtra(EXTRA_IS_AUDIO_CAPTURE_DEVICE, false);
|
||||||
return new ResolverListAdapter(context, payloadIntents, initialIntents, rList,
|
return new ResolverListAdapter(context, payloadIntents, initialIntents, rList,
|
||||||
filterLastUsed, createListController(userHandle), useLayoutForBrowsables, this,
|
filterLastUsed, createListController(userHandle), this,
|
||||||
isAudioCaptureDevice);
|
isAudioCaptureDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1794,7 +1730,7 @@ public class ResolverActivity extends Activity implements
|
|||||||
listView.setOnItemClickListener(listener);
|
listView.setOnItemClickListener(listener);
|
||||||
listView.setOnItemLongClickListener(listener);
|
listView.setOnItemLongClickListener(listener);
|
||||||
|
|
||||||
if (mSupportsAlwaysUseOption || mUseLayoutForBrowsables) {
|
if (mSupportsAlwaysUseOption) {
|
||||||
listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
|
listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1835,7 +1771,7 @@ public class ResolverActivity extends Activity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void resetButtonBar() {
|
protected void resetButtonBar() {
|
||||||
if (!mSupportsAlwaysUseOption && !mUseLayoutForBrowsables) {
|
if (!mSupportsAlwaysUseOption) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ViewGroup buttonLayout = findViewById(R.id.button_bar);
|
final ViewGroup buttonLayout = findViewById(R.id.button_bar);
|
||||||
|
|||||||
@@ -69,13 +69,11 @@ public class ResolverListAdapter extends BaseAdapter {
|
|||||||
private final PackageManager mPm;
|
private final PackageManager mPm;
|
||||||
protected final Context mContext;
|
protected final Context mContext;
|
||||||
private final ColorMatrixColorFilter mSuspendedMatrixColorFilter;
|
private final ColorMatrixColorFilter mSuspendedMatrixColorFilter;
|
||||||
private final boolean mUseLayoutForBrowsables;
|
|
||||||
private final int mIconDpi;
|
private final int mIconDpi;
|
||||||
protected ResolveInfo mLastChosen;
|
protected ResolveInfo mLastChosen;
|
||||||
private DisplayResolveInfo mOtherProfile;
|
private DisplayResolveInfo mOtherProfile;
|
||||||
ResolverListController mResolverListController;
|
ResolverListController mResolverListController;
|
||||||
private int mPlaceholderCount;
|
private int mPlaceholderCount;
|
||||||
private boolean mAllTargetsAreBrowsers = false;
|
|
||||||
|
|
||||||
protected final LayoutInflater mInflater;
|
protected final LayoutInflater mInflater;
|
||||||
|
|
||||||
@@ -94,7 +92,6 @@ public class ResolverListAdapter extends BaseAdapter {
|
|||||||
Intent[] initialIntents, List<ResolveInfo> rList,
|
Intent[] initialIntents, List<ResolveInfo> rList,
|
||||||
boolean filterLastUsed,
|
boolean filterLastUsed,
|
||||||
ResolverListController resolverListController,
|
ResolverListController resolverListController,
|
||||||
boolean useLayoutForBrowsables,
|
|
||||||
ResolverListCommunicator resolverListCommunicator,
|
ResolverListCommunicator resolverListCommunicator,
|
||||||
boolean isAudioCaptureDevice) {
|
boolean isAudioCaptureDevice) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -107,7 +104,6 @@ public class ResolverListAdapter extends BaseAdapter {
|
|||||||
mFilterLastUsed = filterLastUsed;
|
mFilterLastUsed = filterLastUsed;
|
||||||
mResolverListController = resolverListController;
|
mResolverListController = resolverListController;
|
||||||
mSuspendedMatrixColorFilter = createSuspendedColorMatrix();
|
mSuspendedMatrixColorFilter = createSuspendedColorMatrix();
|
||||||
mUseLayoutForBrowsables = useLayoutForBrowsables;
|
|
||||||
mResolverListCommunicator = resolverListCommunicator;
|
mResolverListCommunicator = resolverListCommunicator;
|
||||||
mIsAudioCaptureDevice = isAudioCaptureDevice;
|
mIsAudioCaptureDevice = isAudioCaptureDevice;
|
||||||
final ActivityManager am = (ActivityManager) mContext.getSystemService(ACTIVITY_SERVICE);
|
final ActivityManager am = (ActivityManager) mContext.getSystemService(ACTIVITY_SERVICE);
|
||||||
@@ -182,14 +178,6 @@ public class ResolverListAdapter extends BaseAdapter {
|
|||||||
return mUnfilteredResolveList;
|
return mUnfilteredResolveList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if all items in the display list are defined as browsers by
|
|
||||||
* ResolveInfo.handleAllWebDataURI
|
|
||||||
*/
|
|
||||||
public boolean areAllTargetsBrowsers() {
|
|
||||||
return mAllTargetsAreBrowsers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuild the list of resolvers. In some cases some parts will need some asynchronous work
|
* Rebuild the list of resolvers. In some cases some parts will need some asynchronous work
|
||||||
* to complete.
|
* to complete.
|
||||||
@@ -207,7 +195,6 @@ public class ResolverListAdapter extends BaseAdapter {
|
|||||||
mOtherProfile = null;
|
mOtherProfile = null;
|
||||||
mLastChosen = null;
|
mLastChosen = null;
|
||||||
mLastChosenPosition = -1;
|
mLastChosenPosition = -1;
|
||||||
mAllTargetsAreBrowsers = false;
|
|
||||||
mDisplayList.clear();
|
mDisplayList.clear();
|
||||||
mIsTabLoaded = false;
|
mIsTabLoaded = false;
|
||||||
|
|
||||||
@@ -322,8 +309,6 @@ public class ResolverListAdapter extends BaseAdapter {
|
|||||||
boolean doPostProcessing) {
|
boolean doPostProcessing) {
|
||||||
int n;
|
int n;
|
||||||
if (sortedComponents != null && (n = sortedComponents.size()) != 0) {
|
if (sortedComponents != null && (n = sortedComponents.size()) != 0) {
|
||||||
mAllTargetsAreBrowsers = mUseLayoutForBrowsables;
|
|
||||||
|
|
||||||
// First put the initial items at the top.
|
// First put the initial items at the top.
|
||||||
if (mInitialIntents != null) {
|
if (mInitialIntents != null) {
|
||||||
for (int i = 0; i < mInitialIntents.length; i++) {
|
for (int i = 0; i < mInitialIntents.length; i++) {
|
||||||
@@ -353,7 +338,6 @@ public class ResolverListAdapter extends BaseAdapter {
|
|||||||
ri.noResourceId = true;
|
ri.noResourceId = true;
|
||||||
ri.icon = 0;
|
ri.icon = 0;
|
||||||
}
|
}
|
||||||
mAllTargetsAreBrowsers &= ri.handleAllWebDataURI;
|
|
||||||
|
|
||||||
addResolveInfo(new DisplayResolveInfo(ii, ri,
|
addResolveInfo(new DisplayResolveInfo(ii, ri,
|
||||||
ri.loadLabel(mPm), null, ii, makePresentationGetter(ri)));
|
ri.loadLabel(mPm), null, ii, makePresentationGetter(ri)));
|
||||||
@@ -364,7 +348,6 @@ public class ResolverListAdapter extends BaseAdapter {
|
|||||||
for (ResolvedComponentInfo rci : sortedComponents) {
|
for (ResolvedComponentInfo rci : sortedComponents) {
|
||||||
final ResolveInfo ri = rci.getResolveInfoAt(0);
|
final ResolveInfo ri = rci.getResolveInfoAt(0);
|
||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
mAllTargetsAreBrowsers &= ri.handleAllWebDataURI;
|
|
||||||
addResolveInfoWithAlternates(rci);
|
addResolveInfoWithAlternates(rci);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4137,18 +4137,10 @@
|
|||||||
as the default in the activity resolver. [CHAR LIMIT=25] -->
|
as the default in the activity resolver. [CHAR LIMIT=25] -->
|
||||||
<string name="activity_resolver_use_always">Always</string>
|
<string name="activity_resolver_use_always">Always</string>
|
||||||
|
|
||||||
<!-- Title for a button to choose the currently selected activity
|
|
||||||
as the default in the activity resolver. [CHAR LIMIT=50] -->
|
|
||||||
<string name="activity_resolver_set_always">Set to always open</string>
|
|
||||||
|
|
||||||
<!-- Title for a button to choose the currently selected activity
|
<!-- Title for a button to choose the currently selected activity
|
||||||
from the activity resolver to use just this once. [CHAR LIMIT=25] -->
|
from the activity resolver to use just this once. [CHAR LIMIT=25] -->
|
||||||
<string name="activity_resolver_use_once">Just once</string>
|
<string name="activity_resolver_use_once">Just once</string>
|
||||||
|
|
||||||
<!-- Title for a button to choose to go to
|
|
||||||
'Open by Default' app settings. [CHAR LIMIT=25] -->
|
|
||||||
<string name="activity_resolver_app_settings">Settings</string>
|
|
||||||
|
|
||||||
<!-- Text for the toast that is shown when the user clicks on a launcher that
|
<!-- Text for the toast that is shown when the user clicks on a launcher that
|
||||||
doesn't support the work profile. [CHAR LIMIT=100] -->
|
doesn't support the work profile. [CHAR LIMIT=100] -->
|
||||||
<string name="activity_resolver_work_profiles_support">%1$s doesn\'t support work profile</string>
|
<string name="activity_resolver_work_profiles_support">%1$s doesn\'t support work profile</string>
|
||||||
|
|||||||
@@ -2552,7 +2552,6 @@
|
|||||||
<java-symbol type="bool" name="config_allow_ussd_over_ims" />
|
<java-symbol type="bool" name="config_allow_ussd_over_ims" />
|
||||||
<java-symbol type="attr" name="touchscreenBlocksFocus" />
|
<java-symbol type="attr" name="touchscreenBlocksFocus" />
|
||||||
<java-symbol type="layout" name="resolver_list_with_default" />
|
<java-symbol type="layout" name="resolver_list_with_default" />
|
||||||
<java-symbol type="string" name="activity_resolver_set_always" />
|
|
||||||
<java-symbol type="string" name="activity_resolver_use_always" />
|
<java-symbol type="string" name="activity_resolver_use_always" />
|
||||||
<java-symbol type="string" name="whichApplicationNamed" />
|
<java-symbol type="string" name="whichApplicationNamed" />
|
||||||
<java-symbol type="string" name="whichApplicationLabel" />
|
<java-symbol type="string" name="whichApplicationLabel" />
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ public class ChooserWrapperActivity extends ChooserActivity {
|
|||||||
@Override
|
@Override
|
||||||
public ChooserListAdapter createChooserListAdapter(Context context, List<Intent> payloadIntents,
|
public ChooserListAdapter createChooserListAdapter(Context context, List<Intent> payloadIntents,
|
||||||
Intent[] initialIntents, List<ResolveInfo> rList, boolean filterLastUsed,
|
Intent[] initialIntents, List<ResolveInfo> rList, boolean filterLastUsed,
|
||||||
boolean useLayoutForBrowsables, ResolverListController resolverListController) {
|
ResolverListController resolverListController) {
|
||||||
PackageManager packageManager =
|
PackageManager packageManager =
|
||||||
sOverrides.packageManager == null ? context.getPackageManager()
|
sOverrides.packageManager == null ? context.getPackageManager()
|
||||||
: sOverrides.packageManager;
|
: sOverrides.packageManager;
|
||||||
return new ChooserListAdapter(context, payloadIntents, initialIntents, rList,
|
return new ChooserListAdapter(context, payloadIntents, initialIntents, rList,
|
||||||
filterLastUsed, resolverListController, useLayoutForBrowsables,
|
filterLastUsed, resolverListController,
|
||||||
this, this, packageManager);
|
this, this, packageManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ public class ResolverWrapperActivity extends ResolverActivity {
|
|||||||
@Override
|
@Override
|
||||||
public ResolverListAdapter createResolverListAdapter(Context context,
|
public ResolverListAdapter createResolverListAdapter(Context context,
|
||||||
List<Intent> payloadIntents, Intent[] initialIntents, List<ResolveInfo> rList,
|
List<Intent> payloadIntents, Intent[] initialIntents, List<ResolveInfo> rList,
|
||||||
boolean filterLastUsed, boolean useLayoutForBrowsables, UserHandle userHandle) {
|
boolean filterLastUsed, UserHandle userHandle) {
|
||||||
return new ResolverWrapperAdapter(context, payloadIntents, initialIntents, rList,
|
return new ResolverWrapperAdapter(context, payloadIntents, initialIntents, rList,
|
||||||
filterLastUsed, createListController(userHandle), useLayoutForBrowsables, this);
|
filterLastUsed, createListController(userHandle), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -166,4 +166,4 @@ public class ResolverWrapperActivity extends ResolverActivity {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,11 +35,10 @@ public class ResolverWrapperAdapter extends ResolverListAdapter {
|
|||||||
List<Intent> payloadIntents,
|
List<Intent> payloadIntents,
|
||||||
Intent[] initialIntents,
|
Intent[] initialIntents,
|
||||||
List<ResolveInfo> rList, boolean filterLastUsed,
|
List<ResolveInfo> rList, boolean filterLastUsed,
|
||||||
ResolverListController resolverListController, boolean useLayoutForBrowsables,
|
ResolverListController resolverListController,
|
||||||
ResolverListCommunicator resolverListCommunicator) {
|
ResolverListCommunicator resolverListCommunicator) {
|
||||||
super(context, payloadIntents, initialIntents, rList, filterLastUsed,
|
super(context, payloadIntents, initialIntents, rList, filterLastUsed,
|
||||||
resolverListController,
|
resolverListController, resolverListCommunicator, false);
|
||||||
useLayoutForBrowsables, resolverListCommunicator, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CountingIdlingResource getLabelIdlingResource() {
|
public CountingIdlingResource getLabelIdlingResource() {
|
||||||
|
|||||||
Reference in New Issue
Block a user