App link handling is not just for "official" verified handlers
Allow apps to be enabled as link handlers for their accepted domains even when they are not the "official" apps for those domains. Also clean up a bunch of inconsistent/wrong state reporting in the UI. Bug 22069429 Change-Id: Ic3b2bcc476dfc30085d3df7412b02bdc5d53df6d
This commit is contained in:
@@ -33,6 +33,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.IntentFilterVerificationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
@@ -70,6 +71,7 @@ import android.provider.ContactsContract.RawContacts;
|
||||
import android.service.persistentdata.PersistentDataBlockManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -1109,6 +1111,29 @@ public final class Utils {
|
||||
return prefActList.size() > 0;
|
||||
}
|
||||
|
||||
public static ArraySet<String> getHandledDomains(PackageManager pm, String packageName) {
|
||||
List<IntentFilterVerificationInfo> iviList = pm.getIntentFilterVerifications(packageName);
|
||||
List<IntentFilter> filters = pm.getAllIntentFilters(packageName);
|
||||
|
||||
ArraySet<String> result = new ArraySet<>();
|
||||
if (iviList.size() > 0) {
|
||||
for (IntentFilterVerificationInfo ivi : iviList) {
|
||||
for (String host : ivi.getDomains()) {
|
||||
result.add(host);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filters != null && filters.size() > 0) {
|
||||
for (IntentFilter filter : filters) {
|
||||
if (filter.hasDataScheme(IntentFilter.SCHEME_HTTP) ||
|
||||
filter.hasDataScheme(IntentFilter.SCHEME_HTTPS)) {
|
||||
result.addAll(filter.getHostsList());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static CharSequence getLaunchByDeafaultSummary(ApplicationsState.AppEntry appEntry,
|
||||
IUsbManager usbManager, PackageManager pm, Context context) {
|
||||
String packageName = appEntry.info.packageName;
|
||||
|
Reference in New Issue
Block a user