am 46fc1101: Merge "Use Default Browser App for IntentResolution when needed" into mnc-dev
* commit '46fc110104f3017f23abb397ca817db2be39f1a2': Use Default Browser App for IntentResolution when needed
This commit is contained in:
@@ -9409,6 +9409,7 @@ package android.content.pm {
|
||||
field public static final int GET_SIGNATURES = 64; // 0x40
|
||||
field public static final int GET_UNINSTALLED_PACKAGES = 8192; // 0x2000
|
||||
field public static final int GET_URI_PERMISSION_PATTERNS = 2048; // 0x800
|
||||
field public static final int MATCH_ALL = 131072; // 0x20000
|
||||
field public static final int MATCH_DEFAULT_ONLY = 65536; // 0x10000
|
||||
field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L
|
||||
field public static final int PERMISSION_DENIED = -1; // 0xffffffff
|
||||
|
||||
@@ -9702,6 +9702,7 @@ package android.content.pm {
|
||||
field public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; // 0xffffff99
|
||||
field public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; // 0xffffff9a
|
||||
field public static final int INSTALL_SUCCEEDED = 1; // 0x1
|
||||
field public static final int MATCH_ALL = 131072; // 0x20000
|
||||
field public static final int MATCH_DEFAULT_ONLY = 65536; // 0x10000
|
||||
field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L
|
||||
field public static final int PERMISSION_DENIED = -1; // 0xffffffff
|
||||
|
||||
@@ -209,7 +209,14 @@ public abstract class PackageManager {
|
||||
* matching. This is a synonym for including the CATEGORY_DEFAULT in your
|
||||
* supplied Intent.
|
||||
*/
|
||||
public static final int MATCH_DEFAULT_ONLY = 0x00010000;
|
||||
public static final int MATCH_DEFAULT_ONLY = 0x00010000;
|
||||
|
||||
/**
|
||||
* Querying flag: if set and if the platform is doing any filtering of the results, then
|
||||
* the filtering will not happen. This is a synonym for saying that all results should
|
||||
* be returned.
|
||||
*/
|
||||
public static final int MATCH_ALL = 0x00020000;
|
||||
|
||||
/**
|
||||
* Flag for {@link addCrossProfileIntentFilter}: if this flag is set:
|
||||
@@ -2637,6 +2644,8 @@ public abstract class PackageManager {
|
||||
* {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
|
||||
* those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
|
||||
*
|
||||
* You can also set {@link #MATCH_ALL} for preventing the filtering of the results.
|
||||
*
|
||||
* @return A List<ResolveInfo> containing one entry for each matching
|
||||
* Activity. These are ordered from best to worst match -- that
|
||||
* is, the first item in the list is what is returned by
|
||||
@@ -2658,6 +2667,8 @@ public abstract class PackageManager {
|
||||
* {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
|
||||
* those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
|
||||
*
|
||||
* You can also set {@link #MATCH_ALL} for preventing the filtering of the results.
|
||||
*
|
||||
* @return A List<ResolveInfo> containing one entry for each matching
|
||||
* Activity. These are ordered from best to worst match -- that
|
||||
* is, the first item in the list is what is returned by
|
||||
|
||||
@@ -49,6 +49,7 @@ import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATIO
|
||||
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK;
|
||||
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER;
|
||||
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
|
||||
import static android.content.pm.PackageManager.MATCH_ALL;
|
||||
import static android.content.pm.PackageManager.MOVE_FAILED_DOESNT_EXIST;
|
||||
import static android.content.pm.PackageManager.MOVE_FAILED_INTERNAL_ERROR;
|
||||
import static android.content.pm.PackageManager.MOVE_FAILED_OPERATION_PENDING;
|
||||
@@ -2274,6 +2275,13 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!pkg.isSystemApp()) {
|
||||
if (logging) {
|
||||
Slog.d(TAG, "No priming domain verifications for a non system package : " +
|
||||
packageName);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (PackageParser.Activity a : pkg.activities) {
|
||||
for (ActivityIntentInfo filter : a.intents) {
|
||||
if (hasValidDomains(filter, false)) {
|
||||
@@ -2281,7 +2289,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allHosts.size() > 0) {
|
||||
if (allHosts.size() == 0) {
|
||||
allHosts.add("*");
|
||||
}
|
||||
IntentFilterVerificationInfo ivi =
|
||||
@@ -3939,7 +3947,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
}
|
||||
result = filterIfNotPrimaryUser(result, userId);
|
||||
if (result.size() > 1 && hasWebURI(intent)) {
|
||||
return filterCandidatesWithDomainPreferedActivitiesLPr(result);
|
||||
return filterCandidatesWithDomainPreferedActivitiesLPr(flags, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -3984,7 +3992,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
}
|
||||
|
||||
private List<ResolveInfo> filterCandidatesWithDomainPreferedActivitiesLPr(
|
||||
List<ResolveInfo> candidates) {
|
||||
int flags, List<ResolveInfo> candidates) {
|
||||
if (DEBUG_PREFERRED) {
|
||||
Slog.v("TAG", "Filtering results with prefered activities. Candidates count: " +
|
||||
candidates.size());
|
||||
@@ -4004,6 +4012,11 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
String packageName = info.activityInfo.packageName;
|
||||
PackageSetting ps = mSettings.mPackages.get(packageName);
|
||||
if (ps != null) {
|
||||
// Add to the special match all list (Browser use case)
|
||||
if (info.handleAllWebDataURI) {
|
||||
matchAllList.add(info);
|
||||
continue;
|
||||
}
|
||||
// Try to get the status from User settings first
|
||||
int status = getDomainVerificationStatusLPr(ps, userId);
|
||||
if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS) {
|
||||
@@ -4013,10 +4026,6 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
} else if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED) {
|
||||
undefinedList.add(info);
|
||||
}
|
||||
// Add to the special match all list (Browser use case)
|
||||
if (info.handleAllWebDataURI) {
|
||||
matchAllList.add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
// If there is nothing selected, add all candidates and remove the ones that the User
|
||||
@@ -4031,7 +4040,30 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
result.removeAll(matchAllList);
|
||||
if (result.size() == 0) {
|
||||
result.addAll(undefinedList);
|
||||
result.addAll(matchAllList);
|
||||
if ((flags & MATCH_ALL) != 0) {
|
||||
result.addAll(matchAllList);
|
||||
} else {
|
||||
// Try to add the Default Browser if we can
|
||||
final String defaultBrowserPackageName = getDefaultBrowserPackageName(
|
||||
UserHandle.myUserId());
|
||||
if (!TextUtils.isEmpty(defaultBrowserPackageName)) {
|
||||
boolean defaultBrowserFound = false;
|
||||
final int browserCount = matchAllList.size();
|
||||
for (int n=0; n<browserCount; n++) {
|
||||
ResolveInfo browser = matchAllList.get(n);
|
||||
if (browser.activityInfo.packageName.equals(defaultBrowserPackageName)) {
|
||||
result.add(browser);
|
||||
defaultBrowserFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!defaultBrowserFound) {
|
||||
result.addAll(matchAllList);
|
||||
}
|
||||
} else {
|
||||
result.addAll(matchAllList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DEBUG_PREFERRED) {
|
||||
@@ -11331,10 +11363,16 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
verifierUid, userId, verificationId, filter, packageName);
|
||||
count++;
|
||||
} else if (!needsFilterVerification) {
|
||||
Slog.d(TAG, "No verification needed for IntentFilter:"
|
||||
+ filter.toString());
|
||||
Slog.d(TAG, "No verification needed for IntentFilter:" + filter.toString());
|
||||
if (hasValidDomains(filter)) {
|
||||
allHosts.addAll(filter.getHostsList());
|
||||
ArrayList<String> hosts = filter.getHostsList();
|
||||
if (hosts.size() > 0) {
|
||||
allHosts.addAll(hosts);
|
||||
} else {
|
||||
if (allHosts.isEmpty()) {
|
||||
allHosts.add("*");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Slog.d(TAG, "Verification already done for IntentFilter:"
|
||||
|
||||
Reference in New Issue
Block a user