diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2017-01-30 16:34:13 -0800 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2017-01-30 17:52:14 -0800 |
| commit | 096d304ae3d85c1bfcda1a1d9cd4eb13d0815500 (patch) | |
| tree | 3ebef505ad00306dc5b9f4385715de5f4721b1ce /core/java/android/app/ApplicationPackageManager.java | |
| parent | 9b07338cb2a1a459312d39e85a38edf92549d072 (diff) | |
Add instant cookie APIs
This change adds APIs for instant apps to store cookie data
that is presisted across instant installs and across the
upgrade from an instant to a standard app. Standard apps
can use the cookie APIs but when they are uninstalled the
cookie is also deleted. The cookies are kept longer than
the instant apps as they are much smaller - 16KB by default.
We can change the cookie size via a system setting i.e.
after we ship we can increase size if needed.
We also add internal APIs to surface information about
installed and uninstalled instant apps which should be
used for showing them in the UI. For this puporse we store
the icon, permissions, and label of uninstalled apps. If
the app is re-installed we drop this meta-data but keep
the cookie around. If we have cookie data stored and the
signing cert of the app changes when it gets re-intalled
we wipe the cookie.
Test: CTS tests pass; hiddent APIs tested manually
Change-Id: If145c0440cc61a5303e2cbb70228d235d36037a5
Diffstat (limited to 'core/java/android/app/ApplicationPackageManager.java')
| -rw-r--r-- | core/java/android/app/ApplicationPackageManager.java | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 2c2b279b6c65..0c6c4ba33ee3 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -17,7 +17,6 @@ package android.app; import android.annotation.DrawableRes; -import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringRes; @@ -31,7 +30,7 @@ import android.content.IntentSender; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ComponentInfo; -import android.content.pm.EphemeralApplicationInfo; +import android.content.pm.InstantAppInfo; import android.content.pm.FeatureInfo; import android.content.pm.IOnPermissionsChangeListener; import android.content.pm.IPackageDataObserver; @@ -766,10 +765,10 @@ public class ApplicationPackageManager extends PackageManager { /** @hide */ @SuppressWarnings("unchecked") @Override - public List<EphemeralApplicationInfo> getEphemeralApplications() { + public List<InstantAppInfo> getInstantApps() { try { - ParceledListSlice<EphemeralApplicationInfo> slice = - mPM.getEphemeralApplications(mContext.getUserId()); + ParceledListSlice<InstantAppInfo> slice = + mPM.getInstantApps(mContext.getUserId()); if (slice != null) { return slice.getList(); } @@ -781,9 +780,9 @@ public class ApplicationPackageManager extends PackageManager { /** @hide */ @Override - public Drawable getEphemeralApplicationIcon(String packageName) { + public Drawable getInstantAppIcon(String packageName) { try { - Bitmap bitmap = mPM.getEphemeralApplicationIcon( + Bitmap bitmap = mPM.getInstantAppIcon( packageName, mContext.getUserId()); if (bitmap != null) { return new BitmapDrawable(null, bitmap); @@ -795,26 +794,26 @@ public class ApplicationPackageManager extends PackageManager { } @Override - public boolean isEphemeralApplication() { + public boolean isInstantApp() { try { - return mPM.isEphemeralApplication( - mContext.getPackageName(), mContext.getUserId()); + return mPM.isInstantApp(mContext.getPackageName(), + mContext.getUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } @Override - public int getEphemeralCookieMaxSizeBytes() { + public int getInstantAppCookieMaxSize() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.EPHEMERAL_COOKIE_MAX_SIZE_BYTES, DEFAULT_EPHEMERAL_COOKIE_MAX_SIZE_BYTES); } @Override - public @NonNull byte[] getEphemeralCookie() { + public @NonNull byte[] getInstantAppCookie() { try { - final byte[] cookie = mPM.getEphemeralApplicationCookie( + final byte[] cookie = mPM.getInstantAppCookie( mContext.getPackageName(), mContext.getUserId()); if (cookie != null) { return cookie; @@ -827,10 +826,10 @@ public class ApplicationPackageManager extends PackageManager { } @Override - public boolean setEphemeralCookie(@NonNull byte[] cookie) { + public boolean setInstantAppCookie(@NonNull byte[] cookie) { try { - return mPM.setEphemeralApplicationCookie( - mContext.getPackageName(), cookie, mContext.getUserId()); + return mPM.setInstantAppCookie(mContext.getPackageName(), + cookie, mContext.getUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } |
