Commit 31a16551 authored by David Christie's avatar David Christie

Create PackageManager.isInstantApp API to query whether

a given package name is an instant app.

Test: refactor existing codepaths retained

Change-Id: I6253fe8cc398d6547566d11043bffd1c4ffaa74a
parent b26979f1
......@@ -10345,6 +10345,7 @@ package android.content.pm {
method public abstract boolean hasSystemFeature(java.lang.String);
method public abstract boolean hasSystemFeature(java.lang.String, int);
method public abstract boolean isInstantApp();
method public abstract boolean isInstantApp(java.lang.String);
method public abstract boolean isPermissionRevokedByPolicy(java.lang.String, java.lang.String);
method public abstract boolean isSafeMode();
method public abstract java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(android.content.Intent, int);
......@@ -30125,12 +30126,12 @@ package android.os {
field public static final int BATTERY_PLUGGED_AC = 1; // 0x1
field public static final int BATTERY_PLUGGED_USB = 2; // 0x2
field public static final int BATTERY_PLUGGED_WIRELESS = 4; // 0x4
field public static final int BATTERY_PROPERTY_STATUS = 6; // 0x6
field public static final int BATTERY_PROPERTY_CAPACITY = 4; // 0x4
field public static final int BATTERY_PROPERTY_CHARGE_COUNTER = 1; // 0x1
field public static final int BATTERY_PROPERTY_CURRENT_AVERAGE = 3; // 0x3
field public static final int BATTERY_PROPERTY_CURRENT_NOW = 2; // 0x2
field public static final int BATTERY_PROPERTY_ENERGY_COUNTER = 5; // 0x5
field public static final int BATTERY_PROPERTY_STATUS = 6; // 0x6
field public static final int BATTERY_STATUS_CHARGING = 2; // 0x2
field public static final int BATTERY_STATUS_DISCHARGING = 3; // 0x3
field public static final int BATTERY_STATUS_FULL = 5; // 0x5
......@@ -40375,6 +40376,7 @@ package android.test.mock {
method public boolean hasSystemFeature(java.lang.String);
method public boolean hasSystemFeature(java.lang.String, int);
method public boolean isInstantApp();
method public boolean isInstantApp(java.lang.String);
method public boolean isPermissionRevokedByPolicy(java.lang.String, java.lang.String);
method public boolean isSafeMode();
method public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(android.content.Intent, int);
......@@ -10894,6 +10894,7 @@ package android.content.pm {
method public abstract boolean hasSystemFeature(java.lang.String);
method public abstract boolean hasSystemFeature(java.lang.String, int);
method public abstract boolean isInstantApp();
method public abstract boolean isInstantApp(java.lang.String);
method public abstract boolean isPermissionRevokedByPolicy(java.lang.String, java.lang.String);
method public abstract boolean isSafeMode();
method public abstract java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(android.content.Intent, int);
......@@ -32726,12 +32727,12 @@ package android.os {
field public static final int BATTERY_PLUGGED_AC = 1; // 0x1
field public static final int BATTERY_PLUGGED_USB = 2; // 0x2
field public static final int BATTERY_PLUGGED_WIRELESS = 4; // 0x4
field public static final int BATTERY_PROPERTY_STATUS = 6; // 0x6
field public static final int BATTERY_PROPERTY_CAPACITY = 4; // 0x4
field public static final int BATTERY_PROPERTY_CHARGE_COUNTER = 1; // 0x1
field public static final int BATTERY_PROPERTY_CURRENT_AVERAGE = 3; // 0x3
field public static final int BATTERY_PROPERTY_CURRENT_NOW = 2; // 0x2
field public static final int BATTERY_PROPERTY_ENERGY_COUNTER = 5; // 0x5
field public static final int BATTERY_PROPERTY_STATUS = 6; // 0x6
field public static final int BATTERY_STATUS_CHARGING = 2; // 0x2
field public static final int BATTERY_STATUS_DISCHARGING = 3; // 0x3
field public static final int BATTERY_STATUS_FULL = 5; // 0x5
......@@ -43716,6 +43717,7 @@ package android.test.mock {
method public boolean hasSystemFeature(java.lang.String);
method public boolean hasSystemFeature(java.lang.String, int);
method public boolean isInstantApp();
method public boolean isInstantApp(java.lang.String);
method public boolean isPermissionRevokedByPolicy(java.lang.String, java.lang.String);
method public boolean isSafeMode();
method public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(android.content.Intent, int);
......@@ -10379,6 +10379,7 @@ package android.content.pm {
method public abstract boolean hasSystemFeature(java.lang.String);
method public abstract boolean hasSystemFeature(java.lang.String, int);
method public abstract boolean isInstantApp();
method public abstract boolean isInstantApp(java.lang.String);
method public abstract boolean isPermissionReviewModeEnabled();
method public abstract boolean isPermissionRevokedByPolicy(java.lang.String, java.lang.String);
method public abstract boolean isSafeMode();
......@@ -30221,12 +30222,12 @@ package android.os {
field public static final int BATTERY_PLUGGED_AC = 1; // 0x1
field public static final int BATTERY_PLUGGED_USB = 2; // 0x2
field public static final int BATTERY_PLUGGED_WIRELESS = 4; // 0x4
field public static final int BATTERY_PROPERTY_STATUS = 6; // 0x6
field public static final int BATTERY_PROPERTY_CAPACITY = 4; // 0x4
field public static final int BATTERY_PROPERTY_CHARGE_COUNTER = 1; // 0x1
field public static final int BATTERY_PROPERTY_CURRENT_AVERAGE = 3; // 0x3
field public static final int BATTERY_PROPERTY_CURRENT_NOW = 2; // 0x2
field public static final int BATTERY_PROPERTY_ENERGY_COUNTER = 5; // 0x5
field public static final int BATTERY_PROPERTY_STATUS = 6; // 0x6
field public static final int BATTERY_STATUS_CHARGING = 2; // 0x2
field public static final int BATTERY_STATUS_DISCHARGING = 3; // 0x3
field public static final int BATTERY_STATUS_FULL = 5; // 0x5
......@@ -40562,6 +40563,7 @@ package android.test.mock {
method public boolean hasSystemFeature(java.lang.String);
method public boolean hasSystemFeature(java.lang.String, int);
method public boolean isInstantApp();
method public boolean isInstantApp(java.lang.String);
method public boolean isPermissionReviewModeEnabled();
method public boolean isPermissionRevokedByPolicy(java.lang.String, java.lang.String);
method public boolean isSafeMode();
......@@ -805,9 +805,13 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public boolean isInstantApp() {
return isInstantApp(mContext.getPackageName());
}
@Override
public boolean isInstantApp(String packageName) {
try {
return mPM.isInstantApp(mContext.getPackageName(),
mContext.getUserId());
return mPM.isInstantApp(packageName, mContext.getUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
......
......@@ -3737,16 +3737,30 @@ public abstract class PackageManager {
public abstract @Nullable Drawable getInstantAppIcon(String packageName);
/**
* Gets whether the caller is an instant app.
* Gets whether this application is an instant app.
*
* @return Whether caller is an instant app.
*
* @see #isInstantApp(String)
* @see #setInstantAppCookie(byte[])
* @see #getInstantAppCookie()
* @see #getInstantAppCookieMaxSize()
*/
public abstract boolean isInstantApp();
/**
* Gets whether the given package is an instant app.
*
* @param packageName The package to check
* @return Whether the given package is an instant app.
*
* @see #isInstantApp()
* @see #setInstantAppCookie(byte[])
* @see #getInstantAppCookie()
* @see #getInstantAppCookieMaxSize()
*/
public abstract boolean isInstantApp(String packageName);
/**
* Gets the maximum size in bytes of the cookie data an instant app
* can store on the device.
......@@ -3754,6 +3768,7 @@ public abstract class PackageManager {
* @return The max cookie size in bytes.
*
* @see #isInstantApp()
* @see #isInstantApp(String)
* @see #setInstantAppCookie(byte[])
* @see #getInstantAppCookie()
*/
......@@ -3770,6 +3785,7 @@ public abstract class PackageManager {
* @return The cookie.
*
* @see #isInstantApp()
* @see #isInstantApp(String)
* @see #setInstantAppCookie(byte[])
* @see #getInstantAppCookieMaxSize()
*/
......@@ -3792,6 +3808,7 @@ public abstract class PackageManager {
* @return Whether the cookie was set.
*
* @see #isInstantApp()
* @see #isInstantApp(String)
* @see #getInstantAppCookieMaxSize()
* @see #getInstantAppCookie()
*/
......
......@@ -363,6 +363,12 @@ public class MockPackageManager extends PackageManager {
throw new UnsupportedOperationException();
}
/** @hide */
@Override
public boolean isInstantApp(String packageName) {
throw new UnsupportedOperationException();
}
/** @hide */
@Override
public int getInstantAppCookieMaxSize() {
......
......@@ -320,6 +320,11 @@ public class BridgePackageManager extends PackageManager {
return false;
}
@Override
public boolean isInstantApp(String packageName) {
return false;
}
@Override
public int getInstantAppCookieMaxSize() {
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment