am 9dcfcc84: am 19427156: Merge "Don\'t crash when preferred activity settings are malformed" into klp-dev
* commit '9dcfcc845d5fdbedbbb41e0d22dd3e16a6a53fe5': Don't crash when preferred activity settings are malformed
This commit is contained in:
@@ -9965,6 +9965,10 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
// writer
|
// writer
|
||||||
int callingUid = Binder.getCallingUid();
|
int callingUid = Binder.getCallingUid();
|
||||||
enforceCrossUserPermission(callingUid, userId, true, "add preferred activity");
|
enforceCrossUserPermission(callingUid, userId, true, "add preferred activity");
|
||||||
|
if (filter.countActions() == 0) {
|
||||||
|
Slog.w(TAG, "Cannot set a preferred activity with no filter actions");
|
||||||
|
return;
|
||||||
|
}
|
||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
if (mContext.checkCallingOrSelfPermission(
|
if (mContext.checkCallingOrSelfPermission(
|
||||||
android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
|
android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
|
||||||
@@ -10024,7 +10028,9 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
String category = filter.getCategory(0);
|
String category = filter.getCategory(0);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
PreferredActivity pa = it.next();
|
PreferredActivity pa = it.next();
|
||||||
if (pa.getAction(0).equals(action) && pa.getCategory(0).equals(category)) {
|
if ((pa.countActions() == 0) || (pa.countCategories() == 0)
|
||||||
|
|| (pa.getAction(0).equals(action)
|
||||||
|
&& pa.getCategory(0).equals(category))) {
|
||||||
if (removed == null) {
|
if (removed == null) {
|
||||||
removed = new ArrayList<PreferredActivity>();
|
removed = new ArrayList<PreferredActivity>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user