From 533c9ff58d7649c6056f12c85b4122970f77236b Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Mon, 27 Feb 2017 11:45:13 -0800 Subject: [PATCH] Add boolean when instant apps are available Bug: 34168547 Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest Change-Id: Ic1072d02aa4d43947e689e4381c2c5ee43704dd0 --- api/current.txt | 1 + api/system-current.txt | 1 + api/test-current.txt | 1 + core/java/android/content/pm/ResolveInfo.java | 8 ++++++++ .../core/java/com/android/server/pm/PackageManagerService.java | 2 ++ 5 files changed, 13 insertions(+) diff --git a/api/current.txt b/api/current.txt index 22dbe7b51462..911685be23ba 100644 --- a/api/current.txt +++ b/api/current.txt @@ -10600,6 +10600,7 @@ package android.content.pm { field public android.content.pm.ActivityInfo activityInfo; field public android.content.IntentFilter filter; field public int icon; + field public boolean instantAppAvailable; field public boolean isDefault; field public int labelRes; field public int match; diff --git a/api/system-current.txt b/api/system-current.txt index daf8cefeb443..88e0079f8b5e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -11222,6 +11222,7 @@ package android.content.pm { field public android.content.pm.ActivityInfo activityInfo; field public android.content.IntentFilter filter; field public int icon; + field public boolean instantAppAvailable; field public boolean isDefault; field public int labelRes; field public int match; diff --git a/api/test-current.txt b/api/test-current.txt index e9dddc313fbe..f824fff989bf 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -10636,6 +10636,7 @@ package android.content.pm { field public android.content.pm.ActivityInfo activityInfo; field public android.content.IntentFilter filter; field public int icon; + field public boolean instantAppAvailable; field public boolean isDefault; field public int labelRes; field public int match; diff --git a/core/java/android/content/pm/ResolveInfo.java b/core/java/android/content/pm/ResolveInfo.java index 50f2d5371019..650b4c008dcc 100644 --- a/core/java/android/content/pm/ResolveInfo.java +++ b/core/java/android/content/pm/ResolveInfo.java @@ -69,6 +69,11 @@ public class ResolveInfo implements Parcelable { public AuxiliaryResolveInfo auxiliaryInfo; /** + * Whether or not an instant app is available for the resolved intent. + */ + public boolean instantAppAvailable; + + /** * The IntentFilter that was matched for this ResolveInfo. */ public IntentFilter filter; @@ -325,6 +330,7 @@ public class ResolveInfo implements Parcelable { system = orig.system; targetUserId = orig.targetUserId; handleAllWebDataURI = orig.handleAllWebDataURI; + instantAppAvailable = orig.instantAppAvailable; } public String toString() { @@ -388,6 +394,7 @@ public class ResolveInfo implements Parcelable { dest.writeInt(noResourceId ? 1 : 0); dest.writeInt(iconResourceId); dest.writeInt(handleAllWebDataURI ? 1 : 0); + dest.writeInt(instantAppAvailable ? 1 : 0); } public static final Creator CREATOR @@ -435,6 +442,7 @@ public class ResolveInfo implements Parcelable { noResourceId = source.readInt() != 0; iconResourceId = source.readInt(); handleAllWebDataURI = source.readInt() != 0; + instantAppAvailable = source.readInt() != 0; } public static class DisplayNameComparator diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 116c0a353643..1a48fc669c67 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -6317,6 +6317,7 @@ public class PackageManagerService extends IPackageManager.Stub { ephemeralInstaller.filter = new IntentFilter(intent.getAction()); ephemeralInstaller.filter.addDataPath( intent.getData().getPath(), PatternMatcher.PATTERN_LITERAL); + ephemeralInstaller.instantAppAvailable = true; result.add(ephemeralInstaller); } Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); @@ -12334,6 +12335,7 @@ public class PackageManagerService extends IPackageManager.Stub { } res.iconResourceId = info.icon; res.system = res.activityInfo.applicationInfo.isSystemApp(); + res.instantAppAvailable = userState.instantApp; return res; } -- 2.11.0